Skip to content

Commit 4fa819e

Browse files
committed
[GR-14499] Update jdk9 version of GraalServices.java.
1 parent f57e024 commit 4fa819e

File tree

7 files changed

+651
-9
lines changed

7 files changed

+651
-9
lines changed

compiler/mx.compiler/suite.py

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@
274274
"workingSets" : "API,Graal",
275275
},
276276

277-
"org.graalvm.compiler.serviceprovider.jdk9" : {
277+
"org.graalvm.compiler.serviceprovider.jdk11" : {
278278
"subDir" : "src",
279279
"sourceDirs" : ["src"],
280280
"dependencies" : ["org.graalvm.compiler.serviceprovider"],
@@ -283,9 +283,24 @@
283283
"org.graalvm.compiler.phases.common.jmx.HotSpotMBeanOperationProvider",
284284
],
285285
"checkstyle" : "org.graalvm.compiler.graph",
286-
"javaCompliance" : "9+",
286+
"javaCompliance" : "11+",
287287
"checkPackagePrefix" : "false",
288-
"multiReleaseJarVersion" : "9",
288+
"multiReleaseJarVersion" : "11",
289+
"workingSets" : "API,Graal",
290+
},
291+
292+
"org.graalvm.compiler.serviceprovider.jdk13" : {
293+
"subDir" : "src",
294+
"sourceDirs" : ["src"],
295+
"dependencies" : ["org.graalvm.compiler.serviceprovider"],
296+
"uses" : [
297+
"org.graalvm.compiler.serviceprovider.JMXService",
298+
"org.graalvm.compiler.phases.common.jmx.HotSpotMBeanOperationProvider",
299+
],
300+
"checkstyle" : "org.graalvm.compiler.graph",
301+
"javaCompliance" : "13+",
302+
"checkPackagePrefix" : "false",
303+
"multiReleaseJarVersion" : "13",
289304
"workingSets" : "API,Graal",
290305
},
291306

@@ -610,7 +625,7 @@
610625
"subDir" : "src",
611626
"sourceDirs" : ["src"],
612627
"dependencies" : [
613-
"org.graalvm.compiler.serviceprovider.jdk9",
628+
"org.graalvm.compiler.serviceprovider.jdk11",
614629
"org.graalvm.compiler.hotspot.management",
615630
],
616631
"imports" : [
@@ -625,6 +640,25 @@
625640
"workingSets" : "Graal,HotSpot",
626641
},
627642

