Skip to content

Commit 3fe86c2

Browse files
committed
[svm] interp: remove 'plt' from dispatchInvocation logic
It's misleading.
1 parent 3999122 commit 3fe86c2

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

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

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -754,18 +754,20 @@ private static int determineITableStartingIndex(DynamicHub thisHub, int interfac
754754
public static Object dispatchInvocation(InterpreterResolvedJavaMethod seedMethod, Object[] calleeArgs, boolean isVirtual0, boolean forceStayInInterpreter, boolean preferStayInInterpreter,
755755
boolean isInvokeInterface, boolean quiet)
756756
throws SemanticJavaException {
757-
boolean goThroughPLT;
757+
// True if we need to go through the platform ABI, e.g. calling an entry point of a compilation unit.
758+
boolean callCompiledTarget;
759+
758760
boolean isVirtual = isVirtual0;
759761

760762
if (forceStayInInterpreter) {
761763
// Force execution in the interpreter, transitively, for all callees in the call
762764
// subtree.
763-
goThroughPLT = false;
765+
callCompiledTarget = false;
764766
} else {
765767
// Not forced to transitively "stay in interpreter"; but still; it may be "preferred" to
766768
// execute this callee (and only this one) in the interpreter, if possible e.g. Step
767769
// Into.
768-
goThroughPLT = !preferStayInInterpreter;
770+
callCompiledTarget = !preferStayInInterpreter;
769771
}
770772

771773
InterpreterResolvedObjectType seedDeclaringClass = seedMethod.getDeclaringClass();
@@ -776,7 +778,7 @@ public static Object dispatchInvocation(InterpreterResolvedJavaMethod seedMethod
776778

777779
CFunctionPointer calleeFtnPtr = Word.nullPointer();
778780

779-
if (goThroughPLT) {
781+
if (callCompiledTarget) {
780782
if (seedMethod.hasNativeEntryPoint()) {
781783
calleeFtnPtr = seedMethod.getNativeEntryPoint();
782784
if (!quiet) {
@@ -789,16 +791,16 @@ public static Object dispatchInvocation(InterpreterResolvedJavaMethod seedMethod
789791
*/
790792
// InterpreterUtil.guarantee(!isVirtual, "leaveInterpreter is virtual %s",
791793
// seedMethod);
792-
goThroughPLT = false;
794+
callCompiledTarget = false;
793795

794796
/* arguments to Log methods might have side-effects */
795797
if (InterpreterTraceSupport.getValue() && !quiet) {
796798
traceInterpreter("fall back to interp for compile entry ").string(seedMethod.toString()).string(" because it has not been compiled.").newline();
797799
}
798800
} else if (seedMethod.getVTableIndex() == VTBL_ONE_IMPL) {
799-
goThroughPLT = seedMethod.getOneImplementation().hasNativeEntryPoint();
801+
callCompiledTarget = seedMethod.getOneImplementation().hasNativeEntryPoint();
800802
} else if (!isVirtual && seedMethod.hasVTableIndex()) {
801-
goThroughPLT = false;
803+
callCompiledTarget = false;
802804
/* arguments to Log methods might have side-effects */
803805
if (InterpreterTraceSupport.getValue() && !quiet) {
804806
traceInterpreter("invokespecial: ").string(seedMethod.toString()).newline();
@@ -827,14 +829,14 @@ public static Object dispatchInvocation(InterpreterResolvedJavaMethod seedMethod
827829
Class<?> seedClazz = seedDeclaringClass.getJavaClass();
828830
int vtableIndex = seedMethod.getVTableIndex();
829831

830-
if (goThroughPLT) {
832+
if (callCompiledTarget) {
831833
// determine virtual call target via SVM vtable dispatch
832834
calleeFtnPtr = peekAtSVMVTable(seedClazz, thisClazz, vtableIndex, isInvokeInterface);
833835

834836
if (calleeFtnPtr.equal(InterpreterMethodPointerHolder.getMethodNotCompiledHandler())) {
835837
// can happen e.g. due to devirtualization, need to stay in interpreter in
836838
// this scenario
837-
goThroughPLT = false;
839+
callCompiledTarget = false;
838840

839841
/* arguments to Log methods might have side-effects */
840842
if (InterpreterTraceSupport.getValue() && !quiet) {
@@ -850,7 +852,7 @@ public static Object dispatchInvocation(InterpreterResolvedJavaMethod seedMethod
850852
/* arguments to Log methods might have side-effects */
851853
if (InterpreterTraceSupport.getValue() && !quiet) {
852854
traceInterpreter("found oneImpl: ").string(targetMethod.toString());
853-
if (goThroughPLT) {
855+
if (callCompiledTarget) {
854856
calleeFtnPtr = targetMethod.getNativeEntryPoint();
855857
traceInterpreter(" ... with compiled entry=").hex(calleeFtnPtr);
856858
}
@@ -859,27 +861,27 @@ public static Object dispatchInvocation(InterpreterResolvedJavaMethod seedMethod
859861
VMError.guarantee(targetMethod != null, "VTBL_ONE_IMPL implies that oneImplementation is available in seedMethod");
860862
}
861863

862-
if (!targetMethod.hasBytecodes() && !goThroughPLT && calleeFtnPtr.isNonNull()) {
863-
goThroughPLT = true;
864+
if (!targetMethod.hasBytecodes() && !callCompiledTarget && calleeFtnPtr.isNonNull()) {
865+
callCompiledTarget = true;
864866
/* arguments to Log methods might have side-effects */
865867
if (InterpreterTraceSupport.getValue() && !quiet) {
866868
traceInterpreter("cannot interpret ").string(targetMethod.toString()).string(" falling back to compiled version ").hex(calleeFtnPtr).newline();
867869
}
868870
}
869871

870-
if (!goThroughPLT && (targetMethod.isNative() && targetMethod.getSignaturePolymorphicIntrinsic() == null)) {
872+
if (!callCompiledTarget && (targetMethod.isNative() && targetMethod.getSignaturePolymorphicIntrinsic() == null)) {
871873
/* no way to execute target in interpreter, fall back to compiled code */
872874
VMError.guarantee(targetMethod.hasNativeEntryPoint());
873875
calleeFtnPtr = targetMethod.getNativeEntryPoint();
874876
VMError.guarantee(calleeFtnPtr.isNonNull());
875-
goThroughPLT = true;
877+
callCompiledTarget = true;
876878
}
877879

878880
/* arguments to Log methods might have side-effects */
879881
if (InterpreterOptions.InterpreterTraceSupport.getValue() && !quiet) {
880882
traceInterpreter(" ".repeat(Interpreter.logIndent.get()))
881883
.string(" -> calling (")
882-
.string(goThroughPLT ? "plt" : "interp").string(") ")
884+
.string(callCompiledTarget ? "compiled" : "interp").string(") ")
883885
.string(targetMethod.hasNativeEntryPoint() ? "(compiled entry available) " : "");
884886
if (targetMethod.hasNativeEntryPoint()) {
885887
traceInterpreter("(addr: ").hex(calleeFtnPtr).string(" ) ");
@@ -891,7 +893,7 @@ public static Object dispatchInvocation(InterpreterResolvedJavaMethod seedMethod
891893
}
892894

893895
Object retObj = null;
894-
if (goThroughPLT) {
896+
if (callCompiledTarget) {
895897
VMError.guarantee(!forceStayInInterpreter);
896898
VMError.guarantee(calleeFtnPtr.isNonNull());
897899

0 commit comments

Comments
 (0)