Skip to content

Commit 359783c

Browse files
Add a quiet mode for InterpreterToVM.dispatchInvocation
1 parent 5235cc3 commit 359783c

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/Interpreter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ public static Object execute(InterpreterFrame frame, InterpreterResolvedJavaMeth
540540
boolean preferStayInInterpreter = forceStayInInterpreter;
541541
traceInvokeBasic(target, indent);
542542
try {
543-
yield InterpreterToVM.dispatchInvocation(target, calleeArgs, false, forceStayInInterpreter, preferStayInInterpreter, false);
543+
yield InterpreterToVM.dispatchInvocation(target, calleeArgs, false, forceStayInInterpreter, preferStayInInterpreter, false, false);
544544
} catch (SemanticJavaException e) {
545545
throw uncheckedThrow(e.getCause());
546546
}
@@ -555,7 +555,7 @@ public static Object execute(InterpreterFrame frame, InterpreterResolvedJavaMeth
555555
try {
556556
boolean isInvokeInterface = intrinsic == SignaturePolymorphicIntrinsic.LinkToInterface;
557557
boolean isVirtual = isInvokeInterface || intrinsic == SignaturePolymorphicIntrinsic.LinkToVirtual;
558-
Object result = InterpreterToVM.dispatchInvocation(resolutionSeed, basicArgs, isVirtual, forceStayInInterpreter, preferStayInInterpreter, isInvokeInterface);
558+
Object result = InterpreterToVM.dispatchInvocation(resolutionSeed, basicArgs, isVirtual, forceStayInInterpreter, preferStayInInterpreter, isInvokeInterface, false);
559559
yield rebasic(result, signature.getReturnKind());
560560
} catch (SemanticJavaException e) {
561561
throw uncheckedThrow(e.getCause());
@@ -1455,7 +1455,7 @@ private static int invoke(InterpreterFrame callerFrame, InterpreterResolvedJavaM
14551455
if (!seedMethod.isStatic()) {
14561456
nullCheck(calleeArgs[0]);
14571457
}
1458-
Object retObj = InterpreterToVM.dispatchInvocation(seedMethod, calleeArgs, isVirtual, forceStayInInterpreter, preferStayInInterpreter, opcode == INVOKEINTERFACE);
1458+
Object retObj = InterpreterToVM.dispatchInvocation(seedMethod, calleeArgs, isVirtual, forceStayInInterpreter, preferStayInInterpreter, opcode == INVOKEINTERFACE, false);
14591459

14601460
retStackEffect += EspressoFrame.putKind(callerFrame, resultAt, retObj, seedSignature.getReturnKind());
14611461

substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/InterpreterToVM.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ private static int determineITableStartingIndex(DynamicHub thisHub, int interfac
752752
}
753753

754754
public static Object dispatchInvocation(InterpreterResolvedJavaMethod seedMethod, Object[] calleeArgs, boolean isVirtual0, boolean forceStayInInterpreter, boolean preferStayInInterpreter,
755-
boolean isInvokeInterface)
755+
boolean isInvokeInterface, boolean quiet)
756756
throws SemanticJavaException {
757757
boolean goThroughPLT;
758758
boolean isVirtual = isVirtual0;
@@ -779,7 +779,9 @@ public static Object dispatchInvocation(InterpreterResolvedJavaMethod seedMethod
779779
if (goThroughPLT) {
780780
if (seedMethod.hasNativeEntryPoint()) {
781781
calleeFtnPtr = seedMethod.getNativeEntryPoint();
782-
traceInterpreter("got native entry point: ").hex(calleeFtnPtr).newline();
782+
if (!quiet) {
783+
traceInterpreter("got native entry point: ").hex(calleeFtnPtr).newline();
784+
}
783785
} else if (seedMethod.getVTableIndex() == VTBL_NO_ENTRY) {
784786
/*
785787
* does not always hold. Counter example: j.io.BufferedWriter::min, because it gets
@@ -790,15 +792,15 @@ public static Object dispatchInvocation(InterpreterResolvedJavaMethod seedMethod
790792
goThroughPLT = false;
791793

792794
/* arguments to Log methods might have side-effects */
793-
if (InterpreterTraceSupport.getValue()) {
795+
if (InterpreterTraceSupport.getValue() && !quiet) {
794796
traceInterpreter("fall back to interp for compile entry ").string(seedMethod.toString()).string(" because it has not been compiled.").newline();
795797
}
796798
} else if (seedMethod.getVTableIndex() == VTBL_ONE_IMPL) {
797799
goThroughPLT = seedMethod.getOneImplementation().hasNativeEntryPoint();
798800
} else if (!isVirtual && seedMethod.hasVTableIndex()) {
799801
goThroughPLT = false;
800802
/* arguments to Log methods might have side-effects */
801-
if (InterpreterTraceSupport.getValue()) {
803+
if (InterpreterTraceSupport.getValue() && !quiet) {
802804
traceInterpreter("invokespecial: ").string(seedMethod.toString()).newline();
803805
}
804806
} else if (isVirtual && !seedMethod.hasVTableIndex()) {
@@ -810,7 +812,7 @@ public static Object dispatchInvocation(InterpreterResolvedJavaMethod seedMethod
810812
if (isVirtual && (seedMethod.isFinalFlagSet() || calleeArgs[0].getClass().isArray() || seedDeclaringClass.isLeaf() || seedMethod.isPrivate())) {
811813
isVirtual = false;
812814
/* arguments to Log methods might have side-effects */
813-
if (InterpreterTraceSupport.getValue()) {
815+
if (InterpreterTraceSupport.getValue() && !quiet) {
814816
traceInterpreter("reverting virtual call to invokespecial: ").string(seedMethod.toString()).newline();
815817
}
816818
}
@@ -835,7 +837,7 @@ public static Object dispatchInvocation(InterpreterResolvedJavaMethod seedMethod
835837
goThroughPLT = false;
836838

837839
/* arguments to Log methods might have side-effects */
838-
if (InterpreterTraceSupport.getValue()) {
840+
if (InterpreterTraceSupport.getValue() && !quiet) {
839841
traceInterpreter("fall back to interp (vtable entry) for compile entry ").string(seedMethod.toString()).string(" because it has not been compiled.").newline();
840842
}
841843
}
@@ -846,7 +848,7 @@ public static Object dispatchInvocation(InterpreterResolvedJavaMethod seedMethod
846848
} else if (seedMethod.getVTableIndex() == VTBL_ONE_IMPL) {
847849
targetMethod = seedMethod.getOneImplementation();
848850
/* arguments to Log methods might have side-effects */
849-
if (InterpreterTraceSupport.getValue()) {
851+
if (InterpreterTraceSupport.getValue() && !quiet) {
850852
traceInterpreter("found oneImpl: ").string(targetMethod.toString());
851853
if (goThroughPLT) {
852854
calleeFtnPtr = targetMethod.getNativeEntryPoint();
@@ -860,7 +862,7 @@ public static Object dispatchInvocation(InterpreterResolvedJavaMethod seedMethod
860862
if (!targetMethod.hasBytecodes() && !goThroughPLT && calleeFtnPtr.isNonNull()) {
861863
goThroughPLT = true;
862864
/* arguments to Log methods might have side-effects */
863-
if (InterpreterTraceSupport.getValue()) {
865+
if (InterpreterTraceSupport.getValue() && !quiet) {
864866
traceInterpreter("cannot interpret ").string(targetMethod.toString()).string(" falling back to compiled version ").hex(calleeFtnPtr).newline();
865867
}
866868
}
@@ -874,7 +876,7 @@ public static Object dispatchInvocation(InterpreterResolvedJavaMethod seedMethod
874876
}
875877

876878
/* arguments to Log methods might have side-effects */
877-
if (InterpreterOptions.InterpreterTraceSupport.getValue()) {
879+
if (InterpreterOptions.InterpreterTraceSupport.getValue() && !quiet) {
878880
traceInterpreter(" ".repeat(Interpreter.logIndent.get()))
879881
.string(" -> calling (")
880882
.string(goThroughPLT ? "plt" : "interp").string(") ")

substratevm/src/com.oracle.svm.jdwp.resident/src/com/oracle/svm/jdwp/resident/impl/ResidentJDWP.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1920,7 +1920,7 @@ static Result fromThrowable(Throwable throwable) {
19201920

19211921
static Result ofInvoke(boolean isVirtual, InterpreterResolvedJavaMethod method, Object... args) {
19221922
try {
1923-
return fromValue(InterpreterToVM.dispatchInvocation(method, args, isVirtual, false, false, false));
1923+
return fromValue(InterpreterToVM.dispatchInvocation(method, args, isVirtual, false, false, false, false));
19241924
} catch (SemanticJavaException e) {
19251925
return fromThrowable(e.getCause());
19261926
} catch (StackOverflowError | OutOfMemoryError error) {

0 commit comments

Comments
 (0)