File tree 1 file changed +6
-2
lines changed
substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1
1
/*
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.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* 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) {
439
439
public static long getCurrentThreadId () {
440
440
long id = currentVThreadId .get ();
441
441
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
+ }
443
447
} else {
444
448
assert id != 0 && id == getThreadId (Thread .currentThread ());
445
449
}
You can’t perform that action at this time.
0 commit comments