Mercurial > hg > truffle
annotate src/share/vm/graal/graalRuntime.cpp @ 18550:bbf27a6ffb52
add graph to context in TruffleCacheImpl.cacheLookup
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Wed, 26 Nov 2014 11:51:21 -0800 |
parents | ab47ef2f2207 |
children | c307546c7b0a |
rev | line source |
---|---|
7221 | 1 /* |
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
23 | |
24 #include "precompiled.hpp" | |
7735 | 25 #include "asm/codeBuffer.hpp" |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
26 #include "compiler/compileBroker.hpp" |
17033
2d6dd2eebd51
Fixed HSAIL deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16887
diff
changeset
|
27 #include "compiler/disassembler.hpp" |
7221 | 28 #include "graal/graalRuntime.hpp" |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
29 #include "graal/graalCompilerToVM.hpp" |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
30 #include "graal/graalCompiler.hpp" |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
31 #include "graal/graalJavaAccess.hpp" |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
32 #include "graal/graalEnv.hpp" |
7735 | 33 #include "memory/oopFactory.hpp" |
34 #include "prims/jvm.h" | |
7221 | 35 #include "runtime/biasedLocking.hpp" |
7735 | 36 #include "runtime/interfaceSupport.hpp" |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
37 #include "runtime/arguments.hpp" |
10542
554f67e4ff3f
Use slow-path stub call instead of deopt in lowering of DynamicNewArrayNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10475
diff
changeset
|
38 #include "runtime/reflection.hpp" |
8499
96a337d307bd
-More progress in G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8496
diff
changeset
|
39 #include "utilities/debug.hpp" |
7221 | 40 |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
41 address GraalRuntime::_external_deopt_i2c_entry = NULL; |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
42 jobject GraalRuntime::_HotSpotGraalRuntime_instance = NULL; |
16683
4d0d1dc5db00
introduce extra field to record when HotSpotGraalRuntime has been initialized to avoid spurious errors during VM shutdown for short lived applications
Doug Simon <doug.simon@oracle.com>
parents:
16679
diff
changeset
|
43 bool GraalRuntime::_HotSpotGraalRuntime_initialized = false; |
18303
ab47ef2f2207
disable blocking compilation requests once GraalRuntime::shutdown has been called
Doug Simon <doug.simon@oracle.com>
parents:
18227
diff
changeset
|
44 bool GraalRuntime::_shutdown_called = false; |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
45 |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
46 void GraalRuntime::initialize_natives(JNIEnv *env, jclass c2vmClass) { |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
47 uintptr_t heap_end = (uintptr_t) Universe::heap()->reserved_region().end(); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
48 uintptr_t allocation_end = heap_end + ((uintptr_t)16) * 1024 * 1024 * 1024; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
49 AMD64_ONLY(guarantee(heap_end < allocation_end, "heap end too close to end of address space (might lead to erroneous TLAB allocations)")); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
50 NOT_LP64(error("check TLAB allocation code for address space conflicts")); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
51 |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
52 JavaThread* THREAD = JavaThread::current(); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
53 { |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
54 ThreadToNativeFromVM trans(THREAD); |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
55 |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
56 ResourceMark rm; |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
57 HandleMark hm; |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
58 |
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
59 graal_compute_offsets(); |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
60 |
17033
2d6dd2eebd51
Fixed HSAIL deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16887
diff
changeset
|
61 #ifdef TARGET_ARCH_x86 |
2d6dd2eebd51
Fixed HSAIL deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16887
diff
changeset
|
62 #ifdef _LP64 |
2d6dd2eebd51
Fixed HSAIL deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16887
diff
changeset
|
63 // Only supported on x86_64 for now |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
64 _external_deopt_i2c_entry = create_external_deopt_i2c(); |
17033
2d6dd2eebd51
Fixed HSAIL deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16887
diff
changeset
|
65 #endif |
2d6dd2eebd51
Fixed HSAIL deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16887
diff
changeset
|
66 #endif |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
67 |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
68 // Ensure _non_oop_bits is initialized |
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
69 Universe::non_oop_word(); |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
70 |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
71 env->RegisterNatives(c2vmClass, CompilerToVM_methods, CompilerToVM_methods_count()); |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
72 } |
16428
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
73 if (HAS_PENDING_EXCEPTION) { |
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
74 abort_on_pending_exception(PENDING_EXCEPTION, "Could not register natives"); |
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
75 } |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
76 } |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
77 |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
78 BufferBlob* GraalRuntime::initialize_buffer_blob() { |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
79 JavaThread* THREAD = JavaThread::current(); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
80 BufferBlob* buffer_blob = THREAD->get_buffer_blob(); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
81 if (buffer_blob == NULL) { |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
82 buffer_blob = BufferBlob::create("Graal thread-local CodeBuffer", GraalNMethodSizeLimit); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
83 if (buffer_blob != NULL) { |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
84 THREAD->set_buffer_blob(buffer_blob); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
85 } |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
86 } |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
87 return buffer_blob; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
88 } |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
89 |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
90 address GraalRuntime::create_external_deopt_i2c() { |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
91 ResourceMark rm; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
92 BufferBlob* buffer = BufferBlob::create("externalDeopt", 1*K); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
93 CodeBuffer cb(buffer); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
94 short buffer_locs[20]; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
95 cb.insts()->initialize_shared_locs((relocInfo*)buffer_locs, sizeof(buffer_locs)/sizeof(relocInfo)); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
96 MacroAssembler masm(&cb); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
97 |
17033
2d6dd2eebd51
Fixed HSAIL deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16887
diff
changeset
|
98 int total_args_passed = 6; |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
99 |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
100 BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
101 VMRegPair* regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
102 int i = 0; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
103 sig_bt[i++] = T_INT; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
104 sig_bt[i++] = T_LONG; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
105 sig_bt[i++] = T_VOID; // long stakes 2 slots |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
106 sig_bt[i++] = T_INT; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
107 sig_bt[i++] = T_OBJECT; |
17150
80d021f12b22
fix typo in graalRuntime.cpp
Andreas Woess <andreas.woess@jku.at>
parents:
17033
diff
changeset
|
108 sig_bt[i++] = T_INT; // The number of actual arguments passed to the method. |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
109 |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
110 int comp_args_on_stack = SharedRuntime::java_calling_convention(sig_bt, regs, total_args_passed, false); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
111 |
17033
2d6dd2eebd51
Fixed HSAIL deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16887
diff
changeset
|
112 SharedRuntime::gen_i2c_adapter(&masm, total_args_passed, comp_args_on_stack, sig_bt, regs, total_args_passed - 1); |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
113 masm.flush(); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
114 |
17033
2d6dd2eebd51
Fixed HSAIL deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16887
diff
changeset
|
115 AdapterBlob* adapter = AdapterBlob::create(&cb); |
2d6dd2eebd51
Fixed HSAIL deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16887
diff
changeset
|
116 if (PrintAdapterHandlers) { |
2d6dd2eebd51
Fixed HSAIL deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16887
diff
changeset
|
117 tty->print_cr("Decoding external_deopt_i2c"); |
2d6dd2eebd51
Fixed HSAIL deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16887
diff
changeset
|
118 Disassembler::decode(adapter->code_begin(), adapter->code_end()); |
2d6dd2eebd51
Fixed HSAIL deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16887
diff
changeset
|
119 } |
2d6dd2eebd51
Fixed HSAIL deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16887
diff
changeset
|
120 return adapter->code_begin(); |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
121 } |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
122 |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
123 BasicType GraalRuntime::kindToBasicType(jchar ch) { |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
124 switch(ch) { |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
125 case 'z': return T_BOOLEAN; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
126 case 'b': return T_BYTE; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
127 case 's': return T_SHORT; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
128 case 'c': return T_CHAR; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
129 case 'i': return T_INT; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
130 case 'f': return T_FLOAT; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
131 case 'j': return T_LONG; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
132 case 'd': return T_DOUBLE; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
133 case 'a': return T_OBJECT; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
134 case '-': return T_ILLEGAL; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
135 default: |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
136 fatal(err_msg("unexpected Kind: %c", ch)); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
137 break; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
138 } |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
139 return T_ILLEGAL; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
140 } |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
141 |
7221 | 142 // Simple helper to see if the caller of a runtime stub which |
143 // entered the VM has been deoptimized | |
144 | |
145 static bool caller_is_deopted() { | |
146 JavaThread* thread = JavaThread::current(); | |
147 RegisterMap reg_map(thread, false); | |
148 frame runtime_frame = thread->last_frame(); | |
149 frame caller_frame = runtime_frame.sender(®_map); | |
150 assert(caller_frame.is_compiled_frame(), "must be compiled"); | |
151 return caller_frame.is_deoptimized_frame(); | |
152 } | |
153 | |
154 // Stress deoptimization | |
155 static void deopt_caller() { | |
156 if ( !caller_is_deopted()) { | |
157 JavaThread* thread = JavaThread::current(); | |
158 RegisterMap reg_map(thread, false); | |
159 frame runtime_frame = thread->last_frame(); | |
160 frame caller_frame = runtime_frame.sender(®_map); | |
161 Deoptimization::deoptimize_frame(thread, caller_frame.id(), Deoptimization::Reason_constraint); | |
162 assert(caller_is_deopted(), "Must be deoptimized"); | |
163 } | |
164 } | |
165 | |
12433
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
166 JRT_BLOCK_ENTRY(void, GraalRuntime::new_instance(JavaThread* thread, Klass* klass)) |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
167 JRT_BLOCK; |
7221 | 168 assert(klass->is_klass(), "not a class"); |
169 instanceKlassHandle h(thread, klass); | |
170 h->check_valid_for_instantiation(true, CHECK); | |
171 // make sure klass is initialized | |
172 h->initialize(CHECK); | |
173 // allocate instance and return via TLS | |
174 oop obj = h->allocate_instance(CHECK); | |
12433
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
175 thread->set_vm_result(obj); |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
176 JRT_BLOCK_END; |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
177 |
12366
0991c12c4186
Defer barriers upon slow-path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10953
diff
changeset
|
178 if (GraalDeferredInitBarriers) { |
12433
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
179 new_store_pre_barrier(thread); |
12366
0991c12c4186
Defer barriers upon slow-path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10953
diff
changeset
|
180 } |
7221 | 181 JRT_END |
182 | |
12433
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
183 JRT_BLOCK_ENTRY(void, GraalRuntime::new_array(JavaThread* thread, Klass* array_klass, jint length)) |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
184 JRT_BLOCK; |
7221 | 185 // Note: no handle for klass needed since they are not used |
186 // anymore after new_objArray() and no GC can happen before. | |
187 // (This may have to change if this code changes!) | |
188 assert(array_klass->is_klass(), "not a class"); | |
189 oop obj; | |
190 if (array_klass->oop_is_typeArray()) { | |
191 BasicType elt_type = TypeArrayKlass::cast(array_klass)->element_type(); | |
192 obj = oopFactory::new_typeArray(elt_type, length, CHECK); | |
193 } else { | |
194 Klass* elem_klass = ObjArrayKlass::cast(array_klass)->element_klass(); | |
195 obj = oopFactory::new_objArray(elem_klass, length, CHECK); | |
196 } | |
197 thread->set_vm_result(obj); | |
198 // This is pretty rare but this runtime patch is stressful to deoptimization | |
199 // if we deoptimize here so force a deopt to stress the path. | |
200 if (DeoptimizeALot) { | |
9338
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9232
diff
changeset
|
201 static int deopts = 0; |
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9232
diff
changeset
|
202 // Alternate between deoptimizing and raising an error (which will also cause a deopt) |
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9232
diff
changeset
|
203 if (deopts++ % 2 == 0) { |
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9232
diff
changeset
|
204 ResourceMark rm(THREAD); |
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9232
diff
changeset
|
205 THROW(vmSymbols::java_lang_OutOfMemoryError()); |
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9232
diff
changeset
|
206 } else { |
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9232
diff
changeset
|
207 deopt_caller(); |
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9232
diff
changeset
|
208 } |
7221 | 209 } |
12433
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
210 JRT_BLOCK_END; |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
211 |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
212 if (GraalDeferredInitBarriers) { |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
213 new_store_pre_barrier(thread); |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
214 } |
9338
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9232
diff
changeset
|
215 JRT_END |
7221 | 216 |
12433
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
217 void GraalRuntime::new_store_pre_barrier(JavaThread* thread) { |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
218 // After any safepoint, just before going back to compiled code, |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
219 // we inform the GC that we will be doing initializing writes to |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
220 // this object in the future without emitting card-marks, so |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
221 // GC may take any compensating steps. |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
222 // NOTE: Keep this code consistent with GraphKit::store_barrier. |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
223 |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
224 oop new_obj = thread->vm_result(); |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
225 if (new_obj == NULL) return; |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
226 |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
227 assert(Universe::heap()->can_elide_tlab_store_barriers(), |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
228 "compiler must check this first"); |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
229 // GC may decide to give back a safer copy of new_obj. |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
230 new_obj = Universe::heap()->new_store_pre_barrier(thread, new_obj); |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
231 thread->set_vm_result(new_obj); |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
232 } |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
233 |
7221 | 234 JRT_ENTRY(void, GraalRuntime::new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims)) |
235 assert(klass->is_klass(), "not a class"); | |
236 assert(rank >= 1, "rank must be nonzero"); | |
237 oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK); | |
238 thread->set_vm_result(obj); | |
239 JRT_END | |
240 | |
12423
370b5f07f9e2
The runtime entries need to use oopDesc* rather than oop in their signature
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12372
diff
changeset
|
241 JRT_ENTRY(void, GraalRuntime::dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length)) |
10542
554f67e4ff3f
Use slow-path stub call instead of deopt in lowering of DynamicNewArrayNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10475
diff
changeset
|
242 oop obj = Reflection::reflect_new_array(element_mirror, length, CHECK); |
554f67e4ff3f
Use slow-path stub call instead of deopt in lowering of DynamicNewArrayNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10475
diff
changeset
|
243 thread->set_vm_result(obj); |
554f67e4ff3f
Use slow-path stub call instead of deopt in lowering of DynamicNewArrayNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10475
diff
changeset
|
244 JRT_END |
554f67e4ff3f
Use slow-path stub call instead of deopt in lowering of DynamicNewArrayNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10475
diff
changeset
|
245 |
13578
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
246 JRT_ENTRY(void, GraalRuntime::dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror)) |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
247 instanceKlassHandle klass(THREAD, java_lang_Class::as_Klass(type_mirror)); |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
248 |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
249 if (klass == NULL) { |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
250 ResourceMark rm(THREAD); |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
251 THROW(vmSymbols::java_lang_InstantiationException()); |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
252 } |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
253 |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
254 // Create new instance (the receiver) |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
255 klass->check_valid_for_instantiation(false, CHECK); |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
256 |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
257 // Make sure klass gets initialized |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
258 klass->initialize(CHECK); |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
259 |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
260 oop obj = klass->allocate_instance(CHECK); |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
261 thread->set_vm_result(obj); |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
262 JRT_END |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
263 |
7221 | 264 extern void vm_exit(int code); |
265 | |
266 // Enter this method from compiled code handler below. This is where we transition | |
267 // to VM mode. This is done as a helper routine so that the method called directly | |
268 // from compiled code does not have to transition to VM. This allows the entry | |
269 // method to see if the nmethod that we have just looked up a handler for has | |
270 // been deoptimized while we were in the vm. This simplifies the assembly code | |
271 // cpu directories. | |
272 // | |
273 // We are entering here from exception stub (via the entry method below) | |
274 // If there is a compiled exception handler in this method, we will continue there; | |
275 // otherwise we will unwind the stack and continue at the caller of top frame method | |
276 // Note: we enter in Java using a special JRT wrapper. This wrapper allows us to | |
277 // control the area where we can allow a safepoint. After we exit the safepoint area we can | |
278 // check to see if the handler we are going to return is now in a nmethod that has | |
279 // been deoptimized. If that is the case we return the deopt blob | |
280 // unpack_with_exception entry instead. This makes life for the exception blob easier | |
281 // because making that same check and diverting is painful from assembly language. | |
282 JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* thread, oopDesc* ex, address pc, nmethod*& nm)) | |
283 // Reset method handle flag. | |
284 thread->set_is_method_handle_return(false); | |
285 | |
286 Handle exception(thread, ex); | |
287 nm = CodeCache::find_nmethod(pc); | |
288 assert(nm != NULL, "this is not an nmethod"); | |
289 // Adjust the pc as needed/ | |
290 if (nm->is_deopt_pc(pc)) { | |
291 RegisterMap map(thread, false); | |
292 frame exception_frame = thread->last_frame().sender(&map); | |
293 // if the frame isn't deopted then pc must not correspond to the caller of last_frame | |
294 assert(exception_frame.is_deoptimized_frame(), "must be deopted"); | |
295 pc = exception_frame.pc(); | |
296 } | |
297 #ifdef ASSERT | |
298 assert(exception.not_null(), "NULL exceptions should be handled by throw_exception"); | |
299 assert(exception->is_oop(), "just checking"); | |
300 // Check that exception is a subclass of Throwable, otherwise we have a VerifyError | |
301 if (!(exception->is_a(SystemDictionary::Throwable_klass()))) { | |
302 if (ExitVMOnVerifyError) vm_exit(-1); | |
303 ShouldNotReachHere(); | |
304 } | |
305 #endif | |
306 | |
307 // Check the stack guard pages and reenable them if necessary and there is | |
308 // enough space on the stack to do so. Use fast exceptions only if the guard | |
309 // pages are enabled. | |
310 bool guard_pages_enabled = thread->stack_yellow_zone_enabled(); | |
311 if (!guard_pages_enabled) guard_pages_enabled = thread->reguard_stack(); | |
312 | |
313 if (JvmtiExport::can_post_on_exceptions()) { | |
314 // To ensure correct notification of exception catches and throws | |
315 // we have to deoptimize here. If we attempted to notify the | |
316 // catches and throws during this exception lookup it's possible | |
317 // we could deoptimize on the way out of the VM and end back in | |
318 // the interpreter at the throw site. This would result in double | |
319 // notifications since the interpreter would also notify about | |
320 // these same catches and throws as it unwound the frame. | |
321 | |
322 RegisterMap reg_map(thread); | |
323 frame stub_frame = thread->last_frame(); | |
324 frame caller_frame = stub_frame.sender(®_map); | |
325 | |
326 // We don't really want to deoptimize the nmethod itself since we | |
327 // can actually continue in the exception handler ourselves but I | |
328 // don't see an easy way to have the desired effect. | |
329 Deoptimization::deoptimize_frame(thread, caller_frame.id(), Deoptimization::Reason_constraint); | |
330 assert(caller_is_deopted(), "Must be deoptimized"); | |
331 | |
332 return SharedRuntime::deopt_blob()->unpack_with_exception_in_tls(); | |
333 } | |
334 | |
335 // ExceptionCache is used only for exceptions at call sites and not for implicit exceptions | |
336 if (guard_pages_enabled) { | |
337 address fast_continuation = nm->handler_for_exception_and_pc(exception, pc); | |
338 if (fast_continuation != NULL) { | |
339 // Set flag if return address is a method handle call site. | |
340 thread->set_is_method_handle_return(nm->is_method_handle_return(pc)); | |
341 return fast_continuation; | |
342 } | |
343 } | |
344 | |
345 // If the stack guard pages are enabled, check whether there is a handler in | |
346 // the current method. Otherwise (guard pages disabled), force an unwind and | |
347 // skip the exception cache update (i.e., just leave continuation==NULL). | |
348 address continuation = NULL; | |
349 if (guard_pages_enabled) { | |
350 | |
351 // New exception handling mechanism can support inlined methods | |
352 // with exception handlers since the mappings are from PC to PC | |
353 | |
354 // debugging support | |
355 // tracing | |
356 if (TraceExceptions) { | |
357 ttyLocker ttyl; | |
358 ResourceMark rm; | |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17319
diff
changeset
|
359 tty->print_cr("Exception <%s> (" INTPTR_FORMAT ") thrown in compiled method <%s> at PC " INTPTR_FORMAT " for thread " INTPTR_FORMAT "", |
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17319
diff
changeset
|
360 exception->print_value_string(), p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread)); |
7221 | 361 } |
362 // for AbortVMOnException flag | |
363 NOT_PRODUCT(Exceptions::debug_check_abort(exception)); | |
364 | |
365 // Clear out the exception oop and pc since looking up an | |
366 // exception handler can cause class loading, which might throw an | |
367 // exception and those fields are expected to be clear during | |
368 // normal bytecode execution. | |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17319
diff
changeset
|
369 thread->clear_exception_oop_and_pc(); |
7221 | 370 |
371 continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false); | |
372 // If an exception was thrown during exception dispatch, the exception oop may have changed | |
373 thread->set_exception_oop(exception()); | |
374 thread->set_exception_pc(pc); | |
375 | |
376 // the exception cache is used only by non-implicit exceptions | |
377 if (continuation != NULL && !SharedRuntime::deopt_blob()->contains(continuation)) { | |
378 nm->add_handler_for_exception_and_pc(exception, pc, continuation); | |
379 } | |
380 } | |
381 | |
382 // Set flag if return address is a method handle call site. | |
383 thread->set_is_method_handle_return(nm->is_method_handle_return(pc)); | |
384 | |
385 if (TraceExceptions) { | |
386 ttyLocker ttyl; | |
387 ResourceMark rm; | |
388 tty->print_cr("Thread " PTR_FORMAT " continuing at PC " PTR_FORMAT " for exception thrown at PC " PTR_FORMAT, | |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17319
diff
changeset
|
389 p2i(thread), p2i(continuation), p2i(pc)); |
7221 | 390 } |
391 | |
392 return continuation; | |
393 JRT_END | |
394 | |
395 // Enter this method from compiled code only if there is a Java exception handler | |
396 // in the method handling the exception. | |
397 // We are entering here from exception stub. We don't do a normal VM transition here. | |
398 // We do it in a helper. This is so we can check to see if the nmethod we have just | |
399 // searched for an exception handler has been deoptimized in the meantime. | |
400 address GraalRuntime::exception_handler_for_pc(JavaThread* thread) { | |
401 oop exception = thread->exception_oop(); | |
402 address pc = thread->exception_pc(); | |
403 // Still in Java mode | |
404 DEBUG_ONLY(ResetNoHandleMark rnhm); | |
405 nmethod* nm = NULL; | |
406 address continuation = NULL; | |
407 { | |
408 // Enter VM mode by calling the helper | |
409 ResetNoHandleMark rnhm; | |
410 continuation = exception_handler_for_pc_helper(thread, exception, pc, nm); | |
411 } | |
412 // Back in JAVA, use no oops DON'T safepoint | |
413 | |
414 // Now check to see if the nmethod we were called from is now deoptimized. | |
415 // If so we must return to the deopt blob and deoptimize the nmethod | |
416 if (nm != NULL && caller_is_deopted()) { | |
417 continuation = SharedRuntime::deopt_blob()->unpack_with_exception_in_tls(); | |
418 } | |
419 | |
420 assert(continuation != NULL, "no handler found"); | |
421 return continuation; | |
422 } | |
423 | |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7735
diff
changeset
|
424 JRT_ENTRY(void, GraalRuntime::create_null_exception(JavaThread* thread)) |
12668
e27f3169460e
notify JVMTI about exception throws from runtime
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
12435
diff
changeset
|
425 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_NullPointerException()); |
e27f3169460e
notify JVMTI about exception throws from runtime
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
12435
diff
changeset
|
426 thread->set_vm_result(PENDING_EXCEPTION); |
e27f3169460e
notify JVMTI about exception throws from runtime
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
12435
diff
changeset
|
427 CLEAR_PENDING_EXCEPTION; |
7221 | 428 JRT_END |
429 | |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7735
diff
changeset
|
430 JRT_ENTRY(void, GraalRuntime::create_out_of_bounds_exception(JavaThread* thread, jint index)) |
7221 | 431 char message[jintAsStringSize]; |
432 sprintf(message, "%d", index); | |
12668
e27f3169460e
notify JVMTI about exception throws from runtime
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
12435
diff
changeset
|
433 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message); |
e27f3169460e
notify JVMTI about exception throws from runtime
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
12435
diff
changeset
|
434 thread->set_vm_result(PENDING_EXCEPTION); |
e27f3169460e
notify JVMTI about exception throws from runtime
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
12435
diff
changeset
|
435 CLEAR_PENDING_EXCEPTION; |
7221 | 436 JRT_END |
437 | |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7735
diff
changeset
|
438 JRT_ENTRY_NO_ASYNC(void, GraalRuntime::monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock)) |
7221 | 439 if (TraceGraal >= 3) { |
440 char type[O_BUFLEN]; | |
441 obj->klass()->name()->as_C_string(type, O_BUFLEN); | |
442 markOop mark = obj->mark(); | |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17319
diff
changeset
|
443 tty->print_cr("%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)); |
7221 | 444 tty->flush(); |
445 } | |
446 #ifdef ASSERT | |
447 if (PrintBiasedLockingStatistics) { | |
448 Atomic::inc(BiasedLocking::slow_path_entry_count_addr()); | |
449 } | |
450 #endif | |
451 Handle h_obj(thread, obj); | |
452 assert(h_obj()->is_oop(), "must be NULL or an object"); | |
453 if (UseBiasedLocking) { | |
454 // Retry fast entry if bias is revoked to avoid unnecessary inflation | |
455 ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK); | |
456 } else { | |
7226 | 457 if (GraalUseFastLocking) { |
7221 | 458 // When using fast locking, the compiled code has already tried the fast case |
459 ObjectSynchronizer::slow_enter(h_obj, lock, THREAD); | |
460 } else { | |
461 ObjectSynchronizer::fast_enter(h_obj, lock, false, THREAD); | |
462 } | |
463 } | |
464 if (TraceGraal >= 3) { | |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17319
diff
changeset
|
465 tty->print_cr("%s: exiting locking slow with obj=" INTPTR_FORMAT, thread->name(), p2i(obj)); |
7221 | 466 } |
467 JRT_END | |
468 | |
7911
983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
Doug Simon <doug.simon@oracle.com>
parents:
7735
diff
changeset
|
469 JRT_LEAF(void, GraalRuntime::monitorexit(JavaThread* thread, oopDesc* obj, BasicLock* lock)) |
7221 | 470 assert(thread == JavaThread::current(), "threads must correspond"); |
471 assert(thread->last_Java_sp(), "last_Java_sp must be set"); | |
472 // monitorexit is non-blocking (leaf routine) => no exceptions can be thrown | |
473 EXCEPTION_MARK; | |
474 | |
475 #ifdef DEBUG | |
476 if (!obj->is_oop()) { | |
477 ResetNoHandleMark rhm; | |
478 nmethod* method = thread->last_frame().cb()->as_nmethod_or_null(); | |
479 if (method != NULL) { | |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17319
diff
changeset
|
480 tty->print_cr("ERROR in monitorexit in method %s wrong obj " INTPTR_FORMAT, method->name(), p2i(obj)); |
7221 | 481 } |
482 thread->print_stack_on(tty); | |
483 assert(false, "invalid lock object pointer dected"); | |
484 } | |
485 #endif | |
486 | |
7226 | 487 if (GraalUseFastLocking) { |
7221 | 488 // When using fast locking, the compiled code has already tried the fast case |
489 ObjectSynchronizer::slow_exit(obj, lock, THREAD); | |
490 } else { | |
491 ObjectSynchronizer::fast_exit(obj, lock, THREAD); | |
492 } | |
493 if (TraceGraal >= 3) { | |
494 char type[O_BUFLEN]; | |
495 obj->klass()->name()->as_C_string(type, O_BUFLEN); | |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17319
diff
changeset
|
496 tty->print_cr("%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)); |
7221 | 497 tty->flush(); |
498 } | |
499 JRT_END | |
500 | |
16887
aa412e64808e
logObject and logPrimitive should be leaf
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16876
diff
changeset
|
501 JRT_LEAF(void, GraalRuntime::log_object(JavaThread* thread, oopDesc* obj, jint flags)) |
7221 | 502 bool string = mask_bits_are_true(flags, LOG_OBJECT_STRING); |
12356
359f7e70ae7f
Reduce HotSpot diff and fix previous merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10953
diff
changeset
|
503 bool addr = mask_bits_are_true(flags, LOG_OBJECT_ADDRESS); |
7221 | 504 bool newline = mask_bits_are_true(flags, LOG_OBJECT_NEWLINE); |
505 if (!string) { | |
12356
359f7e70ae7f
Reduce HotSpot diff and fix previous merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10953
diff
changeset
|
506 if (!addr && obj->is_oop_or_null(true)) { |
7221 | 507 char buf[O_BUFLEN]; |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17319
diff
changeset
|
508 tty->print("%s@" INTPTR_FORMAT, obj->klass()->name()->as_C_string(buf, O_BUFLEN), p2i(obj)); |
7221 | 509 } else { |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17319
diff
changeset
|
510 tty->print(INTPTR_FORMAT, p2i(obj)); |
7221 | 511 } |
512 } else { | |
513 ResourceMark rm; | |
514 assert(obj != NULL && java_lang_String::is_instance(obj), "must be"); | |
515 char *buf = java_lang_String::as_utf8_string(obj); | |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17319
diff
changeset
|
516 tty->print_raw(buf); |
7221 | 517 } |
518 if (newline) { | |
519 tty->cr(); | |
520 } | |
521 JRT_END | |
522 | |
10434
8b22524df53b
Add G1 Barriers' foreign calls
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10072
diff
changeset
|
523 JRT_LEAF(void, GraalRuntime::write_barrier_pre(JavaThread* thread, oopDesc* obj)) |
8b22524df53b
Add G1 Barriers' foreign calls
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10072
diff
changeset
|
524 thread->satb_mark_queue().enqueue(obj); |
8b22524df53b
Add G1 Barriers' foreign calls
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10072
diff
changeset
|
525 JRT_END |
8b22524df53b
Add G1 Barriers' foreign calls
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10072
diff
changeset
|
526 |
8b22524df53b
Add G1 Barriers' foreign calls
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10072
diff
changeset
|
527 JRT_LEAF(void, GraalRuntime::write_barrier_post(JavaThread* thread, void* card_addr)) |
8b22524df53b
Add G1 Barriers' foreign calls
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10072
diff
changeset
|
528 thread->dirty_card_queue().enqueue(card_addr); |
8b22524df53b
Add G1 Barriers' foreign calls
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10072
diff
changeset
|
529 JRT_END |
8b22524df53b
Add G1 Barriers' foreign calls
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10072
diff
changeset
|
530 |
12356
359f7e70ae7f
Reduce HotSpot diff and fix previous merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10953
diff
changeset
|
531 JRT_LEAF(jboolean, GraalRuntime::validate_object(JavaThread* thread, oopDesc* parent, oopDesc* child)) |
10953
97e282186b5b
Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10542
diff
changeset
|
532 bool ret = true; |
97e282186b5b
Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10542
diff
changeset
|
533 if(!Universe::heap()->is_in_closed_subset(parent)) { |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17319
diff
changeset
|
534 tty->print_cr("Parent Object "INTPTR_FORMAT" not in heap", p2i(parent)); |
10953
97e282186b5b
Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10542
diff
changeset
|
535 parent->print(); |
97e282186b5b
Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10542
diff
changeset
|
536 ret=false; |
97e282186b5b
Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10542
diff
changeset
|
537 } |
97e282186b5b
Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10542
diff
changeset
|
538 if(!Universe::heap()->is_in_closed_subset(child)) { |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17319
diff
changeset
|
539 tty->print_cr("Child Object "INTPTR_FORMAT" not in heap", p2i(child)); |
10953
97e282186b5b
Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10542
diff
changeset
|
540 child->print(); |
97e282186b5b
Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10542
diff
changeset
|
541 ret=false; |
97e282186b5b
Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10542
diff
changeset
|
542 } |
97e282186b5b
Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10542
diff
changeset
|
543 return (jint)ret; |
97e282186b5b
Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10542
diff
changeset
|
544 JRT_END |
97e282186b5b
Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10542
diff
changeset
|
545 |
14731
0cb5c4d276d4
use raw data support to fix incorrect use of String.intern() for embedding strings in code
Doug Simon <doug.simon@oracle.com>
parents:
14608
diff
changeset
|
546 JRT_ENTRY(void, GraalRuntime::vm_error(JavaThread* thread, jlong where, jlong format, jlong value)) |
7221 | 547 ResourceMark rm; |
14731
0cb5c4d276d4
use raw data support to fix incorrect use of String.intern() for embedding strings in code
Doug Simon <doug.simon@oracle.com>
parents:
14608
diff
changeset
|
548 const char *error_msg = where == 0L ? "<internal Graal error>" : (char*) (address) where; |
7221 | 549 char *detail_msg = NULL; |
14731
0cb5c4d276d4
use raw data support to fix incorrect use of String.intern() for embedding strings in code
Doug Simon <doug.simon@oracle.com>
parents:
14608
diff
changeset
|
550 if (format != 0L) { |
0cb5c4d276d4
use raw data support to fix incorrect use of String.intern() for embedding strings in code
Doug Simon <doug.simon@oracle.com>
parents:
14608
diff
changeset
|
551 const char* buf = (char*) (address) format; |
7221 | 552 size_t detail_msg_length = strlen(buf) * 2; |
553 detail_msg = (char *) NEW_RESOURCE_ARRAY(u_char, detail_msg_length); | |
554 jio_snprintf(detail_msg, detail_msg_length, buf, value); | |
555 } | |
556 report_vm_error(__FILE__, __LINE__, error_msg, detail_msg); | |
557 JRT_END | |
558 | |
12423
370b5f07f9e2
The runtime entries need to use oopDesc* rather than oop in their signature
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12372
diff
changeset
|
559 JRT_LEAF(oopDesc*, GraalRuntime::load_and_clear_exception(JavaThread* thread)) |
9820
1b60f639ac4b
implemented alternative implementation for loading the exception object from the thread at the start of an exception dispatcher
Doug Simon <doug.simon@oracle.com>
parents:
9596
diff
changeset
|
560 oop exception = thread->exception_oop(); |
1b60f639ac4b
implemented alternative implementation for loading the exception object from the thread at the start of an exception dispatcher
Doug Simon <doug.simon@oracle.com>
parents:
9596
diff
changeset
|
561 assert(exception != NULL, "npe"); |
1b60f639ac4b
implemented alternative implementation for loading the exception object from the thread at the start of an exception dispatcher
Doug Simon <doug.simon@oracle.com>
parents:
9596
diff
changeset
|
562 thread->set_exception_oop(NULL); |
1b60f639ac4b
implemented alternative implementation for loading the exception object from the thread at the start of an exception dispatcher
Doug Simon <doug.simon@oracle.com>
parents:
9596
diff
changeset
|
563 thread->set_exception_pc(0); |
1b60f639ac4b
implemented alternative implementation for loading the exception object from the thread at the start of an exception dispatcher
Doug Simon <doug.simon@oracle.com>
parents:
9596
diff
changeset
|
564 return exception; |
1b60f639ac4b
implemented alternative implementation for loading the exception object from the thread at the start of an exception dispatcher
Doug Simon <doug.simon@oracle.com>
parents:
9596
diff
changeset
|
565 JRT_END |
8506 | 566 |
12423
370b5f07f9e2
The runtime entries need to use oopDesc* rather than oop in their signature
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12372
diff
changeset
|
567 JRT_LEAF(void, GraalRuntime::log_printf(JavaThread* thread, oopDesc* format, jlong v1, jlong v2, jlong v3)) |
7221 | 568 ResourceMark rm; |
569 assert(format != NULL && java_lang_String::is_instance(format), "must be"); | |
570 char *buf = java_lang_String::as_utf8_string(format); | |
7235
a6bd253a770f
expanded LOG_PRINTF stub to handle up to 3 arguments in addition to the format string
Doug Simon <doug.simon@oracle.com>
parents:
7226
diff
changeset
|
571 tty->print(buf, v1, v2, v3); |
7221 | 572 JRT_END |
573 | |
9573
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
574 static void decipher(jlong v, bool ignoreZero) { |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
575 if (v != 0 || !ignoreZero) { |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
576 void* p = (void *)(address) v; |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
577 CodeBlob* cb = CodeCache::find_blob(p); |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
578 if (cb) { |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
579 if (cb->is_nmethod()) { |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
580 char buf[O_BUFLEN]; |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17319
diff
changeset
|
581 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())); |
9573
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
582 return; |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
583 } |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
584 cb->print_value_on(tty); |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
585 return; |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
586 } |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
587 if (Universe::heap()->is_in(p)) { |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
588 oop obj = oop(p); |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
589 obj->print_value_on(tty); |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
590 return; |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
591 } |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17319
diff
changeset
|
592 tty->print(INTPTR_FORMAT " [long: " JLONG_FORMAT ", double %lf, char %c]",p2i((void *)v), (jlong)v, (jdouble)v, (char)v); |
9573
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
593 } |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
594 } |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
595 |
9471
5fa54bf57f8c
replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9457
diff
changeset
|
596 JRT_LEAF(void, GraalRuntime::vm_message(jboolean vmError, jlong format, jlong v1, jlong v2, jlong v3)) |
9232
bb2447c64055
strings used in compiled stubs are lowered to malloc'ed C strings so that there are no embedded oops (for the strings) in the resulting installed code
Doug Simon <doug.simon@oracle.com>
parents:
8506
diff
changeset
|
597 ResourceMark rm; |
bb2447c64055
strings used in compiled stubs are lowered to malloc'ed C strings so that there are no embedded oops (for the strings) in the resulting installed code
Doug Simon <doug.simon@oracle.com>
parents:
8506
diff
changeset
|
598 char *buf = (char*) (address) format; |
9471
5fa54bf57f8c
replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9457
diff
changeset
|
599 if (vmError) { |
9573
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
600 if (buf != NULL) { |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
601 fatal(err_msg(buf, v1, v2, v3)); |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
602 } else { |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
603 fatal("<anonymous error>"); |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
604 } |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
605 } else if (buf != NULL) { |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
606 tty->print(buf, v1, v2, v3); |
9471
5fa54bf57f8c
replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9457
diff
changeset
|
607 } else { |
9573
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
608 assert(v2 == 0, "v2 != 0"); |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
609 assert(v3 == 0, "v3 != 0"); |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
610 decipher(v1, false); |
9471
5fa54bf57f8c
replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9457
diff
changeset
|
611 } |
9232
bb2447c64055
strings used in compiled stubs are lowered to malloc'ed C strings so that there are no embedded oops (for the strings) in the resulting installed code
Doug Simon <doug.simon@oracle.com>
parents:
8506
diff
changeset
|
612 JRT_END |
bb2447c64055
strings used in compiled stubs are lowered to malloc'ed C strings so that there are no embedded oops (for the strings) in the resulting installed code
Doug Simon <doug.simon@oracle.com>
parents:
8506
diff
changeset
|
613 |
16887
aa412e64808e
logObject and logPrimitive should be leaf
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16876
diff
changeset
|
614 JRT_LEAF(void, GraalRuntime::log_primitive(JavaThread* thread, jchar typeChar, jlong value, jboolean newline)) |
7221 | 615 union { |
616 jlong l; | |
617 jdouble d; | |
618 jfloat f; | |
619 } uu; | |
620 uu.l = value; | |
621 switch (typeChar) { | |
622 case 'z': tty->print(value == 0 ? "false" : "true"); break; | |
623 case 'b': tty->print("%d", (jbyte) value); break; | |
624 case 'c': tty->print("%c", (jchar) value); break; | |
625 case 's': tty->print("%d", (jshort) value); break; | |
626 case 'i': tty->print("%d", (jint) value); break; | |
627 case 'f': tty->print("%f", uu.f); break; | |
628 case 'j': tty->print(INT64_FORMAT, value); break; | |
629 case 'd': tty->print("%lf", uu.d); break; | |
630 default: assert(false, "unknown typeChar"); break; | |
631 } | |
632 if (newline) { | |
633 tty->cr(); | |
634 } | |
635 JRT_END | |
636 | |
12423
370b5f07f9e2
The runtime entries need to use oopDesc* rather than oop in their signature
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12372
diff
changeset
|
637 JRT_ENTRY(jint, GraalRuntime::identity_hash_code(JavaThread* thread, oopDesc* obj)) |
7221 | 638 return (jint) obj->identity_hash(); |
639 JRT_END | |
640 | |
12423
370b5f07f9e2
The runtime entries need to use oopDesc* rather than oop in their signature
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12372
diff
changeset
|
641 JRT_ENTRY(jboolean, GraalRuntime::thread_is_interrupted(JavaThread* thread, oopDesc* receiver, jboolean clear_interrupted)) |
7220
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7216
diff
changeset
|
642 // Ensure that the C++ Thread and OSThread structures aren't freed before we operate |
fcae6d960acd
added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7216
diff
changeset
|
643 Handle receiverHandle(thread, receiver); |
12423
370b5f07f9e2
The runtime entries need to use oopDesc* rather than oop in their signature
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12372
diff
changeset
|
644 MutexLockerEx ml(thread->threadObj() == (void*)receiver ? NULL : Threads_lock); |
7386
707e9cca11de
fixed HotSpot windows build
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7235
diff
changeset
|
645 JavaThread* receiverThread = java_lang_Thread::thread(receiverHandle()); |
14608
682fba1bcf95
add missing null check in is_interrupted
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13578
diff
changeset
|
646 if (receiverThread == NULL) { |
682fba1bcf95
add missing null check in is_interrupted
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13578
diff
changeset
|
647 // The other thread may exit during this process, which is ok so return false. |
682fba1bcf95
add missing null check in is_interrupted
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13578
diff
changeset
|
648 return JNI_FALSE; |
682fba1bcf95
add missing null check in is_interrupted
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13578
diff
changeset
|
649 } else { |
682fba1bcf95
add missing null check in is_interrupted
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13578
diff
changeset
|
650 return (jint) Thread::is_interrupted(receiverThread, clear_interrupted != 0); |
682fba1bcf95
add missing null check in is_interrupted
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13578
diff
changeset
|
651 } |
7221 | 652 JRT_END |
653 | |
18227
bcb1e5c232d8
Test deoptimization inside ForeignCallNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18043
diff
changeset
|
654 JRT_ENTRY(jint, GraalRuntime::test_deoptimize_call_int(JavaThread* thread, int value)) |
bcb1e5c232d8
Test deoptimization inside ForeignCallNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18043
diff
changeset
|
655 deopt_caller(); |
bcb1e5c232d8
Test deoptimization inside ForeignCallNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18043
diff
changeset
|
656 return value; |
bcb1e5c232d8
Test deoptimization inside ForeignCallNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18043
diff
changeset
|
657 JRT_END |
bcb1e5c232d8
Test deoptimization inside ForeignCallNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18043
diff
changeset
|
658 |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
659 // private static GraalRuntime Graal.initializeRuntime() |
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
660 JVM_ENTRY(jobject, JVM_GetGraalRuntime(JNIEnv *env, jclass c)) |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
661 return GraalRuntime::get_HotSpotGraalRuntime_jobject(); |
7221 | 662 JVM_END |
10475
3489047ffea2
Restructure the handling of HotSpotInstalledCode and their link to nmethods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10434
diff
changeset
|
663 |
15916
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
664 // private static String[] Graal.getServiceImpls(Class service) |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
665 JVM_ENTRY(jobject, JVM_GetGraalServiceImpls(JNIEnv *env, jclass c, jclass serviceClass)) |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
666 HandleMark hm; |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
667 KlassHandle serviceKlass(THREAD, java_lang_Class::as_Klass(JNIHandles::resolve_non_null(serviceClass))); |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
668 return JNIHandles::make_local(THREAD, GraalRuntime::get_service_impls(serviceKlass, THREAD)()); |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
669 JVM_END |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
670 |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
671 // private static TruffleRuntime Truffle.createRuntime() |
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
672 JVM_ENTRY(jobject, JVM_CreateTruffleRuntime(JNIEnv *env, jclass c)) |
16428
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
673 TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime", CHECK_NULL); |
16395
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16291
diff
changeset
|
674 KlassHandle klass = GraalRuntime::resolve_or_fail(name, CHECK_NULL); |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
675 |
16428
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
676 TempNewSymbol makeInstance = SymbolTable::new_symbol("makeInstance", CHECK_NULL); |
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
677 TempNewSymbol sig = SymbolTable::new_symbol("()Lcom/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime;", CHECK_NULL); |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
678 JavaValue result(T_OBJECT); |
16428
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
679 JavaCalls::call_static(&result, klass, makeInstance, sig, CHECK_NULL); |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
680 return JNIHandles::make_local((oop) result.get_jobject()); |
10475
3489047ffea2
Restructure the handling of HotSpotInstalledCode and their link to nmethods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10434
diff
changeset
|
681 JVM_END |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
682 |
16691
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16683
diff
changeset
|
683 // private static NativeFunctionInterfaceRuntime.createInterface() |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16683
diff
changeset
|
684 JVM_ENTRY(jobject, JVM_CreateNativeFunctionInterface(JNIEnv *env, jclass c)) |
16717
91e7d77cfb81
NFI: initialization only if platform is x86
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16691
diff
changeset
|
685 const char* backendName = NULL; |
91e7d77cfb81
NFI: initialization only if platform is x86
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16691
diff
changeset
|
686 #ifdef TARGET_ARCH_x86 |
91e7d77cfb81
NFI: initialization only if platform is x86
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16691
diff
changeset
|
687 #ifdef _LP64 |
91e7d77cfb81
NFI: initialization only if platform is x86
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16691
diff
changeset
|
688 backendName = "com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend"; |
91e7d77cfb81
NFI: initialization only if platform is x86
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16691
diff
changeset
|
689 #endif |
91e7d77cfb81
NFI: initialization only if platform is x86
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16691
diff
changeset
|
690 #endif |
91e7d77cfb81
NFI: initialization only if platform is x86
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16691
diff
changeset
|
691 |
91e7d77cfb81
NFI: initialization only if platform is x86
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16691
diff
changeset
|
692 if (backendName == NULL) { |
91e7d77cfb81
NFI: initialization only if platform is x86
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16691
diff
changeset
|
693 return NULL; |
91e7d77cfb81
NFI: initialization only if platform is x86
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16691
diff
changeset
|
694 } |
91e7d77cfb81
NFI: initialization only if platform is x86
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16691
diff
changeset
|
695 TempNewSymbol name = SymbolTable::new_symbol(backendName, CHECK_NULL); |
16691
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16683
diff
changeset
|
696 KlassHandle klass = GraalRuntime::resolve_or_fail(name, CHECK_NULL); |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16683
diff
changeset
|
697 |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16683
diff
changeset
|
698 TempNewSymbol makeInstance = SymbolTable::new_symbol("createNativeFunctionInterface", CHECK_NULL); |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16683
diff
changeset
|
699 TempNewSymbol sig = SymbolTable::new_symbol("()Lcom/oracle/nfi/api/NativeFunctionInterface;", CHECK_NULL); |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16683
diff
changeset
|
700 JavaValue result(T_OBJECT); |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16683
diff
changeset
|
701 JavaCalls::call_static(&result, klass, makeInstance, sig, CHECK_NULL); |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16683
diff
changeset
|
702 return JNIHandles::make_local((oop) result.get_jobject()); |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16683
diff
changeset
|
703 JVM_END |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
16683
diff
changeset
|
704 |
16628
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16580
diff
changeset
|
705 void GraalRuntime::check_generated_sources_sha1(TRAPS) { |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16580
diff
changeset
|
706 TempNewSymbol name = SymbolTable::new_symbol("GeneratedSourcesSha1", CHECK_ABORT); |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16580
diff
changeset
|
707 KlassHandle klass = load_required_class(name); |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16580
diff
changeset
|
708 fieldDescriptor fd; |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16580
diff
changeset
|
709 if (!InstanceKlass::cast(klass())->find_field(vmSymbols::value_name(), vmSymbols::string_signature(), true, &fd)) { |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16580
diff
changeset
|
710 THROW_MSG(vmSymbols::java_lang_NoSuchFieldError(), "GeneratedSourcesSha1.value"); |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16580
diff
changeset
|
711 } |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16580
diff
changeset
|
712 |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16580
diff
changeset
|
713 Symbol* value = java_lang_String::as_symbol(klass->java_mirror()->obj_field(fd.offset()), CHECK); |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16580
diff
changeset
|
714 if (!value->equals(_generated_sources_sha1)) { |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16580
diff
changeset
|
715 char buf[200]; |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16580
diff
changeset
|
716 jio_snprintf(buf, sizeof(buf), "Generated sources SHA1 check failed (%s != %s) - need to rebuild the VM", value->as_C_string(), _generated_sources_sha1); |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16580
diff
changeset
|
717 THROW_MSG(vmSymbols::java_lang_InternalError(), buf); |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16580
diff
changeset
|
718 } |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16580
diff
changeset
|
719 } |
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16580
diff
changeset
|
720 |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
721 Handle GraalRuntime::get_HotSpotGraalRuntime() { |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
722 if (JNIHandles::resolve(_HotSpotGraalRuntime_instance) == NULL) { |
16683
4d0d1dc5db00
introduce extra field to record when HotSpotGraalRuntime has been initialized to avoid spurious errors during VM shutdown for short lived applications
Doug Simon <doug.simon@oracle.com>
parents:
16679
diff
changeset
|
723 guarantee(!_HotSpotGraalRuntime_initialized, "cannot reinitialize HotSpotGraalRuntime"); |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
724 Thread* THREAD = Thread::current(); |
16628
d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
Doug Simon <doug.simon@oracle.com>
parents:
16580
diff
changeset
|
725 check_generated_sources_sha1(CHECK_ABORT_(Handle())); |
16428
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
726 TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/hotspot/HotSpotGraalRuntime", CHECK_ABORT_(Handle())); |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
727 KlassHandle klass = load_required_class(name); |
16428
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
728 TempNewSymbol runtime = SymbolTable::new_symbol("runtime", CHECK_ABORT_(Handle())); |
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
729 TempNewSymbol sig = SymbolTable::new_symbol("()Lcom/oracle/graal/hotspot/HotSpotGraalRuntime;", CHECK_ABORT_(Handle())); |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
730 JavaValue result(T_OBJECT); |
16428
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
731 JavaCalls::call_static(&result, klass, runtime, sig, CHECK_ABORT_(Handle())); |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
732 _HotSpotGraalRuntime_instance = JNIHandles::make_global((oop) result.get_jobject()); |
16683
4d0d1dc5db00
introduce extra field to record when HotSpotGraalRuntime has been initialized to avoid spurious errors during VM shutdown for short lived applications
Doug Simon <doug.simon@oracle.com>
parents:
16679
diff
changeset
|
733 _HotSpotGraalRuntime_initialized = true; |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
734 } |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
735 return Handle(JNIHandles::resolve_non_null(_HotSpotGraalRuntime_instance)); |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
736 } |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
737 |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
738 // private static void CompilerToVMImpl.init() |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
739 JVM_ENTRY(void, JVM_InitializeGraalNatives(JNIEnv *env, jclass c2vmClass)) |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
740 GraalRuntime::initialize_natives(env, c2vmClass); |
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
741 JVM_END |
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
742 |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
743 // private static boolean HotSpotOptions.parseVMOptions() |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
744 JVM_ENTRY(jboolean, JVM_ParseGraalOptions(JNIEnv *env, jclass c)) |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
745 HandleMark hm; |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
746 KlassHandle hotSpotOptionsClass(THREAD, java_lang_Class::as_Klass(JNIHandles::resolve_non_null(c))); |
16876
9d4c73b0646e
graalRuntime: name_len shound be a size_t
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16870
diff
changeset
|
747 bool result = GraalRuntime::parse_arguments(hotSpotOptionsClass, CHECK_false); |
9d4c73b0646e
graalRuntime: name_len shound be a size_t
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16870
diff
changeset
|
748 return result; |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
749 JVM_END |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
750 |
16270
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
751 jint GraalRuntime::check_arguments(TRAPS) { |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
752 KlassHandle nullHandle; |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
753 parse_arguments(nullHandle, THREAD); |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
754 if (HAS_PENDING_EXCEPTION) { |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
755 // Errors in parsing Graal arguments cause exceptions. |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
756 // We now load and initialize HotSpotOptions which in turn |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
757 // causes argument parsing to be redone with better error messages. |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
758 CLEAR_PENDING_EXCEPTION; |
16428
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
759 TempNewSymbol name = SymbolTable::new_symbol("Lcom/oracle/graal/hotspot/HotSpotOptions;", CHECK_ABORT_(JNI_ERR)); |
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
760 instanceKlassHandle hotSpotOptionsClass = resolve_or_fail(name, CHECK_ABORT_(JNI_ERR)); |
16270
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
761 |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
762 parse_arguments(hotSpotOptionsClass, THREAD); |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
763 assert(HAS_PENDING_EXCEPTION, "must be"); |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
764 |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
765 ResourceMark rm; |
16273
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
766 Handle exception = PENDING_EXCEPTION; |
16270
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
767 CLEAR_PENDING_EXCEPTION; |
16273
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
768 oop message = java_lang_Throwable::message(exception); |
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
769 if (message != NULL) { |
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
770 tty->print_cr("Error parsing Graal options: %s", java_lang_String::as_utf8_string(message)); |
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
771 } else { |
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
772 call_printStackTrace(exception, THREAD); |
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
773 } |
16270
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
774 return JNI_ERR; |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
775 } |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
776 return JNI_OK; |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
777 } |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
778 |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
779 bool GraalRuntime::parse_arguments(KlassHandle hotSpotOptionsClass, TRAPS) { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
780 ResourceMark rm(THREAD); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
781 |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
782 // Process option overrides from graal.options first |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
783 parse_graal_options_file(hotSpotOptionsClass, CHECK_false); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
784 |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
785 // Now process options on the command line |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
786 int numOptions = Arguments::num_graal_args(); |
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
787 for (int i = 0; i < numOptions; i++) { |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
788 char* arg = Arguments::graal_args_array()[i]; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
789 parse_argument(hotSpotOptionsClass, arg, CHECK_false); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
790 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
791 return CITime || CITimeEach; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
792 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
793 |
16876
9d4c73b0646e
graalRuntime: name_len shound be a size_t
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16870
diff
changeset
|
794 void GraalRuntime::check_required_value(const char* name, size_t name_len, const char* value, TRAPS) { |
16270
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
795 if (value == NULL) { |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
796 char buf[200]; |
16273
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
797 jio_snprintf(buf, sizeof(buf), "Must use '-G:%.*s=<value>' format for %.*s option", name_len, name, name_len, name); |
16270
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
798 THROW_MSG(vmSymbols::java_lang_InternalError(), buf); |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
799 } |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
800 } |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
801 |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
802 void GraalRuntime::parse_argument(KlassHandle hotSpotOptionsClass, char* arg, TRAPS) { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
803 char first = arg[0]; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
804 char* name; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
805 size_t name_len; |
16270
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
806 bool recognized = true; |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
807 if (first == '+' || first == '-') { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
808 name = arg + 1; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
809 name_len = strlen(name); |
16876
9d4c73b0646e
graalRuntime: name_len shound be a size_t
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16870
diff
changeset
|
810 recognized = set_option_bool(hotSpotOptionsClass, name, name_len, first, CHECK); |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
811 } else { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
812 char* sep = strchr(arg, '='); |
16270
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
813 name = arg; |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
814 char* value = NULL; |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
815 if (sep != NULL) { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
816 name_len = sep - name; |
16270
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
817 value = sep + 1; |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
818 } else { |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
819 name_len = strlen(name); |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
820 } |
16876
9d4c73b0646e
graalRuntime: name_len shound be a size_t
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16870
diff
changeset
|
821 recognized = set_option(hotSpotOptionsClass, name, name_len, value, CHECK); |
16270
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
822 } |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
823 |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
824 if (!recognized) { |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
825 bool throw_err = hotSpotOptionsClass.is_null(); |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
826 if (!hotSpotOptionsClass.is_null()) { |
16876
9d4c73b0646e
graalRuntime: name_len shound be a size_t
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16870
diff
changeset
|
827 set_option_helper(hotSpotOptionsClass, name, name_len, Handle(), ' ', Handle(), 0L); |
16275
7af7db0bbfe9
handle unwinding exception through recursive call properly
Doug Simon <doug.simon@oracle.com>
parents:
16274
diff
changeset
|
828 if (!HAS_PENDING_EXCEPTION) { |
16270
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
829 throw_err = true; |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
830 } |
16270
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
831 } |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
832 |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
833 if (throw_err) { |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
834 char buf[200]; |
16270
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
835 jio_snprintf(buf, sizeof(buf), "Unrecognized Graal option %.*s", name_len, name); |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
836 THROW_MSG(vmSymbols::java_lang_InternalError(), buf); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
837 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
838 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
839 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
840 |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
841 void GraalRuntime::parse_graal_options_file(KlassHandle hotSpotOptionsClass, TRAPS) { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
842 const char* home = Arguments::get_java_home(); |
16876
9d4c73b0646e
graalRuntime: name_len shound be a size_t
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16870
diff
changeset
|
843 size_t path_len = strlen(home) + strlen("/lib/graal.options") + 1; |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
844 char* path = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, path_len); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
845 char sep = os::file_separator()[0]; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
846 sprintf(path, "%s%clib%cgraal.options", home, sep, sep); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
847 |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
848 struct stat st; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
849 if (os::stat(path, &st) == 0) { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
850 int file_handle = os::open(path, 0, 0); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
851 if (file_handle != -1) { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
852 char* buffer = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, st.st_size); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
853 int num_read = (int) os::read(file_handle, (char*) buffer, st.st_size); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
854 if (num_read == -1) { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
855 warning("Error reading file %s due to %s", path, strerror(errno)); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
856 } else if (num_read != st.st_size) { |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17319
diff
changeset
|
857 warning("Only read %d of " SIZE_FORMAT " bytes from %s", num_read, st.st_size, path); |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
858 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
859 os::close(file_handle); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
860 if (num_read == st.st_size) { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
861 char* line = buffer; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
862 int lineNo = 1; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
863 while (line - buffer < num_read) { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
864 char* nl = strchr(line, '\n'); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
865 if (nl != NULL) { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
866 *nl = '\0'; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
867 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
868 parse_argument(hotSpotOptionsClass, line, THREAD); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
869 if (HAS_PENDING_EXCEPTION) { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
870 warning("Error in %s:%d", path, lineNo); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
871 return; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
872 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
873 if (nl != NULL) { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
874 line = nl + 1; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
875 lineNo++; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
876 } else { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
877 // File without newline at the end |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
878 break; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
879 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
880 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
881 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
882 } else { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
883 warning("Error opening file %s due to %s", path, strerror(errno)); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
884 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
885 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
886 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
887 |
16876
9d4c73b0646e
graalRuntime: name_len shound be a size_t
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16870
diff
changeset
|
888 jlong GraalRuntime::parse_primitive_option_value(char spec, const char* name, size_t name_len, const char* value, TRAPS) { |
16270
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
889 check_required_value(name, name_len, value, CHECK_(0L)); |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
890 union { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
891 jint i; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
892 jlong l; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
893 double d; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
894 } uu; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
895 uu.l = 0L; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
896 char dummy; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
897 switch (spec) { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
898 case 'd': |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
899 case 'f': { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
900 if (sscanf(value, "%lf%c", &uu.d, &dummy) == 1) { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
901 return uu.l; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
902 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
903 break; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
904 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
905 case 'i': { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
906 if (sscanf(value, "%d%c", &uu.i, &dummy) == 1) { |
17165
5247c895a6ab
[SPARC] Use Fzero(d|s) for clearing a fp register
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17033
diff
changeset
|
907 return (jlong)uu.i; |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
908 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
909 break; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
910 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
911 default: |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
912 ShouldNotReachHere(); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
913 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
914 ResourceMark rm(THREAD); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
915 char buf[200]; |
16274
60c3f610183e
separate error messages for missing versus invalid non-String option values
Doug Simon <doug.simon@oracle.com>
parents:
16273
diff
changeset
|
916 bool missing = strlen(value) == 0; |
60c3f610183e
separate error messages for missing versus invalid non-String option values
Doug Simon <doug.simon@oracle.com>
parents:
16273
diff
changeset
|
917 if (missing) { |
60c3f610183e
separate error messages for missing versus invalid non-String option values
Doug Simon <doug.simon@oracle.com>
parents:
16273
diff
changeset
|
918 jio_snprintf(buf, sizeof(buf), "Missing %s value for Graal option %.*s", (spec == 'i' ? "numeric" : "float/double"), name_len, name); |
60c3f610183e
separate error messages for missing versus invalid non-String option values
Doug Simon <doug.simon@oracle.com>
parents:
16273
diff
changeset
|
919 } else { |
60c3f610183e
separate error messages for missing versus invalid non-String option values
Doug Simon <doug.simon@oracle.com>
parents:
16273
diff
changeset
|
920 jio_snprintf(buf, sizeof(buf), "Invalid %s value for Graal option %.*s: %s", (spec == 'i' ? "numeric" : "float/double"), name_len, name, value); |
60c3f610183e
separate error messages for missing versus invalid non-String option values
Doug Simon <doug.simon@oracle.com>
parents:
16273
diff
changeset
|
921 } |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
922 THROW_MSG_(vmSymbols::java_lang_InternalError(), buf, 0L); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
923 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
924 |
16876
9d4c73b0646e
graalRuntime: name_len shound be a size_t
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16870
diff
changeset
|
925 void GraalRuntime::set_option_helper(KlassHandle hotSpotOptionsClass, char* name, size_t name_len, Handle option, jchar spec, Handle stringValue, jlong primitiveValue) { |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
926 Thread* THREAD = Thread::current(); |
16270
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
927 Handle name_handle; |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
928 if (name != NULL) { |
16876
9d4c73b0646e
graalRuntime: name_len shound be a size_t
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16870
diff
changeset
|
929 if (strlen(name) > name_len) { |
16270
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
930 // Temporarily replace '=' with NULL to create the Java string for the option name |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
931 char save = name[name_len]; |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
932 name[name_len] = '\0'; |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
933 name_handle = java_lang_String::create_from_str(name, THREAD); |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
934 name[name_len] = '='; |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
935 if (HAS_PENDING_EXCEPTION) { |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
936 return; |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
937 } |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
938 } else { |
16876
9d4c73b0646e
graalRuntime: name_len shound be a size_t
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16870
diff
changeset
|
939 assert(strlen(name) == name_len, "must be"); |
16270
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
940 name_handle = java_lang_String::create_from_str(name, CHECK); |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
941 } |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
942 } |
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
943 |
16428
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
944 TempNewSymbol setOption = SymbolTable::new_symbol("setOption", CHECK); |
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
945 TempNewSymbol sig = SymbolTable::new_symbol("(Ljava/lang/String;Lcom/oracle/graal/options/OptionValue;CLjava/lang/String;J)V", CHECK); |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
946 JavaValue result(T_VOID); |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
947 JavaCallArguments args; |
16270
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
948 args.push_oop(name_handle()); |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
949 args.push_oop(option()); |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
950 args.push_int(spec); |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
951 args.push_oop(stringValue()); |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
952 args.push_long(primitiveValue); |
16270
d56a09df1a1f
implemented eager checking of Graal options (GRAAL-807)
Doug Simon <doug.simon@oracle.com>
parents:
16006
diff
changeset
|
953 JavaCalls::call_static(&result, hotSpotOptionsClass, setOption, sig, &args, CHECK); |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
954 } |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
955 |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
956 Handle GraalRuntime::get_OptionValue(const char* declaringClass, const char* fieldName, const char* fieldSig, TRAPS) { |
16428
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
957 TempNewSymbol name = SymbolTable::new_symbol(declaringClass, CHECK_NH); |
16395
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16291
diff
changeset
|
958 Klass* klass = resolve_or_fail(name, CHECK_NH); |
15870
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
959 |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
960 // The class has been loaded so the field and signature should already be in the symbol |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
961 // table. If they're not there, the field doesn't exist. |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
962 TempNewSymbol fieldname = SymbolTable::probe(fieldName, (int)strlen(fieldName)); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
963 TempNewSymbol signame = SymbolTable::probe(fieldSig, (int)strlen(fieldSig)); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
964 if (fieldname == NULL || signame == NULL) { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
965 THROW_MSG_(vmSymbols::java_lang_NoSuchFieldError(), (char*) fieldName, Handle()); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
966 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
967 // Make sure class is initialized before handing id's out to fields |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
968 klass->initialize(CHECK_NH); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
969 |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
970 fieldDescriptor fd; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
971 if (!InstanceKlass::cast(klass)->find_field(fieldname, signame, true, &fd)) { |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
972 THROW_MSG_(vmSymbols::java_lang_NoSuchFieldError(), (char*) fieldName, Handle()); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
973 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
974 |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
975 Handle ret = klass->java_mirror()->obj_field(fd.offset()); |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
976 return ret; |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
977 } |
fe608a56e3f7
made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents:
15603
diff
changeset
|
978 |
15916
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
979 Handle GraalRuntime::create_Service(const char* name, TRAPS) { |
16428
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
980 TempNewSymbol kname = SymbolTable::new_symbol(name, CHECK_NH); |
16395
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16291
diff
changeset
|
981 Klass* k = resolve_or_fail(kname, CHECK_NH); |
15916
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
982 instanceKlassHandle klass(THREAD, k); |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
983 klass->initialize(CHECK_NH); |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
984 klass->check_valid_for_instantiation(true, CHECK_NH); |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
985 JavaValue result(T_VOID); |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
986 instanceHandle service = klass->allocate_instance_handle(CHECK_NH); |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
987 JavaCalls::call_special(&result, service, klass, vmSymbols::object_initializer_name(), vmSymbols::void_method_signature(), THREAD); |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
988 return service; |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
989 } |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
990 |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
991 void GraalRuntime::shutdown() { |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
992 if (_HotSpotGraalRuntime_instance != NULL) { |
18303
ab47ef2f2207
disable blocking compilation requests once GraalRuntime::shutdown has been called
Doug Simon <doug.simon@oracle.com>
parents:
18227
diff
changeset
|
993 _shutdown_called = true; |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
994 JavaThread* THREAD = JavaThread::current(); |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
995 HandleMark hm(THREAD); |
16428
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
996 TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/hotspot/HotSpotGraalRuntime", CHECK_ABORT); |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
997 KlassHandle klass = load_required_class(name); |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
998 JavaValue result(T_VOID); |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
999 JavaCallArguments args; |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1000 args.push_oop(get_HotSpotGraalRuntime()); |
16428
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
1001 JavaCalls::call_special(&result, klass, vmSymbols::shutdown_method_name(), vmSymbols::void_method_signature(), &args, CHECK_ABORT); |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1002 |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1003 JNIHandles::destroy_global(_HotSpotGraalRuntime_instance); |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1004 _HotSpotGraalRuntime_instance = NULL; |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1005 } |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1006 } |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1007 |
16273
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
1008 void GraalRuntime::call_printStackTrace(Handle exception, Thread* thread) { |
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
1009 assert(exception->is_a(SystemDictionary::Throwable_klass()), "Throwable instance expected"); |
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
1010 JavaValue result(T_VOID); |
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
1011 JavaCalls::call_virtual(&result, |
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
1012 exception, |
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
1013 KlassHandle(thread, |
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
1014 SystemDictionary::Throwable_klass()), |
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
1015 vmSymbols::printStackTrace_name(), |
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
1016 vmSymbols::void_method_signature(), |
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
1017 thread); |
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
1018 } |
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
1019 |
16395
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16291
diff
changeset
|
1020 oop GraalRuntime::compute_graal_class_loader(TRAPS) { |
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16291
diff
changeset
|
1021 assert(UseGraalClassLoader, "must be"); |
16428
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
1022 TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/hotspot/loader/Factory", CHECK_NULL); |
17319
57b6965524a2
graal init: fail if Factory class cannot be resolved
Doug Simon <doug.simon@oracle.com>
parents:
17167
diff
changeset
|
1023 KlassHandle klass = SystemDictionary::resolve_or_fail(name, true, CHECK_NULL); |
16395
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16291
diff
changeset
|
1024 |
16428
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
1025 TempNewSymbol getClassLoader = SymbolTable::new_symbol("newClassLoader", CHECK_NULL); |
16395
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16291
diff
changeset
|
1026 JavaValue result(T_OBJECT); |
16428
78ddecd6255f
added CHECK macros in uses of SymbolTable::new_symbol; added CHECK_ABORT macros for TRAPS functions that must abort the VM if they throw an exception
Doug Simon <doug.simon@oracle.com>
parents:
16399
diff
changeset
|
1027 JavaCalls::call_static(&result, klass, getClassLoader, vmSymbols::void_classloader_signature(), CHECK_NULL); |
16395
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16291
diff
changeset
|
1028 return (oop) result.get_jobject(); |
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16291
diff
changeset
|
1029 } |
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16291
diff
changeset
|
1030 |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1031 void GraalRuntime::abort_on_pending_exception(Handle exception, const char* message, bool dump_core) { |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1032 Thread* THREAD = Thread::current(); |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1033 CLEAR_PENDING_EXCEPTION; |
18043
f55f2d400797
Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
17319
diff
changeset
|
1034 tty->print_raw_cr(message); |
16273
d6ffc6164830
handle any exception raised during Graal option checking/parsing, not just those with a non-null message
Doug Simon <doug.simon@oracle.com>
parents:
16270
diff
changeset
|
1035 call_printStackTrace(exception, THREAD); |
16679
58622d6b1097
give all aborting threads a chance to print Graal related stack traces
Doug Simon <doug.simon@oracle.com>
parents:
16628
diff
changeset
|
1036 |
58622d6b1097
give all aborting threads a chance to print Graal related stack traces
Doug Simon <doug.simon@oracle.com>
parents:
16628
diff
changeset
|
1037 // Give other aborting threads to also print their stack traces. |
58622d6b1097
give all aborting threads a chance to print Graal related stack traces
Doug Simon <doug.simon@oracle.com>
parents:
16628
diff
changeset
|
1038 // This can be very useful when debugging class initialization |
58622d6b1097
give all aborting threads a chance to print Graal related stack traces
Doug Simon <doug.simon@oracle.com>
parents:
16628
diff
changeset
|
1039 // failures. |
58622d6b1097
give all aborting threads a chance to print Graal related stack traces
Doug Simon <doug.simon@oracle.com>
parents:
16628
diff
changeset
|
1040 os::sleep(THREAD, 200, false); |
58622d6b1097
give all aborting threads a chance to print Graal related stack traces
Doug Simon <doug.simon@oracle.com>
parents:
16628
diff
changeset
|
1041 |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1042 vm_abort(dump_core); |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1043 } |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1044 |
16395
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16291
diff
changeset
|
1045 Klass* GraalRuntime::resolve_or_null(Symbol* name, TRAPS) { |
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16291
diff
changeset
|
1046 return SystemDictionary::resolve_or_null(name, SystemDictionary::graal_loader(), Handle(), CHECK_NULL); |
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16291
diff
changeset
|
1047 } |
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16291
diff
changeset
|
1048 |
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16291
diff
changeset
|
1049 Klass* GraalRuntime::resolve_or_fail(Symbol* name, TRAPS) { |
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16291
diff
changeset
|
1050 return SystemDictionary::resolve_or_fail(name, SystemDictionary::graal_loader(), Handle(), true, CHECK_NULL); |
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16291
diff
changeset
|
1051 } |
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16291
diff
changeset
|
1052 |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1053 Klass* GraalRuntime::load_required_class(Symbol* name) { |
16395
ad431bf0de07
added support to load classes from graal.jar with a separate class loader
Doug Simon <doug.simon@oracle.com>
parents:
16291
diff
changeset
|
1054 Klass* klass = resolve_or_null(name, Thread::current()); |
16006
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1055 if (klass == NULL) { |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1056 tty->print_cr("Could not load class %s", name->as_C_string()); |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1057 vm_abort(false); |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1058 } |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1059 return klass; |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1060 } |
66a9286203a2
decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents:
15916
diff
changeset
|
1061 |
15916
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
1062 #include "graalRuntime.inline.hpp" |