Skip to content

Commit 38f4388

Browse files
committed
remove global safepoint polling support
1 parent cf2c65b commit 38f4388

File tree

3 files changed

+1
-103
lines changed

3 files changed

+1
-103
lines changed

compiler/src/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotSafepointOp.java

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
import org.graalvm.compiler.asm.aarch64.AArch64Address;
3030
import org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler;
31-
import org.graalvm.compiler.core.common.NumUtil;
3231
import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
3332
import org.graalvm.compiler.hotspot.HotSpotMarkId;
3433
import org.graalvm.compiler.lir.LIRFrameState;
@@ -68,46 +67,7 @@ public void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm) {
6867
emitCode(crb, masm, config, false, thread, scratch, state);
6968
}
7069

71-
/**
72-
* Conservatively checks whether we can load the safepoint polling address with a single ldr
73-
* instruction or not.
74-
*
75-
* @return true if it is guaranteed that polling page offset will always fit into a 21-bit
76-
* signed integer, false otherwise.
77-
*/
78-
private static boolean isPollingPageFar(GraalHotSpotVMConfig config) {
79-
final long pollingPageAddress = config.safepointPollingAddress;
80-
return !NumUtil.isSignedNbit(21, pollingPageAddress - config.codeCacheLowBound) || !NumUtil.isSignedNbit(21, pollingPageAddress - config.codeCacheHighBound);
81-
}
82-
8370
public static void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm, GraalHotSpotVMConfig config, boolean onReturn, Register thread, Register scratch, LIRFrameState state) {
84-
if (config.useThreadLocalPolling) {
85-
emitThreadLocalPoll(crb, masm, config, onReturn, thread, scratch, state);
86-
} else {
87-
emitGlobalPoll(crb, masm, config, onReturn, scratch, state);
88-
}
89-
}
90-
91-
private static void emitGlobalPoll(CompilationResultBuilder crb, AArch64MacroAssembler masm, GraalHotSpotVMConfig config, boolean onReturn, Register scratch, LIRFrameState state) {
92-
if (isPollingPageFar(config)) {
93-
crb.recordMark(onReturn ? HotSpotMarkId.POLL_RETURN_FAR : HotSpotMarkId.POLL_FAR);
94-
masm.movNativeAddress(scratch, config.safepointPollingAddress);
95-
crb.recordMark(onReturn ? HotSpotMarkId.POLL_RETURN_FAR : HotSpotMarkId.POLL_FAR);
96-
if (state != null) {
97-
crb.recordInfopoint(masm.position(), state, InfopointReason.SAFEPOINT);
98-
}
99-
masm.deadLoad(32, AArch64Address.createBaseRegisterOnlyAddress(32, scratch), false);
100-
} else {
101-
crb.recordMark(onReturn ? HotSpotMarkId.POLL_RETURN_NEAR : HotSpotMarkId.POLL_NEAR);
102-
if (state != null) {
103-
crb.recordInfopoint(masm.position(), state, InfopointReason.SAFEPOINT);
104-
}
105-
masm.deadLoad(32, AArch64Address.createPCLiteralAddress(32), false);
106-
}
107-
}
108-
109-
private static void emitThreadLocalPoll(CompilationResultBuilder crb, AArch64MacroAssembler masm, GraalHotSpotVMConfig config, boolean onReturn, Register thread, Register scratch,
110-
LIRFrameState state) {
11171
assert config.threadPollingPageOffset >= 0;
11272
masm.ldr(64, scratch, masm.makeAddress(64, thread, config.threadPollingPageOffset));
11373
crb.recordMark(onReturn ? HotSpotMarkId.POLL_RETURN_FAR : HotSpotMarkId.POLL_FAR);
@@ -116,5 +76,4 @@ private static void emitThreadLocalPoll(CompilationResultBuilder crb, AArch64Mac
11676
}
11777
masm.deadLoad(32, AArch64Address.createBaseRegisterOnlyAddress(32, scratch), false);
11878
}
119-
12079
}

compiler/src/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotSafepointOp.java

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,7 @@
2424
*/
2525
package org.graalvm.compiler.hotspot.amd64;
2626

27-
import static jdk.vm.ci.amd64.AMD64.k0;
28-
import static jdk.vm.ci.amd64.AMD64.k1;
29-
import static jdk.vm.ci.amd64.AMD64.k2;
30-
import static jdk.vm.ci.amd64.AMD64.k3;
31-
import static jdk.vm.ci.amd64.AMD64.k4;
32-
import static jdk.vm.ci.amd64.AMD64.k5;
33-
import static jdk.vm.ci.amd64.AMD64.k6;
34-
import static jdk.vm.ci.amd64.AMD64.k7;
3527
import static jdk.vm.ci.amd64.AMD64.rax;
36-
import static jdk.vm.ci.amd64.AMD64.rip;
37-
import static org.graalvm.compiler.core.common.NumUtil.isInt;
3828

3929
import java.util.EnumSet;
4030

@@ -56,7 +46,6 @@
5646
import jdk.vm.ci.code.RegisterValue;
5747
import jdk.vm.ci.code.site.InfopointReason;
5848
import jdk.vm.ci.meta.AllocatableValue;
59-
import jdk.vm.ci.meta.Value;
6049

