|
42 | 42 | import java.nio.ByteBuffer; |
43 | 43 |
|
44 | 44 | import org.graalvm.compiler.core.common.NumUtil; |
45 | | -import org.graalvm.compiler.serviceprovider.JavaVersionUtil; |
46 | 45 | import org.graalvm.nativeimage.ImageSingletons; |
47 | 46 | import org.graalvm.nativeimage.Platform; |
48 | 47 | import org.graalvm.nativeimage.Platforms; |
|
54 | 53 | import org.graalvm.word.Pointer; |
55 | 54 | import org.graalvm.word.WordFactory; |
56 | 55 |
|
57 | | -import com.oracle.svm.core.SubstrateUtil; |
58 | 56 | import com.oracle.svm.core.Uninterruptible; |
59 | 57 | import com.oracle.svm.core.VMInspectionOptions; |
60 | 58 | import com.oracle.svm.core.annotate.Alias; |
61 | 59 | import com.oracle.svm.core.annotate.TargetClass; |
62 | 60 | import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature; |
63 | 61 | import com.oracle.svm.core.feature.InternalFeature; |
64 | 62 | import com.oracle.svm.core.headers.LibC; |
65 | | -import com.oracle.svm.core.jdk.Target_java_nio_DirectByteBuffer; |
| 63 | +import com.oracle.svm.core.jdk.DirectByteBufferUtil; |
66 | 64 | import com.oracle.svm.core.jvmstat.PerfManager; |
67 | 65 | import com.oracle.svm.core.jvmstat.PerfMemoryPrologue; |
68 | 66 | import com.oracle.svm.core.jvmstat.PerfMemoryProvider; |
@@ -148,11 +146,7 @@ public ByteBuffer create() { |
148 | 146 |
|
149 | 147 | /* Clear the shared memory region. */ |
150 | 148 | LibC.memset(mapAddress, WordFactory.signed(0), WordFactory.unsigned(size)); |
151 | | - if (JavaVersionUtil.JAVA_SPEC >= 21) { |
152 | | - return SubstrateUtil.cast(new Target_java_nio_DirectByteBuffer(mapAddress.rawValue(), (long) size), ByteBuffer.class); |
153 | | - } else { |
154 | | - return SubstrateUtil.cast(new Target_java_nio_DirectByteBuffer(mapAddress.rawValue(), size), ByteBuffer.class); |
155 | | - } |
| 149 | + return DirectByteBufferUtil.allocate(mapAddress.rawValue(), size); |
156 | 150 | } |
157 | 151 |
|
158 | 152 | private static String getUserName(int uid) { |
|
0 commit comments