Skip to content

Commit 015b140

Browse files
[GR-36676] Remove the option to do the reference handling in a regular Java thread.
PullRequest: graal/11167
2 parents b398106 + 79ab826 commit 015b140

File tree

6 files changed

+5
-35
lines changed

6 files changed

+5
-35
lines changed

sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/Isolates.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public Builder auxiliaryImageReservedSpaceSize(UnsignedWord size) {
140140
/**
141141
* Appends an isolate argument. The syntax for arguments is the same as the one that is
142142
* used on the command-line when starting Native Image (e.g., {@code
143-
* -XX:+UseReferenceHandlerThread}). If the same argument is added multiple times, the
143+
* -XX:+AutomaticReferenceHandling}). If the same argument is added multiple times, the
144144
* last specified value will be used.
145145
*
146146
* @since 22.1

substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/GCImpl.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ private void collect(GCCause cause, boolean forceFullGC) {
162162
if (outOfMemory) {
163163
throw OUT_OF_MEMORY_ERROR;
164164
}
165-
doReferenceHandlingInRegularThread();
166165
}
167166
}
168167

@@ -1163,13 +1162,6 @@ private void finishCollection() {
11631162
collectionInProgress = false;
11641163
}
11651164

1166-
// This method will be removed as soon as possible, see GR-36676.
1167-
static void doReferenceHandlingInRegularThread() {
1168-
if (ReferenceHandler.useRegularJavaThread() && !VMOperation.isInProgress() && PlatformThreads.isCurrentAssigned()) {
1169-
doReferenceHandling();
1170-
}
1171-
}
1172-
11731165
/**
11741166
* Inside a VMOperation, we are not allowed to do certain things, e.g., perform synchronization
11751167
* (because it can deadlock when a lock is held outside the VMOperation). Similar restrictions

substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/ThreadLocalAllocation.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ private static Object slowPathNewInstance(Word objectHeader) {
203203
* </pre>
204204
*/
205205
private static void runSlowPathHooks() {
206-
GCImpl.doReferenceHandlingInRegularThread();
207206
GCImpl.getPolicy().updateSizeParameters();
208207
}
209208

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/IsolateArgumentParser.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
*/
5757
public class IsolateArgumentParser {
5858
private static final RuntimeOptionKey<?>[] OPTIONS = {SubstrateGCOptions.MinHeapSize, SubstrateGCOptions.MaxHeapSize, SubstrateGCOptions.MaxNewSize,
59-
SubstrateOptions.ConcealedOptions.UseReferenceHandlerThread, SubstrateOptions.ConcealedOptions.AutomaticReferenceHandling};
59+
SubstrateOptions.ConcealedOptions.AutomaticReferenceHandling};
6060
private static final int OPTION_COUNT = OPTIONS.length;
6161
private static final CGlobalData<CCharPointer> OPTION_NAMES = CGlobalDataFactory.createBytes(IsolateArgumentParser::createOptionNames);
6262
private static final CGlobalData<CIntPointer> OPTION_NAME_POSITIONS = CGlobalDataFactory.createBytes(IsolateArgumentParser::createOptionNamePosition);
@@ -73,11 +73,6 @@ public class IsolateArgumentParser {
7373
public IsolateArgumentParser() {
7474
}
7575

76-
@Fold
77-
public static boolean isSupported() {
78-
return ImageSingletons.contains(IsolateArgumentParser.class);
79-
}
80-
8176
@Fold
8277
public static IsolateArgumentParser singleton() {
8378
return ImageSingletons.lookup(IsolateArgumentParser.class);

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -643,10 +643,6 @@ public Boolean getValue(OptionValues values) {
643643
@Option(help = "Determines if VM operations should be executed in a dedicated thread.", type = OptionType.Expert)//
644644
public static final HostedOptionKey<Boolean> UseDedicatedVMOperationThread = new HostedOptionKey<>(false);
645645

646-
/** Use {@link ReferenceHandler#useDedicatedThread()} instead. */
647-
@Option(help = "Populate reference queues in a separate thread rather than after a garbage collection.", type = OptionType.Expert) //
648-
public static final RuntimeOptionKey<Boolean> UseReferenceHandlerThread = new ImmutableRuntimeOptionKey<>(true);
649-
650646
/** Use {@link ReferenceHandler#isExecutedManually()} instead. */
651647
@Option(help = "Determines if the reference handling is executed automatically or manually.", type = OptionType.Expert) //
652648
public static final RuntimeOptionKey<Boolean> AutomaticReferenceHandling = new ImmutableRuntimeOptionKey<>(true);

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/ReferenceHandler.java

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,16 @@
3434

3535
public final class ReferenceHandler {
3636
public static boolean useDedicatedThread() {
37-
if (ReferenceHandlerThread.isSupported()) {
38-
int useReferenceHandlerThread = IsolateArgumentParser.getOptionIndex(SubstrateOptions.ConcealedOptions.UseReferenceHandlerThread);
39-
int automaticReferenceHandling = IsolateArgumentParser.getOptionIndex(SubstrateOptions.ConcealedOptions.AutomaticReferenceHandling);
40-
return IsolateArgumentParser.getBooleanOptionValue(useReferenceHandlerThread) && IsolateArgumentParser.getBooleanOptionValue(automaticReferenceHandling);
41-
}
42-
return false;
43-
}
44-
45-
public static boolean useRegularJavaThread() {
46-
int useReferenceHandlerThread = IsolateArgumentParser.getOptionIndex(SubstrateOptions.ConcealedOptions.UseReferenceHandlerThread);
4737
int automaticReferenceHandling = IsolateArgumentParser.getOptionIndex(SubstrateOptions.ConcealedOptions.AutomaticReferenceHandling);
48-
return (!ReferenceHandlerThread.isSupported() || !IsolateArgumentParser.getBooleanOptionValue(useReferenceHandlerThread)) &&
49-
IsolateArgumentParser.getBooleanOptionValue(automaticReferenceHandling);
38+
return ReferenceHandlerThread.isSupported() && IsolateArgumentParser.getBooleanOptionValue(automaticReferenceHandling);
5039
}
5140

5241
public static boolean isExecutedManually() {
53-
int automaticReferenceHandling = IsolateArgumentParser.getOptionIndex(SubstrateOptions.ConcealedOptions.AutomaticReferenceHandling);
54-
return !IsolateArgumentParser.getBooleanOptionValue(automaticReferenceHandling);
42+
return !useDedicatedThread();
5543
}
5644

5745
public static void processPendingReferencesInRegularThread() {
58-
assert !useDedicatedThread();
46+
assert isExecutedManually();
5947

6048
/*
6149
* We might be running in a user thread that is close to a stack overflow, so enable the

0 commit comments

Comments
 (0)