Skip to content
Merged
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
2 changes: 2 additions & 0 deletions compiler/mx.compiler/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@
"javaCompliance" : "21+",
"dependencies" : [
"GRAAL",
"GRAAL_MANAGEMENT",
"sdk:NATIVEIMAGE_LIBGRAAL",
"sdk:JNIUTILS",
"sdk:NATIVEBRIDGE"
Expand Down Expand Up @@ -697,6 +698,7 @@
],
"distDependencies": [
"GRAAL",
"GRAAL_MANAGEMENT",
"sdk:NATIVEIMAGE_LIBGRAAL",
"sdk:JNIUTILS",
"sdk:NATIVEIMAGE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ byte[] readBytes() throws ClassNotFoundException {
private static final Set<String> LIBGRAAL_MODULES = Set.of(
"jdk.internal.vm.ci",
"jdk.graal.compiler",
"jdk.graal.compiler.management",
"jdk.graal.compiler.libgraal",
"org.graalvm.truffle.compiler",
"com.oracle.graal.graal_enterprise");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,11 @@ protected CompilationResult compileWithLibGraal(Compilation compilation, LibGraa
failedCompilations.getAndAdd(1);
return null;
}
return new CompilationResult(installedCode, memTimeBuffer.readTimeElapsed(), memTimeBuffer.readBytesAllocated());
long memoryUsed = memTimeBuffer.readBytesAllocated();
long compileTime = memTimeBuffer.readTimeElapsed();
GraalError.guarantee(compileTime != 0L, "Compilation time cannot be 0");
GraalError.guarantee(memoryUsed != 0L, "Compilation memory used cannot be 0");
return new CompilationResult(installedCode, compileTime, memoryUsed);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ public static long milliTimeStamp() {
* measurement.
*/
public static long getThreadAllocatedBytes(long id) {
JMXService jmx = JMXService.instance;
if (jmx == null) {
throw new UnsupportedOperationException();
}
Expand Down Expand Up @@ -433,7 +432,6 @@ public static long getCurrentThreadId() {
* the current thread
*/
public static long getCurrentThreadCpuTime() {
JMXService jmx = JMXService.instance;
if (jmx == null) {
throw new UnsupportedOperationException();
}
Expand All @@ -445,7 +443,6 @@ public static long getCurrentThreadCpuTime() {
* measurement.
*/
public static boolean isThreadAllocatedMemorySupported() {
JMXService jmx = JMXService.instance;
if (jmx == null) {
return false;
}
Expand All @@ -456,7 +453,6 @@ public static boolean isThreadAllocatedMemorySupported() {
* Determines if the Java virtual machine supports CPU time measurement for the current thread.
*/
public static boolean isCurrentThreadCpuTimeSupported() {
JMXService jmx = JMXService.instance;
if (jmx == null) {
return false;
}
Expand All @@ -478,7 +474,6 @@ public static boolean isCurrentThreadCpuTimeSupported() {
* @return the input arguments to the JVM or {@code null} if they are unavailable
*/
public static List<String> getInputArguments() {
JMXService jmx = JMXService.instance;
if (jmx == null) {
return null;
}
Expand Down Expand Up @@ -511,4 +506,6 @@ public static double fma(double a, double b, double c) {
public static int getJavaUpdateVersion() {
return Runtime.version().update();
}

private static final JMXService jmx = loadSingle(JMXService.class, libgraalServices != null);
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,4 @@ public abstract class JMXService {
protected abstract boolean isCurrentThreadCpuTimeSupported();

protected abstract List<String> getInputArguments();

// Placing this static field in JMXService (instead of GraalServices)
// allows for lazy initialization.
static final JMXService instance = GraalServices.loadSingle(JMXService.class, false);
}
Loading