643+
"org.graalvm.compiler.hotspot.management.jdk13" : {
644+
"subDir" : "src",
645+
"sourceDirs" : ["src"],
646+
"dependencies" : [
647+
"org.graalvm.compiler.serviceprovider.jdk13",
648+
"org.graalvm.compiler.hotspot.management",
649+
],
650+
"imports" : [
651+
"java.management",
652+
],
653+
"multiReleaseJarVersion" : "13",
654+
"checkstyle" : "org.graalvm.compiler.graph",
655+
"annotationProcessors" : [
656+
"GRAAL_SERVICEPROVIDER_PROCESSOR",
657+
],
658+
"javaCompliance" : "13+",
659+
"workingSets" : "Graal,HotSpot",
660+
},
661+
628662
"org.graalvm.compiler.hotspot.aarch64" : {
629663
"subDir" : "src",
630664
"sourceDirs" : ["src"],
@@ -1975,7 +2009,8 @@
19752009
"subDir" : "src",
19762010
"dependencies" : [
19772011
"org.graalvm.compiler.serviceprovider.jdk8",
1978-
"org.graalvm.compiler.serviceprovider.jdk9",
2012+
"org.graalvm.compiler.serviceprovider.jdk11",
2013+
"org.graalvm.compiler.serviceprovider.jdk13",
19792014
],
19802015
"distDependencies" : [
19812016
"JVMCI_SERVICES"
@@ -2313,7 +2348,8 @@
23132348
"org.graalvm.libgraal.jdk11",
23142349
"org.graalvm.libgraal.jdk13",
23152350
"org.graalvm.compiler.serviceprovider.jdk8",
2316-
"org.graalvm.compiler.serviceprovider.jdk9",
2351+
"org.graalvm.compiler.serviceprovider.jdk11",
2352+
"org.graalvm.compiler.serviceprovider.jdk13",
23172353
"org.graalvm.compiler.options",
23182354
"org.graalvm.compiler.nodeinfo",
23192355
"org.graalvm.compiler.api.replacements",

compiler/src/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotLoweringProvider.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
*/
2525
package org.graalvm.compiler.hotspot.amd64;
2626

27+
import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;
2728
import static org.graalvm.compiler.hotspot.HotSpotBackend.Options.GraalArithmeticStubs;
2829

2930
import org.graalvm.compiler.api.replacements.Snippet;
@@ -66,7 +67,7 @@ public AMD64HotSpotLoweringProvider(HotSpotGraalRuntimeProvider runtime, MetaAcc
6667
@Override
6768
public void initialize(OptionValues options, Iterable<DebugHandlersFactory> factories, HotSpotProviders providers, GraalHotSpotVMConfig config) {
6869
convertSnippets = new AMD64ConvertSnippets.Templates(options, factories, providers, providers.getSnippetReflection(), providers.getCodeCache().getTarget());
69-
profileSnippets = ProfileNode.Options.ProbabilisticProfiling.getValue(options) && !JavaVersionUtil.Java8OrEarlier
70+
profileSnippets = ProfileNode.Options.ProbabilisticProfiling.getValue(options) && !JavaVersionUtil.Java8OrEarlier && GeneratePIC.getValue(options)
7071
? new ProbabilisticProfileSnippets.Templates(options, factories, providers, providers.getCodeCache().getTarget())
7172
: null;
7273
mathSnippets = new AMD64X87MathSnippets.Templates(options, factories, providers, providers.getSnippetReflection(), providers.getCodeCache().getTarget());
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
package org.graalvm.compiler.hotspot.management;
26+
27+
import static java.lang.Thread.currentThread;
28+
29+
import java.lang.management.ManagementFactory;
30+
import java.util.List;
31+
32+
import org.graalvm.compiler.serviceprovider.ServiceProvider;
33+
import org.graalvm.compiler.serviceprovider.JMXService;
34+
35+
import com.sun.management.ThreadMXBean;
36+
37+
/**
38+
* Implementation of {@link JMXService} for JDK 13 and later.
39+
*/
40+
@ServiceProvider(JMXService.class)
41+
public class JMXServiceProvider extends JMXService {
42+
private final ThreadMXBean threadMXBean = (ThreadMXBean) ManagementFactory.getThreadMXBean();
43+
44+
@Override
45+
protected long getThreadAllocatedBytes(long id) {
46+
return threadMXBean.getThreadAllocatedBytes(id);
47+
}
48+
49+
@Override
50+
protected long getCurrentThreadCpuTime() {
51+
long[] times = threadMXBean.getThreadCpuTime(new long[]{currentThread().getId()});
52+
return times[0];
53+
}
54+
55+
@Override
56+
protected boolean isThreadAllocatedMemorySupported() {
57+
return threadMXBean.isThreadAllocatedMemorySupported();
58+
}
59+
60+
@Override
61+
protected boolean isCurrentThreadCpuTimeSupported() {
62+
return threadMXBean.isThreadCpuTimeSupported();
63+
}
64+
65+
@Override
66+
protected List<String> getInputArguments() {
67+
return ManagementFactory.getRuntimeMXBean().getInputArguments();
68+
}
69+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
26+
/**
27+
* JDK 11 and later versioned overlay for the {@code jdk.internal.vm.compiler.management} module.
28+
* This cannot be used in JDK 10 where {@code jdk.internal.vm.compiler.management} is a
29+
* non-upgradeable module.
30+
*/
31+
package org.graalvm.compiler.hotspot.management;

compiler/src/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/DefaultHotSpotLoweringProvider.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
2626

2727
import static jdk.vm.ci.services.Services.IS_IN_NATIVE_IMAGE;
2828
import static org.graalvm.compiler.core.common.GraalOptions.AlwaysInlineVTableStubs;
29+
import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;
2930
import static org.graalvm.compiler.core.common.GraalOptions.InlineVTableStubs;
3031
import static org.graalvm.compiler.core.common.GraalOptions.OmitHotExceptionStacktrace;
3132
import static org.graalvm.compiler.hotspot.meta.HotSpotForeignCallsProviderImpl.OSR_MIGRATION_END;
@@ -227,7 +228,7 @@ public void initialize(OptionValues options, Iterable<DebugHandlersFactory> fact
227228
stringToBytesSnippets = new StringToBytesSnippets.Templates(options, factories, providers, target);
228229
hashCodeSnippets = new HashCodeSnippets.Templates(options, factories, providers, target);
229230
resolveConstantSnippets = new ResolveConstantSnippets.Templates(options, factories, providers, target);
230-
if (!JavaVersionUtil.Java8OrEarlier) {
231+
if (!JavaVersionUtil.Java8OrEarlier && GeneratePIC.getValue(options)) {
231232
profileSnippets = new ProfileSnippets.Templates(options, factories, providers, target);
232233
}
233234
objectCloneSnippets = new ObjectCloneSnippets.Templates(options, factories, providers, target);

0 commit comments

Comments
 (0)