File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed
substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change 3030import org .graalvm .nativeimage .Platforms ;
3131
3232import com .oracle .svm .core .Uninterruptible ;
33+ import com .oracle .svm .core .thread .Target_java_lang_VirtualThread ;
3334import com .oracle .svm .core .thread .VMOperation ;
3435
3536import jdk .graal .compiler .api .replacements .Fold ;
@@ -43,7 +44,12 @@ public class JfrTraceIdEpoch {
4344 private static final long EPOCH_0_BIT = 0b01;
4445 private static final long EPOCH_1_BIT = 0b10;
4546
46- private long epochId ;
47+ /**
48+ * Start the epoch id at 1, so that we can inject fields into JDK classes that store the epoch
49+ * id (see for example {@link Target_java_lang_VirtualThread#jfrEpochId}). This avoids problems
50+ * with uninitialized injected fields that have the value 0 by default.
51+ */
52+ private long epochId = 1 ;
4753
4854 @ Fold
4955 public static JfrTraceIdEpoch getInstance () {
Original file line number Diff line number Diff line change @@ -123,8 +123,8 @@ public final class Target_java_lang_VirtualThread {
123123 // Checkstyle: resume
124124
125125 @ Inject //
126- @ RecomputeFieldValue (kind = RecomputeFieldValue .Kind .Custom , declClass = ResetToMinusOneTransformer . class ) //
127- public long jfrEpochId = - 1 ;
126+ @ RecomputeFieldValue (kind = RecomputeFieldValue .Kind .Reset ) //
127+ public long jfrEpochId ;
128128
129129 @ Alias
130130 private static native ForkJoinPool createDefaultScheduler ();
@@ -602,10 +602,3 @@ static Thread asThread(Object obj) {
602602 private VirtualThreadHelper () {
603603 }
604604}
605-
606- final class ResetToMinusOneTransformer implements FieldValueTransformer {
607- @ Override
608- public Object transform (Object receiver , Object originalValue ) {
609- return -1L ;
610- }
611- }
You can’t perform that action at this time.
0 commit comments