Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java @ 22758:a130b51efb07
removed @Option mechanism from JVMCI (GRAAL-1371)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 21 Dec 2015 15:53:56 +0100 |
parents | 57646377e480 |
children | f2206f5bb62e |
rev | line source |
---|---|
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22658
diff
changeset
|
23 package jdk.vm.ci.hotspot; |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22658
diff
changeset
|
25 import static jdk.vm.ci.inittimer.InitTimer.timer; |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 |
22626
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
27 import java.io.IOException; |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
28 import java.io.OutputStream; |
22562
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
29 import java.lang.reflect.Array; |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
30 import java.lang.reflect.Field; |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
31 import java.lang.reflect.Method; |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
32 import java.lang.reflect.Modifier; |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
33 import java.util.Collections; |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
34 import java.util.HashMap; |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
35 import java.util.Map; |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
36 import java.util.Objects; |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
37 import java.util.TreeMap; |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 |
22758
a130b51efb07
removed @Option mechanism from JVMCI (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
22697
diff
changeset
|
39 import sun.misc.VM; |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22658
diff
changeset
|
40 import jdk.vm.ci.code.Architecture; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22658
diff
changeset
|
41 import jdk.vm.ci.code.CompilationResult; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22658
diff
changeset
|
42 import jdk.vm.ci.code.InstalledCode; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22658
diff
changeset
|
43 import jdk.vm.ci.common.JVMCIError; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22658
diff
changeset
|
44 import jdk.vm.ci.inittimer.InitTimer; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22658
diff
changeset
|
45 import jdk.vm.ci.meta.JVMCIMetaAccessContext; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22658
diff
changeset
|
46 import jdk.vm.ci.meta.JavaKind; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22658
diff
changeset
|
47 import jdk.vm.ci.meta.JavaType; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22658
diff
changeset
|
48 import jdk.vm.ci.meta.ResolvedJavaType; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22658
diff
changeset
|
49 import jdk.vm.ci.runtime.JVMCI; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22658
diff
changeset
|
50 import jdk.vm.ci.runtime.JVMCIBackend; |
22697
57646377e480
Rename Compiler to JVMCICompiler and expose it from JVMCIRuntime.
Roland Schatz <roland.schatz@oracle.com>
parents:
22694
diff
changeset
|
51 import jdk.vm.ci.runtime.JVMCICompiler; |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22658
diff
changeset
|
52 import jdk.vm.ci.service.Services; |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 //JaCoCo Exclude |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 |
22562
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
56 /** |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
57 * HotSpot implementation of a JVMCI runtime. |
22694
023981d7f257
Fix deadlock between JVMCI.initialize and HotSpotJVMCIRuntime.runtime
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22672
diff
changeset
|
58 * |
023981d7f257
Fix deadlock between JVMCI.initialize and HotSpotJVMCIRuntime.runtime
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22672
diff
changeset
|
59 * The initialization of this class is very fragile since it's initialized both through |
023981d7f257
Fix deadlock between JVMCI.initialize and HotSpotJVMCIRuntime.runtime
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22672
diff
changeset
|
60 * {@link JVMCI#initialize()} or through calling {@link HotSpotJVMCIRuntime#runtime()} and |
023981d7f257
Fix deadlock between JVMCI.initialize and HotSpotJVMCIRuntime.runtime
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22672
diff
changeset
|
61 * {@link HotSpotJVMCIRuntime#runtime()} is also called by {@link JVMCI#initialize()}. So this class |
023981d7f257
Fix deadlock between JVMCI.initialize and HotSpotJVMCIRuntime.runtime
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22672
diff
changeset
|
62 * can't have a static initializer and any required initialization must be done as part of |
023981d7f257
Fix deadlock between JVMCI.initialize and HotSpotJVMCIRuntime.runtime
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22672
diff
changeset
|
63 * {@link #runtime()}. This allows the initialization to funnel back through |
023981d7f257
Fix deadlock between JVMCI.initialize and HotSpotJVMCIRuntime.runtime
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22672
diff
changeset
|
64 * {@link JVMCI#initialize()} without deadlocking. |
22562
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
65 */ |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider, HotSpotProxified { |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
67 |
22509
267eecd6d92a
suppressed -Xlint:try warnings
Doug Simon <doug.simon@oracle.com>
parents:
22486
diff
changeset
|
68 @SuppressWarnings("try") |
22462
7a7dd51e7e0b
Ensure that calling HotSpotJVMCIRuntime.runtime() initializes JVMCI correctly
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22454
diff
changeset
|
69 static class DelayedInit { |
7a7dd51e7e0b
Ensure that calling HotSpotJVMCIRuntime.runtime() initializes JVMCI correctly
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22454
diff
changeset
|
70 private static final HotSpotJVMCIRuntime instance; |
7a7dd51e7e0b
Ensure that calling HotSpotJVMCIRuntime.runtime() initializes JVMCI correctly
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22454
diff
changeset
|
71 |
7a7dd51e7e0b
Ensure that calling HotSpotJVMCIRuntime.runtime() initializes JVMCI correctly
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22454
diff
changeset
|
72 static { |
22658
61bb5fa12458
Remove StartupEventListener interface.
Roland Schatz <roland.schatz@oracle.com>
parents:
22657
diff
changeset
|
73 try (InitTimer t = timer("HotSpotJVMCIRuntime.<init>")) { |
61bb5fa12458
Remove StartupEventListener interface.
Roland Schatz <roland.schatz@oracle.com>
parents:
22657
diff
changeset
|
74 instance = new HotSpotJVMCIRuntime(); |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
75 } |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
76 } |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
77 } |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
78 |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
79 /** |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
80 * Gets the singleton {@link HotSpotJVMCIRuntime} object. |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
81 */ |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
82 public static HotSpotJVMCIRuntime runtime() { |
22694
023981d7f257
Fix deadlock between JVMCI.initialize and HotSpotJVMCIRuntime.runtime
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22672
diff
changeset
|
83 JVMCI.initialize(); |
22462
7a7dd51e7e0b
Ensure that calling HotSpotJVMCIRuntime.runtime() initializes JVMCI correctly
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22454
diff
changeset
|
84 return DelayedInit.instance; |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
85 } |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
86 |
22758
a130b51efb07
removed @Option mechanism from JVMCI (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
22697
diff
changeset
|
87 /** |
a130b51efb07
removed @Option mechanism from JVMCI (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
22697
diff
changeset
|
88 * Gets a boolean value based on a {@linkplain VM#getSavedProperty(String) saved} system |
a130b51efb07
removed @Option mechanism from JVMCI (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
22697
diff
changeset
|
89 * property. |
a130b51efb07
removed @Option mechanism from JVMCI (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
22697
diff
changeset
|
90 * |
a130b51efb07
removed @Option mechanism from JVMCI (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
22697
diff
changeset
|
91 * @param name the name of the system property to derive a boolean value from using |
a130b51efb07
removed @Option mechanism from JVMCI (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
22697
diff
changeset
|
92 * {@link Boolean#parseBoolean(String)} |
a130b51efb07
removed @Option mechanism from JVMCI (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
22697
diff
changeset
|
93 * @param def the value to return if there is no system property corresponding to {@code name} |
a130b51efb07
removed @Option mechanism from JVMCI (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
22697
diff
changeset
|
94 */ |
a130b51efb07
removed @Option mechanism from JVMCI (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
22697
diff
changeset
|
95 public static boolean getBooleanOption(String name, boolean def) { |
a130b51efb07
removed @Option mechanism from JVMCI (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
22697
diff
changeset
|
96 String value = VM.getSavedProperty(name); |
a130b51efb07
removed @Option mechanism from JVMCI (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
22697
diff
changeset
|
97 if (value == null) { |
a130b51efb07
removed @Option mechanism from JVMCI (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
22697
diff
changeset
|
98 return def; |
a130b51efb07
removed @Option mechanism from JVMCI (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
22697
diff
changeset
|
99 } |
a130b51efb07
removed @Option mechanism from JVMCI (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
22697
diff
changeset
|
100 return Boolean.parseBoolean(value); |
a130b51efb07
removed @Option mechanism from JVMCI (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
22697
diff
changeset
|
101 } |
a130b51efb07
removed @Option mechanism from JVMCI (GRAAL-1371)
Doug Simon <doug.simon@oracle.com>
parents:
22697
diff
changeset
|
102 |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
103 public static HotSpotJVMCIBackendFactory findFactory(String architecture) { |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
104 for (HotSpotJVMCIBackendFactory factory : Services.load(HotSpotJVMCIBackendFactory.class)) { |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
105 if (factory.getArchitecture().equalsIgnoreCase(architecture)) { |
22429
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22422
diff
changeset
|
106 return factory; |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
107 } |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
108 } |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
109 |
22429
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22422
diff
changeset
|
110 throw new JVMCIError("No JVMCI runtime available for the %s architecture", architecture); |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
111 } |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
112 |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
113 /** |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
114 * Gets the kind of a word value on the {@linkplain #getHostJVMCIBackend() host} backend. |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
115 */ |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22509
diff
changeset
|
116 public static JavaKind getHostWordKind() { |
22567
bfd5fdca1ce9
Clean separation between backend and frontend wordKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22562
diff
changeset
|
117 return runtime().getHostJVMCIBackend().getCodeCache().getTarget().wordJavaKind; |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
118 } |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
119 |
22546
f95eb4e457af
made HotSpotJVMCIRuntime.compilerToVm final (GRAAL-1255)
Doug Simon <doug.simon@oracle.com>
parents:
22536
diff
changeset
|
120 protected final CompilerToVM compilerToVm; |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
121 |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
122 protected final HotSpotVMConfig config; |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
123 private final JVMCIBackend hostBackend; |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
124 |
22697
57646377e480
Rename Compiler to JVMCICompiler and expose it from JVMCIRuntime.
Roland Schatz <roland.schatz@oracle.com>
parents:
22694
diff
changeset
|
125 private volatile JVMCICompiler compiler; |
22422
a98a02bad801
Add simple interface to control caching policy for ResolvedJavaTypes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
126 protected final JVMCIMetaAccessContext metaAccessContext; |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
127 |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
128 private final Map<Class<? extends Architecture>, JVMCIBackend> backends = new HashMap<>(); |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
129 |
21780
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21675
diff
changeset
|
130 private final Iterable<HotSpotVMEventListener> vmEventListeners; |
21616
4c146c9367b6
recast VM compilation request via JVMCI to be a HotSpot JVMCI event, removing the last direct reference to a Graal class in the VM (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21604
diff
changeset
|
131 |
22656
d634e615b00d
Lazily initialize compiler on first compilation request.
Roland Schatz <roland.schatz@oracle.com>
parents:
22634
diff
changeset
|
132 @SuppressWarnings("unused") private final String[] trivialPrefixes; |
22575
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22567
diff
changeset
|
133 |
22509
267eecd6d92a
suppressed -Xlint:try warnings
Doug Simon <doug.simon@oracle.com>
parents:
22486
diff
changeset
|
134 @SuppressWarnings("try") |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
135 private HotSpotJVMCIRuntime() { |
22547
10a9e989850e
made CompilertoVM a final concrete class and removed CompilerToVMImpl (GRAAL-1255)
Doug Simon <doug.simon@oracle.com>
parents:
22546
diff
changeset
|
136 compilerToVm = new CompilerToVM(); |
22562
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
137 |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
138 try (InitTimer t = timer("HotSpotVMConfig<init>")) { |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
139 config = new HotSpotVMConfig(compilerToVm); |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
140 } |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
141 |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
142 String hostArchitecture = config.getHostArchitectureName(); |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
143 |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
144 HotSpotJVMCIBackendFactory factory; |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
145 try (InitTimer t = timer("find factory:", hostArchitecture)) { |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
146 factory = findFactory(hostArchitecture); |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
147 } |
22429
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22422
diff
changeset
|
148 |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
149 try (InitTimer t = timer("create JVMCI backend:", hostArchitecture)) { |
22613
9409f7cec59a
Remove dependency from HotSpotJVMCIRuntime to CompilerFactory.
Roland Schatz <roland.schatz@oracle.com>
parents:
22593
diff
changeset
|
150 hostBackend = registerBackend(factory.createJVMCIBackend(this, null)); |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
151 } |
21616
4c146c9367b6
recast VM compilation request via JVMCI to be a HotSpot JVMCI event, removing the last direct reference to a Graal class in the VM (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21604
diff
changeset
|
152 |
22429
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22422
diff
changeset
|
153 vmEventListeners = Services.load(HotSpotVMEventListener.class); |
22422
a98a02bad801
Add simple interface to control caching policy for ResolvedJavaTypes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
154 |
a98a02bad801
Add simple interface to control caching policy for ResolvedJavaTypes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
155 JVMCIMetaAccessContext context = null; |
a98a02bad801
Add simple interface to control caching policy for ResolvedJavaTypes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
156 for (HotSpotVMEventListener vmEventListener : vmEventListeners) { |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22429
diff
changeset
|
157 context = vmEventListener.createMetaAccessContext(this); |
22422
a98a02bad801
Add simple interface to control caching policy for ResolvedJavaTypes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
158 if (context != null) { |
a98a02bad801
Add simple interface to control caching policy for ResolvedJavaTypes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
159 break; |
a98a02bad801
Add simple interface to control caching policy for ResolvedJavaTypes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
160 } |
a98a02bad801
Add simple interface to control caching policy for ResolvedJavaTypes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
161 } |
a98a02bad801
Add simple interface to control caching policy for ResolvedJavaTypes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
162 if (context == null) { |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22429
diff
changeset
|
163 context = new HotSpotJVMCIMetaAccessContext(); |
22422
a98a02bad801
Add simple interface to control caching policy for ResolvedJavaTypes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
164 } |
a98a02bad801
Add simple interface to control caching policy for ResolvedJavaTypes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
165 metaAccessContext = context; |
22562
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
166 |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
167 if (Boolean.valueOf(System.getProperty("jvmci.printconfig"))) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
168 printConfig(config, compilerToVm); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
169 } |
22656
d634e615b00d
Lazily initialize compiler on first compilation request.
Roland Schatz <roland.schatz@oracle.com>
parents:
22634
diff
changeset
|
170 |
d634e615b00d
Lazily initialize compiler on first compilation request.
Roland Schatz <roland.schatz@oracle.com>
parents:
22634
diff
changeset
|
171 trivialPrefixes = HotSpotJVMCICompilerConfig.getCompilerFactory().getTrivialPrefixes(); |
22422
a98a02bad801
Add simple interface to control caching policy for ResolvedJavaTypes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
172 } |
a98a02bad801
Add simple interface to control caching policy for ResolvedJavaTypes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
173 |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
174 private JVMCIBackend registerBackend(JVMCIBackend backend) { |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
175 Class<? extends Architecture> arch = backend.getCodeCache().getTarget().arch.getClass(); |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
176 JVMCIBackend oldValue = backends.put(arch, backend); |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
177 assert oldValue == null : "cannot overwrite existing backend for architecture " + arch.getSimpleName(); |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
178 return backend; |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
179 } |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
180 |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
181 public ResolvedJavaType fromClass(Class<?> javaClass) { |
22422
a98a02bad801
Add simple interface to control caching policy for ResolvedJavaTypes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
182 return metaAccessContext.fromClass(javaClass); |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
183 } |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
184 |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
185 public HotSpotVMConfig getConfig() { |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
186 return config; |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
187 } |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
188 |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
189 public CompilerToVM getCompilerToVM() { |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
190 return compilerToVm; |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
191 } |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
192 |
22422
a98a02bad801
Add simple interface to control caching policy for ResolvedJavaTypes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
193 public JVMCIMetaAccessContext getMetaAccessContext() { |
a98a02bad801
Add simple interface to control caching policy for ResolvedJavaTypes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
194 return metaAccessContext; |
a98a02bad801
Add simple interface to control caching policy for ResolvedJavaTypes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
195 } |
a98a02bad801
Add simple interface to control caching policy for ResolvedJavaTypes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22420
diff
changeset
|
196 |
22697
57646377e480
Rename Compiler to JVMCICompiler and expose it from JVMCIRuntime.
Roland Schatz <roland.schatz@oracle.com>
parents:
22694
diff
changeset
|
197 public JVMCICompiler getCompiler() { |
22656
d634e615b00d
Lazily initialize compiler on first compilation request.
Roland Schatz <roland.schatz@oracle.com>
parents:
22634
diff
changeset
|
198 if (compiler == null) { |
22657
9203f93ffeb0
Fix race condition in lazy compiler initialization.
Roland Schatz <roland.schatz@oracle.com>
parents:
22656
diff
changeset
|
199 synchronized (this) { |
9203f93ffeb0
Fix race condition in lazy compiler initialization.
Roland Schatz <roland.schatz@oracle.com>
parents:
22656
diff
changeset
|
200 if (compiler == null) { |
9203f93ffeb0
Fix race condition in lazy compiler initialization.
Roland Schatz <roland.schatz@oracle.com>
parents:
22656
diff
changeset
|
201 compiler = HotSpotJVMCICompilerConfig.getCompilerFactory().createCompiler(this); |
9203f93ffeb0
Fix race condition in lazy compiler initialization.
Roland Schatz <roland.schatz@oracle.com>
parents:
22656
diff
changeset
|
202 } |
9203f93ffeb0
Fix race condition in lazy compiler initialization.
Roland Schatz <roland.schatz@oracle.com>
parents:
22656
diff
changeset
|
203 } |
22656
d634e615b00d
Lazily initialize compiler on first compilation request.
Roland Schatz <roland.schatz@oracle.com>
parents:
22634
diff
changeset
|
204 } |
22429
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22422
diff
changeset
|
205 return compiler; |
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22422
diff
changeset
|
206 } |
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22422
diff
changeset
|
207 |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
208 public JavaType lookupType(String name, HotSpotResolvedObjectType accessingType, boolean resolve) { |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
209 Objects.requireNonNull(accessingType, "cannot resolve type without an accessing class"); |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
210 // If the name represents a primitive type we can short-circuit the lookup. |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
211 if (name.length() == 1) { |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22509
diff
changeset
|
212 JavaKind kind = JavaKind.fromPrimitiveOrVoidTypeChar(name.charAt(0)); |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
213 return fromClass(kind.toJavaClass()); |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
214 } |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
215 |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
216 // Resolve non-primitive types in the VM. |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
217 HotSpotResolvedObjectTypeImpl hsAccessingType = (HotSpotResolvedObjectTypeImpl) accessingType; |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22429
diff
changeset
|
218 final HotSpotResolvedObjectTypeImpl klass = compilerToVm.lookupType(name, hsAccessingType.mirror(), resolve); |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
219 |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22429
diff
changeset
|
220 if (klass == null) { |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
221 assert resolve == false; |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
222 return HotSpotUnresolvedJavaType.create(this, name); |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
223 } |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22429
diff
changeset
|
224 return klass; |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
225 } |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
226 |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
227 public JVMCIBackend getHostJVMCIBackend() { |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
228 return hostBackend; |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
229 } |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
230 |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
231 public <T extends Architecture> JVMCIBackend getJVMCIBackend(Class<T> arch) { |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
232 assert arch != Architecture.class; |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
233 return backends.get(arch); |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
234 } |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
235 |
22562
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
236 public Map<Class<? extends Architecture>, JVMCIBackend> getJVMCIBackends() { |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
237 return Collections.unmodifiableMap(backends); |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
238 } |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
239 |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
240 /** |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
241 * Called from the VM. |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
242 */ |
21616
4c146c9367b6
recast VM compilation request via JVMCI to be a HotSpot JVMCI event, removing the last direct reference to a Graal class in the VM (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21604
diff
changeset
|
243 @SuppressWarnings({"unused"}) |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22429
diff
changeset
|
244 private void compileMethod(HotSpotResolvedJavaMethod method, int entryBCI, long jvmciEnv, int id) { |
22656
d634e615b00d
Lazily initialize compiler on first compilation request.
Roland Schatz <roland.schatz@oracle.com>
parents:
22634
diff
changeset
|
245 getCompiler().compileMethod(new HotSpotCompilationRequest(method, entryBCI, jvmciEnv, id)); |
21616
4c146c9367b6
recast VM compilation request via JVMCI to be a HotSpot JVMCI event, removing the last direct reference to a Graal class in the VM (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21604
diff
changeset
|
246 } |
4c146c9367b6
recast VM compilation request via JVMCI to be a HotSpot JVMCI event, removing the last direct reference to a Graal class in the VM (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21604
diff
changeset
|
247 |
4c146c9367b6
recast VM compilation request via JVMCI to be a HotSpot JVMCI event, removing the last direct reference to a Graal class in the VM (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21604
diff
changeset
|
248 /** |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
249 * Shuts down the runtime. |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
250 * |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
251 * Called from the VM. |
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
252 */ |
21616
4c146c9367b6
recast VM compilation request via JVMCI to be a HotSpot JVMCI event, removing the last direct reference to a Graal class in the VM (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21604
diff
changeset
|
253 @SuppressWarnings({"unused"}) |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
254 private void shutdown() throws Exception { |
21780
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21675
diff
changeset
|
255 for (HotSpotVMEventListener vmEventListener : vmEventListeners) { |
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21675
diff
changeset
|
256 vmEventListener.notifyShutdown(); |
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21675
diff
changeset
|
257 } |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
258 } |
22299
7b4a47fcc4c0
Move most of jdk.internal.jvmci.debug back into com.oracle.graal.debug
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
259 |
22593
cabc2b8bc3f1
Make HotSpotCodeCacheProvider.installMethod throw an exception if code installation fails
twisti
parents:
22581
diff
changeset
|
260 /** |
cabc2b8bc3f1
Make HotSpotCodeCacheProvider.installMethod throw an exception if code installation fails
twisti
parents:
22581
diff
changeset
|
261 * Notify on successful install into the CodeCache. |
cabc2b8bc3f1
Make HotSpotCodeCacheProvider.installMethod throw an exception if code installation fails
twisti
parents:
22581
diff
changeset
|
262 * |
cabc2b8bc3f1
Make HotSpotCodeCacheProvider.installMethod throw an exception if code installation fails
twisti
parents:
22581
diff
changeset
|
263 * @param hotSpotCodeCacheProvider |
cabc2b8bc3f1
Make HotSpotCodeCacheProvider.installMethod throw an exception if code installation fails
twisti
parents:
22581
diff
changeset
|
264 * @param installedCode |
cabc2b8bc3f1
Make HotSpotCodeCacheProvider.installMethod throw an exception if code installation fails
twisti
parents:
22581
diff
changeset
|
265 * @param compResult |
cabc2b8bc3f1
Make HotSpotCodeCacheProvider.installMethod throw an exception if code installation fails
twisti
parents:
22581
diff
changeset
|
266 */ |
22299
7b4a47fcc4c0
Move most of jdk.internal.jvmci.debug back into com.oracle.graal.debug
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
267 void notifyInstall(HotSpotCodeCacheProvider hotSpotCodeCacheProvider, InstalledCode installedCode, CompilationResult compResult) { |
7b4a47fcc4c0
Move most of jdk.internal.jvmci.debug back into com.oracle.graal.debug
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
268 for (HotSpotVMEventListener vmEventListener : vmEventListeners) { |
7b4a47fcc4c0
Move most of jdk.internal.jvmci.debug back into com.oracle.graal.debug
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
269 vmEventListener.notifyInstall(hotSpotCodeCacheProvider, installedCode, compResult); |
7b4a47fcc4c0
Move most of jdk.internal.jvmci.debug back into com.oracle.graal.debug
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
270 } |
7b4a47fcc4c0
Move most of jdk.internal.jvmci.debug back into com.oracle.graal.debug
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
271 } |
22562
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
272 |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
273 private static void printConfig(HotSpotVMConfig config, CompilerToVM vm) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
274 Field[] fields = config.getClass().getDeclaredFields(); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
275 Map<String, Field> sortedFields = new TreeMap<>(); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
276 for (Field f : fields) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
277 if (!f.isSynthetic() && !Modifier.isStatic(f.getModifiers())) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
278 f.setAccessible(true); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
279 sortedFields.put(f.getName(), f); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
280 } |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
281 } |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
282 for (Field f : sortedFields.values()) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
283 try { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
284 String line = String.format("%9s %-40s = %s%n", f.getType().getSimpleName(), f.getName(), pretty(f.get(config))); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
285 byte[] lineBytes = line.getBytes(); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
286 vm.writeDebugOutput(lineBytes, 0, lineBytes.length); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
287 vm.flushDebugOutput(); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
288 } catch (Exception e) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
289 } |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
290 } |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
291 } |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
292 |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
293 private static String pretty(Object value) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
294 if (value == null) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
295 return "null"; |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
296 } |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
297 |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
298 Class<?> klass = value.getClass(); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
299 if (value instanceof String) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
300 return "\"" + value + "\""; |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
301 } else if (value instanceof Method) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
302 return "method \"" + ((Method) value).getName() + "\""; |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
303 } else if (value instanceof Class<?>) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
304 return "class \"" + ((Class<?>) value).getSimpleName() + "\""; |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
305 } else if (value instanceof Integer) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
306 if ((Integer) value < 10) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
307 return value.toString(); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
308 } |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
309 return value + " (0x" + Integer.toHexString((Integer) value) + ")"; |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
310 } else if (value instanceof Long) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
311 if ((Long) value < 10 && (Long) value > -10) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
312 return value + "l"; |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
313 } |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
314 return value + "l (0x" + Long.toHexString((Long) value) + "l)"; |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
315 } else if (klass.isArray()) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
316 StringBuilder str = new StringBuilder(); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
317 int dimensions = 0; |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
318 while (klass.isArray()) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
319 dimensions++; |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
320 klass = klass.getComponentType(); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
321 } |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
322 int length = Array.getLength(value); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
323 str.append(klass.getSimpleName()).append('[').append(length).append(']'); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
324 for (int i = 1; i < dimensions; i++) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
325 str.append("[]"); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
326 } |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
327 str.append(" {"); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
328 for (int i = 0; i < length; i++) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
329 str.append(pretty(Array.get(value, i))); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
330 if (i < length - 1) { |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
331 str.append(", "); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
332 } |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
333 } |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
334 str.append('}'); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
335 return str.toString(); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
336 } |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
337 return value.toString(); |
28fe5850735e
removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents:
22550
diff
changeset
|
338 } |
22626
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
339 |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
340 public OutputStream getLogStream() { |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
341 return new OutputStream() { |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
342 |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
343 @Override |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
344 public void write(byte[] b, int off, int len) throws IOException { |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
345 if (b == null) { |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
346 throw new NullPointerException(); |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
347 } else if (off < 0 || off > b.length || len < 0 || (off + len) > b.length || (off + len) < 0) { |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
348 throw new IndexOutOfBoundsException(); |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
349 } else if (len == 0) { |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
350 return; |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
351 } |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
352 compilerToVm.writeDebugOutput(b, off, len); |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
353 } |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
354 |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
355 @Override |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
356 public void write(int b) throws IOException { |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
357 write(new byte[]{(byte) b}, 0, 1); |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
358 } |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
359 |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
360 @Override |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
361 public void flush() throws IOException { |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
362 compilerToVm.flushDebugOutput(); |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
363 } |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
364 }; |
b6b46b741102
added HotSpotJVMCIRuntimeProvider.getLogStream() and made CompilerToVM.writeDebugOutput and CompilerToVm.flushDebugOutput package-private
Doug Simon <doug.simon@oracle.com>
parents:
22623
diff
changeset
|
365 } |
22634
02d95720c455
added HotSpotJVMCIRuntimeProvider.collectCounters and made CompilerToVM.collectCounters package-private
Doug Simon <doug.simon@oracle.com>
parents:
22626
diff
changeset
|
366 |
02d95720c455
added HotSpotJVMCIRuntimeProvider.collectCounters and made CompilerToVM.collectCounters package-private
Doug Simon <doug.simon@oracle.com>
parents:
22626
diff
changeset
|
367 /** |
02d95720c455
added HotSpotJVMCIRuntimeProvider.collectCounters and made CompilerToVM.collectCounters package-private
Doug Simon <doug.simon@oracle.com>
parents:
22626
diff
changeset
|
368 * Collects the current values of all JVMCI benchmark counters, summed up over all threads. |
02d95720c455
added HotSpotJVMCIRuntimeProvider.collectCounters and made CompilerToVM.collectCounters package-private
Doug Simon <doug.simon@oracle.com>
parents:
22626
diff
changeset
|
369 */ |
02d95720c455
added HotSpotJVMCIRuntimeProvider.collectCounters and made CompilerToVM.collectCounters package-private
Doug Simon <doug.simon@oracle.com>
parents:
22626
diff
changeset
|
370 public long[] collectCounters() { |
02d95720c455
added HotSpotJVMCIRuntimeProvider.collectCounters and made CompilerToVM.collectCounters package-private
Doug Simon <doug.simon@oracle.com>
parents:
22626
diff
changeset
|
371 return compilerToVm.collectCounters(); |
02d95720c455
added HotSpotJVMCIRuntimeProvider.collectCounters and made CompilerToVM.collectCounters package-private
Doug Simon <doug.simon@oracle.com>
parents:
22626
diff
changeset
|
372 } |
21551
5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
373 } |