From a4e4f3df451ab401af1e1c57032b7cc76f230bfd Mon Sep 17 00:00:00 2001 From: Christian Haeubl Date: Mon, 7 Feb 2022 09:56:32 +0100 Subject: [PATCH] Fixes after rebasing. --- .../src/com/oracle/svm/core/genscavenge/GCImpl.java | 5 +++-- .../src/com/oracle/svm/core/heap/ReferenceHandler.java | 9 --------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/GCImpl.java b/substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/GCImpl.java index 93f3e9567dfb1..314d0a1dcad2b 100644 --- a/substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/GCImpl.java +++ b/substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/GCImpl.java @@ -30,6 +30,7 @@ import java.lang.ref.Reference; import com.oracle.svm.core.thread.JavaThreads; +import com.oracle.svm.core.thread.PlatformThreads; import org.graalvm.compiler.api.replacements.Fold; import org.graalvm.nativeimage.CurrentIsolate; import org.graalvm.nativeimage.IsolateThread; @@ -1058,7 +1059,7 @@ private void finishCollection() { // This method will be removed as soon as possible, see GR-36676. static void doReferenceHandlingInRegularThread() { - if (ReferenceHandler.useRegularJavaThread() && !VMOperation.isInProgress() && JavaThreads.currentJavaThreadInitialized()) { + if (ReferenceHandler.useRegularJavaThread() && !VMOperation.isInProgress() && PlatformThreads.isCurrentAssigned()) { doReferenceHandling(); } } @@ -1070,7 +1071,7 @@ static void doReferenceHandlingInRegularThread() { */ static void doReferenceHandling() { assert !VMOperation.isInProgress() : "could result in deadlocks"; - assert JavaThreads.currentJavaThreadInitialized() : "thread is not fully initialized yet"; + assert PlatformThreads.isCurrentAssigned() : "thread is not fully initialized yet"; /* Most of the time, we won't have a pending reference list. So, we do that check first. */ if (HeapImpl.getHeapImpl().hasReferencePendingListUnsafe()) { long startTime = System.nanoTime(); diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/ReferenceHandler.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/ReferenceHandler.java index 60c1a2a554f14..d6d28324446bc 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/ReferenceHandler.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/ReferenceHandler.java @@ -91,15 +91,6 @@ static void processCleaners() { } } - public static boolean isReferenceHandlingAllowed() { - /* - * Inside a VMOperation, we are not allowed to do certain things, e.g., perform - * synchronization (because it can deadlock when a lock is held outside the VMOperation). - * Similar restrictions apply if we are too early in the attach sequence of a thread. - */ - return !VMOperation.isInProgress() && JavaThreads.currentJavaThreadInitialized(); - } - private ReferenceHandler() { } }