Skip to content

Commit 59c90b2

Browse files
committed
fixup: address reviewer comments
1 parent ca339b3 commit 59c90b2

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/meta/SubstrateMethod.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ public Object getRawImplementations() {
201201
public void setSubstrateDataAfterCompilation(SubstrateMethod indirectCallTarget, int vTableIndex) {
202202
this.indirectCallTarget = indirectCallTarget;
203203
this.vTableIndex = vTableIndex;
204-
205204
}
206205

207206
public void setSubstrateDataAfterHeapLayout(int imageCodeOffset, int imageCodeDeoptOffset) {

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/SVMImageLayerLoader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ private void loadMethod(PersistedAnalysisMethod.Reader methodData) {
828828
type.getClassInitializer();
829829
} else {
830830
ResolvedSignature<AnalysisType> signature = ResolvedSignature.fromArray(parameterTypes, returnType);
831-
tryFindMethod(type, name, signature);
831+
tryLoadMethod(type, name, signature);
832832
}
833833
}
834834

@@ -847,7 +847,7 @@ private void loadMethod(PersistedAnalysisMethod.Reader methodData) {
847847
* We also need this because reflection cannot find all declared methods within class; one
848848
* example it will not find is bridge methods inserted for covariant overrides.
849849
*/
850-
private void tryFindMethod(AnalysisType type, String name, ResolvedSignature<AnalysisType> signature) {
850+
private void tryLoadMethod(AnalysisType type, String name, ResolvedSignature<AnalysisType> signature) {
851851
ResolvedJavaType wrapped = type.getWrapped();
852852
assert !(wrapped instanceof BaseLayerType) : type;
853853
for (ResolvedJavaMethod method : wrapped.getAllMethods(false)) {

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jni/JNIAccessFeature.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -616,9 +616,8 @@ private static void finishMethodBeforeCompilation(JNICallableJavaMethod method,
616616
if (SubstrateOptions.useClosedTypeWorldHubLayout()) {
617617
interfaceTypeID = JNIAccessibleMethod.INTERFACE_TYPEID_UNNEEDED;
618618
} else {
619-
HostedType declaringClass = hTarget.getIndirectCallTarget().getDeclaringClass();
620-
interfaceTypeID = declaringClass.isInterface() ? declaringClass.getTypeID() : JNIAccessibleMethod.INTERFACE_TYPEID_CLASS_TABLE;
621-
VMError.guarantee(!(interfaceTypeID == JNIAccessibleMethod.INTERFACE_TYPEID_CLASS_TABLE && !declaringClass.equals(hTarget.getDeclaringClass())));
619+
HostedType indirectCallTargetClass = hTarget.getIndirectCallTarget().getDeclaringClass();
620+
interfaceTypeID = indirectCallTargetClass.isInterface() ? indirectCallTargetClass.getTypeID() : JNIAccessibleMethod.INTERFACE_TYPEID_CLASS_TABLE;
622621
}
623622
}
624623
CodePointer nonvirtualTarget = new MethodPointer(hTarget);

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/meta/HostedMethod.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public final class HostedMethod extends HostedElement implements SharedMethod, W
107107
* When using the open type world we must differentiate between this method's vtable index and
108108
* the vtable index used for virtual calls. This is because sometimes JVMCI will expose to
109109
* analysis special methods HotSpot introduces into vtables, such as miranda and overpass
110-
* methods. In the open type word we only include declared methods in vtables and hence must
110+
* methods. In the open type world we only include declared methods in vtables and hence must
111111
* adjust indirect call targets accordingly.
112112
*
113113
* Note normally {@code indirectCallTarget == this}. Only for special HotSpot methods such as
@@ -117,8 +117,8 @@ public final class HostedMethod extends HostedElement implements SharedMethod, W
117117
*
118118
* For additional information, see {@link SharedMethod#getIndirectCallTarget}.
119119
*/
120-
int indirectCallVTableIndex = MISSING_VTABLE_IDX;
121-
HostedMethod indirectCallTarget = null;
120+
private int indirectCallVTableIndex = MISSING_VTABLE_IDX;
121+
private HostedMethod indirectCallTarget = null;
122122

123123
/**
124124
* The address offset of the compiled code relative to the code of the first method in the
@@ -383,9 +383,9 @@ public void setIndirectCallTarget(HostedMethod alias) {
383383
/*
384384
* When there is an indirectCallTarget installed which is not the original method, we
385385
* currently expect the target method to either have an interface as its declaring class
386-
* or for the declaring class to be unchanged. If we change this in the future, then we
387-
* will need to adjust the JNI (JNIAccessFeature) and reflection (ReflectionFeature)
388-
* code as well.
386+
* or for the declaring class to be unchanged. If the declaring class is different, then
387+
* we must ensure that the layout of the vtable matches for all relevant indexes between
388+
* the original and alias methods' declaring classes.
389389
*/
390390
VMError.guarantee(alias.getDeclaringClass().isInterface() || alias.getDeclaringClass().equals(getDeclaringClass()), "Invalid indirect call target for %s: %s", this, alias);
391391
}
@@ -398,7 +398,7 @@ public HostedMethod getIndirectCallTarget() {
398398
return indirectCallTarget;
399399
}
400400

401-
public void finalizeVTableIndex(boolean closedTypeWorld) {
401+
void finalizeVTableIndex(boolean closedTypeWorld) {
402402
if (closedTypeWorld) {
403403
/*
404404
* In the closed type word we do not have a different indirectCallTarget, so the

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/reflect/ReflectionFeature.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,6 @@ public Object transform(Object receiver, Object originalValue) {
534534
if (indirectCallTarget.getDeclaringClass().isInterface()) {
535535
return indirectCallTarget.getDeclaringClass().getTypeID();
536536
}
537-
VMError.guarantee(method.equals(indirectCallTarget));
538537
return SubstrateMethodAccessor.INTERFACE_TYPEID_CLASS_TABLE;
539538
}
540539
}

0 commit comments

Comments
 (0)