annotate src/share/vm/graal/graalVMToCompiler.cpp @ 15627:4612497da67f

remove unused HotSpotResolvedJavaMethod fields in graalJavaAccess.hpp
author twisti
date Mon, 12 May 2014 17:44:23 -0700
parents 063ec2920d21
children fe608a56e3f7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2516
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
1 /*
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
4 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
7 * published by the Free Software Foundation.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
8 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
13 * accompanied this code).
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
14 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
15 * You should have received a copy of the GNU General Public License version
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
18 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
21 * questions.
1410
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
22 */
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
23
2045
9c96c873c42b Fix includes to match new hotspot mechanism.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1941
diff changeset
24 #include "precompiled.hpp"
10770
4e6d6122c558 solaris-fastdebug build fixes.
twisti
parents: 10672
diff changeset
25 #include "classfile/systemDictionary.hpp"
4220
5c80ccb80036 Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4139
diff changeset
26 #include "graal/graalVMToCompiler.hpp"
11596
91e5f927af63 Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents: 11585
diff changeset
27 #include "runtime/gpu.hpp"
1410
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
28
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
29 // these are *global* handles
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
30 jobject VMToCompiler::_HotSpotGraalRuntime_instance = NULL;
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
31 jobject VMToCompiler::_VMToCompiler_instance = NULL;
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
32 Klass* VMToCompiler::_VMToCompiler_klass = NULL;
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
33
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6505
diff changeset
34 static Klass* loadClass(Symbol* name) {
10770
4e6d6122c558 solaris-fastdebug build fixes.
twisti
parents: 10672
diff changeset
35 Klass* klass = SystemDictionary::resolve_or_null(name, SystemDictionary::java_system_loader(), Handle(), Thread::current());
6503
ac3a4ea144a6 simplified error checking when loading Graal classes from the C++ code
Doug Simon <doug.simon@oracle.com>
parents: 6495
diff changeset
36 if (klass == NULL) {
ac3a4ea144a6 simplified error checking when loading Graal classes from the C++ code
Doug Simon <doug.simon@oracle.com>
parents: 6495
diff changeset
37 tty->print_cr("Could not load class %s", name->as_C_string());
ac3a4ea144a6 simplified error checking when loading Graal classes from the C++ code
Doug Simon <doug.simon@oracle.com>
parents: 6495
diff changeset
38 vm_abort(false);
ac3a4ea144a6 simplified error checking when loading Graal classes from the C++ code
Doug Simon <doug.simon@oracle.com>
parents: 6495
diff changeset
39 }
ac3a4ea144a6 simplified error checking when loading Graal classes from the C++ code
Doug Simon <doug.simon@oracle.com>
parents: 6495
diff changeset
40 return klass;
ac3a4ea144a6 simplified error checking when loading Graal classes from the C++ code
Doug Simon <doug.simon@oracle.com>
parents: 6495
diff changeset
41 }
ac3a4ea144a6 simplified error checking when loading Graal classes from the C++ code
Doug Simon <doug.simon@oracle.com>
parents: 6495
diff changeset
42
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
43 KlassHandle VMToCompiler::VMToCompiler_klass() {
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
44 if (_VMToCompiler_klass == NULL) {
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
45 TempNewSymbol VMToCompiler = SymbolTable::new_symbol("com/oracle/graal/hotspot/bridge/VMToCompiler", Thread::current());
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
46 Klass* result = loadClass(VMToCompiler);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
47 _VMToCompiler_klass = result;
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1414
diff changeset
48 }
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
49 return _VMToCompiler_klass;
1410
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
50 }
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
51
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
52 Handle VMToCompiler::create_HotSpotTruffleRuntime() {
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
53 Thread* THREAD = Thread::current();
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
54 TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime", THREAD);
10475
3489047ffea2 Restructure the handling of HotSpotInstalledCode and their link to nmethods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10056
diff changeset
55 KlassHandle klass = loadClass(name);
3489047ffea2 Restructure the handling of HotSpotInstalledCode and their link to nmethods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10056
diff changeset
56
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
57 TempNewSymbol makeInstance = SymbolTable::new_symbol("makeInstance", THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
58 TempNewSymbol sig = SymbolTable::new_symbol("()Lcom/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime;", THREAD);
10475
3489047ffea2 Restructure the handling of HotSpotInstalledCode and their link to nmethods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10056
diff changeset
59 JavaValue result(T_OBJECT);
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
60 JavaCalls::call_static(&result, klass, makeInstance, sig, THREAD);
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14069
diff changeset
61 check_pending_exception("Couldn't initialize HotSpotTruffleRuntime");
10475
3489047ffea2 Restructure the handling of HotSpotInstalledCode and their link to nmethods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10056
diff changeset
62 return Handle((oop) result.get_jobject());
3489047ffea2 Restructure the handling of HotSpotInstalledCode and their link to nmethods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10056
diff changeset
63 }
3489047ffea2 Restructure the handling of HotSpotInstalledCode and their link to nmethods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10056
diff changeset
64
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
65 Handle VMToCompiler::get_HotSpotGraalRuntime() {
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
66 if (JNIHandles::resolve(_HotSpotGraalRuntime_instance) == NULL) {
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
67 Thread* THREAD = Thread::current();
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
68 TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/hotspot/HotSpotGraalRuntime", THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
69 KlassHandle klass = loadClass(name);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
70 TempNewSymbol runtime = SymbolTable::new_symbol("runtime", THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
71 TempNewSymbol sig = SymbolTable::new_symbol("()Lcom/oracle/graal/hotspot/HotSpotGraalRuntime;", THREAD);
2284
569d3fe7d65c non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents: 2045
diff changeset
72 JavaValue result(T_OBJECT);
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
73 JavaCalls::call_static(&result, klass, runtime, sig, THREAD);
6494
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 5554
diff changeset
74 check_pending_exception("Couldn't initialize HotSpotGraalRuntime");
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
75 _HotSpotGraalRuntime_instance = JNIHandles::make_global((oop) result.get_jobject());
2284
569d3fe7d65c non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents: 2045
diff changeset
76 }
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
77 return Handle(JNIHandles::resolve_non_null(_HotSpotGraalRuntime_instance));
2284
569d3fe7d65c non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents: 2045
diff changeset
78 }
569d3fe7d65c non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents: 2045
diff changeset
79
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
80 Handle VMToCompiler::VMToCompiler_instance() {
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
81 if (JNIHandles::resolve(_VMToCompiler_instance) == NULL) {
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
82 Thread* THREAD = Thread::current();
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
83 TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/hotspot/HotSpotGraalRuntime", THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
84 KlassHandle klass = loadClass(name);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
85 TempNewSymbol getVMToCompiler = SymbolTable::new_symbol("getVMToCompiler", THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
86 TempNewSymbol sig = SymbolTable::new_symbol("()Lcom/oracle/graal/hotspot/bridge/VMToCompiler;", THREAD);
1437
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1432
diff changeset
87 JavaValue result(T_OBJECT);
2285
762de4b26788 turn Compiler and HotSpotTypeResolved into interfaces
Lukas Stadler <lukas.stadler@jku.at>
parents: 2284
diff changeset
88 JavaCallArguments args;
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
89 args.set_receiver(get_HotSpotGraalRuntime());
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
90 JavaCalls::call_virtual(&result, klass, getVMToCompiler, sig, &args, THREAD);
5278
74dfa6f86879 removed last remaining references to vmEntries and vmExits
Lukas Stadler <lukas.stadler@jku.at>
parents: 5176
diff changeset
91 check_pending_exception("Couldn't get VMToCompiler");
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
92 _VMToCompiler_instance = JNIHandles::make_global((oop) result.get_jobject());
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1414
diff changeset
93 }
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
94 return Handle(JNIHandles::resolve_non_null(_VMToCompiler_instance));
1437
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1432
diff changeset
95 }
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1432
diff changeset
96
9913
35f93560b1f0 ensure that <clinit> for HotSpotOptions is called irrespective of whether and -G: options are specified
Doug Simon <doug.simon@oracle.com>
parents: 9728
diff changeset
97 void VMToCompiler::initOptions() {
35f93560b1f0 ensure that <clinit> for HotSpotOptions is called irrespective of whether and -G: options are specified
Doug Simon <doug.simon@oracle.com>
parents: 9728
diff changeset
98 Thread* THREAD = Thread::current();
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
99 TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/hotspot/HotSpotOptions", THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
100 KlassHandle optionsKlass = loadClass(name);
11561
e1309fc4d17f ensure Debug.enable() is called before any DebugTimer or DebugMetric objects are requested
Doug Simon <doug.simon@oracle.com>
parents: 10770
diff changeset
101 optionsKlass->initialize(THREAD);
9913
35f93560b1f0 ensure that <clinit> for HotSpotOptions is called irrespective of whether and -G: options are specified
Doug Simon <doug.simon@oracle.com>
parents: 9728
diff changeset
102 check_pending_exception("Error while calling initOptions");
35f93560b1f0 ensure that <clinit> for HotSpotOptions is called irrespective of whether and -G: options are specified
Doug Simon <doug.simon@oracle.com>
parents: 9728
diff changeset
103 }
35f93560b1f0 ensure that <clinit> for HotSpotOptions is called irrespective of whether and -G: options are specified
Doug Simon <doug.simon@oracle.com>
parents: 9728
diff changeset
104
4220
5c80ccb80036 Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4139
diff changeset
105 jboolean VMToCompiler::setOption(Handle option) {
1437
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1432
diff changeset
106 assert(!option.is_null(), "");
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1432
diff changeset
107 Thread* THREAD = Thread::current();
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
108 TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/hotspot/HotSpotOptions", THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
109 TempNewSymbol setOption = SymbolTable::new_symbol("setOption", THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
110 TempNewSymbol sig = SymbolTable::new_symbol("(Ljava/lang/String;)Z", THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
111 KlassHandle optionsKlass = loadClass(name);
1437
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1432
diff changeset
112 JavaValue result(T_BOOLEAN);
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
113 JavaCalls::call_static(&result, optionsKlass, setOption, sig, option, THREAD);
1437
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1432
diff changeset
114 check_pending_exception("Error while calling setOption");
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1432
diff changeset
115 return result.get_jboolean();
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1414
diff changeset
116 }
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1414
diff changeset
117
11585
516b93ccf7c9 pass the value of the -XX:+CITime VM option explicitly to HotSpotOptions.finalize()
Doug Simon <doug.simon@oracle.com>
parents: 11561
diff changeset
118 void VMToCompiler::finalizeOptions(jboolean ciTime) {
11561
e1309fc4d17f ensure Debug.enable() is called before any DebugTimer or DebugMetric objects are requested
Doug Simon <doug.simon@oracle.com>
parents: 10770
diff changeset
119 Thread* THREAD = Thread::current();
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
120 TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/hotspot/HotSpotOptions", THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
121 TempNewSymbol finalizeOptions = SymbolTable::new_symbol("finalizeOptions", THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
122 TempNewSymbol sig = SymbolTable::new_symbol("(Ljava/lang/String;)Z", THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
123 KlassHandle optionsKlass = loadClass(name);
11561
e1309fc4d17f ensure Debug.enable() is called before any DebugTimer or DebugMetric objects are requested
Doug Simon <doug.simon@oracle.com>
parents: 10770
diff changeset
124 JavaValue result(T_VOID);
11585
516b93ccf7c9 pass the value of the -XX:+CITime VM option explicitly to HotSpotOptions.finalize()
Doug Simon <doug.simon@oracle.com>
parents: 11561
diff changeset
125 JavaCallArguments args;
516b93ccf7c9 pass the value of the -XX:+CITime VM option explicitly to HotSpotOptions.finalize()
Doug Simon <doug.simon@oracle.com>
parents: 11561
diff changeset
126 args.push_int(ciTime);
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
127 JavaCalls::call_static(&result, optionsKlass, finalizeOptions, vmSymbols::bool_void_signature(), &args, THREAD);
11561
e1309fc4d17f ensure Debug.enable() is called before any DebugTimer or DebugMetric objects are requested
Doug Simon <doug.simon@oracle.com>
parents: 10770
diff changeset
128 check_pending_exception("Error while calling finalizeOptions");
e1309fc4d17f ensure Debug.enable() is called before any DebugTimer or DebugMetric objects are requested
Doug Simon <doug.simon@oracle.com>
parents: 10770
diff changeset
129 }
e1309fc4d17f ensure Debug.enable() is called before any DebugTimer or DebugMetric objects are requested
Doug Simon <doug.simon@oracle.com>
parents: 10770
diff changeset
130
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
131 void VMToCompiler::startRuntime() {
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
132 JavaThread* THREAD = JavaThread::current();
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
133 JavaValue result(T_VOID);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
134 JavaCallArguments args;
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
135 TempNewSymbol startRuntime = SymbolTable::new_symbol("startRuntime", THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
136 args.push_oop(VMToCompiler_instance());
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
137 JavaCalls::call_interface(&result, VMToCompiler_klass(), startRuntime, vmSymbols::void_method_signature(), &args, THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
138 check_pending_exception("Error while calling startRuntime");
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
139 }
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
140
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
141 #ifdef COMPILERGRAAL
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
142 void VMToCompiler::bootstrap() {
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
143 JavaThread* THREAD = JavaThread::current();
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
144 JavaValue result(T_VOID);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
145 JavaCallArguments args;
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
146 TempNewSymbol bootstrap = SymbolTable::new_symbol("bootstrap", THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
147 args.push_oop(VMToCompiler_instance());
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
148 JavaCalls::call_interface(&result, VMToCompiler_klass(), bootstrap, vmSymbols::void_method_signature(), &args, THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
149 check_pending_exception("Error while calling bootstrap");
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
150 }
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
151
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
152 void VMToCompiler::startCompiler(jboolean bootstrap_enabled) {
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
153 JavaThread* THREAD = JavaThread::current();
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
154 JavaValue result(T_VOID);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
155 JavaCallArguments args;
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
156 TempNewSymbol startCompiler = SymbolTable::new_symbol("startCompiler", THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
157 args.push_oop(VMToCompiler_instance());
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
158 args.push_int(bootstrap_enabled);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
159 JavaCalls::call_interface(&result, VMToCompiler_klass(), startCompiler, vmSymbols::bool_void_signature(), &args, THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
160 check_pending_exception("Error while calling startCompiler");
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
161 }
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
162
15463
a20be10ad437 made Graal work with the HotSpot compiler queue and compiler threads, enabled by -XX:-UseGraalCompilationQueue
Doug Simon <doug.simon@oracle.com>
parents: 15106
diff changeset
163 void VMToCompiler::compileMethod(Method* method, int entry_bci, jlong ctask, jboolean blocking) {
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6505
diff changeset
164 assert(method != NULL, "just checking");
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
165 Thread* THREAD = Thread::current();
10056
a323a9e20f9d Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9934
diff changeset
166 JavaValue result(T_VOID);
1410
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
167 JavaCallArguments args;
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
168 args.push_oop(VMToCompiler_instance());
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6505
diff changeset
169 args.push_long((jlong) (address) method);
1410
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
170 args.push_int(entry_bci);
15463
a20be10ad437 made Graal work with the HotSpot compiler queue and compiler threads, enabled by -XX:-UseGraalCompilationQueue
Doug Simon <doug.simon@oracle.com>
parents: 15106
diff changeset
171 args.push_long(ctask);
3651
a31028282e3e Support blocking compilation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
172 args.push_int(blocking);
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
173 JavaCalls::call_interface(&result, VMToCompiler_klass(), vmSymbols::compileMethod_name(), vmSymbols::compileMethod_signature(), &args, THREAD);
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1414
diff changeset
174 check_pending_exception("Error while calling compileMethod");
1410
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
175 }
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
176
4220
5c80ccb80036 Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4139
diff changeset
177 void VMToCompiler::shutdownCompiler() {
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
178 JavaThread* THREAD = JavaThread::current();
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
179 HandleMark hm(THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
180 TempNewSymbol shutdownCompiler = SymbolTable::new_symbol("shutdownCompiler", THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
181 JavaValue result(T_VOID);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
182 JavaCallArguments args;
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
183 args.push_oop(VMToCompiler_instance());
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
184 JavaCalls::call_interface(&result, VMToCompiler_klass(), shutdownCompiler, vmSymbols::void_method_signature(), &args, THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
185 check_pending_exception("Error while calling shutdownCompiler");
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
186 }
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
187 #endif // COMPILERGRAAL
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
188
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
189 void VMToCompiler::shutdownRuntime() {
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
190 if (_HotSpotGraalRuntime_instance != NULL) {
3011
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2951
diff changeset
191 JavaThread* THREAD = JavaThread::current();
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
192 HandleMark hm(THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
193 TempNewSymbol shutdownRuntime = SymbolTable::new_symbol("shutdownRuntime", THREAD);
3011
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2951
diff changeset
194 JavaValue result(T_VOID);
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2951
diff changeset
195 JavaCallArguments args;
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
196 args.push_oop(VMToCompiler_instance());
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
197 JavaCalls::call_interface(&result, VMToCompiler_klass(), shutdownRuntime, vmSymbols::void_method_signature(), &args, THREAD);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
198 check_pending_exception("Error while calling shutdownRuntime");
3011
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2951
diff changeset
199
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
200 JNIHandles::destroy_global(_HotSpotGraalRuntime_instance);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
201 JNIHandles::destroy_global(_VMToCompiler_instance);
3011
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2951
diff changeset
202
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
203 _HotSpotGraalRuntime_instance = NULL;
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
204 _VMToCompiler_instance = NULL;
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
205 _VMToCompiler_klass = NULL;
3011
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2951
diff changeset
206 }
2901
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2891
diff changeset
207 }
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2891
diff changeset
208
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
209 #ifndef PRODUCT
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
210 void VMToCompiler::compileTheWorld() {
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
211 // We turn off CompileTheWorld so that Graal can
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
212 // be compiled by C1/C2 when Graal does a CTW.
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
213 CompileTheWorld = false;
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
214
2925
b78b4ae0757c Also call Compiler shutdown hook in case of System.exit call. Draft VMExits.Sandbox class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2916
diff changeset
215 JavaThread* THREAD = JavaThread::current();
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
216 TempNewSymbol compileTheWorld = SymbolTable::new_symbol("compileTheWorld", THREAD);
3650
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
217 JavaValue result(T_VOID);
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
218 JavaCallArguments args;
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
219 args.push_oop(VMToCompiler_instance());
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
220 JavaCalls::call_interface(&result, VMToCompiler_klass(), compileTheWorld, vmSymbols::void_method_signature(), &args, THREAD);
12652
0dd597c6c9c7 fixed performance regression in hosted CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents: 12456
diff changeset
221 check_pending_exception("Error while calling compileTheWorld");
3650
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
222 }
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
223 #endif