Skip to content

Commit

Permalink
Fix @Uninterruptible on VMThreads.lockThreadMutexInNativeCode().
Browse files Browse the repository at this point in the history
  • Loading branch information
christianhaeubl committed Dec 23, 2023
1 parent 9114b53 commit 3cf5f17
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
*/
package com.oracle.svm.core.thread;

import com.oracle.svm.core.locks.VMLockSupport;
import jdk.graal.compiler.api.directives.GraalDirectives;
import jdk.graal.compiler.api.replacements.Fold;
import jdk.graal.compiler.replacements.ReplacementsUtil;
import jdk.graal.compiler.replacements.nodes.AssertionNode;
import org.graalvm.nativeimage.CurrentIsolate;
import org.graalvm.nativeimage.ImageSingletons;
import org.graalvm.nativeimage.Isolate;
Expand All @@ -55,6 +50,7 @@
import com.oracle.svm.core.jdk.UninterruptibleUtils;
import com.oracle.svm.core.jdk.UninterruptibleUtils.AtomicWord;
import com.oracle.svm.core.locks.VMCondition;
import com.oracle.svm.core.locks.VMLockSupport;
import com.oracle.svm.core.locks.VMMutex;
import com.oracle.svm.core.log.Log;
import com.oracle.svm.core.nodes.CFunctionEpilogueNode;
Expand All @@ -68,6 +64,11 @@
import com.oracle.svm.core.util.UnsignedUtils;
import com.oracle.svm.core.util.VMError;

import jdk.graal.compiler.api.directives.GraalDirectives;
import jdk.graal.compiler.api.replacements.Fold;
import jdk.graal.compiler.replacements.ReplacementsUtil;
import jdk.graal.compiler.replacements.nodes.AssertionNode;

/**
* Utility methods for the manipulation and iteration of {@link IsolateThread}s.
*/
Expand Down Expand Up @@ -407,12 +408,12 @@ public static boolean wasStartedByCurrentIsolate(IsolateThread thread) {
return StartedByCurrentIsolate.getAddress(thread).readByte(0) != 0;
}

@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
@Uninterruptible(reason = "Thread locks/holds the THREAD_MUTEX.", callerMustBe = true)
static void lockThreadMutexInNativeCode() {
lockThreadMutexInNativeCode(false);
}

@Uninterruptible(reason = "Called from uninterruptible code.")
@Uninterruptible(reason = "Thread locks/holds the THREAD_MUTEX.", callerMustBe = true)
@NeverInline("Must not be inlined in a caller that has an exception handler: We only support InvokeNode and not InvokeWithExceptionNode between a CFunctionPrologueNode and CFunctionEpilogueNode.")
private static void lockThreadMutexInNativeCode(boolean unspecifiedOwner) {
CFunctionPrologueNode.cFunctionPrologue(StatusSupport.STATUS_IN_NATIVE);
Expand Down

0 comments on commit 3cf5f17

Please sign in to comment.