Skip to content

Commit 2e69bb6

Browse files
committed
[GR-62569] Libgraal needs jdk.graal.compiler.management.
PullRequest: graal/20170
2 parents 514a958 + a592fcf commit 2e69bb6

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

compiler/mx.compiler/suite.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@
487487
"javaCompliance" : "21+",
488488
"dependencies" : [
489489
"GRAAL",
490+
"GRAAL_MANAGEMENT",
490491
"sdk:NATIVEIMAGE_LIBGRAAL",
491492
"sdk:JNIUTILS",
492493
"sdk:NATIVEBRIDGE"
@@ -697,6 +698,7 @@
697698
],
698699
"distDependencies": [
699700
"GRAAL",
701+
"GRAAL_MANAGEMENT",
700702
"sdk:NATIVEIMAGE_LIBGRAAL",
701703
"sdk:JNIUTILS",
702704
"sdk:NATIVEIMAGE",

compiler/src/jdk.graal.compiler.libgraal.loader/src/jdk/graal/compiler/libgraal/loader/HostedLibGraalClassLoader.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ byte[] readBytes() throws ClassNotFoundException {
177177
private static final Set<String> LIBGRAAL_MODULES = Set.of(
178178
"jdk.internal.vm.ci",
179179
"jdk.graal.compiler",
180+
"jdk.graal.compiler.management",
180181
"jdk.graal.compiler.libgraal",
181182
"org.graalvm.truffle.compiler",
182183
"com.oracle.graal.graal_enterprise");

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test/LibGraalCompilationDriver.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,11 @@ protected CompilationResult compileWithLibGraal(Compilation compilation, LibGraa
574574
failedCompilations.getAndAdd(1);
575575
return null;
576576
}
577-
return new CompilationResult(installedCode, memTimeBuffer.readTimeElapsed(), memTimeBuffer.readBytesAllocated());
577+
long memoryUsed = memTimeBuffer.readBytesAllocated();
578+
long compileTime = memTimeBuffer.readTimeElapsed();
579+
GraalError.guarantee(compileTime != 0L, "Compilation time cannot be 0");
580+
GraalError.guarantee(memoryUsed != 0L, "Compilation memory used cannot be 0");
581+
return new CompilationResult(installedCode, compileTime, memoryUsed);
578582
}
579583
}
580584

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/serviceprovider/GraalServices.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,6 @@ public static long milliTimeStamp() {
384384
* measurement.
385385
*/
386386
public static long getThreadAllocatedBytes(long id) {
387-
JMXService jmx = JMXService.instance;
388387
if (jmx == null) {
389388
throw new UnsupportedOperationException();
390389
}
@@ -433,7 +432,6 @@ public static long getCurrentThreadId() {
433432
* the current thread
434433
*/
435434
public static long getCurrentThreadCpuTime() {
436-
JMXService jmx = JMXService.instance;
437435
if (jmx == null) {
438436
throw new UnsupportedOperationException();
439437
}
@@ -445,7 +443,6 @@ public static long getCurrentThreadCpuTime() {
445443
* measurement.
446444
*/
447445
public static boolean isThreadAllocatedMemorySupported() {
448-
JMXService jmx = JMXService.instance;
449446
if (jmx == null) {
450447
return false;
451448
}
@@ -456,7 +453,6 @@ public static boolean isThreadAllocatedMemorySupported() {
456453
* Determines if the Java virtual machine supports CPU time measurement for the current thread.
457454
*/
458455
public static boolean isCurrentThreadCpuTimeSupported() {
459-
JMXService jmx = JMXService.instance;
460456
if (jmx == null) {
461457
return false;
462458
}
@@ -478,7 +474,6 @@ public static boolean isCurrentThreadCpuTimeSupported() {
478474
* @return the input arguments to the JVM or {@code null} if they are unavailable
479475
*/
480476
public static List<String> getInputArguments() {
481-
JMXService jmx = JMXService.instance;
482477
if (jmx == null) {
483478
return null;
484479
}
@@ -511,4 +506,6 @@ public static double fma(double a, double b, double c) {
511506
public static int getJavaUpdateVersion() {
512507
return Runtime.version().update();
513508
}
509+
510+
private static final JMXService jmx = loadSingle(JMXService.class, libgraalServices != null);
514511
}

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/serviceprovider/JMXService.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,4 @@ public abstract class JMXService {
4242
protected abstract boolean isCurrentThreadCpuTimeSupported();
4343

4444
protected abstract List<String> getInputArguments();
45-
46-
// Placing this static field in JMXService (instead of GraalServices)
47-
// allows for lazy initialization.
48-
static final JMXService instance = GraalServices.loadSingle(JMXService.class, false);
4945
}

0 commit comments

Comments
 (0)