Mercurial > hg > graal-jvmci-8
annotate src/share/vm/jvmci/jvmciRuntime.cpp @ 23679:b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 15 Jun 2016 00:00:41 +0200 |
parents | eb166b568645 |
children | 93be30973b26 |
rev | line source |
---|---|
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1 /* |
23322
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23319
diff
changeset
|
2 * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
4 * |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
7 * published by the Free Software Foundation. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
8 * |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
13 * accompanied this code). |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
14 * |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
18 * |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
21 * questions. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
22 */ |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
23 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
24 #include "precompiled.hpp" |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
25 #include "asm/codeBuffer.hpp" |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
26 #include "code/codeCache.hpp" |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
27 #include "compiler/compileBroker.hpp" |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
28 #include "compiler/disassembler.hpp" |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
29 #include "jvmci/jvmciRuntime.hpp" |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
30 #include "jvmci/jvmciCompilerToVM.hpp" |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
31 #include "jvmci/jvmciCompiler.hpp" |
22548
02fc27dc1da7
Rename jvmciJavaAccess.* to jvmciJavaClasses.*
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22547
diff
changeset
|
32 #include "jvmci/jvmciJavaClasses.hpp" |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
33 #include "jvmci/jvmciEnv.hpp" |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
34 #include "memory/oopFactory.hpp" |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
35 #include "oops/oop.inline.hpp" |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
36 #include "prims/jvm.h" |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
37 #include "runtime/biasedLocking.hpp" |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
38 #include "runtime/interfaceSupport.hpp" |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
39 #include "runtime/reflection.hpp" |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
40 #include "runtime/sharedRuntime.hpp" |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
41 #include "utilities/debug.hpp" |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
42 #include "utilities/defaultStream.hpp" |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
43 |
21587
59c3f921e454
fixes for windows build (size_t conversion, missing precompiled.hpp, missing strtof, strtoll in Windows SDK)
Christian Wirth <christian.wirth@oracle.com>
parents:
21564
diff
changeset
|
44 #if defined(_MSC_VER) |
59c3f921e454
fixes for windows build (size_t conversion, missing precompiled.hpp, missing strtof, strtoll in Windows SDK)
Christian Wirth <christian.wirth@oracle.com>
parents:
21564
diff
changeset
|
45 #define strtoll _strtoi64 |
59c3f921e454
fixes for windows build (size_t conversion, missing precompiled.hpp, missing strtof, strtoll in Windows SDK)
Christian Wirth <christian.wirth@oracle.com>
parents:
21564
diff
changeset
|
46 #endif |
59c3f921e454
fixes for windows build (size_t conversion, missing precompiled.hpp, missing strtof, strtoll in Windows SDK)
Christian Wirth <christian.wirth@oracle.com>
parents:
21564
diff
changeset
|
47 |
59c3f921e454
fixes for windows build (size_t conversion, missing precompiled.hpp, missing strtof, strtoll in Windows SDK)
Christian Wirth <christian.wirth@oracle.com>
parents:
21564
diff
changeset
|
48 jobject JVMCIRuntime::_HotSpotJVMCIRuntime_instance = NULL; |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
49 bool JVMCIRuntime::_HotSpotJVMCIRuntime_initialized = false; |
22575
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
50 int JVMCIRuntime::_trivial_prefixes_count = 0; |
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
51 char** JVMCIRuntime::_trivial_prefixes = NULL; |
23379
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
52 JVMCIRuntime::CompLevelAdjustment JVMCIRuntime::_comp_level_adjustment = JVMCIRuntime::none; |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
53 bool JVMCIRuntime::_shutdown_called = false; |
23674
09a536b9233c
8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23404
diff
changeset
|
54 int JVMCIRuntime::max_oop_map_stack_offset = (OopMapValue::register_mask - VMRegImpl::stack2reg(0)->value()) * VMRegImpl::stack_slot_size; |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
55 |
23408
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
56 BasicType JVMCIRuntime::kindToBasicType(Handle kind, TRAPS) { |
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
57 if (kind.is_null()) { |
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
58 THROW_(vmSymbols::java_lang_NullPointerException(), T_ILLEGAL); |
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
59 } |
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
60 jchar ch = JavaKind::typeChar(kind); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
61 switch(ch) { |
23393
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
62 case 'Z': return T_BOOLEAN; |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
63 case 'B': return T_BYTE; |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
64 case 'S': return T_SHORT; |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
65 case 'C': return T_CHAR; |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
66 case 'I': return T_INT; |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
67 case 'F': return T_FLOAT; |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
68 case 'J': return T_LONG; |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
69 case 'D': return T_DOUBLE; |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
70 case 'A': return T_OBJECT; |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
71 case '-': return T_ILLEGAL; |
22722
0229a2ca608b
Make kindToBasicType trapping.
Roland Schatz <roland.schatz@oracle.com>
parents:
22711
diff
changeset
|
72 default: |
0229a2ca608b
Make kindToBasicType trapping.
Roland Schatz <roland.schatz@oracle.com>
parents:
22711
diff
changeset
|
73 JVMCI_ERROR_(T_ILLEGAL, "unexpected Kind: %c", ch); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
74 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
75 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
76 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
77 // Simple helper to see if the caller of a runtime stub which |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
78 // entered the VM has been deoptimized |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
79 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
80 static bool caller_is_deopted() { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
81 JavaThread* thread = JavaThread::current(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
82 RegisterMap reg_map(thread, false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
83 frame runtime_frame = thread->last_frame(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
84 frame caller_frame = runtime_frame.sender(®_map); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
85 assert(caller_frame.is_compiled_frame(), "must be compiled"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
86 return caller_frame.is_deoptimized_frame(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
87 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
88 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
89 // Stress deoptimization |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
90 static void deopt_caller() { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
91 if ( !caller_is_deopted()) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
92 JavaThread* thread = JavaThread::current(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
93 RegisterMap reg_map(thread, false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
94 frame runtime_frame = thread->last_frame(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
95 frame caller_frame = runtime_frame.sender(®_map); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
96 Deoptimization::deoptimize_frame(thread, caller_frame.id(), Deoptimization::Reason_constraint); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
97 assert(caller_is_deopted(), "Must be deoptimized"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
98 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
99 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
100 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
101 JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_instance(JavaThread* thread, Klass* klass)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
102 JRT_BLOCK; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
103 assert(klass->is_klass(), "not a class"); |
23408
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
104 Handle holder(THREAD, klass->klass_holder()); // keep the klass alive |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
105 instanceKlassHandle h(thread, klass); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
106 h->check_valid_for_instantiation(true, CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
107 // make sure klass is initialized |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
108 h->initialize(CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
109 // allocate instance and return via TLS |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
110 oop obj = h->allocate_instance(CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
111 thread->set_vm_result(obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
112 JRT_BLOCK_END; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
113 |
22447
ecbf949a9dcd
replace JVMCIDeferredInitBarriers with ReduceInitialCardMarks
Doug Simon <doug.simon@oracle.com>
parents:
22438
diff
changeset
|
114 if (ReduceInitialCardMarks) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
115 new_store_pre_barrier(thread); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
116 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
117 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
118 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
119 JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_array(JavaThread* thread, Klass* array_klass, jint length)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
120 JRT_BLOCK; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
121 // Note: no handle for klass needed since they are not used |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
122 // anymore after new_objArray() and no GC can happen before. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
123 // (This may have to change if this code changes!) |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
124 assert(array_klass->is_klass(), "not a class"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
125 oop obj; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
126 if (array_klass->oop_is_typeArray()) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
127 BasicType elt_type = TypeArrayKlass::cast(array_klass)->element_type(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
128 obj = oopFactory::new_typeArray(elt_type, length, CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
129 } else { |
23408
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
130 Handle holder(THREAD, array_klass->klass_holder()); // keep the klass alive |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
131 Klass* elem_klass = ObjArrayKlass::cast(array_klass)->element_klass(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
132 obj = oopFactory::new_objArray(elem_klass, length, CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
133 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
134 thread->set_vm_result(obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
135 // This is pretty rare but this runtime patch is stressful to deoptimization |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
136 // if we deoptimize here so force a deopt to stress the path. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
137 if (DeoptimizeALot) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
138 static int deopts = 0; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
139 // Alternate between deoptimizing and raising an error (which will also cause a deopt) |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
140 if (deopts++ % 2 == 0) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
141 ResourceMark rm(THREAD); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
142 THROW(vmSymbols::java_lang_OutOfMemoryError()); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
143 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
144 deopt_caller(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
145 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
146 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
147 JRT_BLOCK_END; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
148 |
22447
ecbf949a9dcd
replace JVMCIDeferredInitBarriers with ReduceInitialCardMarks
Doug Simon <doug.simon@oracle.com>
parents:
22438
diff
changeset
|
149 if (ReduceInitialCardMarks) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
150 new_store_pre_barrier(thread); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
151 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
152 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
153 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
154 void JVMCIRuntime::new_store_pre_barrier(JavaThread* thread) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
155 // After any safepoint, just before going back to compiled code, |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
156 // we inform the GC that we will be doing initializing writes to |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
157 // this object in the future without emitting card-marks, so |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
158 // GC may take any compensating steps. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
159 // NOTE: Keep this code consistent with GraphKit::store_barrier. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
160 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
161 oop new_obj = thread->vm_result(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
162 if (new_obj == NULL) return; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
163 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
164 assert(Universe::heap()->can_elide_tlab_store_barriers(), |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
165 "compiler must check this first"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
166 // GC may decide to give back a safer copy of new_obj. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
167 new_obj = Universe::heap()->new_store_pre_barrier(thread, new_obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
168 thread->set_vm_result(new_obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
169 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
170 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
171 JRT_ENTRY(void, JVMCIRuntime::new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
172 assert(klass->is_klass(), "not a class"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
173 assert(rank >= 1, "rank must be nonzero"); |
23408
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
174 Handle holder(THREAD, klass->klass_holder()); // keep the klass alive |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
175 oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
176 thread->set_vm_result(obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
177 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
178 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
179 JRT_ENTRY(void, JVMCIRuntime::dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
180 oop obj = Reflection::reflect_new_array(element_mirror, length, CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
181 thread->set_vm_result(obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
182 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
183 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
184 JRT_ENTRY(void, JVMCIRuntime::dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
185 instanceKlassHandle klass(THREAD, java_lang_Class::as_Klass(type_mirror)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
186 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
187 if (klass == NULL) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
188 ResourceMark rm(THREAD); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
189 THROW(vmSymbols::java_lang_InstantiationException()); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
190 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
191 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
192 // Create new instance (the receiver) |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
193 klass->check_valid_for_instantiation(false, CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
194 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
195 // Make sure klass gets initialized |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
196 klass->initialize(CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
197 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
198 oop obj = klass->allocate_instance(CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
199 thread->set_vm_result(obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
200 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
201 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
202 extern void vm_exit(int code); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
203 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
204 // Enter this method from compiled code handler below. This is where we transition |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
205 // to VM mode. This is done as a helper routine so that the method called directly |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
206 // from compiled code does not have to transition to VM. This allows the entry |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
207 // method to see if the nmethod that we have just looked up a handler for has |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
208 // been deoptimized while we were in the vm. This simplifies the assembly code |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
209 // cpu directories. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
210 // |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
211 // We are entering here from exception stub (via the entry method below) |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
212 // If there is a compiled exception handler in this method, we will continue there; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
213 // otherwise we will unwind the stack and continue at the caller of top frame method |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
214 // Note: we enter in Java using a special JRT wrapper. This wrapper allows us to |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
215 // control the area where we can allow a safepoint. After we exit the safepoint area we can |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
216 // check to see if the handler we are going to return is now in a nmethod that has |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
217 // been deoptimized. If that is the case we return the deopt blob |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
218 // unpack_with_exception entry instead. This makes life for the exception blob easier |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
219 // because making that same check and diverting is painful from assembly language. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
220 JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* thread, oopDesc* ex, address pc, nmethod*& nm)) |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
221 // Reset method handle flag. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
222 thread->set_is_method_handle_return(false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
223 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
224 Handle exception(thread, ex); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
225 nm = CodeCache::find_nmethod(pc); |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
226 assert(nm != NULL, "this is not a compiled method"); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
227 // Adjust the pc as needed/ |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
228 if (nm->is_deopt_pc(pc)) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
229 RegisterMap map(thread, false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
230 frame exception_frame = thread->last_frame().sender(&map); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
231 // if the frame isn't deopted then pc must not correspond to the caller of last_frame |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
232 assert(exception_frame.is_deoptimized_frame(), "must be deopted"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
233 pc = exception_frame.pc(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
234 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
235 #ifdef ASSERT |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
236 assert(exception.not_null(), "NULL exceptions should be handled by throw_exception"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
237 assert(exception->is_oop(), "just checking"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
238 // Check that exception is a subclass of Throwable, otherwise we have a VerifyError |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
239 if (!(exception->is_a(SystemDictionary::Throwable_klass()))) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
240 if (ExitVMOnVerifyError) vm_exit(-1); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
241 ShouldNotReachHere(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
242 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
243 #endif |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
244 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
245 // Check the stack guard pages and reenable them if necessary and there is |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
246 // enough space on the stack to do so. Use fast exceptions only if the guard |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
247 // pages are enabled. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
248 bool guard_pages_enabled = thread->stack_yellow_zone_enabled(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
249 if (!guard_pages_enabled) guard_pages_enabled = thread->reguard_stack(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
250 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
251 if (JvmtiExport::can_post_on_exceptions()) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
252 // To ensure correct notification of exception catches and throws |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
253 // we have to deoptimize here. If we attempted to notify the |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
254 // catches and throws during this exception lookup it's possible |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
255 // we could deoptimize on the way out of the VM and end back in |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
256 // the interpreter at the throw site. This would result in double |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
257 // notifications since the interpreter would also notify about |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
258 // these same catches and throws as it unwound the frame. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
259 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
260 RegisterMap reg_map(thread); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
261 frame stub_frame = thread->last_frame(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
262 frame caller_frame = stub_frame.sender(®_map); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
263 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
264 // We don't really want to deoptimize the nmethod itself since we |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
265 // can actually continue in the exception handler ourselves but I |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
266 // don't see an easy way to have the desired effect. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
267 Deoptimization::deoptimize_frame(thread, caller_frame.id(), Deoptimization::Reason_constraint); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
268 assert(caller_is_deopted(), "Must be deoptimized"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
269 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
270 return SharedRuntime::deopt_blob()->unpack_with_exception_in_tls(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
271 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
272 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
273 // ExceptionCache is used only for exceptions at call sites and not for implicit exceptions |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
274 if (guard_pages_enabled) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
275 address fast_continuation = nm->handler_for_exception_and_pc(exception, pc); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
276 if (fast_continuation != NULL) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
277 // Set flag if return address is a method handle call site. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
278 thread->set_is_method_handle_return(nm->is_method_handle_return(pc)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
279 return fast_continuation; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
280 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
281 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
282 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
283 // If the stack guard pages are enabled, check whether there is a handler in |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
284 // the current method. Otherwise (guard pages disabled), force an unwind and |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
285 // skip the exception cache update (i.e., just leave continuation==NULL). |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
286 address continuation = NULL; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
287 if (guard_pages_enabled) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
288 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
289 // New exception handling mechanism can support inlined methods |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
290 // with exception handlers since the mappings are from PC to PC |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
291 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
292 // debugging support |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
293 // tracing |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
294 if (TraceExceptions) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
295 ttyLocker ttyl; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
296 ResourceMark rm; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
297 tty->print_cr("Exception <%s> (" INTPTR_FORMAT ") thrown in compiled method <%s> at PC " INTPTR_FORMAT " for thread " INTPTR_FORMAT "", |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
298 exception->print_value_string(), p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
299 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
300 // for AbortVMOnException flag |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
301 NOT_PRODUCT(Exceptions::debug_check_abort(exception)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
302 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
303 // Clear out the exception oop and pc since looking up an |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
304 // exception handler can cause class loading, which might throw an |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
305 // exception and those fields are expected to be clear during |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
306 // normal bytecode execution. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
307 thread->clear_exception_oop_and_pc(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
308 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
309 continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
310 // If an exception was thrown during exception dispatch, the exception oop may have changed |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
311 thread->set_exception_oop(exception()); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
312 thread->set_exception_pc(pc); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
313 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
314 // the exception cache is used only by non-implicit exceptions |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
315 if (continuation != NULL && !SharedRuntime::deopt_blob()->contains(continuation)) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
316 nm->add_handler_for_exception_and_pc(exception, pc, continuation); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
317 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
318 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
319 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
320 // Set flag if return address is a method handle call site. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
321 thread->set_is_method_handle_return(nm->is_method_handle_return(pc)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
322 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
323 if (TraceExceptions) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
324 ttyLocker ttyl; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
325 ResourceMark rm; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
326 tty->print_cr("Thread " PTR_FORMAT " continuing at PC " PTR_FORMAT " for exception thrown at PC " PTR_FORMAT, |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
327 p2i(thread), p2i(continuation), p2i(pc)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
328 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
329 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
330 return continuation; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
331 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
332 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
333 // Enter this method from compiled code only if there is a Java exception handler |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
334 // in the method handling the exception. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
335 // We are entering here from exception stub. We don't do a normal VM transition here. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
336 // We do it in a helper. This is so we can check to see if the nmethod we have just |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
337 // searched for an exception handler has been deoptimized in the meantime. |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
338 address JVMCIRuntime::exception_handler_for_pc(JavaThread* thread) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
339 oop exception = thread->exception_oop(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
340 address pc = thread->exception_pc(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
341 // Still in Java mode |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
342 DEBUG_ONLY(ResetNoHandleMark rnhm); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
343 nmethod* nm = NULL; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
344 address continuation = NULL; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
345 { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
346 // Enter VM mode by calling the helper |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
347 ResetNoHandleMark rnhm; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
348 continuation = exception_handler_for_pc_helper(thread, exception, pc, nm); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
349 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
350 // Back in JAVA, use no oops DON'T safepoint |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
351 |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
352 // Now check to see if the compiled method we were called from is now deoptimized. |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
353 // If so we must return to the deopt blob and deoptimize the nmethod |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
354 if (nm != NULL && caller_is_deopted()) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
355 continuation = SharedRuntime::deopt_blob()->unpack_with_exception_in_tls(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
356 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
357 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
358 assert(continuation != NULL, "no handler found"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
359 return continuation; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
360 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
361 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
362 JRT_ENTRY_NO_ASYNC(void, JVMCIRuntime::monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock)) |
22544
b87d1bf3cd9a
renamed TraceJVMCI option to JVMCITraceLevel and ensured all tracing controlled by this option uses the TRACE_jvmci_* macros
Doug Simon <doug.simon@oracle.com>
parents:
22543
diff
changeset
|
363 IF_TRACE_jvmci_3 { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
364 char type[O_BUFLEN]; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
365 obj->klass()->name()->as_C_string(type, O_BUFLEN); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
366 markOop mark = obj->mark(); |
22544
b87d1bf3cd9a
renamed TraceJVMCI option to JVMCITraceLevel and ensured all tracing controlled by this option uses the TRACE_jvmci_* macros
Doug Simon <doug.simon@oracle.com>
parents:
22543
diff
changeset
|
367 TRACE_jvmci_3("%s: entered locking slow case with obj=" INTPTR_FORMAT ", type=%s, mark=" INTPTR_FORMAT ", lock=" INTPTR_FORMAT, thread->name(), p2i(obj), type, p2i(mark), p2i(lock)); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
368 tty->flush(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
369 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
370 #ifdef ASSERT |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
371 if (PrintBiasedLockingStatistics) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
372 Atomic::inc(BiasedLocking::slow_path_entry_count_addr()); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
373 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
374 #endif |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
375 Handle h_obj(thread, obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
376 assert(h_obj()->is_oop(), "must be NULL or an object"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
377 if (UseBiasedLocking) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
378 // Retry fast entry if bias is revoked to avoid unnecessary inflation |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
379 ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
380 } else { |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
381 if (JVMCIUseFastLocking) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
382 // When using fast locking, the compiled code has already tried the fast case |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
383 ObjectSynchronizer::slow_enter(h_obj, lock, THREAD); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
384 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
385 ObjectSynchronizer::fast_enter(h_obj, lock, false, THREAD); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
386 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
387 } |
22544
b87d1bf3cd9a
renamed TraceJVMCI option to JVMCITraceLevel and ensured all tracing controlled by this option uses the TRACE_jvmci_* macros
Doug Simon <doug.simon@oracle.com>
parents:
22543
diff
changeset
|
388 TRACE_jvmci_3("%s: exiting locking slow with obj=" INTPTR_FORMAT, thread->name(), p2i(obj)); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
389 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
390 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
391 JRT_LEAF(void, JVMCIRuntime::monitorexit(JavaThread* thread, oopDesc* obj, BasicLock* lock)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
392 assert(thread == JavaThread::current(), "threads must correspond"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
393 assert(thread->last_Java_sp(), "last_Java_sp must be set"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
394 // monitorexit is non-blocking (leaf routine) => no exceptions can be thrown |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
395 EXCEPTION_MARK; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
396 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
397 #ifdef DEBUG |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
398 if (!obj->is_oop()) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
399 ResetNoHandleMark rhm; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
400 nmethod* method = thread->last_frame().cb()->as_nmethod_or_null(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
401 if (method != NULL) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
402 tty->print_cr("ERROR in monitorexit in method %s wrong obj " INTPTR_FORMAT, method->name(), p2i(obj)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
403 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
404 thread->print_stack_on(tty); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
405 assert(false, "invalid lock object pointer dected"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
406 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
407 #endif |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
408 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
409 if (JVMCIUseFastLocking) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
410 // When using fast locking, the compiled code has already tried the fast case |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
411 ObjectSynchronizer::slow_exit(obj, lock, THREAD); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
412 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
413 ObjectSynchronizer::fast_exit(obj, lock, THREAD); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
414 } |
22544
b87d1bf3cd9a
renamed TraceJVMCI option to JVMCITraceLevel and ensured all tracing controlled by this option uses the TRACE_jvmci_* macros
Doug Simon <doug.simon@oracle.com>
parents:
22543
diff
changeset
|
415 IF_TRACE_jvmci_3 { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
416 char type[O_BUFLEN]; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
417 obj->klass()->name()->as_C_string(type, O_BUFLEN); |
22544
b87d1bf3cd9a
renamed TraceJVMCI option to JVMCITraceLevel and ensured all tracing controlled by this option uses the TRACE_jvmci_* macros
Doug Simon <doug.simon@oracle.com>
parents:
22543
diff
changeset
|
418 TRACE_jvmci_3("%s: exited locking slow case with obj=" INTPTR_FORMAT ", type=%s, mark=" INTPTR_FORMAT ", lock=" INTPTR_FORMAT, thread->name(), p2i(obj), type, p2i(obj->mark()), p2i(lock)); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
419 tty->flush(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
420 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
421 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
422 |
23367
041534002323
Use strings instead of Symbol* for exception names (JDK-8155735).
Roland Schatz <roland.schatz@oracle.com>
parents:
23337
diff
changeset
|
423 JRT_ENTRY(void, JVMCIRuntime::throw_and_post_jvmti_exception(JavaThread* thread, const char* exception, const char* message)) |
23372
1c7bac3f1f20
Use CHECK instead of HAS_PENDING_EXCEPTION (JDK-8155735).
Roland Schatz <roland.schatz@oracle.com>
parents:
23371
diff
changeset
|
424 TempNewSymbol symbol = SymbolTable::new_symbol(exception, CHECK); |
1c7bac3f1f20
Use CHECK instead of HAS_PENDING_EXCEPTION (JDK-8155735).
Roland Schatz <roland.schatz@oracle.com>
parents:
23371
diff
changeset
|
425 SharedRuntime::throw_and_post_jvmti_exception(thread, symbol, message); |
23322
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23319
diff
changeset
|
426 JRT_END |
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23319
diff
changeset
|
427 |
23367
041534002323
Use strings instead of Symbol* for exception names (JDK-8155735).
Roland Schatz <roland.schatz@oracle.com>
parents:
23337
diff
changeset
|
428 JRT_ENTRY(void, JVMCIRuntime::throw_klass_external_name_exception(JavaThread* thread, const char* exception, Klass* klass)) |
23334
e0a15983ab51
Create exception throwing routines for exceptions with complex messages.
Roland Schatz <roland.schatz@oracle.com>
parents:
23329
diff
changeset
|
429 ResourceMark rm(thread); |
23372
1c7bac3f1f20
Use CHECK instead of HAS_PENDING_EXCEPTION (JDK-8155735).
Roland Schatz <roland.schatz@oracle.com>
parents:
23371
diff
changeset
|
430 TempNewSymbol symbol = SymbolTable::new_symbol(exception, CHECK); |
1c7bac3f1f20
Use CHECK instead of HAS_PENDING_EXCEPTION (JDK-8155735).
Roland Schatz <roland.schatz@oracle.com>
parents:
23371
diff
changeset
|
431 SharedRuntime::throw_and_post_jvmti_exception(thread, symbol, klass->external_name()); |
23334
e0a15983ab51
Create exception throwing routines for exceptions with complex messages.
Roland Schatz <roland.schatz@oracle.com>
parents:
23329
diff
changeset
|
432 JRT_END |
e0a15983ab51
Create exception throwing routines for exceptions with complex messages.
Roland Schatz <roland.schatz@oracle.com>
parents:
23329
diff
changeset
|
433 |
23367
041534002323
Use strings instead of Symbol* for exception names (JDK-8155735).
Roland Schatz <roland.schatz@oracle.com>
parents:
23337
diff
changeset
|
434 JRT_ENTRY(void, JVMCIRuntime::throw_class_cast_exception(JavaThread* thread, const char* exception, Klass* caster_klass, Klass* target_klass)) |
23334
e0a15983ab51
Create exception throwing routines for exceptions with complex messages.
Roland Schatz <roland.schatz@oracle.com>
parents:
23329
diff
changeset
|
435 ResourceMark rm(thread); |
23337
62804a7d3877
Remove `desc` argument from JVMCIRuntime::throw_class_cast_exception.
Roland Schatz <roland.schatz@oracle.com>
parents:
23334
diff
changeset
|
436 const char* message = SharedRuntime::generate_class_cast_message(caster_klass->external_name(), target_klass->external_name()); |
23372
1c7bac3f1f20
Use CHECK instead of HAS_PENDING_EXCEPTION (JDK-8155735).
Roland Schatz <roland.schatz@oracle.com>
parents:
23371
diff
changeset
|
437 TempNewSymbol symbol = SymbolTable::new_symbol(exception, CHECK); |
1c7bac3f1f20
Use CHECK instead of HAS_PENDING_EXCEPTION (JDK-8155735).
Roland Schatz <roland.schatz@oracle.com>
parents:
23371
diff
changeset
|
438 SharedRuntime::throw_and_post_jvmti_exception(thread, symbol, message); |
23334
e0a15983ab51
Create exception throwing routines for exceptions with complex messages.
Roland Schatz <roland.schatz@oracle.com>
parents:
23329
diff
changeset
|
439 JRT_END |
e0a15983ab51
Create exception throwing routines for exceptions with complex messages.
Roland Schatz <roland.schatz@oracle.com>
parents:
23329
diff
changeset
|
440 |
22668
da5bdbf4a008
Simplify log_object interface
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22650
diff
changeset
|
441 JRT_LEAF(void, JVMCIRuntime::log_object(JavaThread* thread, oopDesc* obj, bool as_string, bool newline)) |
da5bdbf4a008
Simplify log_object interface
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22650
diff
changeset
|
442 ttyLocker ttyl; |
da5bdbf4a008
Simplify log_object interface
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22650
diff
changeset
|
443 |
da5bdbf4a008
Simplify log_object interface
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22650
diff
changeset
|
444 if (obj == NULL) { |
da5bdbf4a008
Simplify log_object interface
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22650
diff
changeset
|
445 tty->print("NULL"); |
da5bdbf4a008
Simplify log_object interface
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22650
diff
changeset
|
446 } else if (obj->is_oop_or_null(true) && (!as_string || !java_lang_String::is_instance(obj))) { |
da5bdbf4a008
Simplify log_object interface
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22650
diff
changeset
|
447 if (obj->is_oop_or_null(true)) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
448 char buf[O_BUFLEN]; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
449 tty->print("%s@" INTPTR_FORMAT, obj->klass()->name()->as_C_string(buf, O_BUFLEN), p2i(obj)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
450 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
451 tty->print(INTPTR_FORMAT, p2i(obj)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
452 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
453 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
454 ResourceMark rm; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
455 assert(obj != NULL && java_lang_String::is_instance(obj), "must be"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
456 char *buf = java_lang_String::as_utf8_string(obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
457 tty->print_raw(buf); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
458 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
459 if (newline) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
460 tty->cr(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
461 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
462 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
463 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
464 JRT_LEAF(void, JVMCIRuntime::write_barrier_pre(JavaThread* thread, oopDesc* obj)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
465 thread->satb_mark_queue().enqueue(obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
466 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
467 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
468 JRT_LEAF(void, JVMCIRuntime::write_barrier_post(JavaThread* thread, void* card_addr)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
469 thread->dirty_card_queue().enqueue(card_addr); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
470 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
471 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
472 JRT_LEAF(jboolean, JVMCIRuntime::validate_object(JavaThread* thread, oopDesc* parent, oopDesc* child)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
473 bool ret = true; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
474 if(!Universe::heap()->is_in_closed_subset(parent)) { |
22507
693e1df2b808
Add spaces around format macros
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22501
diff
changeset
|
475 tty->print_cr("Parent Object " INTPTR_FORMAT " not in heap", p2i(parent)); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
476 parent->print(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
477 ret=false; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
478 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
479 if(!Universe::heap()->is_in_closed_subset(child)) { |
22507
693e1df2b808
Add spaces around format macros
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22501
diff
changeset
|
480 tty->print_cr("Child Object " INTPTR_FORMAT " not in heap", p2i(child)); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
481 child->print(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
482 ret=false; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
483 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
484 return (jint)ret; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
485 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
486 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
487 JRT_ENTRY(void, JVMCIRuntime::vm_error(JavaThread* thread, jlong where, jlong format, jlong value)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
488 ResourceMark rm; |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
489 const char *error_msg = where == 0L ? "<internal JVMCI error>" : (char*) (address) where; |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
490 char *detail_msg = NULL; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
491 if (format != 0L) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
492 const char* buf = (char*) (address) format; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
493 size_t detail_msg_length = strlen(buf) * 2; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
494 detail_msg = (char *) NEW_RESOURCE_ARRAY(u_char, detail_msg_length); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
495 jio_snprintf(detail_msg, detail_msg_length, buf, value); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
496 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
497 report_vm_error(__FILE__, __LINE__, error_msg, detail_msg); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
498 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
499 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
500 JRT_LEAF(oopDesc*, JVMCIRuntime::load_and_clear_exception(JavaThread* thread)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
501 oop exception = thread->exception_oop(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
502 assert(exception != NULL, "npe"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
503 thread->set_exception_oop(NULL); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
504 thread->set_exception_pc(0); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
505 return exception; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
506 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
507 |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
508 PRAGMA_DIAG_PUSH |
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
509 PRAGMA_FORMAT_NONLITERAL_IGNORED |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
510 JRT_LEAF(void, JVMCIRuntime::log_printf(JavaThread* thread, oopDesc* format, jlong v1, jlong v2, jlong v3)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
511 ResourceMark rm; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
512 assert(format != NULL && java_lang_String::is_instance(format), "must be"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
513 char *buf = java_lang_String::as_utf8_string(format); |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
514 tty->print((const char*)buf, v1, v2, v3); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
515 JRT_END |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
516 PRAGMA_DIAG_POP |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
517 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
518 static void decipher(jlong v, bool ignoreZero) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
519 if (v != 0 || !ignoreZero) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
520 void* p = (void *)(address) v; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
521 CodeBlob* cb = CodeCache::find_blob(p); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
522 if (cb) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
523 if (cb->is_nmethod()) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
524 char buf[O_BUFLEN]; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
525 tty->print("%s [" INTPTR_FORMAT "+" JLONG_FORMAT "]", cb->as_nmethod_or_null()->method()->name_and_sig_as_C_string(buf, O_BUFLEN), p2i(cb->code_begin()), (jlong)((address)v - cb->code_begin())); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
526 return; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
527 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
528 cb->print_value_on(tty); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
529 return; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
530 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
531 if (Universe::heap()->is_in(p)) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
532 oop obj = oop(p); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
533 obj->print_value_on(tty); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
534 return; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
535 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
536 tty->print(INTPTR_FORMAT " [long: " JLONG_FORMAT ", double %lf, char %c]",p2i((void *)v), (jlong)v, (jdouble)v, (char)v); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
537 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
538 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
539 |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
540 PRAGMA_DIAG_PUSH |
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
541 PRAGMA_FORMAT_NONLITERAL_IGNORED |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
542 JRT_LEAF(void, JVMCIRuntime::vm_message(jboolean vmError, jlong format, jlong v1, jlong v2, jlong v3)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
543 ResourceMark rm; |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
544 const char *buf = (const char*) (address) format; |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
545 if (vmError) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
546 if (buf != NULL) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
547 fatal(err_msg(buf, v1, v2, v3)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
548 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
549 fatal("<anonymous error>"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
550 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
551 } else if (buf != NULL) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
552 tty->print(buf, v1, v2, v3); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
553 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
554 assert(v2 == 0, "v2 != 0"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
555 assert(v3 == 0, "v3 != 0"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
556 decipher(v1, false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
557 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
558 JRT_END |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
559 PRAGMA_DIAG_POP |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
560 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
561 JRT_LEAF(void, JVMCIRuntime::log_primitive(JavaThread* thread, jchar typeChar, jlong value, jboolean newline)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
562 union { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
563 jlong l; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
564 jdouble d; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
565 jfloat f; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
566 } uu; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
567 uu.l = value; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
568 switch (typeChar) { |
23393
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
569 case 'Z': tty->print(value == 0 ? "false" : "true"); break; |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
570 case 'B': tty->print("%d", (jbyte) value); break; |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
571 case 'C': tty->print("%c", (jchar) value); break; |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
572 case 'S': tty->print("%d", (jshort) value); break; |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
573 case 'I': tty->print("%d", (jint) value); break; |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
574 case 'F': tty->print("%f", uu.f); break; |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
575 case 'J': tty->print(JLONG_FORMAT, value); break; |
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
576 case 'D': tty->print("%lf", uu.d); break; |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
577 default: assert(false, "unknown typeChar"); break; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
578 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
579 if (newline) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
580 tty->cr(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
581 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
582 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
583 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
584 JRT_ENTRY(jint, JVMCIRuntime::identity_hash_code(JavaThread* thread, oopDesc* obj)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
585 return (jint) obj->identity_hash(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
586 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
587 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
588 JRT_ENTRY(jboolean, JVMCIRuntime::thread_is_interrupted(JavaThread* thread, oopDesc* receiver, jboolean clear_interrupted)) |
21207
93dc70e47fb0
documented why THREAD_IS_INTERRUPTED foreign call is NOT_LEAF
Doug Simon <doug.simon@oracle.com>
parents:
21123
diff
changeset
|
589 // Ensure that the C++ Thread and OSThread structures aren't freed before we operate. |
93dc70e47fb0
documented why THREAD_IS_INTERRUPTED foreign call is NOT_LEAF
Doug Simon <doug.simon@oracle.com>
parents:
21123
diff
changeset
|
590 // This locking requires thread_in_vm which is why this method cannot be JRT_LEAF. |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
591 Handle receiverHandle(thread, receiver); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
592 MutexLockerEx ml(thread->threadObj() == (void*)receiver ? NULL : Threads_lock); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
593 JavaThread* receiverThread = java_lang_Thread::thread(receiverHandle()); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
594 if (receiverThread == NULL) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
595 // The other thread may exit during this process, which is ok so return false. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
596 return JNI_FALSE; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
597 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
598 return (jint) Thread::is_interrupted(receiverThread, clear_interrupted != 0); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
599 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
600 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
601 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
602 JRT_ENTRY(jint, JVMCIRuntime::test_deoptimize_call_int(JavaThread* thread, int value)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
603 deopt_caller(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
604 return value; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
605 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
606 |
22398
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
607 // private static void JVMCIClassLoaderFactory.init(ClassLoader loader) |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
608 JVM_ENTRY(void, JVM_InitJVMCIClassLoader(JNIEnv *env, jclass c, jobject loader_handle)) |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
609 SystemDictionary::init_jvmci_loader(JNIHandles::resolve(loader_handle)); |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
610 SystemDictionary::WKID scan = SystemDictionary::FIRST_JVMCI_WKID; |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
611 SystemDictionary::initialize_wk_klasses_through(SystemDictionary::LAST_JVMCI_WKID, scan, CHECK); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
612 JVM_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
613 |
21527
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
614 // private static JVMCIRuntime JVMCI.initializeRuntime() |
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
615 JVM_ENTRY(jobject, JVM_GetJVMCIRuntime(JNIEnv *env, jclass c)) |
23408
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
616 if (!EnableJVMCI) { |
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
617 THROW_MSG_NULL(vmSymbols::java_lang_InternalError(), "JVMCI is not enabled") |
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
618 } |
22574
5a706439be63
Propagate exceptions up instead of aborting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22553
diff
changeset
|
619 JVMCIRuntime::initialize_HotSpotJVMCIRuntime(CHECK_NULL); |
5a706439be63
Propagate exceptions up instead of aborting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22553
diff
changeset
|
620 return JVMCIRuntime::get_HotSpotJVMCIRuntime_jobject(CHECK_NULL); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
621 JVM_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
622 |
23408
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
623 // private static ClassLoader Services.getJVMCIClassLoader() |
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
624 JVM_ENTRY(jobject, JVM_GetJVMCIClassLoader(JNIEnv *env, jclass c)) |
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
625 if (!EnableJVMCI) { |
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
626 THROW_MSG_NULL(vmSymbols::java_lang_InternalError(), "JVMCI is not enabled") |
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
627 } |
22416
8abc6030cf1c
ensure JVMCI class loader is initialized before attempting to load service provider
Andreas Woess <andreas.woess@oracle.com>
parents:
22401
diff
changeset
|
628 JVMCIRuntime::ensure_jvmci_class_loader_is_initialized(); |
23408
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
629 return JNIHandles::make_local(THREAD, SystemDictionary::jvmci_loader()); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
630 JVM_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
631 |
22574
5a706439be63
Propagate exceptions up instead of aborting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22553
diff
changeset
|
632 Handle JVMCIRuntime::callStatic(const char* className, const char* methodName, const char* signature, JavaCallArguments* args, TRAPS) { |
21527
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
633 guarantee(!_HotSpotJVMCIRuntime_initialized, "cannot reinitialize HotSpotJVMCIRuntime"); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
634 |
22574
5a706439be63
Propagate exceptions up instead of aborting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22553
diff
changeset
|
635 TempNewSymbol name = SymbolTable::new_symbol(className, CHECK_(Handle())); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
636 KlassHandle klass = load_required_class(name); |
22574
5a706439be63
Propagate exceptions up instead of aborting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22553
diff
changeset
|
637 TempNewSymbol runtime = SymbolTable::new_symbol(methodName, CHECK_(Handle())); |
5a706439be63
Propagate exceptions up instead of aborting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22553
diff
changeset
|
638 TempNewSymbol sig = SymbolTable::new_symbol(signature, CHECK_(Handle())); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
639 JavaValue result(T_OBJECT); |
22398
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
640 if (args == NULL) { |
22574
5a706439be63
Propagate exceptions up instead of aborting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22553
diff
changeset
|
641 JavaCalls::call_static(&result, klass, runtime, sig, CHECK_(Handle())); |
22398
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
642 } else { |
22574
5a706439be63
Propagate exceptions up instead of aborting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22553
diff
changeset
|
643 JavaCalls::call_static(&result, klass, runtime, sig, args, CHECK_(Handle())); |
22398
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
644 } |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
645 return Handle((oop)result.get_jobject()); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
646 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
647 |
22574
5a706439be63
Propagate exceptions up instead of aborting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22553
diff
changeset
|
648 void JVMCIRuntime::initialize_HotSpotJVMCIRuntime(TRAPS) { |
21527
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
649 if (JNIHandles::resolve(_HotSpotJVMCIRuntime_instance) == NULL) { |
22398
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
650 Thread* THREAD = Thread::current(); |
23304
3dab35122bce
Add missing ResourceMark
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23296
diff
changeset
|
651 ResourceMark rm; |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
652 #ifdef ASSERT |
21527
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
653 // This should only be called in the context of the JVMCI class being initialized |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22668
diff
changeset
|
654 TempNewSymbol name = SymbolTable::new_symbol("jdk/vm/ci/runtime/JVMCI", CHECK); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
655 instanceKlassHandle klass = InstanceKlass::cast(load_required_class(name)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
656 assert(klass->is_being_initialized() && klass->is_reentrant_initialization(THREAD), |
21527
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
657 "HotSpotJVMCIRuntime initialization should only be triggered through JVMCI initialization"); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
658 #endif |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
659 |
23674
09a536b9233c
8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23404
diff
changeset
|
660 int max_oop_map_stack_index = max_oop_map_stack_offset / VMRegImpl::stack_slot_size; |
09a536b9233c
8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23404
diff
changeset
|
661 assert(OopMapValue::legal_vm_reg_name(VMRegImpl::stack2reg(max_oop_map_stack_index)), "should be valid"); |
09a536b9233c
8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23404
diff
changeset
|
662 assert(!OopMapValue::legal_vm_reg_name(VMRegImpl::stack2reg(max_oop_map_stack_index + 1)), "should be invalid"); |
09a536b9233c
8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23404
diff
changeset
|
663 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22668
diff
changeset
|
664 Handle result = callStatic("jdk/vm/ci/hotspot/HotSpotJVMCIRuntime", |
22461
07d9f0909560
Rename callInitializer to callStatic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22454
diff
changeset
|
665 "runtime", |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22668
diff
changeset
|
666 "()Ljdk/vm/ci/hotspot/HotSpotJVMCIRuntime;", NULL, CHECK); |
22575
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
667 objArrayOop trivial_prefixes = HotSpotJVMCIRuntime::trivialPrefixes(result); |
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
668 if (trivial_prefixes != NULL) { |
22586
cf99b5e5b0b4
Fix race in initialization of trivial prefixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22585
diff
changeset
|
669 char** prefixes = NEW_C_HEAP_ARRAY(char*, trivial_prefixes->length(), mtCompiler); |
22575
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
670 for (int i = 0; i < trivial_prefixes->length(); i++) { |
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
671 oop str = trivial_prefixes->obj_at(i); |
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
672 if (str == NULL) { |
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
673 THROW(vmSymbols::java_lang_NullPointerException()); |
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
674 } else { |
22588
3e3d5678a6bf
Fix trivial prefixes code
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22586
diff
changeset
|
675 prefixes[i] = strdup(java_lang_String::as_utf8_string(str)); |
22575
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
676 } |
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
677 } |
22586
cf99b5e5b0b4
Fix race in initialization of trivial prefixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22585
diff
changeset
|
678 _trivial_prefixes = prefixes; |
cf99b5e5b0b4
Fix race in initialization of trivial prefixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22585
diff
changeset
|
679 _trivial_prefixes_count = trivial_prefixes->length(); |
22575
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
680 } |
23379
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
681 int adjustment = HotSpotJVMCIRuntime::compilationLevelAdjustment(result); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
682 assert(adjustment >= JVMCIRuntime::none && |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
683 adjustment <= JVMCIRuntime::by_full_signature, |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
684 "compilation level adjustment out of bounds"); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
685 _comp_level_adjustment = (CompLevelAdjustment) adjustment; |
21527
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
686 _HotSpotJVMCIRuntime_initialized = true; |
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
687 _HotSpotJVMCIRuntime_instance = JNIHandles::make_global(result()); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
688 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
689 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
690 |
22574
5a706439be63
Propagate exceptions up instead of aborting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22553
diff
changeset
|
691 void JVMCIRuntime::initialize_JVMCI(TRAPS) { |
21527
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
692 if (JNIHandles::resolve(_HotSpotJVMCIRuntime_instance) == NULL) { |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22668
diff
changeset
|
693 callStatic("jdk/vm/ci/runtime/JVMCI", |
22461
07d9f0909560
Rename callInitializer to callStatic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22454
diff
changeset
|
694 "getRuntime", |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22668
diff
changeset
|
695 "()Ljdk/vm/ci/runtime/JVMCIRuntime;", NULL, CHECK); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
696 } |
21527
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
697 assert(_HotSpotJVMCIRuntime_initialized == true, "what?"); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
698 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
699 |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
700 void JVMCIRuntime::metadata_do(void f(Metadata*)) { |
22543
97ca867d3622
Fix assertion failure in JVMCIRuntime::metadata_do
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22538
diff
changeset
|
701 // For simplicity, the existence of HotSpotJVMCIMetaAccessContext in |
97ca867d3622
Fix assertion failure in JVMCIRuntime::metadata_do
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22538
diff
changeset
|
702 // the SystemDictionary well known classes should ensure the other |
97ca867d3622
Fix assertion failure in JVMCIRuntime::metadata_do
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22538
diff
changeset
|
703 // classes have already been loaded, so make sure their order in the |
97ca867d3622
Fix assertion failure in JVMCIRuntime::metadata_do
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22538
diff
changeset
|
704 // table enforces that. |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22668
diff
changeset
|
705 assert(SystemDictionary::WK_KLASS_ENUM_NAME(jdk_vm_ci_hotspot_HotSpotResolvedJavaMethodImpl) < |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22668
diff
changeset
|
706 SystemDictionary::WK_KLASS_ENUM_NAME(jdk_vm_ci_hotspot_HotSpotJVMCIMetaAccessContext), "must be loaded earlier"); |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22668
diff
changeset
|
707 assert(SystemDictionary::WK_KLASS_ENUM_NAME(jdk_vm_ci_hotspot_HotSpotConstantPool) < |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22668
diff
changeset
|
708 SystemDictionary::WK_KLASS_ENUM_NAME(jdk_vm_ci_hotspot_HotSpotJVMCIMetaAccessContext), "must be loaded earlier"); |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22668
diff
changeset
|
709 assert(SystemDictionary::WK_KLASS_ENUM_NAME(jdk_vm_ci_hotspot_HotSpotResolvedObjectTypeImpl) < |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22668
diff
changeset
|
710 SystemDictionary::WK_KLASS_ENUM_NAME(jdk_vm_ci_hotspot_HotSpotJVMCIMetaAccessContext), "must be loaded earlier"); |
22543
97ca867d3622
Fix assertion failure in JVMCIRuntime::metadata_do
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22538
diff
changeset
|
711 |
97ca867d3622
Fix assertion failure in JVMCIRuntime::metadata_do
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22538
diff
changeset
|
712 if (HotSpotJVMCIMetaAccessContext::klass() == NULL || |
97ca867d3622
Fix assertion failure in JVMCIRuntime::metadata_do
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22538
diff
changeset
|
713 !HotSpotJVMCIMetaAccessContext::klass()->is_linked()) { |
97ca867d3622
Fix assertion failure in JVMCIRuntime::metadata_do
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22538
diff
changeset
|
714 // Nothing could be registered yet |
22464
3fb432661d59
make JVMCIRuntime::metadata_do return immediately if HotSpotJVMCIMetaAccessContext has not yet been loaded
Doug Simon <doug.simon@oracle.com>
parents:
22461
diff
changeset
|
715 return; |
3fb432661d59
make JVMCIRuntime::metadata_do return immediately if HotSpotJVMCIMetaAccessContext has not yet been loaded
Doug Simon <doug.simon@oracle.com>
parents:
22461
diff
changeset
|
716 } |
22515
feb4131657bb
JVMCIRuntime::metadata_do shouldn't run until HotSpotJVMCIRuntime is initialized
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22511
diff
changeset
|
717 |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
718 // WeakReference<HotSpotJVMCIMetaAccessContext>[] |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
719 objArrayOop allContexts = HotSpotJVMCIMetaAccessContext::allContexts(); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
720 if (allContexts == NULL) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
721 return; |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
722 } |
22543
97ca867d3622
Fix assertion failure in JVMCIRuntime::metadata_do
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22538
diff
changeset
|
723 |
97ca867d3622
Fix assertion failure in JVMCIRuntime::metadata_do
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22538
diff
changeset
|
724 // These must be loaded at this point but the linking state doesn't matter. |
97ca867d3622
Fix assertion failure in JVMCIRuntime::metadata_do
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22538
diff
changeset
|
725 assert(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass() != NULL, "must be loaded"); |
97ca867d3622
Fix assertion failure in JVMCIRuntime::metadata_do
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22538
diff
changeset
|
726 assert(SystemDictionary::HotSpotConstantPool_klass() != NULL, "must be loaded"); |
97ca867d3622
Fix assertion failure in JVMCIRuntime::metadata_do
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22538
diff
changeset
|
727 assert(SystemDictionary::HotSpotResolvedObjectTypeImpl_klass() != NULL, "must be loaded"); |
22650
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
728 |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
729 for (int i = 0; i < allContexts->length(); i++) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
730 oop ref = allContexts->obj_at(i); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
731 if (ref != NULL) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
732 oop referent = java_lang_ref_Reference::referent(ref); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
733 if (referent != NULL) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
734 // Chunked Object[] with last element pointing to next chunk |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
735 objArrayOop metadataRoots = HotSpotJVMCIMetaAccessContext::metadataRoots(referent); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
736 while (metadataRoots != NULL) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
737 for (int typeIndex = 0; typeIndex < metadataRoots->length() - 1; typeIndex++) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
738 oop reference = metadataRoots->obj_at(typeIndex); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
739 if (reference == NULL) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
740 continue; |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
741 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
742 oop metadataRoot = java_lang_ref_Reference::referent(reference); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
743 if (metadataRoot == NULL) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
744 continue; |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
745 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
746 if (metadataRoot->is_a(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass())) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
747 Method* method = CompilerToVM::asMethod(metadataRoot); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
748 f(method); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
749 } else if (metadataRoot->is_a(SystemDictionary::HotSpotConstantPool_klass())) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
750 ConstantPool* constantPool = CompilerToVM::asConstantPool(metadataRoot); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
751 f(constantPool); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
752 } else if (metadataRoot->is_a(SystemDictionary::HotSpotResolvedObjectTypeImpl_klass())) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
753 Klass* klass = CompilerToVM::asKlass(metadataRoot); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
754 f(klass); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
755 } else { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
756 metadataRoot->print(); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
757 ShouldNotReachHere(); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
758 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
759 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
760 metadataRoots = (objArrayOop)metadataRoots->obj_at(metadataRoots->length() - 1); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
761 assert(metadataRoots == NULL || metadataRoots->is_objArray(), "wrong type"); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
762 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
763 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
764 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
765 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
766 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
767 |
22650
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
768 // private static void CompilerToVM.registerNatives() |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
769 JVM_ENTRY(void, JVM_RegisterJVMCINatives(JNIEnv *env, jclass c2vmClass)) |
23408
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
770 if (!EnableJVMCI) { |
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
771 THROW_MSG(vmSymbols::java_lang_InternalError(), "JVMCI is not enabled"); |
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
772 } |
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
773 |
22650
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
774 #ifdef _LP64 |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
775 #ifndef TARGET_ARCH_sparc |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
776 uintptr_t heap_end = (uintptr_t) Universe::heap()->reserved_region().end(); |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
777 uintptr_t allocation_end = heap_end + ((uintptr_t)16) * 1024 * 1024 * 1024; |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
778 guarantee(heap_end < allocation_end, "heap end too close to end of address space (might lead to erroneous TLAB allocations)"); |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
779 #endif // TARGET_ARCH_sparc |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
780 #else |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
781 fatal("check TLAB allocation code for address space conflicts"); |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
782 #endif |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
783 |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
784 JVMCIRuntime::ensure_jvmci_class_loader_is_initialized(); |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
785 |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
786 { |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
787 ThreadToNativeFromVM trans(thread); |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
788 |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
789 ResourceMark rm; |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
790 HandleMark hm; |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
791 |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
792 // Ensure _non_oop_bits is initialized |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
793 Universe::non_oop_word(); |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
794 |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
795 env->RegisterNatives(c2vmClass, CompilerToVM::methods, CompilerToVM::methods_count()); |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
796 } |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
797 if (HAS_PENDING_EXCEPTION) { |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
798 JVMCIRuntime::abort_on_pending_exception(PENDING_EXCEPTION, "Could not register natives"); |
939d5da65929
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22637
diff
changeset
|
799 } |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
800 JVM_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
801 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
802 void JVMCIRuntime::ensure_jvmci_class_loader_is_initialized() { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
803 // This initialization code is guarded by a static pointer to the Factory class. |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
804 // Once it is non-null, the JVMCI class loader and well known JVMCI classes are |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
805 // guaranteed to have been initialized. By going through the static |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
806 // initializer of Factory, we can rely on class initialization semantics to |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
807 // synchronize threads racing to do the initialization. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
808 static Klass* _FactoryKlass = NULL; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
809 if (_FactoryKlass == NULL) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
810 Thread* THREAD = Thread::current(); |
22761
f2206f5bb62e
removed @ServiceProvider mechanism (GRAAL-1380)
Doug Simon <doug.simon@oracle.com>
parents:
22758
diff
changeset
|
811 TempNewSymbol name = SymbolTable::new_symbol("jdk/vm/ci/services/JVMCIClassLoaderFactory", CHECK_ABORT); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
812 KlassHandle klass = SystemDictionary::resolve_or_fail(name, true, THREAD); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
813 if (HAS_PENDING_EXCEPTION) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
814 static volatile int seen_error = 0; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
815 if (!seen_error && Atomic::cmpxchg(1, &seen_error, 0) == 0) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
816 // Only report the failure on the first thread that hits it |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
817 abort_on_pending_exception(PENDING_EXCEPTION, "JVMCI classes are not available"); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
818 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
819 CLEAR_PENDING_EXCEPTION; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
820 // Give first thread time to report the error. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
821 os::sleep(THREAD, 100, false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
822 vm_abort(false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
823 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
824 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
825 |
22551
71ea8d7db665
removed author tags in comments
Doug Simon <doug.simon@oracle.com>
parents:
22548
diff
changeset
|
826 // We cannot use jvmciJavaClasses for this because we are currently in the |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
827 // process of initializing that mechanism. |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
828 TempNewSymbol field_name = SymbolTable::new_symbol("useJVMCIClassLoader", CHECK_ABORT); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
829 fieldDescriptor field_desc; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
830 if (klass->find_field(field_name, vmSymbols::bool_signature(), &field_desc) == NULL) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
831 ResourceMark rm; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
832 fatal(err_msg("Invalid layout of %s at %s", field_name->as_C_string(), klass->external_name())); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
833 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
834 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
835 InstanceKlass* ik = InstanceKlass::cast(klass()); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
836 address addr = ik->static_field_addr(field_desc.offset() - InstanceMirrorKlass::offset_of_static_fields()); |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
837 *((jboolean *) addr) = (jboolean) UseJVMCIClassLoader; |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
838 klass->initialize(CHECK_ABORT); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
839 _FactoryKlass = klass(); |
21562 | 840 assert(!UseJVMCIClassLoader || SystemDictionary::jvmci_loader() != NULL, "JVMCI classloader should have been initialized"); |
23296
f41d4011035d
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22761
diff
changeset
|
841 |
f41d4011035d
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22761
diff
changeset
|
842 JVMCIJavaClasses::compute_offsets(THREAD); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
843 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
844 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
845 |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
846 #define CHECK_WARN_ABORT_(message) THREAD); \ |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
847 if (HAS_PENDING_EXCEPTION) { \ |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
848 warning(message); \ |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
849 char buf[512]; \ |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
850 jio_snprintf(buf, 512, "Uncaught exception at %s:%d", __FILE__, __LINE__); \ |
21562 | 851 JVMCIRuntime::abort_on_pending_exception(PENDING_EXCEPTION, buf); \ |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
852 return; \ |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
853 } \ |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
854 (void)(0 |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
855 |
23408
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
856 void JVMCIRuntime::shutdown(TRAPS) { |
21527
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
857 if (_HotSpotJVMCIRuntime_instance != NULL) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
858 _shutdown_called = true; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
859 HandleMark hm(THREAD); |
23408
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
860 Handle receiver = get_HotSpotJVMCIRuntime(CHECK); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
861 JavaValue result(T_VOID); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
862 JavaCallArguments args; |
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:
21614
diff
changeset
|
863 args.push_oop(receiver); |
23408
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
864 JavaCalls::call_special(&result, receiver->klass(), vmSymbols::shutdown_method_name(), vmSymbols::void_method_signature(), &args, CHECK); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
865 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
866 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
867 |
23385 | 868 void JVMCIRuntime::bootstrap_finished(TRAPS) { |
23383
0226d6bcb0d2
Notify the compiler on completion of a bootstrap (JDK-8156034)
Josef Eisl <josef.eisl@jku.at>
parents:
23379
diff
changeset
|
869 if (_HotSpotJVMCIRuntime_instance != NULL) { |
0226d6bcb0d2
Notify the compiler on completion of a bootstrap (JDK-8156034)
Josef Eisl <josef.eisl@jku.at>
parents:
23379
diff
changeset
|
870 HandleMark hm(THREAD); |
0226d6bcb0d2
Notify the compiler on completion of a bootstrap (JDK-8156034)
Josef Eisl <josef.eisl@jku.at>
parents:
23379
diff
changeset
|
871 Handle receiver = get_HotSpotJVMCIRuntime(CHECK_ABORT); |
0226d6bcb0d2
Notify the compiler on completion of a bootstrap (JDK-8156034)
Josef Eisl <josef.eisl@jku.at>
parents:
23379
diff
changeset
|
872 JavaValue result(T_VOID); |
0226d6bcb0d2
Notify the compiler on completion of a bootstrap (JDK-8156034)
Josef Eisl <josef.eisl@jku.at>
parents:
23379
diff
changeset
|
873 JavaCallArguments args; |
0226d6bcb0d2
Notify the compiler on completion of a bootstrap (JDK-8156034)
Josef Eisl <josef.eisl@jku.at>
parents:
23379
diff
changeset
|
874 args.push_oop(receiver); |
0226d6bcb0d2
Notify the compiler on completion of a bootstrap (JDK-8156034)
Josef Eisl <josef.eisl@jku.at>
parents:
23379
diff
changeset
|
875 JavaCalls::call_special(&result, receiver->klass(), vmSymbols::bootstrapFinished_method_name(), vmSymbols::void_method_signature(), &args, CHECK_ABORT); |
0226d6bcb0d2
Notify the compiler on completion of a bootstrap (JDK-8156034)
Josef Eisl <josef.eisl@jku.at>
parents:
23379
diff
changeset
|
876 } |
0226d6bcb0d2
Notify the compiler on completion of a bootstrap (JDK-8156034)
Josef Eisl <josef.eisl@jku.at>
parents:
23379
diff
changeset
|
877 } |
0226d6bcb0d2
Notify the compiler on completion of a bootstrap (JDK-8156034)
Josef Eisl <josef.eisl@jku.at>
parents:
23379
diff
changeset
|
878 |
22575
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
879 bool JVMCIRuntime::treat_as_trivial(Method* method) { |
22586
cf99b5e5b0b4
Fix race in initialization of trivial prefixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22585
diff
changeset
|
880 if (_HotSpotJVMCIRuntime_initialized) { |
22609
c42b12eb270a
trivial prefixes shoudl only apply to the compiler itself
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22602
diff
changeset
|
881 oop loader = method->method_holder()->class_loader(); |
c42b12eb270a
trivial prefixes shoudl only apply to the compiler itself
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22602
diff
changeset
|
882 if (loader == NULL || loader == SystemDictionary::jvmci_loader()) { |
c42b12eb270a
trivial prefixes shoudl only apply to the compiler itself
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22602
diff
changeset
|
883 for (int i = 0; i < _trivial_prefixes_count; i++) { |
c42b12eb270a
trivial prefixes shoudl only apply to the compiler itself
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22602
diff
changeset
|
884 if (method->method_holder()->name()->starts_with(_trivial_prefixes[i])) { |
c42b12eb270a
trivial prefixes shoudl only apply to the compiler itself
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22602
diff
changeset
|
885 return true; |
c42b12eb270a
trivial prefixes shoudl only apply to the compiler itself
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22602
diff
changeset
|
886 } |
22586
cf99b5e5b0b4
Fix race in initialization of trivial prefixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22585
diff
changeset
|
887 } |
22575
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
888 } |
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
889 } |
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
890 return false; |
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
891 } |
569c82ebb96e
Replace JVMCICompileWithC1Only with package based controls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22574
diff
changeset
|
892 |
23379
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
893 CompLevel JVMCIRuntime::adjust_comp_level(methodHandle method, bool is_osr, CompLevel level, JavaThread* thread) { |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
894 if (!thread->adjusting_comp_level()) { |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
895 thread->set_adjusting_comp_level(true); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
896 level = adjust_comp_level_inner(method, is_osr, level, thread); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
897 thread->set_adjusting_comp_level(false); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
898 } |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
899 return level; |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
900 } |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
901 |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
902 CompLevel JVMCIRuntime::adjust_comp_level_inner(methodHandle method, bool is_osr, CompLevel level, JavaThread* thread) { |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
903 JVMCICompiler* compiler = JVMCICompiler::instance(thread); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
904 if (compiler != NULL && compiler->is_bootstrapping()) { |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
905 return level; |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
906 } |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
907 if (!is_HotSpotJVMCIRuntime_initialized() || !_comp_level_adjustment) { |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
908 // JVMCI cannot participate in compilation scheduling until |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
909 // JVMCI is initialized and indicates it wants to participate. |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
910 return level; |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
911 } |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
912 |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
913 #define CHECK_RETURN THREAD); \ |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
914 if (HAS_PENDING_EXCEPTION) { \ |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
915 Handle exception(THREAD, PENDING_EXCEPTION); \ |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
916 CLEAR_PENDING_EXCEPTION; \ |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
917 \ |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
918 java_lang_Throwable::print(exception, tty); \ |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
919 tty->cr(); \ |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
920 java_lang_Throwable::print_stack_trace(exception(), tty); \ |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
921 if (HAS_PENDING_EXCEPTION) { \ |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
922 CLEAR_PENDING_EXCEPTION; \ |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
923 } \ |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
924 return level; \ |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
925 } \ |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
926 (void)(0 |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
927 |
23408
f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents:
23404
diff
changeset
|
928 |
23379
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
929 Thread* THREAD = thread; |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
930 HandleMark hm; |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
931 Handle receiver = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK_RETURN); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
932 Handle name; |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
933 Handle sig; |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
934 if (_comp_level_adjustment == JVMCIRuntime::by_full_signature) { |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
935 name = java_lang_String::create_from_symbol(method->name(), CHECK_RETURN); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
936 sig = java_lang_String::create_from_symbol(method->signature(), CHECK_RETURN); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
937 } else { |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
938 name = Handle(); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
939 sig = Handle(); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
940 } |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
941 |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
942 JavaValue result(T_INT); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
943 JavaCallArguments args; |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
944 args.push_oop(receiver); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
945 args.push_oop(method->method_holder()->java_mirror()); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
946 args.push_oop(name()); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
947 args.push_oop(sig()); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
948 args.push_int(is_osr); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
949 args.push_int(level); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
950 JavaCalls::call_special(&result, receiver->klass(), vmSymbols::adjustCompilationLevel_name(), |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
951 vmSymbols::adjustCompilationLevel_signature(), &args, CHECK_RETURN); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
952 |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
953 // An uncaught exception was thrown. Generally these |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
954 // should be handled by the Java code in some useful way but if they leak |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
955 // through to here report them instead of dying or silently ignoring them. |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
956 if (HAS_PENDING_EXCEPTION) { |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
957 Handle throwable = PENDING_EXCEPTION; |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
958 CLEAR_PENDING_EXCEPTION; |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
959 |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
960 java_lang_Throwable::print(throwable, tty); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
961 tty->cr(); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
962 java_lang_Throwable::print_stack_trace(throwable(), tty); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
963 return level; |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
964 } |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
965 int comp_level = result.get_jint(); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
966 if (comp_level < CompLevel_none || comp_level > CompLevel_full_optimization) { |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
967 assert(false, "compilation level out of bounds"); |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
968 return level; |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
969 } |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
970 return (CompLevel) comp_level; |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
971 #undef CHECK_RETURN |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
972 } |
24505bf61633
allow JVMCI compiler to change the compilation policy for a method (JDK-8152311)
Doug Simon <doug.simon@oracle.com>
parents:
23372
diff
changeset
|
973 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
974 void JVMCIRuntime::abort_on_pending_exception(Handle exception, const char* message, bool dump_core) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
975 Thread* THREAD = Thread::current(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
976 CLEAR_PENDING_EXCEPTION; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
977 tty->print_raw_cr(message); |
23329
bc5552dc384b
Use VM routines to print stack traces from C++ code.
Roland Schatz <roland.schatz@oracle.com>
parents:
23327
diff
changeset
|
978 |
bc5552dc384b
Use VM routines to print stack traces from C++ code.
Roland Schatz <roland.schatz@oracle.com>
parents:
23327
diff
changeset
|
979 java_lang_Throwable::print(exception, tty); |
bc5552dc384b
Use VM routines to print stack traces from C++ code.
Roland Schatz <roland.schatz@oracle.com>
parents:
23327
diff
changeset
|
980 tty->cr(); |
bc5552dc384b
Use VM routines to print stack traces from C++ code.
Roland Schatz <roland.schatz@oracle.com>
parents:
23327
diff
changeset
|
981 java_lang_Throwable::print_stack_trace(exception(), tty); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
982 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
983 // Give other aborting threads to also print their stack traces. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
984 // This can be very useful when debugging class initialization |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
985 // failures. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
986 os::sleep(THREAD, 200, false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
987 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
988 vm_abort(dump_core); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
989 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
990 |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
991 void JVMCIRuntime::fthrow_error(Thread* thread, const char* file, int line, const char* format, ...) { |
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
992 const int max_msg_size = 1024; |
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
993 va_list ap; |
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
994 va_start(ap, format); |
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
995 char msg[max_msg_size]; |
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
996 vsnprintf(msg, max_msg_size, format, ap); |
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
997 msg[max_msg_size-1] = '\0'; |
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
998 va_end(ap); |
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
999 Handle h_loader = Handle(thread, SystemDictionary::jvmci_loader()); |
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
1000 Handle h_protection_domain = Handle(); |
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
1001 Exceptions::_throw_msg(thread, file, line, vmSymbols::jdk_vm_ci_common_JVMCIError(), msg, h_loader, h_protection_domain); |
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
1002 } |
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23387
diff
changeset
|
1003 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1004 Klass* JVMCIRuntime::resolve_or_null(Symbol* name, TRAPS) { |
23296
f41d4011035d
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22761
diff
changeset
|
1005 assert(!UseJVMCIClassLoader || SystemDictionary::jvmci_loader() != NULL, "JVMCI classloader should have been initialized"); |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1006 return SystemDictionary::resolve_or_null(name, SystemDictionary::jvmci_loader(), Handle(), CHECK_NULL); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1007 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1008 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1009 Klass* JVMCIRuntime::resolve_or_fail(Symbol* name, TRAPS) { |
23296
f41d4011035d
reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents:
22761
diff
changeset
|
1010 assert(!UseJVMCIClassLoader || SystemDictionary::jvmci_loader() != NULL, "JVMCI classloader should have been initialized"); |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1011 return SystemDictionary::resolve_or_fail(name, SystemDictionary::jvmci_loader(), Handle(), true, CHECK_NULL); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1012 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1013 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
1014 Klass* JVMCIRuntime::load_required_class(Symbol* name) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1015 Klass* klass = resolve_or_null(name, Thread::current()); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1016 if (klass == NULL) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1017 tty->print_cr("Could not load class %s", name->as_C_string()); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1018 vm_abort(false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1019 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1020 return klass; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1021 } |