Skip to content

Commit 94cf473

Browse files
committed
Rename MethodPointer.isAbsolute.
1 parent 94cf07e commit 94cf473

File tree

5 files changed

+10
-15
lines changed

5 files changed

+10
-15
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/meta/MethodPointer.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,24 @@
3838
*/
3939
public final class MethodPointer implements CFunctionPointer {
4040
private final ResolvedJavaMethod method;
41-
private final boolean isAbsolute;
41+
private final boolean permitsRewriteToPLT;
4242

43-
public MethodPointer(ResolvedJavaMethod method, boolean isAbsolute) {
43+
public MethodPointer(ResolvedJavaMethod method, boolean permitsRewriteToPLT) {
4444
Objects.requireNonNull(method);
4545
this.method = method;
46-
this.isAbsolute = isAbsolute;
46+
this.permitsRewriteToPLT = permitsRewriteToPLT;
4747
}
4848

4949
public MethodPointer(ResolvedJavaMethod method) {
50-
this(method, false);
50+
this(method, true);
5151
}
5252

5353
public ResolvedJavaMethod getMethod() {
5454
return method;
5555
}
5656

57-
public boolean isAbsolute() {
58-
return isAbsolute;
57+
public boolean permitsRewriteToPLT() {
58+
return permitsRewriteToPLT;
5959
}
6060

6161
@Override

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageCodeCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ public int getAlignedConstantsSize() {
301301
}
302302

303303
public void buildRuntimeMetadata(DebugContext debug, SnippetReflectionProvider snippetReflectionProvider) {
304-
buildRuntimeMetadata(debug, snippetReflectionProvider, new MethodPointer(getFirstCompilation().getLeft(), true), Word.signed(getCodeAreaSize()));
304+
buildRuntimeMetadata(debug, snippetReflectionProvider, new MethodPointer(getFirstCompilation().getLeft(), false), Word.signed(getCodeAreaSize()));
305305
}
306306

307307
static class HostedConstantAccess extends ConstantAccess {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public boolean equals(Object obj) {
114114
@Override
115115
public String toValueString() {
116116
if (pointer instanceof MethodPointer mp) {
117-
return "relocatable method pointer: " + mp.getMethod().format("%H.%n(%p)") + ", isAbsolute: " + mp.isAbsolute();
117+
return "relocatable method pointer: " + mp.getMethod().format("%H.%n(%p)") + ", permitsRewriteToPLT: " + mp.permitsRewriteToPLT();
118118
}
119119
return "relocatable constant";
120120
}

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/pltgot/IdentityMethodAddressResolverFeature.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public void augmentImageObjectFile(ObjectFile imageObjectFile) {
133133

134134
ObjectFile.RelocationKind relocationKind = ObjectFile.RelocationKind.getDirect(wordSize);
135135
for (int gotEntryNo = 0; gotEntryNo < got.length; ++gotEntryNo) {
136-
offsetsSectionBuffer.addRelocationWithoutAddend(gotEntryNo * wordSize, relocationKind, new MethodPointer(got[gotEntryNo], true));
136+
offsetsSectionBuffer.addRelocationWithoutAddend(gotEntryNo * wordSize, relocationKind, new MethodPointer(got[gotEntryNo], false));
137137
}
138138

139139
imageObjectFile.createDefinedSymbol(offsetsSection.getName(), offsetsSection, 0, 0, false, false);

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/pltgot/PLTGOTPointerRelocationProvider.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,10 @@ public PLTGOTPointerRelocationProvider(Predicate<SharedMethod> shouldMarkRelocat
4848
this.pltSectionSupport = HostedPLTGOTConfiguration.singleton().getPLTSectionSupport();
4949
}
5050

51-
private boolean hasPLTStub(HostedMethod target, boolean isStaticallyResolved) {
52-
return !isStaticallyResolved && shouldMarkRelocationToPLTStub.test(target);
53-
}
54-
5551
@Override
5652
public void markMethodPointerRelocation(ObjectFile.ProgbitsSectionImpl section, int offset, ObjectFile.RelocationKind relocationKind, HostedMethod target, long addend,
5753
MethodPointer methodPointer, boolean isInjectedNotCompiled) {
58-
boolean isStaticallyResolved = methodPointer.isAbsolute();
59-
if (hasPLTStub(target, isStaticallyResolved)) {
54+
if (methodPointer.permitsRewriteToPLT() && shouldMarkRelocationToPLTStub.test(target)) {
6055
pltSectionSupport.markRelocationToPLTStub(section, offset, relocationKind, target, addend);
6156
} else {
6257
super.markMethodPointerRelocation(section, offset, relocationKind, target, addend, methodPointer, isInjectedNotCompiled);

0 commit comments

Comments
 (0)