Mercurial > hg > graal-jvmci-8
annotate src/share/vm/jvmci/jvmciCompiler.cpp @ 23367:041534002323
Use strings instead of Symbol* for exception names (JDK-8155735).
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Fri, 29 Apr 2016 14:49:30 +0200 |
parents | bc5552dc384b |
children | 0226d6bcb0d2 |
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:
1407
diff
changeset
|
22 */ |
b30a2cd5e3a2
Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1407
diff
changeset
|
23 |
2045
9c96c873c42b
Fix includes to match new hotspot mechanism.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
24 #include "precompiled.hpp" |
6559
d5f7e737827f
fixed compilation issues on Solaris. When using SunStudio compiler, Solaris build with DONT_USE_PRECOMPILED_HEADER
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6442
diff
changeset
|
25 #include "memory/oopFactory.hpp" |
d5f7e737827f
fixed compilation issues on Solaris. When using SunStudio compiler, Solaris build with DONT_USE_PRECOMPILED_HEADER
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6442
diff
changeset
|
26 #include "runtime/javaCalls.hpp" |
22548
02fc27dc1da7
Rename jvmciJavaAccess.* to jvmciJavaClasses.*
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22538
diff
changeset
|
27 #include "jvmci/jvmciJavaClasses.hpp" |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
28 #include "jvmci/jvmciCompiler.hpp" |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
29 #include "jvmci/jvmciEnv.hpp" |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
30 #include "jvmci/jvmciRuntime.hpp" |
5150
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
31 #include "runtime/compilationPolicy.hpp" |
14881
1415a62ac8b2
allow to force bootstrap in tiered
Bernhard Urban <bernhard.urban@jku.at>
parents:
14875
diff
changeset
|
32 #include "runtime/globals_extension.hpp" |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
33 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
34 JVMCICompiler* JVMCICompiler::_instance = NULL; |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
35 elapsedTimer JVMCICompiler::_codeInstallTimer; |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
36 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
37 JVMCICompiler::JVMCICompiler() : AbstractCompiler(jvmci) { |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
38 #ifdef COMPILERJVMCI |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
39 _bootstrapping = false; |
23303
633cf7bea01d
thread waiting for blocking JVMCI compilation should not wait on compiler queue forever (JDK-8148507) [part 2]
Doug Simon <doug.simon@oracle.com>
parents:
23296
diff
changeset
|
40 _methods_compiled = 0; |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
15495
diff
changeset
|
41 #endif |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
42 assert(_instance == NULL, "only one instance allowed"); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
43 _instance = this; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
44 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
45 |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
46 // Initialization |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
47 void JVMCICompiler::initialize() { |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
48 #ifdef COMPILERJVMCI |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
15495
diff
changeset
|
49 if (!UseCompiler || !should_perform_init()) { |
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
|
50 return; |
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
|
51 } |
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
|
52 |
22538
ea6d1727fdc6
Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22467
diff
changeset
|
53 set_state(initialized); |
ea6d1727fdc6
Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22467
diff
changeset
|
54 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
55 // JVMCI is considered as application code so we need to |
18144
70077134cabc
graalCompiler: remove unnecessary HandleMark.
Bernhard Urban <bernhard.urban@jku.at>
parents:
18134
diff
changeset
|
56 // stop the VM deferring compilation now. |
70077134cabc
graalCompiler: remove unnecessary HandleMark.
Bernhard Urban <bernhard.urban@jku.at>
parents:
18134
diff
changeset
|
57 CompilationPolicy::completed_vm_startup(); |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
58 #endif // COMPILERJVMCI |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
59 } |
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
60 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
61 #ifdef COMPILERJVMCI |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
62 void JVMCICompiler::bootstrap() { |
22692
a269bc93625b
fix -Xint -XX:+BootstrapJVMCI crash
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22575
diff
changeset
|
63 if (Arguments::mode() == Arguments::_int) { |
a269bc93625b
fix -Xint -XX:+BootstrapJVMCI crash
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22575
diff
changeset
|
64 // Nothing to do in -Xint mode |
a269bc93625b
fix -Xint -XX:+BootstrapJVMCI crash
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22575
diff
changeset
|
65 return; |
a269bc93625b
fix -Xint -XX:+BootstrapJVMCI crash
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22575
diff
changeset
|
66 } |
22467
d1019456c4d2
Disable CTW during JVMCI bootstrap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22463
diff
changeset
|
67 #ifndef PRODUCT |
d1019456c4d2
Disable CTW during JVMCI bootstrap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22463
diff
changeset
|
68 // We turn off CompileTheWorld so that compilation requests are not |
d1019456c4d2
Disable CTW during JVMCI bootstrap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22463
diff
changeset
|
69 // ignored during bootstrap or that JVMCI can be compiled by C1/C2. |
d1019456c4d2
Disable CTW during JVMCI bootstrap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22463
diff
changeset
|
70 FlagSetting ctwOff(CompileTheWorld, false); |
d1019456c4d2
Disable CTW during JVMCI bootstrap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22463
diff
changeset
|
71 #endif |
d1019456c4d2
Disable CTW during JVMCI bootstrap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22463
diff
changeset
|
72 |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
73 JavaThread* THREAD = JavaThread::current(); |
16136
d32be0297274
support -XX:+BootstrapGraal in conjunction with -XX:-UseGraalCompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16105
diff
changeset
|
74 _bootstrapping = true; |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
75 // Allow bootstrap to perform JVMCI compilations of itself |
16399
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
76 ResourceMark rm; |
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
77 HandleMark hm; |
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
78 if (PrintBootstrap) { |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
79 tty->print("Bootstrapping JVMCI"); |
16399
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
80 } |
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
81 jlong start = os::javaTimeMillis(); |
16136
d32be0297274
support -XX:+BootstrapGraal in conjunction with -XX:-UseGraalCompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16105
diff
changeset
|
82 |
16399
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
83 Array<Method*>* objectMethods = InstanceKlass::cast(SystemDictionary::Object_klass())->methods(); |
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
84 // Initialize compile queue with a selected set of methods. |
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
85 int len = objectMethods->length(); |
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
86 for (int i = 0; i < len; i++) { |
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
87 methodHandle mh = objectMethods->at(i); |
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
88 if (!mh->is_native() && !mh->is_static() && !mh->is_initializer()) { |
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
89 ResourceMark rm; |
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
90 int hot_count = 10; // TODO: what's the appropriate value? |
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
91 CompileBroker::compile_method(mh, InvocationEntryBci, CompLevel_full_optimization, mh, hot_count, "bootstrap", THREAD); |
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
92 } |
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
93 } |
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
94 |
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
95 int qsize; |
19780 | 96 bool first_round = true; |
16399
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
97 int z = 0; |
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
98 do { |
19780 | 99 // Loop until there is something in the queue. |
100 do { | |
101 os::sleep(THREAD, 100, true); | |
102 qsize = CompileBroker::queue_size(CompLevel_full_optimization); | |
103 } while (first_round && qsize == 0); | |
104 first_round = false; | |
16399
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
105 if (PrintBootstrap) { |
23303
633cf7bea01d
thread waiting for blocking JVMCI compilation should not wait on compiler queue forever (JDK-8148507) [part 2]
Doug Simon <doug.simon@oracle.com>
parents:
23296
diff
changeset
|
106 while (z < (_methods_compiled / 100)) { |
16399
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
107 ++z; |
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
108 tty->print_raw("."); |
16136
d32be0297274
support -XX:+BootstrapGraal in conjunction with -XX:-UseGraalCompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16105
diff
changeset
|
109 } |
d32be0297274
support -XX:+BootstrapGraal in conjunction with -XX:-UseGraalCompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16105
diff
changeset
|
110 } |
16399
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
111 } while (qsize != 0); |
16136
d32be0297274
support -XX:+BootstrapGraal in conjunction with -XX:-UseGraalCompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16105
diff
changeset
|
112 |
16399
4481cf549cfc
removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16146
diff
changeset
|
113 if (PrintBootstrap) { |
23303
633cf7bea01d
thread waiting for blocking JVMCI compilation should not wait on compiler queue forever (JDK-8148507) [part 2]
Doug Simon <doug.simon@oracle.com>
parents:
23296
diff
changeset
|
114 tty->print_cr(" in " JLONG_FORMAT " ms (compiled %d methods)", os::javaTimeMillis() - start, _methods_compiled); |
16136
d32be0297274
support -XX:+BootstrapGraal in conjunction with -XX:-UseGraalCompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16105
diff
changeset
|
115 } |
d32be0297274
support -XX:+BootstrapGraal in conjunction with -XX:-UseGraalCompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16105
diff
changeset
|
116 _bootstrapping = false; |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
117 } |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
118 |
22730
24fd08e99b35
Backport Handle fixes from jvmci-9.
Roland Schatz <roland.schatz@oracle.com>
parents:
22703
diff
changeset
|
119 void JVMCICompiler::compile_method(const methodHandle& method, int entry_bci, JVMCIEnv* env) { |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
120 JVMCI_EXCEPTION_CONTEXT |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
121 |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
122 bool is_osr = entry_bci != InvocationEntryBci; |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
123 if (_bootstrapping && is_osr) { |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
124 // no OSR compilations during bootstrap - the compiler is just too slow at this point, |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
125 // and we know that there are no endless loops |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
126 return; |
3651
a31028282e3e
Support blocking compilation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
127 } |
6948
e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
128 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
129 JVMCIRuntime::ensure_jvmci_class_loader_is_initialized(); |
16105
e54507c88a93
placed HandleMark around Graal compilation performed on a native compiler thread
Doug Simon <doug.simon@oracle.com>
parents:
16014
diff
changeset
|
130 HandleMark hm; |
22574
5a706439be63
Propagate exceptions up instead of aborting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22548
diff
changeset
|
131 Handle receiver = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK_ABORT); |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22397
diff
changeset
|
132 |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22397
diff
changeset
|
133 JavaValue method_result(T_OBJECT); |
22703
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
134 JavaCallArguments args; |
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
135 args.push_long((jlong) (address) method()); |
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
136 JavaCalls::call_static(&method_result, SystemDictionary::HotSpotResolvedJavaMethodImpl_klass(), |
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
137 vmSymbols::fromMetaspace_name(), vmSymbols::method_fromMetaspace_signature(), &args, THREAD); |
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
138 |
22767
d88299d598d6
Add support for passing back bailout messages
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22752
diff
changeset
|
139 JavaValue result(T_OBJECT); |
22703
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
140 if (!HAS_PENDING_EXCEPTION) { |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22397
diff
changeset
|
141 JavaCallArguments args; |
22703
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
142 args.push_oop(receiver); |
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
143 args.push_oop((oop)method_result.get_jobject()); |
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
144 args.push_int(entry_bci); |
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
145 args.push_long((jlong) (address) env); |
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
146 args.push_int(env->task()->compile_id()); |
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
147 JavaCalls::call_special(&result, receiver->klass(), |
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
148 vmSymbols::compileMethod_name(), vmSymbols::compileMethod_signature(), &args, THREAD); |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22397
diff
changeset
|
149 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22397
diff
changeset
|
150 |
22703
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
151 // An uncaught exception was thrown during compilation. Generally these |
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
152 // should be handled by the Java code in some useful way but if they leak |
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
153 // through to here report them instead of dying or silently ignoring them. |
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
154 if (HAS_PENDING_EXCEPTION) { |
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
155 Handle throwable = PENDING_EXCEPTION; |
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
156 CLEAR_PENDING_EXCEPTION; |
16136
d32be0297274
support -XX:+BootstrapGraal in conjunction with -XX:-UseGraalCompilationQueue
Doug Simon <doug.simon@oracle.com>
parents:
16105
diff
changeset
|
157 |
23329
bc5552dc384b
Use VM routines to print stack traces from C++ code.
Roland Schatz <roland.schatz@oracle.com>
parents:
23303
diff
changeset
|
158 java_lang_Throwable::print(throwable, tty); |
bc5552dc384b
Use VM routines to print stack traces from C++ code.
Roland Schatz <roland.schatz@oracle.com>
parents:
23303
diff
changeset
|
159 tty->cr(); |
bc5552dc384b
Use VM routines to print stack traces from C++ code.
Roland Schatz <roland.schatz@oracle.com>
parents:
23303
diff
changeset
|
160 java_lang_Throwable::print_stack_trace(throwable(), tty); |
bc5552dc384b
Use VM routines to print stack traces from C++ code.
Roland Schatz <roland.schatz@oracle.com>
parents:
23303
diff
changeset
|
161 |
22770
1fbfcc0334d3
JVMCI PrintCompilation support should reuse CompileBroker logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22768
diff
changeset
|
162 env->set_failure("exception throw", false); |
22703
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
163 } else { |
22770
1fbfcc0334d3
JVMCI PrintCompilation support should reuse CompileBroker logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22768
diff
changeset
|
164 oop result_object = (oop) result.get_jobject(); |
1fbfcc0334d3
JVMCI PrintCompilation support should reuse CompileBroker logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22768
diff
changeset
|
165 if (result_object != NULL) { |
1fbfcc0334d3
JVMCI PrintCompilation support should reuse CompileBroker logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22768
diff
changeset
|
166 oop failure_message = CompilationRequestResult::failureMessage(result_object); |
1fbfcc0334d3
JVMCI PrintCompilation support should reuse CompileBroker logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22768
diff
changeset
|
167 if (failure_message != NULL) { |
22779
b41377216cf9
JVMCICompiler.compileMethod should always return non-null
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22770
diff
changeset
|
168 const char* failure_reason = java_lang_String::as_utf8_string(failure_message); |
22770
1fbfcc0334d3
JVMCI PrintCompilation support should reuse CompileBroker logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22768
diff
changeset
|
169 env->set_failure(failure_reason, CompilationRequestResult::retry(result_object)); |
1fbfcc0334d3
JVMCI PrintCompilation support should reuse CompileBroker logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22768
diff
changeset
|
170 } else { |
1fbfcc0334d3
JVMCI PrintCompilation support should reuse CompileBroker logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22768
diff
changeset
|
171 if (env->task()->code() == NULL) { |
1fbfcc0334d3
JVMCI PrintCompilation support should reuse CompileBroker logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22768
diff
changeset
|
172 env->set_failure("no nmethod produced", true); |
22767
d88299d598d6
Add support for passing back bailout messages
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22752
diff
changeset
|
173 } else { |
22770
1fbfcc0334d3
JVMCI PrintCompilation support should reuse CompileBroker logic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22768
diff
changeset
|
174 env->task()->set_num_inlined_bytecodes(CompilationRequestResult::inlinedBytecodes(result_object)); |
23303
633cf7bea01d
thread waiting for blocking JVMCI compilation should not wait on compiler queue forever (JDK-8148507) [part 2]
Doug Simon <doug.simon@oracle.com>
parents:
23296
diff
changeset
|
175 Atomic::inc(&_methods_compiled); |
22767
d88299d598d6
Add support for passing back bailout messages
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22752
diff
changeset
|
176 } |
d88299d598d6
Add support for passing back bailout messages
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22752
diff
changeset
|
177 } |
22779
b41377216cf9
JVMCICompiler.compileMethod should always return non-null
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22770
diff
changeset
|
178 } else { |
b41377216cf9
JVMCICompiler.compileMethod should always return non-null
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22770
diff
changeset
|
179 assert(false, "JVMCICompiler.compileMethod should always return non-null"); |
22767
d88299d598d6
Add support for passing back bailout messages
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22752
diff
changeset
|
180 } |
22703
f190cf6fb28e
Don't abort if exceptions occur during JVMCI compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22692
diff
changeset
|
181 } |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
182 } |
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
183 |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
15495
diff
changeset
|
184 |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
185 // Compilation entry point for methods |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
186 void JVMCICompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) { |
3651
a31028282e3e
Support blocking compilation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
187 ShouldNotReachHere(); |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
188 } |
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
189 |
22575
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
190 bool JVMCICompiler::is_trivial(Method* method) { |
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
191 if (_bootstrapping) { |
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
192 return false; |
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
193 } |
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
194 return JVMCIRuntime::treat_as_trivial(method); |
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
195 } |
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
196 |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
197 // Print compilation timers and statistics |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
198 void JVMCICompiler::print_timers() { |
18171
9bb816169777
Report code install timer in hosted mode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18144
diff
changeset
|
199 print_compilation_timers(); |
9bb816169777
Report code install timer in hosted mode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18144
diff
changeset
|
200 } |
9bb816169777
Report code install timer in hosted mode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18144
diff
changeset
|
201 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
202 #endif // COMPILERJVMCI |
18171
9bb816169777
Report code install timer in hosted mode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18144
diff
changeset
|
203 |
9bb816169777
Report code install timer in hosted mode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18144
diff
changeset
|
204 // Print compilation timers and statistics |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
205 void JVMCICompiler::print_compilation_timers() { |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
206 TRACE_jvmci_1("JVMCICompiler::print_timers"); |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21551
diff
changeset
|
207 tty->print_cr(" JVMCI code install time: %6.3f s", _codeInstallTimer.seconds()); |
1410
b30a2cd5e3a2
Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1407
diff
changeset
|
208 } |