File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2017, 2022 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2017, 2025 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
@@ -439,7 +439,11 @@ static void blockedOn(Target_sun_nio_ch_Interruptible b) {
439439 public static long getCurrentThreadId () {
440440 long id = currentVThreadId .get ();
441441 if (GraalDirectives .inIntrinsic ()) {
442- ReplacementsUtil .dynamicAssert (id != 0 && id == getThreadId (Thread .currentThread ()), "ids must match" );
442+ // The condition may throw so we must manually wrap the assert in this if, otherwise the
443+ // compiler is not allowed to remove the evaluation
444+ if (ReplacementsUtil .REPLACEMENTS_ASSERTIONS_ENABLED ) {
445+ ReplacementsUtil .dynamicAssert (id != 0 && id == getThreadId (Thread .currentThread ()), "ids must match" );
446+ }
443447 } else {
444448 assert id != 0 && id == getThreadId (Thread .currentThread ());
445449 }
You can’t perform that action at this time.
0 commit comments