6150
/**
6251
* Emits a safepoint poll.
@@ -72,19 +61,12 @@ public final class AMD64HotSpotSafepointOp extends AMD64LIRInstruction {
7261
private final GraalHotSpotVMConfig config;
7362
private final Register thread;
7463

75-
private static final AllocatableValue[] MASK_REGISTERS = new AllocatableValue[]{k0.asValue(), k1.asValue(), k2.asValue(), k3.asValue(), k4.asValue(), k5.asValue(), k6.asValue(), k7.asValue()};
76-
7764
public AMD64HotSpotSafepointOp(LIRFrameState state, GraalHotSpotVMConfig config, NodeLIRBuilderTool tool, Register thread) {
7865
super(TYPE);
7966
this.state = state;
8067
this.config = config;
8168
this.thread = thread;
82-
if (config.useThreadLocalPolling || isPollingPageFar(config)) {
83-
temp = tool.getLIRGeneratorTool().newVariable(LIRKind.value(tool.getLIRGeneratorTool().target().arch.getWordKind()));
84-
} else {
85-
// Don't waste a register if it's unneeded
86-
temp = Value.ILLEGAL;
87-
}
69+
temp = tool.getLIRGeneratorTool().newVariable(LIRKind.value(tool.getLIRGeneratorTool().target().arch.getWordKind()));
8870
EnumSet<CPUFeature> features = ((AMD64) tool.getLIRGeneratorTool().target().arch).getFeatures();
8971
killedMaskRegisters = AllocatableValue.NONE;
9072
}
@@ -95,46 +77,6 @@ public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler asm) {
9577
}
9678

9779
public static void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler asm, GraalHotSpotVMConfig config, boolean atReturn, LIRFrameState state, Register thread, Register scratch) {
98-
if (config.useThreadLocalPolling) {
99-
emitThreadLocalPoll(crb, asm, config, atReturn, state, thread, scratch);
100-
} else {
101-
emitGlobalPoll(crb, asm, config, atReturn, state, scratch);
102-
}
103-
}
104-
105-
/**
106-
* Tests if the polling page address can be reached from the code cache with 32-bit
107-
* displacements.
108-
*/
109-
private static boolean isPollingPageFar(GraalHotSpotVMConfig config) {
110-
final long pollingPageAddress = config.safepointPollingAddress;
111-
return config.forceUnreachable || !isInt(pollingPageAddress - config.codeCacheLowBound) || !isInt(pollingPageAddress - config.codeCacheHighBound);
112-
}
113-
114-
private static void emitGlobalPoll(CompilationResultBuilder crb, AMD64MacroAssembler asm, GraalHotSpotVMConfig config, boolean atReturn, LIRFrameState state, Register scratch) {
115-
assert !atReturn || state == null : "state is unneeded at return";
116-
if (isPollingPageFar(config)) {
117-
asm.movq(scratch, config.safepointPollingAddress);
118-
crb.recordMark(atReturn ? HotSpotMarkId.POLL_RETURN_FAR : HotSpotMarkId.POLL_FAR);
119-
final int pos = asm.position();
120-
if (state != null) {
121-
crb.recordInfopoint(pos, state, InfopointReason.SAFEPOINT);
122-
}
123-
asm.testl(rax, new AMD64Address(scratch));
124-
} else {
125-
crb.recordMark(atReturn ? HotSpotMarkId.POLL_RETURN_NEAR : HotSpotMarkId.POLL_NEAR);
126-
final int pos = asm.position();
127-
if (state != null) {
128-
crb.recordInfopoint(pos, state, InfopointReason.SAFEPOINT);
129-
}
130-
// The C++ code transforms the polling page offset into an RIP displacement
131-
// to the real address at that offset in the polling page.
132-
asm.testl(rax, new AMD64Address(rip, 0));
133-
}
134-
}
135-
136-
private static void emitThreadLocalPoll(CompilationResultBuilder crb, AMD64MacroAssembler asm, GraalHotSpotVMConfig config, boolean atReturn, LIRFrameState state, Register thread,
137-
Register scratch) {
13880
assert !atReturn || state == null : "state is unneeded at return";
13981

14082
assert config.threadPollingPageOffset >= 0;

compiler/src/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ public CompressEncoding getKlassEncoding() {
106106
public final boolean useAESCTRIntrinsics = getFlag("UseAESCTRIntrinsics", Boolean.class);
107107
public final boolean useCRC32Intrinsics = getFlag("UseCRC32Intrinsics", Boolean.class);
108108
public final boolean useCRC32CIntrinsics = getFlag("UseCRC32CIntrinsics", Boolean.class); // JDK-8073583
109-
public final boolean useThreadLocalPolling = true;
110109
private final boolean useMultiplyToLenIntrinsic = getFlag("UseMultiplyToLenIntrinsic", Boolean.class);
111110
private final boolean useSHA1Intrinsics = getFlag("UseSHA1Intrinsics", Boolean.class);
112111
private final boolean useSHA256Intrinsics = getFlag("UseSHA256Intrinsics", Boolean.class);
@@ -485,8 +484,6 @@ private static String markWordField(String simpleName) {
485484
*/
486485
public final int maxOopMapStackOffset = getFieldValue("CompilerToVM::Data::_max_oop_map_stack_offset", Integer.class, "int");
487486

488-
public final long safepointPollingAddress = getFieldValue("os::_polling_page", Long.class, "address");
489-
490487
// G1 Collector Related Values.
491488
public final byte dirtyCardValue;
492489
public final byte g1YoungCardValue;

0 commit comments

Comments
 (0)