Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/
package com.oracle.svm.core.posix.darwin;

import com.oracle.svm.core.util.BasedOnJDKFile;
import org.graalvm.nativeimage.CurrentIsolate;
import org.graalvm.nativeimage.IsolateThread;
import org.graalvm.nativeimage.StackValue;
Expand Down Expand Up @@ -54,10 +55,7 @@ public long getThreadCpuTime(IsolateThread isolateThread, boolean includeSystemT
return getThreadCpuTime(machThread, includeSystemTime);
}

/**
* Based on jdk-20-ga, see <a href=
* "https://github.com/openjdk/jdk20/blob/82749901b1497f524e53e47c45708c8e4a63c8b9/src/hotspot/os/bsd/os_bsd.cpp#L2314">os::thread_cpu_time</a>.
*/
@BasedOnJDKFile("src/hotspot/os/bsd/os_bsd.cpp#L2403-L2428")
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
private static long getThreadCpuTime(int machThread, boolean includeSystemTime) {
CIntPointer sizePointer = UnsafeStackValue.get(Integer.BYTES);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/
package com.oracle.svm.core.posix.linux;

import com.oracle.svm.core.util.BasedOnJDKFile;
import org.graalvm.nativeimage.CurrentIsolate;
import org.graalvm.nativeimage.IsolateThread;
import org.graalvm.nativeimage.StackValue;
Expand Down Expand Up @@ -65,10 +66,7 @@ public long getThreadCpuTime(IsolateThread isolateThread, boolean includeSystemT
return fastCpuTime(pthread);
}

/**
* Based on jdk-20-ga, see <a href=
* "https://github.com/openjdk/jdk/blob/df6cf1e41d0fc2dd5f5c094f66c7c8969cf5548d/src/hotspot/os/linux/os_linux.cpp#L4976">fast_cpu_time(...)</a>.
*/
@BasedOnJDKFile("src/hotspot/os/linux/os_linux.cpp#L5086-L5098")
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
private static long fastCpuTime(pthread_t pthread) {
CIntPointer threadsClockId = StackValue.get(Integer.BYTES);
Expand All @@ -79,6 +77,7 @@ private static long fastCpuTime(pthread_t pthread) {
}

@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
@BasedOnJDKFile("src/hotspot/os/linux/os_linux.cpp#L4290-L4295")
private static long fastThreadCpuTime(int clockId) {
timespec time = UnsafeStackValue.get(timespec.class);
if (LinuxTime.NoTransitions.clock_gettime(clockId, time) != 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/
package com.oracle.svm.core.windows;

import com.oracle.svm.core.util.BasedOnJDKFile;
import org.graalvm.nativeimage.CurrentIsolate;
import org.graalvm.nativeimage.IsolateThread;
import org.graalvm.nativeimage.StackValue;
Expand Down Expand Up @@ -54,10 +55,7 @@ public long getThreadCpuTime(IsolateThread isolateThread, boolean includeSystemT
return getThreadCpuTime(hThread, includeSystemTime);
}

/**
* Based on jdk-20-ga, see <a href=
* "https://github.com/openjdk/jdk20/blob/82749901b1497f524e53e47c45708c8e4a63c8b9/src/hotspot/os/windows/os_windows.cpp#L4609">os::thread_cpu_time</a>.
*/
@BasedOnJDKFile("src/hotspot/os/windows/os_windows.cpp#L4709-L4725")
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
private static long getThreadCpuTime(HANDLE hThread, boolean includeSystemTime) {
FILETIME create = StackValue.get(FILETIME.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ static void writeBytes(FileDescriptor descriptor, byte[] bytes, int off, int len

/** Retrieve a nanosecond counter for elapsed time measurement. */
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
@BasedOnJDKFile("src/hotspot/os/windows/os_windows.cpp#L970-L977")
@BasedOnJDKFile("src/hotspot/os/windows/os_windows.cpp#L1075-L1081")
@BasedOnJDKFile("src/hotspot/os/windows/os_windows.cpp#L990-L997")
@BasedOnJDKFile("src/hotspot/os/windows/os_windows.cpp#L1095-L1101")
public static long getNanoCounter() {
if (performanceFrequency == 0L) {
CLongPointer count = StackValue.get(CLongPointer.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
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.util.BasedOnJDKFile;

@SuppressWarnings("unused")
@TargetClass(value = java.lang.Module.class)
Expand All @@ -53,6 +54,7 @@ public boolean isNativeAccessEnabled() {
public native void ensureNativeAccess(Class<?> owner, String methodName, Class<?> currentClass);

@Substitute
@BasedOnJDKFile("src/hotspot/share/classfile/modules.cpp#L275-L479")
private static void defineModule0(Module module, boolean isOpen, String version, String location, Object[] pns) {
if (Arrays.stream(pns).anyMatch(Objects::isNull)) {
throw new IllegalArgumentException("Bad package name");
Expand All @@ -62,13 +64,15 @@ private static void defineModule0(Module module, boolean isOpen, String version,
}

@Substitute
@BasedOnJDKFile("src/hotspot/share/classfile/modules.cpp#L763-L799")
private static void addReads0(Module from, Module to) {
if (Objects.isNull(from)) {
throw new NullPointerException("The from_module is null");
}
}

@Substitute
@BasedOnJDKFile("src/hotspot/share/classfile/modules.cpp#L753-L761")
private static void addExports0(Module from, String pn, Module to) {
if (Objects.isNull(to)) {
throw new NullPointerException("The to_module is null");
Expand All @@ -79,12 +83,14 @@ private static void addExports0(Module from, String pn, Module to) {
}

@Substitute
@BasedOnJDKFile("src/hotspot/share/classfile/modules.cpp#L686-L750")
private static void addExportsToAll0(Module from, String pn) {
ModuleUtil.checkFromModuleAndPackageNullability(from, pn);
ModuleUtil.checkIsPackageContainedInModule(pn, from);
}

@Substitute
@BasedOnJDKFile("src/hotspot/share/classfile/modules.cpp#L869-L918")
private static void addExportsToAllUnnamed0(Module from, String pn) {
ModuleUtil.checkFromModuleAndPackageNullability(from, pn);
if (from.isNamed()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
import com.oracle.svm.core.annotate.RecomputeFieldValue;
import com.oracle.svm.core.annotate.TargetClass;
import com.oracle.svm.core.heap.Target_jdk_internal_ref_Cleaner;
import com.oracle.svm.core.util.BasedOnJDKFile;
import com.oracle.svm.core.util.VMError;

@TargetClass(className = "java.nio.DirectByteBuffer")
@BasedOnJDKFile("src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template")
public final class Target_java_nio_DirectByteBuffer {

/**
Expand Down