Skip to content

Commit

Permalink
Adapt JDK-8345687: Improve the implementation of SegmentFactories::al…
Browse files Browse the repository at this point in the history
…locateSegment
  • Loading branch information
mur47x111 committed Dec 9, 2024
1 parent 653a232 commit 9ccd4c8
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.oracle.svm.core.annotate.RecomputeFieldValue.Kind;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
import com.oracle.svm.core.annotate.TargetElement;
import com.oracle.svm.core.snippets.KnownIntrinsics;

import jdk.internal.misc.Unsafe;
Expand Down Expand Up @@ -68,7 +69,12 @@ public static ClassLoader latestUserDefinedLoader0() {
@Alias @InjectAccessors(DirectMemoryAccessors.class) //
private static long directMemory;
@Alias @InjectAccessors(PageAlignDirectMemoryAccessors.class) //
private static boolean pageAlignDirectMemory;
@TargetElement(onlyWith = JDKLatest.class) //
private static Boolean pageAlignDirectMemory;

@Alias @InjectAccessors(PageAlignDirectMemoryJDK21Accessors.class) //
@TargetElement(name = "pageAlignDirectMemory", onlyWith = JDK21OrEarlier.class) //
private static boolean pageAlignDirectMemoryJDK21;
}

final class DirectMemoryAccessors {
Expand Down Expand Up @@ -125,7 +131,7 @@ final class PageAlignDirectMemoryAccessors {
private static boolean initialized;
private static boolean pageAlignDirectMemory;

static boolean getPageAlignDirectMemory() {
static Boolean getPageAlignDirectMemory() {
if (!initialized) {
initialize();
}
Expand All @@ -140,3 +146,9 @@ private static void initialize() {
initialized = true;
}
}

final class PageAlignDirectMemoryJDK21Accessors {
static boolean getPageAlignDirectMemory() {
return PageAlignDirectMemoryAccessors.getPageAlignDirectMemory();
}
}

0 comments on commit 9ccd4c8

Please sign in to comment.