Mercurial > hg > graal-compiler
annotate src/share/vm/graal/graalRuntime.cpp @ 15968:42eaa579e134
more improvements to runtime initialization:
- replaced HotSpotSymbol with native method for reading a symbol
- moved more ForeignCallDescriptors to HotSpotBackend to reduce class initialization
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 28 May 2014 17:41:59 +0200 |
parents | 6aa352b260f4 |
children | 66a9286203a2 |
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" |
7221 | 26 #include "graal/graalRuntime.hpp" |
27 #include "graal/graalVMToCompiler.hpp" | |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
28 #include "graal/graalCompilerToVM.hpp" |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
29 #include "graal/graalJavaAccess.hpp" |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
30 #include "graal/graalEnv.hpp" |
7735 | 31 #include "memory/oopFactory.hpp" |
32 #include "prims/jvm.h" | |
7221 | 33 #include "runtime/biasedLocking.hpp" |
7735 | 34 #include "runtime/interfaceSupport.hpp" |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
35 #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
|
36 #include "runtime/reflection.hpp" |
8499
96a337d307bd
-More progress in G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8496
diff
changeset
|
37 #include "utilities/debug.hpp" |
7221 | 38 |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
39 address GraalRuntime::_external_deopt_i2c_entry = NULL; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
40 |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
41 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
|
42 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
|
43 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
|
44 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
|
45 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
|
46 |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
47 JavaThread* THREAD = JavaThread::current(); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
48 { |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
49 ThreadToNativeFromVM trans(THREAD); |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
50 |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
51 ResourceMark rm; |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
52 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
|
53 |
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
54 graal_compute_offsets(); |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
55 |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
56 _external_deopt_i2c_entry = create_external_deopt_i2c(); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
57 |
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 // 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
|
59 Universe::non_oop_word(); |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
60 |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
61 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
|
62 } |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
63 check_pending_exception("Could not register natives"); |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
64 } |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
65 |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
66 BufferBlob* GraalRuntime::initialize_buffer_blob() { |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
67 JavaThread* THREAD = JavaThread::current(); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
68 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
|
69 if (buffer_blob == NULL) { |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
70 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
|
71 if (buffer_blob != NULL) { |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
72 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
|
73 } |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
74 } |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
75 return buffer_blob; |
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 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
|
79 ResourceMark rm; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
80 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
|
81 CodeBuffer cb(buffer); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
82 short buffer_locs[20]; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
83 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
|
84 MacroAssembler masm(&cb); |
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 int total_args_passed = 5; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
87 |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
88 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
|
89 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
|
90 int i = 0; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
91 sig_bt[i++] = T_INT; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
92 sig_bt[i++] = T_LONG; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
93 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
|
94 sig_bt[i++] = T_INT; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
95 sig_bt[i++] = T_OBJECT; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
96 |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
97 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
|
98 |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
99 SharedRuntime::gen_i2c_adapter(&masm, total_args_passed, comp_args_on_stack, sig_bt, regs); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
100 masm.flush(); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
101 |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
102 return AdapterBlob::create(&cb)->content_begin(); |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
103 } |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
104 |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
105 BasicType GraalRuntime::kindToBasicType(jchar ch) { |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
106 switch(ch) { |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
107 case 'z': return T_BOOLEAN; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
108 case 'b': return T_BYTE; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
109 case 's': return T_SHORT; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
110 case 'c': return T_CHAR; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
111 case 'i': return T_INT; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
112 case 'f': return T_FLOAT; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
113 case 'j': return T_LONG; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
114 case 'd': return T_DOUBLE; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
115 case 'a': return T_OBJECT; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
116 case 'r': return T_ADDRESS; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
117 case '-': return T_ILLEGAL; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
118 default: |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
119 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
|
120 break; |
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 return T_ILLEGAL; |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
123 } |
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
124 |
7221 | 125 // Simple helper to see if the caller of a runtime stub which |
126 // entered the VM has been deoptimized | |
127 | |
128 static bool caller_is_deopted() { | |
129 JavaThread* thread = JavaThread::current(); | |
130 RegisterMap reg_map(thread, false); | |
131 frame runtime_frame = thread->last_frame(); | |
132 frame caller_frame = runtime_frame.sender(®_map); | |
133 assert(caller_frame.is_compiled_frame(), "must be compiled"); | |
134 return caller_frame.is_deoptimized_frame(); | |
135 } | |
136 | |
137 // Stress deoptimization | |
138 static void deopt_caller() { | |
139 if ( !caller_is_deopted()) { | |
140 JavaThread* thread = JavaThread::current(); | |
141 RegisterMap reg_map(thread, false); | |
142 frame runtime_frame = thread->last_frame(); | |
143 frame caller_frame = runtime_frame.sender(®_map); | |
144 Deoptimization::deoptimize_frame(thread, caller_frame.id(), Deoptimization::Reason_constraint); | |
145 assert(caller_is_deopted(), "Must be deoptimized"); | |
146 } | |
147 } | |
148 | |
12433
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
149 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
|
150 JRT_BLOCK; |
7221 | 151 assert(klass->is_klass(), "not a class"); |
152 instanceKlassHandle h(thread, klass); | |
153 h->check_valid_for_instantiation(true, CHECK); | |
154 // make sure klass is initialized | |
155 h->initialize(CHECK); | |
156 // allocate instance and return via TLS | |
157 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
|
158 thread->set_vm_result(obj); |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
159 JRT_BLOCK_END; |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
160 |
12366
0991c12c4186
Defer barriers upon slow-path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10953
diff
changeset
|
161 if (GraalDeferredInitBarriers) { |
12433
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
162 new_store_pre_barrier(thread); |
12366
0991c12c4186
Defer barriers upon slow-path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10953
diff
changeset
|
163 } |
7221 | 164 JRT_END |
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_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
|
167 JRT_BLOCK; |
7221 | 168 // Note: no handle for klass needed since they are not used |
169 // anymore after new_objArray() and no GC can happen before. | |
170 // (This may have to change if this code changes!) | |
171 assert(array_klass->is_klass(), "not a class"); | |
172 oop obj; | |
173 if (array_klass->oop_is_typeArray()) { | |
174 BasicType elt_type = TypeArrayKlass::cast(array_klass)->element_type(); | |
175 obj = oopFactory::new_typeArray(elt_type, length, CHECK); | |
176 } else { | |
177 Klass* elem_klass = ObjArrayKlass::cast(array_klass)->element_klass(); | |
178 obj = oopFactory::new_objArray(elem_klass, length, CHECK); | |
179 } | |
180 thread->set_vm_result(obj); | |
181 // This is pretty rare but this runtime patch is stressful to deoptimization | |
182 // if we deoptimize here so force a deopt to stress the path. | |
183 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
|
184 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
|
185 // 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
|
186 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
|
187 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
|
188 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
|
189 } 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
|
190 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
|
191 } |
7221 | 192 } |
12433
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
193 JRT_BLOCK_END; |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
194 |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
195 if (GraalDeferredInitBarriers) { |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
196 new_store_pre_barrier(thread); |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
197 } |
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
|
198 JRT_END |
7221 | 199 |
12433
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
200 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
|
201 // 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
|
202 // 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
|
203 // 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
|
204 // GC may take any compensating steps. |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
205 // 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
|
206 |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
207 oop new_obj = thread->vm_result(); |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
208 if (new_obj == NULL) return; |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
209 |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
210 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
|
211 "compiler must check this first"); |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
212 // 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
|
213 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
|
214 thread->set_vm_result(new_obj); |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
215 } |
808348377021
Fix inconsistent oops in slow path allocation
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12372
diff
changeset
|
216 |
7221 | 217 JRT_ENTRY(void, GraalRuntime::new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims)) |
218 assert(klass->is_klass(), "not a class"); | |
219 assert(rank >= 1, "rank must be nonzero"); | |
220 oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK); | |
221 thread->set_vm_result(obj); | |
222 JRT_END | |
223 | |
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
|
224 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
|
225 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
|
226 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
|
227 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
|
228 |
13578
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
229 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
|
230 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
|
231 |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
232 if (klass == NULL) { |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
233 ResourceMark rm(THREAD); |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
234 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
|
235 } |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
236 |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
237 // 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
|
238 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
|
239 |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
240 // 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
|
241 klass->initialize(CHECK); |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
242 |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
243 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
|
244 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
|
245 JRT_END |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12668
diff
changeset
|
246 |
7221 | 247 extern void vm_exit(int code); |
248 | |
249 // Enter this method from compiled code handler below. This is where we transition | |
250 // to VM mode. This is done as a helper routine so that the method called directly | |
251 // from compiled code does not have to transition to VM. This allows the entry | |
252 // method to see if the nmethod that we have just looked up a handler for has | |
253 // been deoptimized while we were in the vm. This simplifies the assembly code | |
254 // cpu directories. | |
255 // | |
256 // We are entering here from exception stub (via the entry method below) | |
257 // If there is a compiled exception handler in this method, we will continue there; | |
258 // otherwise we will unwind the stack and continue at the caller of top frame method | |
259 // Note: we enter in Java using a special JRT wrapper. This wrapper allows us to | |
260 // control the area where we can allow a safepoint. After we exit the safepoint area we can | |
261 // check to see if the handler we are going to return is now in a nmethod that has | |
262 // been deoptimized. If that is the case we return the deopt blob | |
263 // unpack_with_exception entry instead. This makes life for the exception blob easier | |
264 // because making that same check and diverting is painful from assembly language. | |
265 JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* thread, oopDesc* ex, address pc, nmethod*& nm)) | |
266 // Reset method handle flag. | |
267 thread->set_is_method_handle_return(false); | |
268 | |
269 Handle exception(thread, ex); | |
270 nm = CodeCache::find_nmethod(pc); | |
271 assert(nm != NULL, "this is not an nmethod"); | |
272 // Adjust the pc as needed/ | |
273 if (nm->is_deopt_pc(pc)) { | |
274 RegisterMap map(thread, false); | |
275 frame exception_frame = thread->last_frame().sender(&map); | |
276 // if the frame isn't deopted then pc must not correspond to the caller of last_frame | |
277 assert(exception_frame.is_deoptimized_frame(), "must be deopted"); | |
278 pc = exception_frame.pc(); | |
279 } | |
280 #ifdef ASSERT | |
281 assert(exception.not_null(), "NULL exceptions should be handled by throw_exception"); | |
282 assert(exception->is_oop(), "just checking"); | |
283 // Check that exception is a subclass of Throwable, otherwise we have a VerifyError | |
284 if (!(exception->is_a(SystemDictionary::Throwable_klass()))) { | |
285 if (ExitVMOnVerifyError) vm_exit(-1); | |
286 ShouldNotReachHere(); | |
287 } | |
288 #endif | |
289 | |
290 // Check the stack guard pages and reenable them if necessary and there is | |
291 // enough space on the stack to do so. Use fast exceptions only if the guard | |
292 // pages are enabled. | |
293 bool guard_pages_enabled = thread->stack_yellow_zone_enabled(); | |
294 if (!guard_pages_enabled) guard_pages_enabled = thread->reguard_stack(); | |
295 | |
296 if (JvmtiExport::can_post_on_exceptions()) { | |
297 // To ensure correct notification of exception catches and throws | |
298 // we have to deoptimize here. If we attempted to notify the | |
299 // catches and throws during this exception lookup it's possible | |
300 // we could deoptimize on the way out of the VM and end back in | |
301 // the interpreter at the throw site. This would result in double | |
302 // notifications since the interpreter would also notify about | |
303 // these same catches and throws as it unwound the frame. | |
304 | |
305 RegisterMap reg_map(thread); | |
306 frame stub_frame = thread->last_frame(); | |
307 frame caller_frame = stub_frame.sender(®_map); | |
308 | |
309 // We don't really want to deoptimize the nmethod itself since we | |
310 // can actually continue in the exception handler ourselves but I | |
311 // don't see an easy way to have the desired effect. | |
312 Deoptimization::deoptimize_frame(thread, caller_frame.id(), Deoptimization::Reason_constraint); | |
313 assert(caller_is_deopted(), "Must be deoptimized"); | |
314 | |
315 return SharedRuntime::deopt_blob()->unpack_with_exception_in_tls(); | |
316 } | |
317 | |
318 // ExceptionCache is used only for exceptions at call sites and not for implicit exceptions | |
319 if (guard_pages_enabled) { | |
320 address fast_continuation = nm->handler_for_exception_and_pc(exception, pc); | |
321 if (fast_continuation != NULL) { | |
322 // Set flag if return address is a method handle call site. | |
323 thread->set_is_method_handle_return(nm->is_method_handle_return(pc)); | |
324 return fast_continuation; | |
325 } | |
326 } | |
327 | |
328 // If the stack guard pages are enabled, check whether there is a handler in | |
329 // the current method. Otherwise (guard pages disabled), force an unwind and | |
330 // skip the exception cache update (i.e., just leave continuation==NULL). | |
331 address continuation = NULL; | |
332 if (guard_pages_enabled) { | |
333 | |
334 // New exception handling mechanism can support inlined methods | |
335 // with exception handlers since the mappings are from PC to PC | |
336 | |
337 // debugging support | |
338 // tracing | |
339 if (TraceExceptions) { | |
340 ttyLocker ttyl; | |
341 ResourceMark rm; | |
342 int offset = pc - nm->code_begin(); | |
343 tty->print_cr("Exception <%s> (0x%x) thrown in compiled method <%s> at PC " PTR_FORMAT " [" PTR_FORMAT "+%d] for thread 0x%x", | |
344 exception->print_value_string(), (address)exception(), nm->method()->print_value_string(), pc, nm->code_begin(), offset, thread); | |
345 } | |
346 // for AbortVMOnException flag | |
347 NOT_PRODUCT(Exceptions::debug_check_abort(exception)); | |
348 | |
349 // Clear out the exception oop and pc since looking up an | |
350 // exception handler can cause class loading, which might throw an | |
351 // exception and those fields are expected to be clear during | |
352 // normal bytecode execution. | |
353 thread->set_exception_oop(NULL); | |
354 thread->set_exception_pc(NULL); | |
355 | |
356 continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false); | |
357 // If an exception was thrown during exception dispatch, the exception oop may have changed | |
358 thread->set_exception_oop(exception()); | |
359 thread->set_exception_pc(pc); | |
360 | |
361 // the exception cache is used only by non-implicit exceptions | |
362 if (continuation != NULL && !SharedRuntime::deopt_blob()->contains(continuation)) { | |
363 nm->add_handler_for_exception_and_pc(exception, pc, continuation); | |
364 } | |
365 } | |
366 | |
367 // Set flag if return address is a method handle call site. | |
368 thread->set_is_method_handle_return(nm->is_method_handle_return(pc)); | |
369 | |
370 if (TraceExceptions) { | |
371 ttyLocker ttyl; | |
372 ResourceMark rm; | |
373 tty->print_cr("Thread " PTR_FORMAT " continuing at PC " PTR_FORMAT " for exception thrown at PC " PTR_FORMAT, | |
374 thread, continuation, pc); | |
375 } | |
376 | |
377 return continuation; | |
378 JRT_END | |
379 | |
380 // Enter this method from compiled code only if there is a Java exception handler | |
381 // in the method handling the exception. | |
382 // We are entering here from exception stub. We don't do a normal VM transition here. | |
383 // We do it in a helper. This is so we can check to see if the nmethod we have just | |
384 // searched for an exception handler has been deoptimized in the meantime. | |
385 address GraalRuntime::exception_handler_for_pc(JavaThread* thread) { | |
386 oop exception = thread->exception_oop(); | |
387 address pc = thread->exception_pc(); | |
388 // Still in Java mode | |
389 DEBUG_ONLY(ResetNoHandleMark rnhm); | |
390 nmethod* nm = NULL; | |
391 address continuation = NULL; | |
392 { | |
393 // Enter VM mode by calling the helper | |
394 ResetNoHandleMark rnhm; | |
395 continuation = exception_handler_for_pc_helper(thread, exception, pc, nm); | |
396 } | |
397 // Back in JAVA, use no oops DON'T safepoint | |
398 | |
399 // Now check to see if the nmethod we were called from is now deoptimized. | |
400 // If so we must return to the deopt blob and deoptimize the nmethod | |
401 if (nm != NULL && caller_is_deopted()) { | |
402 continuation = SharedRuntime::deopt_blob()->unpack_with_exception_in_tls(); | |
403 } | |
404 | |
405 assert(continuation != NULL, "no handler found"); | |
406 return continuation; | |
407 } | |
408 | |
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
|
409 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
|
410 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
|
411 thread->set_vm_result(PENDING_EXCEPTION); |
e27f3169460e
notify JVMTI about exception throws from runtime
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
12435
diff
changeset
|
412 CLEAR_PENDING_EXCEPTION; |
7221 | 413 JRT_END |
414 | |
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
|
415 JRT_ENTRY(void, GraalRuntime::create_out_of_bounds_exception(JavaThread* thread, jint index)) |
7221 | 416 char message[jintAsStringSize]; |
417 sprintf(message, "%d", index); | |
12668
e27f3169460e
notify JVMTI about exception throws from runtime
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
12435
diff
changeset
|
418 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
|
419 thread->set_vm_result(PENDING_EXCEPTION); |
e27f3169460e
notify JVMTI about exception throws from runtime
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
12435
diff
changeset
|
420 CLEAR_PENDING_EXCEPTION; |
7221 | 421 JRT_END |
422 | |
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
|
423 JRT_ENTRY_NO_ASYNC(void, GraalRuntime::monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock)) |
7221 | 424 if (TraceGraal >= 3) { |
425 char type[O_BUFLEN]; | |
426 obj->klass()->name()->as_C_string(type, O_BUFLEN); | |
427 markOop mark = obj->mark(); | |
428 tty->print_cr("%s: entered locking slow case with obj=" INTPTR_FORMAT ", type=%s, mark=" INTPTR_FORMAT ", lock=" INTPTR_FORMAT, thread->name(), obj, type, mark, lock); | |
429 tty->flush(); | |
430 } | |
431 #ifdef ASSERT | |
432 if (PrintBiasedLockingStatistics) { | |
433 Atomic::inc(BiasedLocking::slow_path_entry_count_addr()); | |
434 } | |
435 #endif | |
436 Handle h_obj(thread, obj); | |
437 assert(h_obj()->is_oop(), "must be NULL or an object"); | |
438 if (UseBiasedLocking) { | |
439 // Retry fast entry if bias is revoked to avoid unnecessary inflation | |
440 ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK); | |
441 } else { | |
7226 | 442 if (GraalUseFastLocking) { |
7221 | 443 // When using fast locking, the compiled code has already tried the fast case |
444 ObjectSynchronizer::slow_enter(h_obj, lock, THREAD); | |
445 } else { | |
446 ObjectSynchronizer::fast_enter(h_obj, lock, false, THREAD); | |
447 } | |
448 } | |
449 if (TraceGraal >= 3) { | |
450 tty->print_cr("%s: exiting locking slow with obj=" INTPTR_FORMAT, thread->name(), obj); | |
451 } | |
452 JRT_END | |
453 | |
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
|
454 JRT_LEAF(void, GraalRuntime::monitorexit(JavaThread* thread, oopDesc* obj, BasicLock* lock)) |
7221 | 455 assert(thread == JavaThread::current(), "threads must correspond"); |
456 assert(thread->last_Java_sp(), "last_Java_sp must be set"); | |
457 // monitorexit is non-blocking (leaf routine) => no exceptions can be thrown | |
458 EXCEPTION_MARK; | |
459 | |
460 #ifdef DEBUG | |
461 if (!obj->is_oop()) { | |
462 ResetNoHandleMark rhm; | |
463 nmethod* method = thread->last_frame().cb()->as_nmethod_or_null(); | |
464 if (method != NULL) { | |
465 tty->print_cr("ERROR in monitorexit in method %s wrong obj " INTPTR_FORMAT, method->name(), obj); | |
466 } | |
467 thread->print_stack_on(tty); | |
468 assert(false, "invalid lock object pointer dected"); | |
469 } | |
470 #endif | |
471 | |
7226 | 472 if (GraalUseFastLocking) { |
7221 | 473 // When using fast locking, the compiled code has already tried the fast case |
474 ObjectSynchronizer::slow_exit(obj, lock, THREAD); | |
475 } else { | |
476 ObjectSynchronizer::fast_exit(obj, lock, THREAD); | |
477 } | |
478 if (TraceGraal >= 3) { | |
479 char type[O_BUFLEN]; | |
480 obj->klass()->name()->as_C_string(type, O_BUFLEN); | |
481 tty->print_cr("%s: exited locking slow case with obj=" INTPTR_FORMAT ", type=%s, mark=" INTPTR_FORMAT ", lock=" INTPTR_FORMAT, thread->name(), obj, type, obj->mark(), lock); | |
482 tty->flush(); | |
483 } | |
484 JRT_END | |
485 | |
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
|
486 JRT_ENTRY(void, GraalRuntime::log_object(JavaThread* thread, oopDesc* obj, jint flags)) |
7221 | 487 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
|
488 bool addr = mask_bits_are_true(flags, LOG_OBJECT_ADDRESS); |
7221 | 489 bool newline = mask_bits_are_true(flags, LOG_OBJECT_NEWLINE); |
490 if (!string) { | |
12356
359f7e70ae7f
Reduce HotSpot diff and fix previous merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10953
diff
changeset
|
491 if (!addr && obj->is_oop_or_null(true)) { |
7221 | 492 char buf[O_BUFLEN]; |
12356
359f7e70ae7f
Reduce HotSpot diff and fix previous merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10953
diff
changeset
|
493 tty->print("%s@%p", obj->klass()->name()->as_C_string(buf, O_BUFLEN), (address)obj); |
7221 | 494 } else { |
12356
359f7e70ae7f
Reduce HotSpot diff and fix previous merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10953
diff
changeset
|
495 tty->print("%p", (address)obj); |
7221 | 496 } |
497 } else { | |
498 ResourceMark rm; | |
499 assert(obj != NULL && java_lang_String::is_instance(obj), "must be"); | |
500 char *buf = java_lang_String::as_utf8_string(obj); | |
501 tty->print(buf); | |
502 } | |
503 if (newline) { | |
504 tty->cr(); | |
505 } | |
506 JRT_END | |
507 | |
10434
8b22524df53b
Add G1 Barriers' foreign calls
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10072
diff
changeset
|
508 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
|
509 thread->satb_mark_queue().enqueue(obj); |
8b22524df53b
Add G1 Barriers' foreign calls
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10072
diff
changeset
|
510 JRT_END |
8b22524df53b
Add G1 Barriers' foreign calls
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10072
diff
changeset
|
511 |
8b22524df53b
Add G1 Barriers' foreign calls
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10072
diff
changeset
|
512 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
|
513 thread->dirty_card_queue().enqueue(card_addr); |
8b22524df53b
Add G1 Barriers' foreign calls
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10072
diff
changeset
|
514 JRT_END |
8b22524df53b
Add G1 Barriers' foreign calls
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10072
diff
changeset
|
515 |
12356
359f7e70ae7f
Reduce HotSpot diff and fix previous merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10953
diff
changeset
|
516 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
|
517 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
|
518 if(!Universe::heap()->is_in_closed_subset(parent)) { |
97e282186b5b
Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10542
diff
changeset
|
519 tty->print_cr("Parent Object "INTPTR_FORMAT" not in heap", parent); |
97e282186b5b
Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10542
diff
changeset
|
520 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
|
521 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
|
522 } |
97e282186b5b
Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10542
diff
changeset
|
523 if(!Universe::heap()->is_in_closed_subset(child)) { |
97e282186b5b
Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10542
diff
changeset
|
524 tty->print_cr("Child Object "INTPTR_FORMAT" not in heap", child); |
97e282186b5b
Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10542
diff
changeset
|
525 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
|
526 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
|
527 } |
97e282186b5b
Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10542
diff
changeset
|
528 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
|
529 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
|
530 |
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
|
531 JRT_ENTRY(void, GraalRuntime::vm_error(JavaThread* thread, jlong where, jlong format, jlong value)) |
7221 | 532 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
|
533 const char *error_msg = where == 0L ? "<internal Graal error>" : (char*) (address) where; |
7221 | 534 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
|
535 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
|
536 const char* buf = (char*) (address) format; |
7221 | 537 size_t detail_msg_length = strlen(buf) * 2; |
538 detail_msg = (char *) NEW_RESOURCE_ARRAY(u_char, detail_msg_length); | |
539 jio_snprintf(detail_msg, detail_msg_length, buf, value); | |
540 } | |
541 report_vm_error(__FILE__, __LINE__, error_msg, detail_msg); | |
542 JRT_END | |
543 | |
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
|
544 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
|
545 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
|
546 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
|
547 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
|
548 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
|
549 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
|
550 JRT_END |
8506 | 551 |
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
|
552 JRT_LEAF(void, GraalRuntime::log_printf(JavaThread* thread, oopDesc* format, jlong v1, jlong v2, jlong v3)) |
7221 | 553 ResourceMark rm; |
554 assert(format != NULL && java_lang_String::is_instance(format), "must be"); | |
555 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
|
556 tty->print(buf, v1, v2, v3); |
7221 | 557 JRT_END |
558 | |
9573
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
559 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
|
560 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
|
561 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
|
562 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
|
563 if (cb) { |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
564 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
|
565 char buf[O_BUFLEN]; |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
566 tty->print("%s [%p+%d]", cb->as_nmethod_or_null()->method()->name_and_sig_as_C_string(buf, O_BUFLEN), cb->code_begin(), (address)v - cb->code_begin()); |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
567 return; |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
568 } |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
569 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
|
570 return; |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
571 } |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
572 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
|
573 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
|
574 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
|
575 return; |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
576 } |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
577 tty->print("%p [long: %d, double %f, char %c]", v, v, v, v); |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
578 } |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
579 } |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
580 |
9471
5fa54bf57f8c
replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9457
diff
changeset
|
581 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
|
582 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
|
583 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
|
584 if (vmError) { |
9573
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
585 if (buf != NULL) { |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
586 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
|
587 } else { |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
588 fatal("<anonymous error>"); |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
589 } |
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
590 } 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
|
591 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
|
592 } else { |
9573
a79e8020ad4b
added Stub.decipher() to print information about values in stubs
Doug Simon <doug.simon@oracle.com>
parents:
9565
diff
changeset
|
593 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
|
594 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
|
595 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
|
596 } |
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 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
|
598 |
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
|
599 JRT_ENTRY(void, GraalRuntime::log_primitive(JavaThread* thread, jchar typeChar, jlong value, jboolean newline)) |
7221 | 600 union { |
601 jlong l; | |
602 jdouble d; | |
603 jfloat f; | |
604 } uu; | |
605 uu.l = value; | |
606 switch (typeChar) { | |
607 case 'z': tty->print(value == 0 ? "false" : "true"); break; | |
608 case 'b': tty->print("%d", (jbyte) value); break; | |
609 case 'c': tty->print("%c", (jchar) value); break; | |
610 case 's': tty->print("%d", (jshort) value); break; | |
611 case 'i': tty->print("%d", (jint) value); break; | |
612 case 'f': tty->print("%f", uu.f); break; | |
613 case 'j': tty->print(INT64_FORMAT, value); break; | |
614 case 'd': tty->print("%lf", uu.d); break; | |
615 default: assert(false, "unknown typeChar"); break; | |
616 } | |
617 if (newline) { | |
618 tty->cr(); | |
619 } | |
620 JRT_END | |
621 | |
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
|
622 JRT_ENTRY(jint, GraalRuntime::identity_hash_code(JavaThread* thread, oopDesc* obj)) |
7221 | 623 return (jint) obj->identity_hash(); |
624 JRT_END | |
625 | |
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
|
626 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
|
627 // 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
|
628 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
|
629 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
|
630 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
|
631 if (receiverThread == NULL) { |
682fba1bcf95
add missing null check in is_interrupted
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13578
diff
changeset
|
632 // 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
|
633 return JNI_FALSE; |
682fba1bcf95
add missing null check in is_interrupted
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13578
diff
changeset
|
634 } else { |
682fba1bcf95
add missing null check in is_interrupted
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13578
diff
changeset
|
635 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
|
636 } |
7221 | 637 JRT_END |
638 | |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
639 // 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
|
640 JVM_ENTRY(jobject, JVM_GetGraalRuntime(JNIEnv *env, jclass c)) |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
641 return VMToCompiler::get_HotSpotGraalRuntime_jobject(); |
7221 | 642 JVM_END |
10475
3489047ffea2
Restructure the handling of HotSpotInstalledCode and their link to nmethods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10434
diff
changeset
|
643 |
15916
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
644 // 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
|
645 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
|
646 HandleMark hm; |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
647 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
|
648 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
|
649 JVM_END |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
650 |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
651 // 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
|
652 JVM_ENTRY(jobject, JVM_CreateTruffleRuntime(JNIEnv *env, jclass c)) |
15582
063ec2920d21
made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents:
14731
diff
changeset
|
653 return JNIHandles::make_local(VMToCompiler::create_HotSpotTruffleRuntime()()); |
10475
3489047ffea2
Restructure the handling of HotSpotInstalledCode and their link to nmethods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10434
diff
changeset
|
654 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
|
655 |
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
656 // private static void HotSpotGraalRuntime.init(Class compilerToVMClass) |
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
657 JVM_ENTRY(void, JVM_InitializeGraalNatives(JNIEnv *env, jclass c, jclass c2vmClass)) |
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
658 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
|
659 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
|
660 |
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
|
661 // 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
|
662 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
|
663 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
|
664 KlassHandle hotSpotOptionsClass(THREAD, java_lang_Class::as_Klass(JNIHandles::resolve_non_null(c))); |
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
|
665 return GraalRuntime::parse_arguments(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
|
666 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
|
667 |
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
|
668 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
|
669 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
|
670 |
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
|
671 // 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
|
672 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
|
673 |
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
|
674 // 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
|
675 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
|
676 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
|
677 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
|
678 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
|
679 } |
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
|
680 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
|
681 } |
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
|
682 |
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
|
683 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
|
684 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
|
685 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
|
686 size_t name_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
|
687 Handle name_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
|
688 bool valid = true; |
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
|
689 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
|
690 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
|
691 name_len = strlen(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
|
692 name_handle = java_lang_String::create_from_str(name, CHECK); |
15894
a9810ed7cad2
explicit conversion to int, fixes windows build
Christian Wirth <christian.wirth@oracle.com>
parents:
15870
diff
changeset
|
693 valid = set_option(hotSpotOptionsClass, name, (int)name_len, name_handle, arg, 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
|
694 } 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
|
695 char* sep = strchr(arg, '='); |
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
|
696 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
|
697 name = arg; |
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
|
698 name_len = sep - 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
|
699 // Temporarily replace '=' with NULL to create the Java string for the option 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
|
700 *sep = '\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
|
701 name_handle = java_lang_String::create_from_str(arg, 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
|
702 *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
|
703 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
|
704 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
|
705 } |
15894
a9810ed7cad2
explicit conversion to int, fixes windows build
Christian Wirth <christian.wirth@oracle.com>
parents:
15870
diff
changeset
|
706 valid = set_option(hotSpotOptionsClass, name, (int)name_len, name_handle, sep + 1, 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
|
707 } 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
|
708 char buf[200]; |
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
|
709 jio_snprintf(buf, sizeof(buf), "Value for option %s must use '-G:%s=<value>' format", arg, arg); |
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
|
710 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
|
711 } |
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
|
712 } |
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
|
713 |
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
|
714 if (!valid) { |
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
|
715 VMToCompiler::setOption(hotSpotOptionsClass, name_handle, Handle(), ' ', Handle(), 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
|
716 char buf[200]; |
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
|
717 jio_snprintf(buf, sizeof(buf), "Invalid Graal option %s", arg); |
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
|
718 THROW_MSG(vmSymbols::java_lang_InternalError(), buf); |
15603
b7fb36e57da8
made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents:
15589
diff
changeset
|
719 } |
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
|
720 } |
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
|
721 |
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
|
722 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
|
723 const char* home = Arguments::get_java_home(); |
15894
a9810ed7cad2
explicit conversion to int, fixes windows build
Christian Wirth <christian.wirth@oracle.com>
parents:
15870
diff
changeset
|
724 int path_len = (int)strlen(home) + (int)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
|
725 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
|
726 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
|
727 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
|
728 |
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
|
729 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
|
730 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
|
731 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
|
732 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
|
733 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
|
734 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
|
735 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
|
736 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
|
737 } else 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
|
738 warning("Only read %d of %d bytes from %s", num_read, st.st_size, path); |
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
|
739 } |
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
|
740 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
|
741 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
|
742 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
|
743 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
|
744 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
|
745 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
|
746 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
|
747 *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
|
748 } |
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 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
|
750 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
|
751 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
|
752 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
|
753 } |
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
|
754 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
|
755 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
|
756 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
|
757 } 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
|
758 // 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
|
759 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
|
760 } |
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
|
761 } |
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
|
762 } |
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
|
763 } 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
|
764 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
|
765 } |
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
|
766 } |
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
|
767 } |
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
|
768 |
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
|
769 jlong GraalRuntime::parse_primitive_option_value(char spec, Handle name, const char* value, 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
|
770 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
|
771 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
|
772 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
|
773 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
|
774 } 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
|
775 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
|
776 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
|
777 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
|
778 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
|
779 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
|
780 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
|
781 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
|
782 } |
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 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
|
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 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
|
786 if (sscanf(value, "%d%c", &uu.i, &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
|
787 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
|
788 } |
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 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
|
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 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
|
792 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
|
793 } |
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
|
794 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
|
795 char buf[200]; |
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
|
796 jio_snprintf(buf, sizeof(buf), "Invalid %s value for Graal option %s: %s", (spec == 'i' ? "numeric" : "float/double"), java_lang_String::as_utf8_string(name()), value); |
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
|
797 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
|
798 } |
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
|
799 |
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
|
800 Handle GraalRuntime::get_OptionValue(const char* declaringClass, const char* fieldName, const char* fieldSig, 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
|
801 TempNewSymbol name = SymbolTable::new_symbol(declaringClass, 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
|
802 Klass* klass = SystemDictionary::resolve_or_fail(name, true, 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
|
803 |
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 // 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
|
805 // 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
|
806 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
|
807 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
|
808 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
|
809 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
|
810 } |
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 // 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
|
812 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
|
813 |
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
|
814 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
|
815 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
|
816 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
|
817 } |
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
|
818 |
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
|
819 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
|
820 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
|
821 } |
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
|
822 |
15916
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
823 Handle GraalRuntime::create_Service(const char* name, TRAPS) { |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
824 TempNewSymbol kname = SymbolTable::new_symbol(name, THREAD); |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
825 Klass* k = SystemDictionary::resolve_or_fail(kname, true, CHECK_NH); |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
826 instanceKlassHandle klass(THREAD, k); |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
827 klass->initialize(CHECK_NH); |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
828 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
|
829 JavaValue result(T_VOID); |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
830 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
|
831 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
|
832 return service; |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
833 } |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
834 |
6aa352b260f4
removed use of ServiceLoader in runtime initialization
Doug Simon <doug.simon@oracle.com>
parents:
15894
diff
changeset
|
835 #include "graalRuntime.inline.hpp" |