author | neliasso |
Fri, 04 Sep 2015 12:47:57 +0200 | |
changeset 32582 | 56619bb8bcaa |
parent 32581 | 632402f18fe6 |
child 33063 | 9e222337a81e |
permissions | -rw-r--r-- |
1 | 1 |
/* |
30244 | 2 |
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5252
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5252
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5252
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "classfile/systemDictionary.hpp" |
|
27 |
#include "classfile/vmSymbols.hpp" |
|
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
25351
diff
changeset
|
28 |
#include "code/codeCache.hpp" |
7397 | 29 |
#include "code/compiledIC.hpp" |
30 |
#include "code/icBuffer.hpp" |
|
31 |
#include "code/nmethod.hpp" |
|
32 |
#include "code/pcDesc.hpp" |
|
33 |
#include "code/scopeDesc.hpp" |
|
34 |
#include "code/vtableStubs.hpp" |
|
35 |
#include "compiler/compileBroker.hpp" |
|
36 |
#include "compiler/oopMap.hpp" |
|
30764 | 37 |
#include "gc/g1/g1SATBCardTableModRefBS.hpp" |
38 |
#include "gc/g1/heapRegion.hpp" |
|
39 |
#include "gc/shared/barrierSet.hpp" |
|
40 |
#include "gc/shared/collectedHeap.hpp" |
|
41 |
#include "gc/shared/gcLocker.inline.hpp" |
|
7397 | 42 |
#include "interpreter/bytecode.hpp" |
43 |
#include "interpreter/interpreter.hpp" |
|
44 |
#include "interpreter/linkResolver.hpp" |
|
45 |
#include "memory/oopFactory.hpp" |
|
46 |
#include "oops/objArrayKlass.hpp" |
|
47 |
#include "oops/oop.inline.hpp" |
|
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
25351
diff
changeset
|
48 |
#include "opto/ad.hpp" |
7397 | 49 |
#include "opto/addnode.hpp" |
50 |
#include "opto/callnode.hpp" |
|
51 |
#include "opto/cfgnode.hpp" |
|
52 |
#include "opto/graphKit.hpp" |
|
53 |
#include "opto/machnode.hpp" |
|
54 |
#include "opto/matcher.hpp" |
|
55 |
#include "opto/memnode.hpp" |
|
56 |
#include "opto/mulnode.hpp" |
|
57 |
#include "opto/runtime.hpp" |
|
58 |
#include "opto/subnode.hpp" |
|
25351
7c198a690050
8044775: Improve usage of umbrella header atomic.inline.hpp.
goetz
parents:
24953
diff
changeset
|
59 |
#include "runtime/atomic.inline.hpp" |
7397 | 60 |
#include "runtime/fprofiler.hpp" |
61 |
#include "runtime/handles.inline.hpp" |
|
62 |
#include "runtime/interfaceSupport.hpp" |
|
63 |
#include "runtime/javaCalls.hpp" |
|
64 |
#include "runtime/sharedRuntime.hpp" |
|
65 |
#include "runtime/signature.hpp" |
|
66 |
#include "runtime/threadCritical.hpp" |
|
67 |
#include "runtime/vframe.hpp" |
|
68 |
#include "runtime/vframeArray.hpp" |
|
69 |
#include "runtime/vframe_hp.hpp" |
|
70 |
#include "utilities/copy.hpp" |
|
71 |
#include "utilities/preserveException.hpp" |
|
1 | 72 |
|
73 |
||
74 |
// For debugging purposes: |
|
75 |
// To force FullGCALot inside a runtime function, add the following two lines |
|
76 |
// |
|
77 |
// Universe::release_fullgc_alot_dummy(); |
|
78 |
// MarkSweep::invoke(0, "Debugging"); |
|
79 |
// |
|
80 |
// At command line specify the parameters: -XX:+FullGCALot -XX:FullGCALotStart=100000000 |
|
81 |
||
82 |
||
83 |
||
84 |
||
85 |
// Compiled code entry points |
|
86 |
address OptoRuntime::_new_instance_Java = NULL; |
|
87 |
address OptoRuntime::_new_array_Java = NULL; |
|
10566
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
88 |
address OptoRuntime::_new_array_nozero_Java = NULL; |
1 | 89 |
address OptoRuntime::_multianewarray2_Java = NULL; |
90 |
address OptoRuntime::_multianewarray3_Java = NULL; |
|
91 |
address OptoRuntime::_multianewarray4_Java = NULL; |
|
92 |
address OptoRuntime::_multianewarray5_Java = NULL; |
|
10028
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
93 |
address OptoRuntime::_multianewarrayN_Java = NULL; |
1374 | 94 |
address OptoRuntime::_g1_wb_pre_Java = NULL; |
95 |
address OptoRuntime::_g1_wb_post_Java = NULL; |
|
1 | 96 |
address OptoRuntime::_vtable_must_compile_Java = NULL; |
97 |
address OptoRuntime::_complete_monitor_locking_Java = NULL; |
|
31856 | 98 |
address OptoRuntime::_monitor_notify_Java = NULL; |
99 |
address OptoRuntime::_monitor_notifyAll_Java = NULL; |
|
1 | 100 |
address OptoRuntime::_rethrow_Java = NULL; |
101 |
||
102 |
address OptoRuntime::_slow_arraycopy_Java = NULL; |
|
103 |
address OptoRuntime::_register_finalizer_Java = NULL; |
|
104 |
||
105 |
# ifdef ENABLE_ZAP_DEAD_LOCALS |
|
106 |
address OptoRuntime::_zap_dead_Java_locals_Java = NULL; |
|
107 |
address OptoRuntime::_zap_dead_native_locals_Java = NULL; |
|
108 |
# endif |
|
109 |
||
9976
6fef34e63df1
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
8921
diff
changeset
|
110 |
ExceptionBlob* OptoRuntime::_exception_blob; |
1 | 111 |
|
112 |
// This should be called in an assertion at the start of OptoRuntime routines |
|
113 |
// which are entered from compiled code (all of them) |
|
17379 | 114 |
#ifdef ASSERT |
1 | 115 |
static bool check_compiled_frame(JavaThread* thread) { |
116 |
assert(thread->last_frame().is_runtime_frame(), "cannot call runtime directly from compiled code"); |
|
117 |
RegisterMap map(thread, false); |
|
118 |
frame caller = thread->last_frame().sender(&map); |
|
119 |
assert(caller.is_compiled_frame(), "not being called from compiled like code"); |
|
120 |
return true; |
|
121 |
} |
|
17379 | 122 |
#endif // ASSERT |
1 | 123 |
|
124 |
||
125 |
#define gen(env, var, type_func_gen, c_func, fancy_jump, pass_tls, save_arg_regs, return_pc) \ |
|
20707
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
20703
diff
changeset
|
126 |
var = generate_stub(env, type_func_gen, CAST_FROM_FN_PTR(address, c_func), #var, fancy_jump, pass_tls, save_arg_regs, return_pc); \ |
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
20703
diff
changeset
|
127 |
if (var == NULL) { return false; } |
1 | 128 |
|
20707
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
20703
diff
changeset
|
129 |
bool OptoRuntime::generate(ciEnv* env) { |
1 | 130 |
|
131 |
generate_exception_blob(); |
|
132 |
||
133 |
// Note: tls: Means fetching the return oop out of the thread-local storage |
|
134 |
// |
|
135 |
// variable/name type-function-gen , runtime method ,fncy_jp, tls,save_args,retpc |
|
136 |
// ------------------------------------------------------------------------------------------------------------------------------- |
|
137 |
gen(env, _new_instance_Java , new_instance_Type , new_instance_C , 0 , true , false, false); |
|
138 |
gen(env, _new_array_Java , new_array_Type , new_array_C , 0 , true , false, false); |
|
10566
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
139 |
gen(env, _new_array_nozero_Java , new_array_Type , new_array_nozero_C , 0 , true , false, false); |
1 | 140 |
gen(env, _multianewarray2_Java , multianewarray2_Type , multianewarray2_C , 0 , true , false, false); |
141 |
gen(env, _multianewarray3_Java , multianewarray3_Type , multianewarray3_C , 0 , true , false, false); |
|
142 |
gen(env, _multianewarray4_Java , multianewarray4_Type , multianewarray4_C , 0 , true , false, false); |
|
143 |
gen(env, _multianewarray5_Java , multianewarray5_Type , multianewarray5_C , 0 , true , false, false); |
|
10028
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
144 |
gen(env, _multianewarrayN_Java , multianewarrayN_Type , multianewarrayN_C , 0 , true , false, false); |
1374 | 145 |
gen(env, _g1_wb_pre_Java , g1_wb_pre_Type , SharedRuntime::g1_wb_pre , 0 , false, false, false); |
146 |
gen(env, _g1_wb_post_Java , g1_wb_post_Type , SharedRuntime::g1_wb_post , 0 , false, false, false); |
|
20707
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
20703
diff
changeset
|
147 |
gen(env, _complete_monitor_locking_Java , complete_monitor_enter_Type , SharedRuntime::complete_monitor_locking_C, 0, false, false, false); |
31856 | 148 |
gen(env, _monitor_notify_Java , monitor_notify_Type , monitor_notify_C , 0 , false, false, false); |
149 |
gen(env, _monitor_notifyAll_Java , monitor_notify_Type , monitor_notifyAll_C , 0 , false, false, false); |
|
1 | 150 |
gen(env, _rethrow_Java , rethrow_Type , rethrow_C , 2 , true , false, true ); |
151 |
||
152 |
gen(env, _slow_arraycopy_Java , slow_arraycopy_Type , SharedRuntime::slow_arraycopy_C , 0 , false, false, false); |
|
153 |
gen(env, _register_finalizer_Java , register_finalizer_Type , register_finalizer , 0 , false, false, false); |
|
154 |
||
155 |
# ifdef ENABLE_ZAP_DEAD_LOCALS |
|
156 |
gen(env, _zap_dead_Java_locals_Java , zap_dead_locals_Type , zap_dead_Java_locals_C , 0 , false, true , false ); |
|
157 |
gen(env, _zap_dead_native_locals_Java , zap_dead_locals_Type , zap_dead_native_locals_C , 0 , false, true , false ); |
|
158 |
# endif |
|
20707
b3b658c6d1f8
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
20703
diff
changeset
|
159 |
return true; |
1 | 160 |
} |
161 |
||
162 |
#undef gen |
|
163 |
||
164 |
||
165 |
// Helper method to do generation of RunTimeStub's |
|
166 |
address OptoRuntime::generate_stub( ciEnv* env, |
|
167 |
TypeFunc_generator gen, address C_function, |
|
168 |
const char *name, int is_fancy_jump, |
|
169 |
bool pass_tls, |
|
170 |
bool save_argument_registers, |
|
171 |
bool return_pc ) { |
|
172 |
ResourceMark rm; |
|
173 |
Compile C( env, gen, C_function, name, is_fancy_jump, pass_tls, save_argument_registers, return_pc ); |
|
174 |
return C.stub_entry_point(); |
|
175 |
} |
|
176 |
||
177 |
const char* OptoRuntime::stub_name(address entry) { |
|
178 |
#ifndef PRODUCT |
|
179 |
CodeBlob* cb = CodeCache::find_blob(entry); |
|
180 |
RuntimeStub* rs =(RuntimeStub *)cb; |
|
181 |
assert(rs != NULL && rs->is_runtime_stub(), "not a runtime stub"); |
|
182 |
return rs->name(); |
|
183 |
#else |
|
184 |
// Fast implementation for product mode (maybe it should be inlined too) |
|
185 |
return "runtime stub"; |
|
186 |
#endif |
|
187 |
} |
|
188 |
||
189 |
||
190 |
//============================================================================= |
|
191 |
// Opto compiler runtime routines |
|
192 |
//============================================================================= |
|
193 |
||
194 |
||
195 |
//=============================allocation====================================== |
|
196 |
// We failed the fast-path allocation. Now we need to do a scavenge or GC |
|
197 |
// and try allocation again. |
|
198 |
||
4637 | 199 |
void OptoRuntime::new_store_pre_barrier(JavaThread* thread) { |
1 | 200 |
// After any safepoint, just before going back to compiled code, |
4030
4c471254865e
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
2131
diff
changeset
|
201 |
// we inform the GC that we will be doing initializing writes to |
4c471254865e
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
2131
diff
changeset
|
202 |
// this object in the future without emitting card-marks, so |
4c471254865e
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
2131
diff
changeset
|
203 |
// GC may take any compensating steps. |
4c471254865e
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
2131
diff
changeset
|
204 |
// NOTE: Keep this code consistent with GraphKit::store_barrier. |
1 | 205 |
|
206 |
oop new_obj = thread->vm_result(); |
|
207 |
if (new_obj == NULL) return; |
|
208 |
||
209 |
assert(Universe::heap()->can_elide_tlab_store_barriers(), |
|
210 |
"compiler must check this first"); |
|
4030
4c471254865e
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
2131
diff
changeset
|
211 |
// GC may decide to give back a safer copy of new_obj. |
4637 | 212 |
new_obj = Universe::heap()->new_store_pre_barrier(thread, new_obj); |
1 | 213 |
thread->set_vm_result(new_obj); |
214 |
} |
|
215 |
||
216 |
// object allocation |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13521
diff
changeset
|
217 |
JRT_BLOCK_ENTRY(void, OptoRuntime::new_instance_C(Klass* klass, JavaThread* thread)) |
1 | 218 |
JRT_BLOCK; |
219 |
#ifndef PRODUCT |
|
220 |
SharedRuntime::_new_instance_ctr++; // new instance requires GC |
|
221 |
#endif |
|
222 |
assert(check_compiled_frame(thread), "incorrect caller"); |
|
223 |
||
224 |
// These checks are cheap to make and support reflective allocation. |
|
14488 | 225 |
int lh = klass->layout_helper(); |
1 | 226 |
if (Klass::layout_helper_needs_slow_path(lh) |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13521
diff
changeset
|
227 |
|| !InstanceKlass::cast(klass)->is_initialized()) { |
1 | 228 |
KlassHandle kh(THREAD, klass); |
229 |
kh->check_valid_for_instantiation(false, THREAD); |
|
230 |
if (!HAS_PENDING_EXCEPTION) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13521
diff
changeset
|
231 |
InstanceKlass::cast(kh())->initialize(THREAD); |
1 | 232 |
} |
233 |
if (!HAS_PENDING_EXCEPTION) { |
|
234 |
klass = kh(); |
|
235 |
} else { |
|
236 |
klass = NULL; |
|
237 |
} |
|
238 |
} |
|
239 |
||
240 |
if (klass != NULL) { |
|
241 |
// Scavenge and allocate an instance. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13521
diff
changeset
|
242 |
oop result = InstanceKlass::cast(klass)->allocate_instance(THREAD); |
1 | 243 |
thread->set_vm_result(result); |
244 |
||
245 |
// Pass oops back through thread local storage. Our apparent type to Java |
|
246 |
// is that we return an oop, but we can block on exit from this routine and |
|
247 |
// a GC can trash the oop in C's return register. The generated stub will |
|
248 |
// fetch the oop from TLS after any possible GC. |
|
249 |
} |
|
250 |
||
251 |
deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); |
|
252 |
JRT_BLOCK_END; |
|
253 |
||
254 |
if (GraphKit::use_ReduceInitialCardMarks()) { |
|
4030
4c471254865e
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
2131
diff
changeset
|
255 |
// inform GC that we won't do card marks for initializing writes. |
4637 | 256 |
new_store_pre_barrier(thread); |
1 | 257 |
} |
258 |
JRT_END |
|
259 |
||
260 |
||
261 |
// array allocation |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13521
diff
changeset
|
262 |
JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_C(Klass* array_type, int len, JavaThread *thread)) |
1 | 263 |
JRT_BLOCK; |
264 |
#ifndef PRODUCT |
|
265 |
SharedRuntime::_new_array_ctr++; // new array requires GC |
|
266 |
#endif |
|
267 |
assert(check_compiled_frame(thread), "incorrect caller"); |
|
268 |
||
269 |
// Scavenge and allocate an instance. |
|
270 |
oop result; |
|
271 |
||
14488 | 272 |
if (array_type->oop_is_typeArray()) { |
1 | 273 |
// The oopFactory likes to work with the element type. |
274 |
// (We could bypass the oopFactory, since it doesn't add much value.) |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13742
diff
changeset
|
275 |
BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type(); |
1 | 276 |
result = oopFactory::new_typeArray(elem_type, len, THREAD); |
277 |
} else { |
|
278 |
// Although the oopFactory likes to work with the elem_type, |
|
279 |
// the compiler prefers the array_type, since it must already have |
|
280 |
// that latter value in hand for the fast path. |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13742
diff
changeset
|
281 |
Klass* elem_type = ObjArrayKlass::cast(array_type)->element_klass(); |
1 | 282 |
result = oopFactory::new_objArray(elem_type, len, THREAD); |
283 |
} |
|
284 |
||
285 |
// Pass oops back through thread local storage. Our apparent type to Java |
|
286 |
// is that we return an oop, but we can block on exit from this routine and |
|
287 |
// a GC can trash the oop in C's return register. The generated stub will |
|
288 |
// fetch the oop from TLS after any possible GC. |
|
289 |
deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); |
|
290 |
thread->set_vm_result(result); |
|
291 |
JRT_BLOCK_END; |
|
292 |
||
293 |
if (GraphKit::use_ReduceInitialCardMarks()) { |
|
4030
4c471254865e
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
2131
diff
changeset
|
294 |
// inform GC that we won't do card marks for initializing writes. |
4637 | 295 |
new_store_pre_barrier(thread); |
1 | 296 |
} |
297 |
JRT_END |
|
298 |
||
10566
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
299 |
// array allocation without zeroing |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13521
diff
changeset
|
300 |
JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_nozero_C(Klass* array_type, int len, JavaThread *thread)) |
10566
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
301 |
JRT_BLOCK; |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
302 |
#ifndef PRODUCT |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
303 |
SharedRuntime::_new_array_ctr++; // new array requires GC |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
304 |
#endif |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
305 |
assert(check_compiled_frame(thread), "incorrect caller"); |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
306 |
|
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
307 |
// Scavenge and allocate an instance. |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
308 |
oop result; |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
309 |
|
14488 | 310 |
assert(array_type->oop_is_typeArray(), "should be called only for type array"); |
10566
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
311 |
// The oopFactory likes to work with the element type. |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13742
diff
changeset
|
312 |
BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type(); |
10566
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
313 |
result = oopFactory::new_typeArray_nozero(elem_type, len, THREAD); |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
314 |
|
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
315 |
// Pass oops back through thread local storage. Our apparent type to Java |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
316 |
// is that we return an oop, but we can block on exit from this routine and |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
317 |
// a GC can trash the oop in C's return register. The generated stub will |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
318 |
// fetch the oop from TLS after any possible GC. |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
319 |
deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
320 |
thread->set_vm_result(result); |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
321 |
JRT_BLOCK_END; |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
322 |
|
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
323 |
if (GraphKit::use_ReduceInitialCardMarks()) { |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
324 |
// inform GC that we won't do card marks for initializing writes. |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
325 |
new_store_pre_barrier(thread); |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
326 |
} |
10987
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
327 |
|
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
328 |
oop result = thread->vm_result(); |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
329 |
if ((len > 0) && (result != NULL) && |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
330 |
is_deoptimized_caller_frame(thread)) { |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
331 |
// Zero array here if the caller is deoptimized. |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
332 |
int size = ((typeArrayOop)result)->object_size(); |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13742
diff
changeset
|
333 |
BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type(); |
10987
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
334 |
const size_t hs = arrayOopDesc::header_size(elem_type); |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
335 |
// Align to next 8 bytes to avoid trashing arrays's length. |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
336 |
const size_t aligned_hs = align_object_offset(hs); |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
337 |
HeapWord* obj = (HeapWord*)result; |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
338 |
if (aligned_hs > hs) { |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
339 |
Copy::zero_to_words(obj+hs, aligned_hs-hs); |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
340 |
} |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
341 |
// Optimized zeroing. |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
342 |
Copy::fill_to_aligned_words(obj+aligned_hs, size-aligned_hs); |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
343 |
} |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
344 |
|
10566
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
345 |
JRT_END |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
10508
diff
changeset
|
346 |
|
1 | 347 |
// Note: multianewarray for one dimension is handled inline by GraphKit::new_array. |
348 |
||
349 |
// multianewarray for 2 dimensions |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13521
diff
changeset
|
350 |
JRT_ENTRY(void, OptoRuntime::multianewarray2_C(Klass* elem_type, int len1, int len2, JavaThread *thread)) |
1 | 351 |
#ifndef PRODUCT |
352 |
SharedRuntime::_multi2_ctr++; // multianewarray for 1 dimension |
|
353 |
#endif |
|
354 |
assert(check_compiled_frame(thread), "incorrect caller"); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13521
diff
changeset
|
355 |
assert(elem_type->is_klass(), "not a class"); |
1 | 356 |
jint dims[2]; |
357 |
dims[0] = len1; |
|
358 |
dims[1] = len2; |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13742
diff
changeset
|
359 |
oop obj = ArrayKlass::cast(elem_type)->multi_allocate(2, dims, THREAD); |
1 | 360 |
deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); |
361 |
thread->set_vm_result(obj); |
|
362 |
JRT_END |
|
363 |
||
364 |
// multianewarray for 3 dimensions |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13521
diff
changeset
|
365 |
JRT_ENTRY(void, OptoRuntime::multianewarray3_C(Klass* elem_type, int len1, int len2, int len3, JavaThread *thread)) |
1 | 366 |
#ifndef PRODUCT |
367 |
SharedRuntime::_multi3_ctr++; // multianewarray for 1 dimension |
|
368 |
#endif |
|
369 |
assert(check_compiled_frame(thread), "incorrect caller"); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13521
diff
changeset
|
370 |
assert(elem_type->is_klass(), "not a class"); |
1 | 371 |
jint dims[3]; |
372 |
dims[0] = len1; |
|
373 |
dims[1] = len2; |
|
374 |
dims[2] = len3; |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13742
diff
changeset
|
375 |
oop obj = ArrayKlass::cast(elem_type)->multi_allocate(3, dims, THREAD); |
1 | 376 |
deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); |
377 |
thread->set_vm_result(obj); |
|
378 |
JRT_END |
|
379 |
||
380 |
// multianewarray for 4 dimensions |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13521
diff
changeset
|
381 |
JRT_ENTRY(void, OptoRuntime::multianewarray4_C(Klass* elem_type, int len1, int len2, int len3, int len4, JavaThread *thread)) |
1 | 382 |
#ifndef PRODUCT |
383 |
SharedRuntime::_multi4_ctr++; // multianewarray for 1 dimension |
|
384 |
#endif |
|
385 |
assert(check_compiled_frame(thread), "incorrect caller"); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13521
diff
changeset
|
386 |
assert(elem_type->is_klass(), "not a class"); |
1 | 387 |
jint dims[4]; |
388 |
dims[0] = len1; |
|
389 |
dims[1] = len2; |
|
390 |
dims[2] = len3; |
|
391 |
dims[3] = len4; |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13742
diff
changeset
|
392 |
oop obj = ArrayKlass::cast(elem_type)->multi_allocate(4, dims, THREAD); |
1 | 393 |
deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); |
394 |
thread->set_vm_result(obj); |
|
395 |
JRT_END |
|
396 |
||
397 |
// multianewarray for 5 dimensions |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13521
diff
changeset
|
398 |
JRT_ENTRY(void, OptoRuntime::multianewarray5_C(Klass* elem_type, int len1, int len2, int len3, int len4, int len5, JavaThread *thread)) |
1 | 399 |
#ifndef PRODUCT |
400 |
SharedRuntime::_multi5_ctr++; // multianewarray for 1 dimension |
|
401 |
#endif |
|
402 |
assert(check_compiled_frame(thread), "incorrect caller"); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13521
diff
changeset
|
403 |
assert(elem_type->is_klass(), "not a class"); |
1 | 404 |
jint dims[5]; |
405 |
dims[0] = len1; |
|
406 |
dims[1] = len2; |
|
407 |
dims[2] = len3; |
|
408 |
dims[3] = len4; |
|
409 |
dims[4] = len5; |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13742
diff
changeset
|
410 |
oop obj = ArrayKlass::cast(elem_type)->multi_allocate(5, dims, THREAD); |
1 | 411 |
deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); |
412 |
thread->set_vm_result(obj); |
|
413 |
JRT_END |
|
414 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13521
diff
changeset
|
415 |
JRT_ENTRY(void, OptoRuntime::multianewarrayN_C(Klass* elem_type, arrayOopDesc* dims, JavaThread *thread)) |
10028
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
416 |
assert(check_compiled_frame(thread), "incorrect caller"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13521
diff
changeset
|
417 |
assert(elem_type->is_klass(), "not a class"); |
10028
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
418 |
assert(oop(dims)->is_typeArray(), "not an array"); |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
419 |
|
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
420 |
ResourceMark rm; |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
421 |
jint len = dims->length(); |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
422 |
assert(len > 0, "Dimensions array should contain data"); |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
423 |
jint *j_dims = typeArrayOop(dims)->int_at_addr(0); |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
424 |
jint *c_dims = NEW_RESOURCE_ARRAY(jint, len); |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
425 |
Copy::conjoint_jints_atomic(j_dims, c_dims, len); |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
426 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13742
diff
changeset
|
427 |
oop obj = ArrayKlass::cast(elem_type)->multi_allocate(len, c_dims, THREAD); |
10028
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
428 |
deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
429 |
thread->set_vm_result(obj); |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
430 |
JRT_END |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
431 |
|
31856 | 432 |
JRT_BLOCK_ENTRY(void, OptoRuntime::monitor_notify_C(oopDesc* obj, JavaThread *thread)) |
433 |
||
434 |
// Very few notify/notifyAll operations find any threads on the waitset, so |
|
435 |
// the dominant fast-path is to simply return. |
|
436 |
// Relatedly, it's critical that notify/notifyAll be fast in order to |
|
437 |
// reduce lock hold times. |
|
438 |
if (!SafepointSynchronize::is_synchronizing()) { |
|
439 |
if (ObjectSynchronizer::quick_notify(obj, thread, false)) { |
|
440 |
return; |
|
441 |
} |
|
442 |
} |
|
443 |
||
444 |
// This is the case the fast-path above isn't provisioned to handle. |
|
445 |
// The fast-path is designed to handle frequently arising cases in an efficient manner. |
|
446 |
// (The fast-path is just a degenerate variant of the slow-path). |
|
447 |
// Perform the dreaded state transition and pass control into the slow-path. |
|
448 |
JRT_BLOCK; |
|
449 |
Handle h_obj(THREAD, obj); |
|
450 |
ObjectSynchronizer::notify(h_obj, CHECK); |
|
451 |
JRT_BLOCK_END; |
|
452 |
JRT_END |
|
453 |
||
454 |
JRT_BLOCK_ENTRY(void, OptoRuntime::monitor_notifyAll_C(oopDesc* obj, JavaThread *thread)) |
|
455 |
||
456 |
if (!SafepointSynchronize::is_synchronizing() ) { |
|
457 |
if (ObjectSynchronizer::quick_notify(obj, thread, true)) { |
|
458 |
return; |
|
459 |
} |
|
460 |
} |
|
461 |
||
462 |
// This is the case the fast-path above isn't provisioned to handle. |
|
463 |
// The fast-path is designed to handle frequently arising cases in an efficient manner. |
|
464 |
// (The fast-path is just a degenerate variant of the slow-path). |
|
465 |
// Perform the dreaded state transition and pass control into the slow-path. |
|
466 |
JRT_BLOCK; |
|
467 |
Handle h_obj(THREAD, obj); |
|
468 |
ObjectSynchronizer::notifyall(h_obj, CHECK); |
|
469 |
JRT_BLOCK_END; |
|
470 |
JRT_END |
|
10028
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
471 |
|
1 | 472 |
const TypeFunc *OptoRuntime::new_instance_Type() { |
473 |
// create input type (domain) |
|
474 |
const Type **fields = TypeTuple::fields(1); |
|
475 |
fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Klass to be allocated |
|
476 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields); |
|
477 |
||
478 |
// create result type (range) |
|
479 |
fields = TypeTuple::fields(1); |
|
480 |
fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Returned oop |
|
481 |
||
482 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields); |
|
483 |
||
484 |
return TypeFunc::make(domain, range); |
|
485 |
} |
|
486 |
||
487 |
||
488 |
const TypeFunc *OptoRuntime::athrow_Type() { |
|
489 |
// create input type (domain) |
|
490 |
const Type **fields = TypeTuple::fields(1); |
|
491 |
fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Klass to be allocated |
|
492 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields); |
|
493 |
||
494 |
// create result type (range) |
|
495 |
fields = TypeTuple::fields(0); |
|
496 |
||
497 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields); |
|
498 |
||
499 |
return TypeFunc::make(domain, range); |
|
500 |
} |
|
501 |
||
502 |
||
503 |
const TypeFunc *OptoRuntime::new_array_Type() { |
|
504 |
// create input type (domain) |
|
505 |
const Type **fields = TypeTuple::fields(2); |
|
506 |
fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // element klass |
|
507 |
fields[TypeFunc::Parms+1] = TypeInt::INT; // array size |
|
508 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields); |
|
509 |
||
510 |
// create result type (range) |
|
511 |
fields = TypeTuple::fields(1); |
|
512 |
fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Returned oop |
|
513 |
||
514 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields); |
|
515 |
||
516 |
return TypeFunc::make(domain, range); |
|
517 |
} |
|
518 |
||
519 |
const TypeFunc *OptoRuntime::multianewarray_Type(int ndim) { |
|
520 |
// create input type (domain) |
|
521 |
const int nargs = ndim + 1; |
|
522 |
const Type **fields = TypeTuple::fields(nargs); |
|
523 |
fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // element klass |
|
524 |
for( int i = 1; i < nargs; i++ ) |
|
525 |
fields[TypeFunc::Parms + i] = TypeInt::INT; // array size |
|
526 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+nargs, fields); |
|
527 |
||
528 |
// create result type (range) |
|
529 |
fields = TypeTuple::fields(1); |
|
530 |
fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Returned oop |
|
531 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields); |
|
532 |
||
533 |
return TypeFunc::make(domain, range); |
|
534 |
} |
|
535 |
||
536 |
const TypeFunc *OptoRuntime::multianewarray2_Type() { |
|
537 |
return multianewarray_Type(2); |
|
538 |
} |
|
539 |
||
540 |
const TypeFunc *OptoRuntime::multianewarray3_Type() { |
|
541 |
return multianewarray_Type(3); |
|
542 |
} |
|
543 |
||
544 |
const TypeFunc *OptoRuntime::multianewarray4_Type() { |
|
545 |
return multianewarray_Type(4); |
|
546 |
} |
|
547 |
||
548 |
const TypeFunc *OptoRuntime::multianewarray5_Type() { |
|
549 |
return multianewarray_Type(5); |
|
550 |
} |
|
551 |
||
10028
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
552 |
const TypeFunc *OptoRuntime::multianewarrayN_Type() { |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
553 |
// create input type (domain) |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
554 |
const Type **fields = TypeTuple::fields(2); |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
555 |
fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // element klass |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
556 |
fields[TypeFunc::Parms+1] = TypeInstPtr::NOTNULL; // array of dim sizes |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
557 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields); |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
558 |
|
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
559 |
// create result type (range) |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
560 |
fields = TypeTuple::fields(1); |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
561 |
fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Returned oop |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
562 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields); |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
563 |
|
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
564 |
return TypeFunc::make(domain, range); |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
565 |
} |
035159a868a1
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
9976
diff
changeset
|
566 |
|
1374 | 567 |
const TypeFunc *OptoRuntime::g1_wb_pre_Type() { |
568 |
const Type **fields = TypeTuple::fields(2); |
|
569 |
fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // original field value |
|
570 |
fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // thread |
|
571 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields); |
|
572 |
||
573 |
// create result type (range) |
|
574 |
fields = TypeTuple::fields(0); |
|
575 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields); |
|
576 |
||
577 |
return TypeFunc::make(domain, range); |
|
578 |
} |
|
579 |
||
580 |
const TypeFunc *OptoRuntime::g1_wb_post_Type() { |
|
581 |
||
582 |
const Type **fields = TypeTuple::fields(2); |
|
583 |
fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Card addr |
|
584 |
fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // thread |
|
585 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields); |
|
586 |
||
587 |
// create result type (range) |
|
588 |
fields = TypeTuple::fields(0); |
|
589 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms, fields); |
|
590 |
||
591 |
return TypeFunc::make(domain, range); |
|
592 |
} |
|
593 |
||
1 | 594 |
const TypeFunc *OptoRuntime::uncommon_trap_Type() { |
595 |
// create input type (domain) |
|
596 |
const Type **fields = TypeTuple::fields(1); |
|
22551 | 597 |
fields[TypeFunc::Parms+0] = TypeInt::INT; // trap_reason (deopt reason and action) |
1 | 598 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields); |
599 |
||
600 |
// create result type (range) |
|
601 |
fields = TypeTuple::fields(0); |
|
602 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields); |
|
603 |
||
604 |
return TypeFunc::make(domain, range); |
|
605 |
} |
|
606 |
||
607 |
# ifdef ENABLE_ZAP_DEAD_LOCALS |
|
608 |
// Type used for stub generation for zap_dead_locals. |
|
609 |
// No inputs or outputs |
|
610 |
const TypeFunc *OptoRuntime::zap_dead_locals_Type() { |
|
611 |
// create input type (domain) |
|
612 |
const Type **fields = TypeTuple::fields(0); |
|
613 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms,fields); |
|
614 |
||
615 |
// create result type (range) |
|
616 |
fields = TypeTuple::fields(0); |
|
617 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms,fields); |
|
618 |
||
619 |
return TypeFunc::make(domain,range); |
|
620 |
} |
|
621 |
# endif |
|
622 |
||
623 |
||
624 |
//----------------------------------------------------------------------------- |
|
625 |
// Monitor Handling |
|
626 |
const TypeFunc *OptoRuntime::complete_monitor_enter_Type() { |
|
627 |
// create input type (domain) |
|
628 |
const Type **fields = TypeTuple::fields(2); |
|
629 |
fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Object to be Locked |
|
630 |
fields[TypeFunc::Parms+1] = TypeRawPtr::BOTTOM; // Address of stack location for lock |
|
631 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields); |
|
632 |
||
633 |
// create result type (range) |
|
634 |
fields = TypeTuple::fields(0); |
|
635 |
||
636 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields); |
|
637 |
||
638 |
return TypeFunc::make(domain,range); |
|
639 |
} |
|
640 |
||
641 |
||
642 |
//----------------------------------------------------------------------------- |
|
643 |
const TypeFunc *OptoRuntime::complete_monitor_exit_Type() { |
|
644 |
// create input type (domain) |
|
30244 | 645 |
const Type **fields = TypeTuple::fields(3); |
1 | 646 |
fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Object to be Locked |
30244 | 647 |
fields[TypeFunc::Parms+1] = TypeRawPtr::BOTTOM; // Address of stack location for lock - BasicLock |
648 |
fields[TypeFunc::Parms+2] = TypeRawPtr::BOTTOM; // Thread pointer (Self) |
|
31856 | 649 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+3, fields); |
1 | 650 |
|
651 |
// create result type (range) |
|
652 |
fields = TypeTuple::fields(0); |
|
653 |
||
31856 | 654 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields); |
655 |
||
656 |
return TypeFunc::make(domain, range); |
|
657 |
} |
|
1 | 658 |
|
31856 | 659 |
const TypeFunc *OptoRuntime::monitor_notify_Type() { |
660 |
// create input type (domain) |
|
661 |
const Type **fields = TypeTuple::fields(1); |
|
662 |
fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Object to be Locked |
|
663 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields); |
|
664 |
||
665 |
// create result type (range) |
|
666 |
fields = TypeTuple::fields(0); |
|
667 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields); |
|
668 |
return TypeFunc::make(domain, range); |
|
1 | 669 |
} |
670 |
||
671 |
const TypeFunc* OptoRuntime::flush_windows_Type() { |
|
672 |
// create input type (domain) |
|
673 |
const Type** fields = TypeTuple::fields(1); |
|
674 |
fields[TypeFunc::Parms+0] = NULL; // void |
|
675 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms, fields); |
|
676 |
||
677 |
// create result type |
|
678 |
fields = TypeTuple::fields(1); |
|
679 |
fields[TypeFunc::Parms+0] = NULL; // void |
|
680 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms, fields); |
|
681 |
||
682 |
return TypeFunc::make(domain, range); |
|
683 |
} |
|
684 |
||
685 |
const TypeFunc* OptoRuntime::l2f_Type() { |
|
686 |
// create input type (domain) |
|
687 |
const Type **fields = TypeTuple::fields(2); |
|
688 |
fields[TypeFunc::Parms+0] = TypeLong::LONG; |
|
689 |
fields[TypeFunc::Parms+1] = Type::HALF; |
|
690 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields); |
|
691 |
||
692 |
// create result type (range) |
|
693 |
fields = TypeTuple::fields(1); |
|
694 |
fields[TypeFunc::Parms+0] = Type::FLOAT; |
|
695 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields); |
|
696 |
||
697 |
return TypeFunc::make(domain, range); |
|
698 |
} |
|
699 |
||
700 |
const TypeFunc* OptoRuntime::modf_Type() { |
|
701 |
const Type **fields = TypeTuple::fields(2); |
|
702 |
fields[TypeFunc::Parms+0] = Type::FLOAT; |
|
703 |
fields[TypeFunc::Parms+1] = Type::FLOAT; |
|
704 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields); |
|
705 |
||
706 |
// create result type (range) |
|
707 |
fields = TypeTuple::fields(1); |
|
708 |
fields[TypeFunc::Parms+0] = Type::FLOAT; |
|
709 |
||
710 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields); |
|
711 |
||
712 |
return TypeFunc::make(domain, range); |
|
713 |
} |
|
714 |
||
715 |
const TypeFunc *OptoRuntime::Math_D_D_Type() { |
|
716 |
// create input type (domain) |
|
717 |
const Type **fields = TypeTuple::fields(2); |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
718 |
// Symbol* name of class to be loaded |
1 | 719 |
fields[TypeFunc::Parms+0] = Type::DOUBLE; |
720 |
fields[TypeFunc::Parms+1] = Type::HALF; |
|
721 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields); |
|
722 |
||
723 |
// create result type (range) |
|
724 |
fields = TypeTuple::fields(2); |
|
725 |
fields[TypeFunc::Parms+0] = Type::DOUBLE; |
|
726 |
fields[TypeFunc::Parms+1] = Type::HALF; |
|
727 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+2, fields); |
|
728 |
||
729 |
return TypeFunc::make(domain, range); |
|
730 |
} |
|
731 |
||
732 |
const TypeFunc* OptoRuntime::Math_DD_D_Type() { |
|
733 |
const Type **fields = TypeTuple::fields(4); |
|
734 |
fields[TypeFunc::Parms+0] = Type::DOUBLE; |
|
735 |
fields[TypeFunc::Parms+1] = Type::HALF; |
|
736 |
fields[TypeFunc::Parms+2] = Type::DOUBLE; |
|
737 |
fields[TypeFunc::Parms+3] = Type::HALF; |
|
738 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+4, fields); |
|
739 |
||
740 |
// create result type (range) |
|
741 |
fields = TypeTuple::fields(2); |
|
742 |
fields[TypeFunc::Parms+0] = Type::DOUBLE; |
|
743 |
fields[TypeFunc::Parms+1] = Type::HALF; |
|
744 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+2, fields); |
|
745 |
||
746 |
return TypeFunc::make(domain, range); |
|
747 |
} |
|
748 |
||
12377
ae6def2813e0
7160570: Intrinsification support for tracing framework
rbackman
parents:
10987
diff
changeset
|
749 |
//-------------- currentTimeMillis, currentTimeNanos, etc |
1 | 750 |
|
12377
ae6def2813e0
7160570: Intrinsification support for tracing framework
rbackman
parents:
10987
diff
changeset
|
751 |
const TypeFunc* OptoRuntime::void_long_Type() { |
1 | 752 |
// create input type (domain) |
753 |
const Type **fields = TypeTuple::fields(0); |
|
754 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+0, fields); |
|
755 |
||
756 |
// create result type (range) |
|
757 |
fields = TypeTuple::fields(2); |
|
758 |
fields[TypeFunc::Parms+0] = TypeLong::LONG; |
|
759 |
fields[TypeFunc::Parms+1] = Type::HALF; |
|
760 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+2, fields); |
|
761 |
||
762 |
return TypeFunc::make(domain, range); |
|
763 |
} |
|
764 |
||
765 |
// arraycopy stub variations: |
|
766 |
enum ArrayCopyType { |
|
767 |
ac_fast, // void(ptr, ptr, size_t) |
|
768 |
ac_checkcast, // int(ptr, ptr, size_t, size_t, ptr) |
|
769 |
ac_slow, // void(ptr, int, ptr, int, int) |
|
770 |
ac_generic // int(ptr, int, ptr, int, int) |
|
771 |
}; |
|
772 |
||
773 |
static const TypeFunc* make_arraycopy_Type(ArrayCopyType act) { |
|
774 |
// create input type (domain) |
|
775 |
int num_args = (act == ac_fast ? 3 : 5); |
|
776 |
int num_size_args = (act == ac_fast ? 1 : act == ac_checkcast ? 2 : 0); |
|
777 |
int argcnt = num_args; |
|
778 |
LP64_ONLY(argcnt += num_size_args); // halfwords for lengths |
|
779 |
const Type** fields = TypeTuple::fields(argcnt); |
|
780 |
int argp = TypeFunc::Parms; |
|
781 |
fields[argp++] = TypePtr::NOTNULL; // src |
|
782 |
if (num_size_args == 0) { |
|
783 |
fields[argp++] = TypeInt::INT; // src_pos |
|
784 |
} |
|
785 |
fields[argp++] = TypePtr::NOTNULL; // dest |
|
786 |
if (num_size_args == 0) { |
|
787 |
fields[argp++] = TypeInt::INT; // dest_pos |
|
788 |
fields[argp++] = TypeInt::INT; // length |
|
789 |
} |
|
790 |
while (num_size_args-- > 0) { |
|
791 |
fields[argp++] = TypeX_X; // size in whatevers (size_t) |
|
792 |
LP64_ONLY(fields[argp++] = Type::HALF); // other half of long length |
|
793 |
} |
|
794 |
if (act == ac_checkcast) { |
|
795 |
fields[argp++] = TypePtr::NOTNULL; // super_klass |
|
796 |
} |
|
797 |
assert(argp == TypeFunc::Parms+argcnt, "correct decoding of act"); |
|
798 |
const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); |
|
799 |
||
800 |
// create result type if needed |
|
801 |
int retcnt = (act == ac_checkcast || act == ac_generic ? 1 : 0); |
|
802 |
fields = TypeTuple::fields(1); |
|
803 |
if (retcnt == 0) |
|
804 |
fields[TypeFunc::Parms+0] = NULL; // void |
|
805 |
else |
|
806 |
fields[TypeFunc::Parms+0] = TypeInt::INT; // status result, if needed |
|
807 |
const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+retcnt, fields); |
|
808 |
return TypeFunc::make(domain, range); |
|
809 |
} |
|
810 |
||
811 |
const TypeFunc* OptoRuntime::fast_arraycopy_Type() { |
|
812 |
// This signature is simple: Two base pointers and a size_t. |
|
813 |
return make_arraycopy_Type(ac_fast); |
|
814 |
} |
|
815 |
||
816 |
const TypeFunc* OptoRuntime::checkcast_arraycopy_Type() { |
|
817 |
// An extension of fast_arraycopy_Type which adds type checking. |
|
818 |
return make_arraycopy_Type(ac_checkcast); |
|
819 |
} |
|
820 |
||
821 |
const TypeFunc* OptoRuntime::slow_arraycopy_Type() { |
|
822 |
// This signature is exactly the same as System.arraycopy. |
|
823 |
// There are no intptr_t (int/long) arguments. |
|
824 |
return make_arraycopy_Type(ac_slow); |
|
825 |
} |
|
826 |
||
827 |
const TypeFunc* OptoRuntime::generic_arraycopy_Type() { |
|
828 |
// This signature is like System.arraycopy, except that it returns status. |
|
829 |
return make_arraycopy_Type(ac_generic); |
|
830 |
} |
|
831 |
||
832 |
||
6433 | 833 |
const TypeFunc* OptoRuntime::array_fill_Type() { |
22834
3e2df6a4a28c
8024342: PPC64 (part 111): Support for C calling conventions that require 64-bit ints.
goetz
parents:
22820
diff
changeset
|
834 |
const Type** fields; |
6770
a67870aaedb3
6980792: Crash "exception happened outside interpreter, nmethods and vtable stubs (1)"
never
parents:
6433
diff
changeset
|
835 |
int argp = TypeFunc::Parms; |
22834
3e2df6a4a28c
8024342: PPC64 (part 111): Support for C calling conventions that require 64-bit ints.
goetz
parents:
22820
diff
changeset
|
836 |
// create input type (domain): pointer, int, size_t |
31590
427d073af867
8086069: Adapt runtime calls to recent intrinsics to pass ints as long
goetz
parents:
31584
diff
changeset
|
837 |
fields = TypeTuple::fields(3 LP64_ONLY( + 1)); |
427d073af867
8086069: Adapt runtime calls to recent intrinsics to pass ints as long
goetz
parents:
31584
diff
changeset
|
838 |
fields[argp++] = TypePtr::NOTNULL; |
427d073af867
8086069: Adapt runtime calls to recent intrinsics to pass ints as long
goetz
parents:
31584
diff
changeset
|
839 |
fields[argp++] = TypeInt::INT; |
6770
a67870aaedb3
6980792: Crash "exception happened outside interpreter, nmethods and vtable stubs (1)"
never
parents:
6433
diff
changeset
|
840 |
fields[argp++] = TypeX_X; // size in whatevers (size_t) |
a67870aaedb3
6980792: Crash "exception happened outside interpreter, nmethods and vtable stubs (1)"
never
parents:
6433
diff
changeset
|
841 |
LP64_ONLY(fields[argp++] = Type::HALF); // other half of long length |
a67870aaedb3
6980792: Crash "exception happened outside interpreter, nmethods and vtable stubs (1)"
never
parents:
6433
diff
changeset
|
842 |
const TypeTuple *domain = TypeTuple::make(argp, fields); |
6433 | 843 |
|
844 |
// create result type |
|
845 |
fields = TypeTuple::fields(1); |
|
846 |
fields[TypeFunc::Parms+0] = NULL; // void |
|
847 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms, fields); |
|
848 |
||
849 |
return TypeFunc::make(domain, range); |
|
850 |
} |
|
851 |
||
14132 | 852 |
// for aescrypt encrypt/decrypt operations, just three pointers returning void (length is constant) |
853 |
const TypeFunc* OptoRuntime::aescrypt_block_Type() { |
|
854 |
// create input type (domain) |
|
855 |
int num_args = 3; |
|
22505 | 856 |
if (Matcher::pass_original_key_for_aes()) { |
857 |
num_args = 4; |
|
858 |
} |
|
14132 | 859 |
int argcnt = num_args; |
860 |
const Type** fields = TypeTuple::fields(argcnt); |
|
861 |
int argp = TypeFunc::Parms; |
|
862 |
fields[argp++] = TypePtr::NOTNULL; // src |
|
863 |
fields[argp++] = TypePtr::NOTNULL; // dest |
|
864 |
fields[argp++] = TypePtr::NOTNULL; // k array |
|
22505 | 865 |
if (Matcher::pass_original_key_for_aes()) { |
866 |
fields[argp++] = TypePtr::NOTNULL; // original k array |
|
867 |
} |
|
14132 | 868 |
assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); |
869 |
const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); |
|
870 |
||
871 |
// no result type needed |
|
872 |
fields = TypeTuple::fields(1); |
|
873 |
fields[TypeFunc::Parms+0] = NULL; // void |
|
874 |
const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields); |
|
875 |
return TypeFunc::make(domain, range); |
|
876 |
} |
|
877 |
||
18507
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
878 |
/** |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
879 |
* int updateBytesCRC32(int crc, byte* b, int len) |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
880 |
*/ |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
881 |
const TypeFunc* OptoRuntime::updateBytesCRC32_Type() { |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
882 |
// create input type (domain) |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
883 |
int num_args = 3; |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
884 |
int argcnt = num_args; |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
885 |
const Type** fields = TypeTuple::fields(argcnt); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
886 |
int argp = TypeFunc::Parms; |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
887 |
fields[argp++] = TypeInt::INT; // crc |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
888 |
fields[argp++] = TypePtr::NOTNULL; // src |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
889 |
fields[argp++] = TypeInt::INT; // len |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
890 |
assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
891 |
const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
892 |
|
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
893 |
// result type needed |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
894 |
fields = TypeTuple::fields(1); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
895 |
fields[TypeFunc::Parms+0] = TypeInt::INT; // crc result |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
896 |
const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
897 |
return TypeFunc::make(domain, range); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
898 |
} |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17379
diff
changeset
|
899 |
|
31515 | 900 |
/** |
901 |
* int updateBytesCRC32C(int crc, byte* buf, int len, int* table) |
|
902 |
*/ |
|
903 |
const TypeFunc* OptoRuntime::updateBytesCRC32C_Type() { |
|
904 |
// create input type (domain) |
|
905 |
int num_args = 4; |
|
906 |
int argcnt = num_args; |
|
907 |
const Type** fields = TypeTuple::fields(argcnt); |
|
908 |
int argp = TypeFunc::Parms; |
|
909 |
fields[argp++] = TypeInt::INT; // crc |
|
910 |
fields[argp++] = TypePtr::NOTNULL; // buf |
|
911 |
fields[argp++] = TypeInt::INT; // len |
|
912 |
fields[argp++] = TypePtr::NOTNULL; // table |
|
913 |
assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); |
|
914 |
const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); |
|
915 |
||
916 |
// result type needed |
|
917 |
fields = TypeTuple::fields(1); |
|
918 |
fields[TypeFunc::Parms+0] = TypeInt::INT; // crc result |
|
919 |
const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields); |
|
920 |
return TypeFunc::make(domain, range); |
|
921 |
} |
|
922 |
||
32581 | 923 |
/** |
924 |
* int updateBytesAdler32(int adler, bytes* b, int off, int len) |
|
925 |
*/ |
|
926 |
const TypeFunc* OptoRuntime::updateBytesAdler32_Type() { |
|
927 |
// create input type (domain) |
|
928 |
int num_args = 3; |
|
929 |
int argcnt = num_args; |
|
930 |
const Type** fields = TypeTuple::fields(argcnt); |
|
931 |
int argp = TypeFunc::Parms; |
|
932 |
fields[argp++] = TypeInt::INT; // crc |
|
933 |
fields[argp++] = TypePtr::NOTNULL; // src + offset |
|
934 |
fields[argp++] = TypeInt::INT; // len |
|
935 |
assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); |
|
936 |
const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); |
|
937 |
||
938 |
// result type needed |
|
939 |
fields = TypeTuple::fields(1); |
|
940 |
fields[TypeFunc::Parms+0] = TypeInt::INT; // crc result |
|
941 |
const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields); |
|
942 |
return TypeFunc::make(domain, range); |
|
943 |
} |
|
944 |
||
24328
bddefb356fba
8035936: SIGBUS in StubRoutines::aesencryptBlock, solaris-sparc
kvn
parents:
23528
diff
changeset
|
945 |
// for cipherBlockChaining calls of aescrypt encrypt/decrypt, four pointers and a length, returning int |
14132 | 946 |
const TypeFunc* OptoRuntime::cipherBlockChaining_aescrypt_Type() { |
947 |
// create input type (domain) |
|
948 |
int num_args = 5; |
|
22505 | 949 |
if (Matcher::pass_original_key_for_aes()) { |
950 |
num_args = 6; |
|
951 |
} |
|
14132 | 952 |
int argcnt = num_args; |
953 |
const Type** fields = TypeTuple::fields(argcnt); |
|
954 |
int argp = TypeFunc::Parms; |
|
955 |
fields[argp++] = TypePtr::NOTNULL; // src |
|
956 |
fields[argp++] = TypePtr::NOTNULL; // dest |
|
957 |
fields[argp++] = TypePtr::NOTNULL; // k array |
|
958 |
fields[argp++] = TypePtr::NOTNULL; // r array |
|
959 |
fields[argp++] = TypeInt::INT; // src len |
|
22505 | 960 |
if (Matcher::pass_original_key_for_aes()) { |
961 |
fields[argp++] = TypePtr::NOTNULL; // original k array |
|
962 |
} |
|
14132 | 963 |
assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); |
964 |
const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); |
|
965 |
||
22505 | 966 |
// returning cipher len (int) |
14132 | 967 |
fields = TypeTuple::fields(1); |
22505 | 968 |
fields[TypeFunc::Parms+0] = TypeInt::INT; |
969 |
const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields); |
|
14132 | 970 |
return TypeFunc::make(domain, range); |
971 |
} |
|
972 |
||
24953
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
973 |
/* |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
974 |
* void implCompress(byte[] buf, int ofs) |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
975 |
*/ |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
976 |
const TypeFunc* OptoRuntime::sha_implCompress_Type() { |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
977 |
// create input type (domain) |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
978 |
int num_args = 2; |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
979 |
int argcnt = num_args; |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
980 |
const Type** fields = TypeTuple::fields(argcnt); |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
981 |
int argp = TypeFunc::Parms; |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
982 |
fields[argp++] = TypePtr::NOTNULL; // buf |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
983 |
fields[argp++] = TypePtr::NOTNULL; // state |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
984 |
assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
985 |
const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
986 |
|
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
987 |
// no result type needed |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
988 |
fields = TypeTuple::fields(1); |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
989 |
fields[TypeFunc::Parms+0] = NULL; // void |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
990 |
const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields); |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
991 |
return TypeFunc::make(domain, range); |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
992 |
} |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
993 |
|
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
994 |
/* |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
995 |
* int implCompressMultiBlock(byte[] b, int ofs, int limit) |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
996 |
*/ |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
997 |
const TypeFunc* OptoRuntime::digestBase_implCompressMB_Type() { |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
998 |
// create input type (domain) |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
999 |
int num_args = 4; |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
1000 |
int argcnt = num_args; |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
1001 |
const Type** fields = TypeTuple::fields(argcnt); |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
1002 |
int argp = TypeFunc::Parms; |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
1003 |
fields[argp++] = TypePtr::NOTNULL; // buf |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
1004 |
fields[argp++] = TypePtr::NOTNULL; // state |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
1005 |
fields[argp++] = TypeInt::INT; // ofs |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
1006 |
fields[argp++] = TypeInt::INT; // limit |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
1007 |
assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
1008 |
const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
1009 |
|
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
1010 |
// returning ofs (int) |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
1011 |
fields = TypeTuple::fields(1); |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
1012 |
fields[TypeFunc::Parms+0] = TypeInt::INT; // ofs |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
1013 |
const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields); |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
1014 |
return TypeFunc::make(domain, range); |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
1015 |
} |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24429
diff
changeset
|
1016 |
|
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1017 |
const TypeFunc* OptoRuntime::multiplyToLen_Type() { |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1018 |
// create input type (domain) |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1019 |
int num_args = 6; |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1020 |
int argcnt = num_args; |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1021 |
const Type** fields = TypeTuple::fields(argcnt); |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1022 |
int argp = TypeFunc::Parms; |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1023 |
fields[argp++] = TypePtr::NOTNULL; // x |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1024 |
fields[argp++] = TypeInt::INT; // xlen |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1025 |
fields[argp++] = TypePtr::NOTNULL; // y |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1026 |
fields[argp++] = TypeInt::INT; // ylen |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1027 |
fields[argp++] = TypePtr::NOTNULL; // z |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1028 |
fields[argp++] = TypeInt::INT; // zlen |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1029 |
assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1030 |
const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1031 |
|
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1032 |
// no result type needed |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1033 |
fields = TypeTuple::fields(1); |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1034 |
fields[TypeFunc::Parms+0] = NULL; |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1035 |
const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields); |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1036 |
return TypeFunc::make(domain, range); |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1037 |
} |
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1038 |
|
31129
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1039 |
const TypeFunc* OptoRuntime::squareToLen_Type() { |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1040 |
// create input type (domain) |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1041 |
int num_args = 4; |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1042 |
int argcnt = num_args; |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1043 |
const Type** fields = TypeTuple::fields(argcnt); |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1044 |
int argp = TypeFunc::Parms; |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1045 |
fields[argp++] = TypePtr::NOTNULL; // x |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1046 |
fields[argp++] = TypeInt::INT; // len |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1047 |
fields[argp++] = TypePtr::NOTNULL; // z |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1048 |
fields[argp++] = TypeInt::INT; // zlen |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1049 |
assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1050 |
const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1051 |
|
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1052 |
// no result type needed |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1053 |
fields = TypeTuple::fields(1); |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1054 |
fields[TypeFunc::Parms+0] = NULL; |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1055 |
const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields); |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1056 |
return TypeFunc::make(domain, range); |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1057 |
} |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1058 |
|
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1059 |
// for mulAdd calls, 2 pointers and 3 ints, returning int |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1060 |
const TypeFunc* OptoRuntime::mulAdd_Type() { |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1061 |
// create input type (domain) |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1062 |
int num_args = 5; |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1063 |
int argcnt = num_args; |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1064 |
const Type** fields = TypeTuple::fields(argcnt); |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1065 |
int argp = TypeFunc::Parms; |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1066 |
fields[argp++] = TypePtr::NOTNULL; // out |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1067 |
fields[argp++] = TypePtr::NOTNULL; // in |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1068 |
fields[argp++] = TypeInt::INT; // offset |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1069 |
fields[argp++] = TypeInt::INT; // len |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1070 |
fields[argp++] = TypeInt::INT; // k |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1071 |
assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1072 |
const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1073 |
|
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1074 |
// returning carry (int) |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1075 |
fields = TypeTuple::fields(1); |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1076 |
fields[TypeFunc::Parms+0] = TypeInt::INT; |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1077 |
const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields); |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1078 |
return TypeFunc::make(domain, range); |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1079 |
} |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30764
diff
changeset
|
1080 |
|
31583
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1081 |
const TypeFunc* OptoRuntime::montgomeryMultiply_Type() { |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1082 |
// create input type (domain) |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1083 |
int num_args = 7; |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1084 |
int argcnt = num_args; |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1085 |
const Type** fields = TypeTuple::fields(argcnt); |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1086 |
int argp = TypeFunc::Parms; |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1087 |
fields[argp++] = TypePtr::NOTNULL; // a |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1088 |
fields[argp++] = TypePtr::NOTNULL; // b |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1089 |
fields[argp++] = TypePtr::NOTNULL; // n |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1090 |
fields[argp++] = TypeInt::INT; // len |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1091 |
fields[argp++] = TypeLong::LONG; // inv |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1092 |
fields[argp++] = Type::HALF; |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1093 |
fields[argp++] = TypePtr::NOTNULL; // result |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1094 |
assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1095 |
const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1096 |
|
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1097 |
// result type needed |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1098 |
fields = TypeTuple::fields(1); |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1099 |
fields[TypeFunc::Parms+0] = TypePtr::NOTNULL; |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1100 |
|
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1101 |
const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields); |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1102 |
return TypeFunc::make(domain, range); |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1103 |
} |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1104 |
|
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1105 |
const TypeFunc* OptoRuntime::montgomerySquare_Type() { |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1106 |
// create input type (domain) |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1107 |
int num_args = 6; |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1108 |
int argcnt = num_args; |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1109 |
const Type** fields = TypeTuple::fields(argcnt); |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1110 |
int argp = TypeFunc::Parms; |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1111 |
fields[argp++] = TypePtr::NOTNULL; // a |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1112 |
fields[argp++] = TypePtr::NOTNULL; // n |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1113 |
fields[argp++] = TypeInt::INT; // len |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1114 |
fields[argp++] = TypeLong::LONG; // inv |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1115 |
fields[argp++] = Type::HALF; |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1116 |
fields[argp++] = TypePtr::NOTNULL; // result |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1117 |
assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1118 |
const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1119 |
|
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1120 |
// result type needed |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1121 |
fields = TypeTuple::fields(1); |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1122 |
fields[TypeFunc::Parms+0] = TypePtr::NOTNULL; |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1123 |
|
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1124 |
const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields); |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1125 |
return TypeFunc::make(domain, range); |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1126 |
} |
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1127 |
|
31404
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
1128 |
// GHASH block processing |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
1129 |
const TypeFunc* OptoRuntime::ghash_processBlocks_Type() { |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
1130 |
int argcnt = 4; |
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1131 |
|
31404
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
1132 |
const Type** fields = TypeTuple::fields(argcnt); |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
1133 |
int argp = TypeFunc::Parms; |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
1134 |
fields[argp++] = TypePtr::NOTNULL; // state |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
1135 |
fields[argp++] = TypePtr::NOTNULL; // subkeyH |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
1136 |
fields[argp++] = TypePtr::NOTNULL; // data |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
1137 |
fields[argp++] = TypeInt::INT; // blocks |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
1138 |
assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
1139 |
const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
1140 |
|
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
1141 |
// result type needed |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
1142 |
fields = TypeTuple::fields(1); |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
1143 |
fields[TypeFunc::Parms+0] = NULL; // void |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
1144 |
const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields); |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
1145 |
return TypeFunc::make(domain, range); |
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
1146 |
} |
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25949
diff
changeset
|
1147 |
|
1 | 1148 |
//------------- Interpreter state access for on stack replacement |
1149 |
const TypeFunc* OptoRuntime::osr_end_Type() { |
|
1150 |
// create input type (domain) |
|
1151 |
const Type **fields = TypeTuple::fields(1); |
|
1152 |
fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // OSR temp buf |
|
1153 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields); |
|
1154 |
||
1155 |
// create result type |
|
1156 |
fields = TypeTuple::fields(1); |
|
1157 |
// fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // locked oop |
|
1158 |
fields[TypeFunc::Parms+0] = NULL; // void |
|
1159 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms, fields); |
|
1160 |
return TypeFunc::make(domain, range); |
|
1161 |
} |
|
1162 |
||
1163 |
//-------------- methodData update helpers |
|
1164 |
||
1165 |
const TypeFunc* OptoRuntime::profile_receiver_type_Type() { |
|
1166 |
// create input type (domain) |
|
1167 |
const Type **fields = TypeTuple::fields(2); |
|
1168 |
fields[TypeFunc::Parms+0] = TypeAryPtr::NOTNULL; // methodData pointer |
|
1169 |
fields[TypeFunc::Parms+1] = TypeInstPtr::BOTTOM; // receiver oop |
|
1170 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields); |
|
1171 |
||
1172 |
// create result type |
|
1173 |
fields = TypeTuple::fields(1); |
|
1174 |
fields[TypeFunc::Parms+0] = NULL; // void |
|
1175 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms, fields); |
|
1176 |
return TypeFunc::make(domain,range); |
|
1177 |
} |
|
1178 |
||
1179 |
JRT_LEAF(void, OptoRuntime::profile_receiver_type_C(DataLayout* data, oopDesc* receiver)) |
|
1180 |
if (receiver == NULL) return; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13521
diff
changeset
|
1181 |
Klass* receiver_klass = receiver->klass(); |
1 | 1182 |
|
1183 |
intptr_t* mdp = ((intptr_t*)(data)) + DataLayout::header_size_in_cells(); |
|
1184 |
int empty_row = -1; // free row, if any is encountered |
|
1185 |
||
1186 |
// ReceiverTypeData* vc = new ReceiverTypeData(mdp); |
|
1187 |
for (uint row = 0; row < ReceiverTypeData::row_limit(); row++) { |
|
1188 |
// if (vc->receiver(row) == receiver_klass) |
|
1189 |
int receiver_off = ReceiverTypeData::receiver_cell_index(row); |
|
1190 |
intptr_t row_recv = *(mdp + receiver_off); |
|
1191 |
if (row_recv == (intptr_t) receiver_klass) { |
|
1192 |
// vc->set_receiver_count(row, vc->receiver_count(row) + DataLayout::counter_increment); |
|
1193 |
int count_off = ReceiverTypeData::receiver_count_cell_index(row); |
|
1194 |
*(mdp + count_off) += DataLayout::counter_increment; |
|
1195 |
return; |
|
1196 |
} else if (row_recv == 0) { |
|
1197 |
// else if (vc->receiver(row) == NULL) |
|
1198 |
empty_row = (int) row; |
|
1199 |
} |
|
1200 |
} |
|
1201 |
||
1202 |
if (empty_row != -1) { |
|
1203 |
int receiver_off = ReceiverTypeData::receiver_cell_index(empty_row); |
|
1204 |
// vc->set_receiver(empty_row, receiver_klass); |
|
1205 |
*(mdp + receiver_off) = (intptr_t) receiver_klass; |
|
1206 |
// vc->set_receiver_count(empty_row, DataLayout::counter_increment); |
|
1207 |
int count_off = ReceiverTypeData::receiver_count_cell_index(empty_row); |
|
1208 |
*(mdp + count_off) = DataLayout::counter_increment; |
|
4754
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4637
diff
changeset
|
1209 |
} else { |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4637
diff
changeset
|
1210 |
// Receiver did not match any saved receiver and there is no empty row for it. |
4892
e977b527544a
6923002: assert(false,"this call site should not be polymorphic")
kvn
parents:
4754
diff
changeset
|
1211 |
// Increment total counter to indicate polymorphic case. |
24425 | 1212 |
intptr_t* count_p = (intptr_t*)(((uint8_t*)(data)) + in_bytes(CounterData::count_offset())); |
4754
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4637
diff
changeset
|
1213 |
*count_p += DataLayout::counter_increment; |
1 | 1214 |
} |
1215 |
JRT_END |
|
1216 |
||
1217 |
//------------------------------------------------------------------------------------- |
|
1218 |
// register policy |
|
1219 |
||
1220 |
bool OptoRuntime::is_callee_saved_register(MachRegisterNumbers reg) { |
|
1221 |
assert(reg >= 0 && reg < _last_Mach_Reg, "must be a machine register"); |
|
1222 |
switch (register_save_policy[reg]) { |
|
1223 |
case 'C': return false; //SOC |
|
1224 |
case 'E': return true ; //SOE |
|
1225 |
case 'N': return false; //NS |
|
1226 |
case 'A': return false; //AS |
|
1227 |
} |
|
1228 |
ShouldNotReachHere(); |
|
1229 |
return false; |
|
1230 |
} |
|
1231 |
||
1232 |
//----------------------------------------------------------------------- |
|
1233 |
// Exceptions |
|
1234 |
// |
|
1235 |
||
1236 |
static void trace_exception(oop exception_oop, address exception_pc, const char* msg) PRODUCT_RETURN; |
|
1237 |
||
1238 |
// The method is an entry that is always called by a C++ method not |
|
1239 |
// directly from compiled code. Compiled code will call the C++ method following. |
|
1240 |
// We can't allow async exception to be installed during exception processing. |
|
1241 |
JRT_ENTRY_NO_ASYNC(address, OptoRuntime::handle_exception_C_helper(JavaThread* thread, nmethod* &nm)) |
|
1242 |
||
1243 |
// Do not confuse exception_oop with pending_exception. The exception_oop |
|
1244 |
// is only used to pass arguments into the method. Not for general |
|
1245 |
// exception handling. DO NOT CHANGE IT to use pending_exception, since |
|
1246 |
// the runtime stubs checks this on exit. |
|
1247 |
assert(thread->exception_oop() != NULL, "exception oop is found"); |
|
1248 |
address handler_address = NULL; |
|
1249 |
||
1250 |
Handle exception(thread, thread->exception_oop()); |
|
20703
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
18507
diff
changeset
|
1251 |
address pc = thread->exception_pc(); |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
18507
diff
changeset
|
1252 |
|
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
18507
diff
changeset
|
1253 |
// Clear out the exception oop and pc since looking up an |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
18507
diff
changeset
|
1254 |
// exception handler can cause class loading, which might throw an |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
18507
diff
changeset
|
1255 |
// exception and those fields are expected to be clear during |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
18507
diff
changeset
|
1256 |
// normal bytecode execution. |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
18507
diff
changeset
|
1257 |
thread->clear_exception_oop_and_pc(); |
1 | 1258 |
|
1259 |
if (TraceExceptions) { |
|
20703
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
18507
diff
changeset
|
1260 |
trace_exception(exception(), pc, ""); |
1 | 1261 |
} |
20703
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
18507
diff
changeset
|
1262 |
|
1 | 1263 |
// for AbortVMOnException flag |
1264 |
NOT_PRODUCT(Exceptions::debug_check_abort(exception)); |
|
1265 |
||
20703
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
18507
diff
changeset
|
1266 |
#ifdef ASSERT |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
18507
diff
changeset
|
1267 |
if (!(exception->is_a(SystemDictionary::Throwable_klass()))) { |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
18507
diff
changeset
|
1268 |
// should throw an exception here |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
18507
diff
changeset
|
1269 |
ShouldNotReachHere(); |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
18507
diff
changeset
|
1270 |
} |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
18507
diff
changeset
|
1271 |
#endif |
1 | 1272 |
|
1273 |
// new exception handling: this method is entered only from adapters |
|
1274 |
// exceptions from compiled java methods are handled in compiled code |
|
1275 |
// using rethrow node |
|
1276 |
||
1277 |
nm = CodeCache::find_nmethod(pc); |
|
1278 |
assert(nm != NULL, "No NMethod found"); |
|
1279 |
if (nm->is_native_method()) { |
|
20703
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
18507
diff
changeset
|
1280 |
fatal("Native method should not have path to exception handling"); |
1 | 1281 |
} else { |
1282 |
// we are switching to old paradigm: search for exception handler in caller_frame |
|
1283 |
// instead in exception handler of caller_frame.sender() |
|
1284 |
||
4761
bdb7375a1fee
6902182: 4/4 Starting with jdwp agent should not incur performance penalty
dcubed
parents:
4637
diff
changeset
|
1285 |
if (JvmtiExport::can_post_on_exceptions()) { |
1 | 1286 |
// "Full-speed catching" is not necessary here, |
1287 |
// since we're notifying the VM on every catch. |
|
1288 |
// Force deoptimization and the rest of the lookup |
|
1289 |
// will be fine. |
|
14835
70896cb93c35
8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
14488
diff
changeset
|
1290 |
deoptimize_caller_frame(thread); |
1 | 1291 |
} |
1292 |
||
1293 |
// Check the stack guard pages. If enabled, look for handler in this frame; |
|
1294 |
// otherwise, forcibly unwind the frame. |
|
1295 |
// |
|
1296 |
// 4826555: use default current sp for reguard_stack instead of &nm: it's more accurate. |
|
1297 |
bool force_unwind = !thread->reguard_stack(); |
|
1298 |
bool deopting = false; |
|
1299 |
if (nm->is_deopt_pc(pc)) { |
|
1300 |
deopting = true; |
|
1301 |
RegisterMap map(thread, false); |
|
1302 |
frame deoptee = thread->last_frame().sender(&map); |
|
1303 |
assert(deoptee.is_deoptimized_frame(), "must be deopted"); |
|
1304 |
// Adjust the pc back to the original throwing pc |
|
1305 |
pc = deoptee.pc(); |
|
1306 |
} |
|
1307 |
||
1308 |
// If we are forcing an unwind because of stack overflow then deopt is |
|
22807 | 1309 |
// irrelevant since we are throwing the frame away anyway. |
1 | 1310 |
|
1311 |
if (deopting && !force_unwind) { |
|
1312 |
handler_address = SharedRuntime::deopt_blob()->unpack_with_exception(); |
|
1313 |
} else { |
|
1314 |
||
1315 |
handler_address = |
|
1316 |
force_unwind ? NULL : nm->handler_for_exception_and_pc(exception, pc); |
|
1317 |
||
1318 |
if (handler_address == NULL) { |
|
10731
ffe24d6f0575
6865265: JVM crashes with "missing exception handler" error
kvn
parents:
10566
diff
changeset
|
1319 |
Handle original_exception(thread, exception()); |
1 | 1320 |
handler_address = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true); |
1321 |
assert (handler_address != NULL, "must have compiled handler"); |
|
10731
ffe24d6f0575
6865265: JVM crashes with "missing exception handler" error
kvn
parents:
10566
diff
changeset
|
1322 |
// Update the exception cache only when the unwind was not forced |
ffe24d6f0575
6865265: JVM crashes with "missing exception handler" error
kvn
parents:
10566
diff
changeset
|
1323 |
// and there didn't happen another exception during the computation of the |
ffe24d6f0575
6865265: JVM crashes with "missing exception handler" error
kvn
parents:
10566
diff
changeset
|
1324 |
// compiled exception handler. |
ffe24d6f0575
6865265: JVM crashes with "missing exception handler" error
kvn
parents:
10566
diff
changeset
|
1325 |
if (!force_unwind && original_exception() == exception()) { |
1 | 1326 |
nm->add_handler_for_exception_and_pc(exception,pc,handler_address); |
1327 |
} |
|
1328 |
} else { |
|
1329 |
assert(handler_address == SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true), "Must be the same"); |
|
1330 |
} |
|
1331 |
} |
|
1332 |
||
1333 |
thread->set_exception_pc(pc); |
|
1334 |
thread->set_exception_handler_pc(handler_address); |
|
4564
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
4030
diff
changeset
|
1335 |
|
5046 | 1336 |
// Check if the exception PC is a MethodHandle call site. |
5252
58f23871a5b6
6941529: SharedRuntime::raw_exception_handler_for_return_address must reset thread MethodHandle flag
twisti
parents:
5046
diff
changeset
|
1337 |
thread->set_is_method_handle_return(nm->is_method_handle_return(pc)); |
1 | 1338 |
} |
1339 |
||
1340 |
// Restore correct return pc. Was saved above. |
|
1341 |
thread->set_exception_oop(exception()); |
|
1342 |
return handler_address; |
|
1343 |
||
1344 |
JRT_END |
|
1345 |
||
1346 |
// We are entering here from exception_blob |
|
1347 |
// If there is a compiled exception handler in this method, we will continue there; |
|
1348 |
// otherwise we will unwind the stack and continue at the caller of top frame method |
|
1349 |
// Note we enter without the usual JRT wrapper. We will call a helper routine that |
|
1350 |
// will do the normal VM entry. We do it this way so that we can see if the nmethod |
|
1351 |
// we looked up the handler for has been deoptimized in the meantime. If it has been |
|
22807 | 1352 |
// we must not use the handler and instead return the deopt blob. |
1 | 1353 |
address OptoRuntime::handle_exception_C(JavaThread* thread) { |
1354 |
// |
|
1355 |
// We are in Java not VM and in debug mode we have a NoHandleMark |
|
1356 |
// |
|
1357 |
#ifndef PRODUCT |
|
1358 |
SharedRuntime::_find_handler_ctr++; // find exception handler |
|
1359 |
#endif |
|
1360 |
debug_only(NoHandleMark __hm;) |
|
1361 |
nmethod* nm = NULL; |
|
1362 |
address handler_address = NULL; |
|
1363 |
{ |
|
1364 |
// Enter the VM |
|
1365 |
||
1366 |
ResetNoHandleMark rnhm; |
|
1367 |
handler_address = handle_exception_C_helper(thread, nm); |
|
1368 |
} |
|
1369 |
||
1370 |
// Back in java: Use no oops, DON'T safepoint |
|
1371 |
||
1372 |
// Now check to see if the handler we are returning is in a now |
|
1373 |
// deoptimized frame |
|
1374 |
||
1375 |
if (nm != NULL) { |
|
1376 |
RegisterMap map(thread, false); |
|
1377 |
frame caller = thread->last_frame().sender(&map); |
|
1378 |
#ifdef ASSERT |
|
1379 |
assert(caller.is_compiled_frame(), "must be"); |
|
1380 |
#endif // ASSERT |
|
1381 |
if (caller.is_deoptimized_frame()) { |
|
1382 |
handler_address = SharedRuntime::deopt_blob()->unpack_with_exception(); |
|
1383 |
} |
|
1384 |
} |
|
1385 |
return handler_address; |
|
1386 |
} |
|
1387 |
||
1388 |
//------------------------------rethrow---------------------------------------- |
|
1389 |
// We get here after compiled code has executed a 'RethrowNode'. The callee |
|
1390 |
// is either throwing or rethrowing an exception. The callee-save registers |
|
1391 |
// have been restored, synchronized objects have been unlocked and the callee |
|
1392 |
// stack frame has been removed. The return address was passed in. |
|
1393 |
// Exception oop is passed as the 1st argument. This routine is then called |
|
1394 |
// from the stub. On exit, we know where to jump in the caller's code. |
|
1395 |
// After this C code exits, the stub will pop his frame and end in a jump |
|
1396 |
// (instead of a return). We enter the caller's default handler. |
|
1397 |
// |
|
1398 |
// This must be JRT_LEAF: |
|
1399 |
// - caller will not change its state as we cannot block on exit, |
|
1400 |
// therefore raw_exception_handler_for_return_address is all it takes |
|
1401 |
// to handle deoptimized blobs |
|
1402 |
// |
|
1403 |
// However, there needs to be a safepoint check in the middle! So compiled |
|
1404 |
// safepoints are completely watertight. |
|
1405 |
// |
|
1406 |
// Thus, it cannot be a leaf since it contains the No_GC_Verifier. |
|
1407 |
// |
|
1408 |
// *THIS IS NOT RECOMMENDED PROGRAMMING STYLE* |
|
1409 |
// |
|
1410 |
address OptoRuntime::rethrow_C(oopDesc* exception, JavaThread* thread, address ret_pc) { |
|
1411 |
#ifndef PRODUCT |
|
1412 |
SharedRuntime::_rethrow_ctr++; // count rethrows |
|
1413 |
#endif |
|
1414 |
assert (exception != NULL, "should have thrown a NULLPointerException"); |
|
1415 |
#ifdef ASSERT |
|
4571 | 1416 |
if (!(exception->is_a(SystemDictionary::Throwable_klass()))) { |
1 | 1417 |
// should throw an exception here |
1418 |
ShouldNotReachHere(); |
|
1419 |
} |
|
1420 |
#endif |
|
1421 |
||
1422 |
thread->set_vm_result(exception); |
|
1423 |
// Frame not compiled (handles deoptimization blob) |
|
5046 | 1424 |
return SharedRuntime::raw_exception_handler_for_return_address(thread, ret_pc); |
1 | 1425 |
} |
1426 |
||
1427 |
||
1428 |
const TypeFunc *OptoRuntime::rethrow_Type() { |
|
1429 |
// create input type (domain) |
|
1430 |
const Type **fields = TypeTuple::fields(1); |
|
1431 |
fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Exception oop |
|
1432 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1,fields); |
|
1433 |
||
1434 |
// create result type (range) |
|
1435 |
fields = TypeTuple::fields(1); |
|
1436 |
fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Exception oop |
|
1437 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields); |
|
1438 |
||
1439 |
return TypeFunc::make(domain, range); |
|
1440 |
} |
|
1441 |
||
1442 |
||
1443 |
void OptoRuntime::deoptimize_caller_frame(JavaThread *thread, bool doit) { |
|
14835
70896cb93c35
8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
14488
diff
changeset
|
1444 |
// Deoptimize the caller before continuing, as the compiled |
70896cb93c35
8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
14488
diff
changeset
|
1445 |
// exception handler table may not be valid. |
70896cb93c35
8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
14488
diff
changeset
|
1446 |
if (!StressCompiledExceptionHandlers && doit) { |
70896cb93c35
8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
14488
diff
changeset
|
1447 |
deoptimize_caller_frame(thread); |
70896cb93c35
8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
14488
diff
changeset
|
1448 |
} |
70896cb93c35
8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
14488
diff
changeset
|
1449 |
} |
1 | 1450 |
|
14835
70896cb93c35
8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
14488
diff
changeset
|
1451 |
void OptoRuntime::deoptimize_caller_frame(JavaThread *thread) { |
70896cb93c35
8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
14488
diff
changeset
|
1452 |
// Called from within the owner thread, so no need for safepoint |
70896cb93c35
8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
14488
diff
changeset
|
1453 |
RegisterMap reg_map(thread); |
70896cb93c35
8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
14488
diff
changeset
|
1454 |
frame stub_frame = thread->last_frame(); |
70896cb93c35
8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
14488
diff
changeset
|
1455 |
assert(stub_frame.is_runtime_frame() || exception_blob()->contains(stub_frame.pc()), "sanity check"); |
70896cb93c35
8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
14488
diff
changeset
|
1456 |
frame caller_frame = stub_frame.sender(®_map); |
70896cb93c35
8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
14488
diff
changeset
|
1457 |
|
70896cb93c35
8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
14488
diff
changeset
|
1458 |
// Deoptimize the caller frame. |
70896cb93c35
8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
14488
diff
changeset
|
1459 |
Deoptimization::deoptimize_frame(thread, caller_frame.id()); |
1 | 1460 |
} |
1461 |
||
1462 |
||
10987
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
1463 |
bool OptoRuntime::is_deoptimized_caller_frame(JavaThread *thread) { |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
1464 |
// Called from within the owner thread, so no need for safepoint |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
1465 |
RegisterMap reg_map(thread); |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
1466 |
frame stub_frame = thread->last_frame(); |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
1467 |
assert(stub_frame.is_runtime_frame() || exception_blob()->contains(stub_frame.pc()), "sanity check"); |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
1468 |
frame caller_frame = stub_frame.sender(®_map); |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
1469 |
return caller_frame.is_deoptimized_frame(); |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
1470 |
} |
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
1471 |
|
696ed3367418
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
10972
diff
changeset
|
1472 |
|
1 | 1473 |
const TypeFunc *OptoRuntime::register_finalizer_Type() { |
1474 |
// create input type (domain) |
|
1475 |
const Type **fields = TypeTuple::fields(1); |
|
1476 |
fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // oop; Receiver |
|
1477 |
// // The JavaThread* is passed to each routine as the last argument |
|
1478 |
// fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // JavaThread *; Executing thread |
|
1479 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1,fields); |
|
1480 |
||
1481 |
// create result type (range) |
|
1482 |
fields = TypeTuple::fields(0); |
|
1483 |
||
1484 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields); |
|
1485 |
||
1486 |
return TypeFunc::make(domain,range); |
|
1487 |
} |
|
1488 |
||
1489 |
||
1490 |
//----------------------------------------------------------------------------- |
|
1491 |
// Dtrace support. entry and exit probes have the same signature |
|
1492 |
const TypeFunc *OptoRuntime::dtrace_method_entry_exit_Type() { |
|
1493 |
// create input type (domain) |
|
1494 |
const Type **fields = TypeTuple::fields(2); |
|
1495 |
fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // Thread-local storage |
|
13742
9180987e305d
7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents:
13728
diff
changeset
|
1496 |
fields[TypeFunc::Parms+1] = TypeMetadataPtr::BOTTOM; // Method*; Method we are entering |
1 | 1497 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields); |
1498 |
||
1499 |
// create result type (range) |
|
1500 |
fields = TypeTuple::fields(0); |
|
1501 |
||
1502 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields); |
|
1503 |
||
1504 |
return TypeFunc::make(domain,range); |
|
1505 |
} |
|
1506 |
||
1507 |
const TypeFunc *OptoRuntime::dtrace_object_alloc_Type() { |
|
1508 |
// create input type (domain) |
|
1509 |
const Type **fields = TypeTuple::fields(2); |
|
1510 |
fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // Thread-local storage |
|
1511 |
fields[TypeFunc::Parms+1] = TypeInstPtr::NOTNULL; // oop; newly allocated object |
|
1512 |
||
1513 |
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields); |
|
1514 |
||
1515 |
// create result type (range) |
|
1516 |
fields = TypeTuple::fields(0); |
|
1517 |
||
1518 |
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields); |
|
1519 |
||
1520 |
return TypeFunc::make(domain,range); |
|
1521 |
} |
|
1522 |
||
1523 |
||
1524 |
JRT_ENTRY_NO_ASYNC(void, OptoRuntime::register_finalizer(oopDesc* obj, JavaThread* thread)) |
|
1525 |
assert(obj->is_oop(), "must be a valid oop"); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13521
diff
changeset
|
1526 |
assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13521
diff
changeset
|
1527 |
InstanceKlass::register_finalizer(instanceOop(obj), CHECK); |
1 | 1528 |
JRT_END |
1529 |
||
1530 |
//----------------------------------------------------------------------------- |
|
1531 |
||
1532 |
NamedCounter * volatile OptoRuntime::_named_counters = NULL; |
|
1533 |
||
1534 |
// |
|
1535 |
// dump the collected NamedCounters. |
|
1536 |
// |
|
1537 |
void OptoRuntime::print_named_counters() { |
|
1538 |
int total_lock_count = 0; |
|
1539 |
int eliminated_lock_count = 0; |
|
1540 |
||
1541 |
NamedCounter* c = _named_counters; |
|
1542 |
while (c) { |
|
1543 |
if (c->tag() == NamedCounter::LockCounter || c->tag() == NamedCounter::EliminatedLockCounter) { |
|
1544 |
int count = c->count(); |
|
1545 |
if (count > 0) { |
|
1546 |
bool eliminated = c->tag() == NamedCounter::EliminatedLockCounter; |
|
1547 |
if (Verbose) { |
|
1548 |
tty->print_cr("%d %s%s", count, c->name(), eliminated ? " (eliminated)" : ""); |
|
1549 |
} |
|
1550 |
total_lock_count += count; |
|
1551 |
if (eliminated) { |
|
1552 |
eliminated_lock_count += count; |
|
1553 |
} |
|
1554 |
} |
|
1555 |
} else if (c->tag() == NamedCounter::BiasedLockingCounter) { |
|
1556 |
BiasedLockingCounters* blc = ((BiasedLockingNamedCounter*)c)->counters(); |
|
1557 |
if (blc->nonzero()) { |
|
1558 |
tty->print_cr("%s", c->name()); |
|
1559 |
blc->print_on(tty); |
|
1560 |
} |
|
23491 | 1561 |
#if INCLUDE_RTM_OPT |
1562 |
} else if (c->tag() == NamedCounter::RTMLockingCounter) { |
|
1563 |
RTMLockingCounters* rlc = ((RTMLockingNamedCounter*)c)->counters(); |
|
1564 |
if (rlc->nonzero()) { |
|
1565 |
tty->print_cr("%s", c->name()); |
|
1566 |
rlc->print_on(tty); |
|
1567 |
} |
|
1568 |
#endif |
|
1 | 1569 |
} |
1570 |
c = c->next(); |
|
1571 |
} |
|
1572 |
if (total_lock_count > 0) { |
|
1573 |
tty->print_cr("dynamic locks: %d", total_lock_count); |
|
1574 |
if (eliminated_lock_count) { |
|
1575 |
tty->print_cr("eliminated locks: %d (%d%%)", eliminated_lock_count, |
|
1576 |
(int)(eliminated_lock_count * 100.0 / total_lock_count)); |
|
1577 |
} |
|
1578 |
} |
|
1579 |
} |
|
1580 |
||
1581 |
// |
|
1582 |
// Allocate a new NamedCounter. The JVMState is used to generate the |
|
1583 |
// name which consists of method@line for the inlining tree. |
|
1584 |
// |
|
1585 |
||
1586 |
NamedCounter* OptoRuntime::new_named_counter(JVMState* youngest_jvms, NamedCounter::CounterTag tag) { |
|
1587 |
int max_depth = youngest_jvms->depth(); |
|
1588 |
||
1589 |
// Visit scopes from youngest to oldest. |
|
1590 |
bool first = true; |
|
1591 |
stringStream st; |
|
1592 |
for (int depth = max_depth; depth >= 1; depth--) { |
|
1593 |
JVMState* jvms = youngest_jvms->of_depth(depth); |
|
1594 |
ciMethod* m = jvms->has_method() ? jvms->method() : NULL; |
|
1595 |
if (!first) { |
|
1596 |
st.print(" "); |
|
1597 |
} else { |
|
1598 |
first = false; |
|
1599 |
} |
|
1600 |
int bci = jvms->bci(); |
|
1601 |
if (bci < 0) bci = 0; |
|
1602 |
st.print("%s.%s@%d", m->holder()->name()->as_utf8(), m->name()->as_utf8(), bci); |
|
1603 |
// To print linenumbers instead of bci use: m->line_number_from_bci(bci) |
|
1604 |
} |
|
1605 |
NamedCounter* c; |
|
1606 |
if (tag == NamedCounter::BiasedLockingCounter) { |
|
25949 | 1607 |
c = new BiasedLockingNamedCounter(st.as_string()); |
23491 | 1608 |
} else if (tag == NamedCounter::RTMLockingCounter) { |
25949 | 1609 |
c = new RTMLockingNamedCounter(st.as_string()); |
1 | 1610 |
} else { |
25949 | 1611 |
c = new NamedCounter(st.as_string(), tag); |
1 | 1612 |
} |
1613 |
||
1614 |
// atomically add the new counter to the head of the list. We only |
|
1615 |
// add counters so this is safe. |
|
1616 |
NamedCounter* head; |
|
1617 |
do { |
|
23491 | 1618 |
c->set_next(NULL); |
1 | 1619 |
head = _named_counters; |
1620 |
c->set_next(head); |
|
1621 |
} while (Atomic::cmpxchg_ptr(c, &_named_counters, head) != head); |
|
1622 |
return c; |
|
1623 |
} |
|
1624 |
||
1625 |
//----------------------------------------------------------------------------- |
|
1626 |
// Non-product code |
|
1627 |
#ifndef PRODUCT |
|
1628 |
||
1629 |
int trace_exception_counter = 0; |
|
1630 |
static void trace_exception(oop exception_oop, address exception_pc, const char* msg) { |
|
1631 |
ttyLocker ttyl; |
|
1632 |
trace_exception_counter++; |
|
1633 |
tty->print("%d [Exception (%s): ", trace_exception_counter, msg); |
|
1634 |
exception_oop->print_value(); |
|
1635 |
tty->print(" in "); |
|
1636 |
CodeBlob* blob = CodeCache::find_blob(exception_pc); |
|
1637 |
if (blob->is_nmethod()) { |
|
20703
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
18507
diff
changeset
|
1638 |
nmethod* nm = blob->as_nmethod_or_null(); |
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
18507
diff
changeset
|
1639 |
nm->method()->print_value(); |
1 | 1640 |
} else if (blob->is_runtime_stub()) { |
1641 |
tty->print("<runtime-stub>"); |
|
1642 |
} else { |
|
1643 |
tty->print("<unknown>"); |
|
1644 |
} |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
24328
diff
changeset
|
1645 |
tty->print(" at " INTPTR_FORMAT, p2i(exception_pc)); |
1 | 1646 |
tty->print_cr("]"); |
1647 |
} |
|
1648 |
||
1649 |
#endif // PRODUCT |
|
1650 |
||
1651 |
||
1652 |
# ifdef ENABLE_ZAP_DEAD_LOCALS |
|
1653 |
// Called from call sites in compiled code with oop maps (actually safepoints) |
|
1654 |
// Zaps dead locals in first java frame. |
|
1655 |
// Is entry because may need to lock to generate oop maps |
|
1656 |
// Currently, only used for compiler frames, but someday may be used |
|
1657 |
// for interpreter frames, too. |
|
1658 |
||
1659 |
int OptoRuntime::ZapDeadCompiledLocals_count = 0; |
|
1660 |
||
1661 |
// avoid pointers to member funcs with these helpers |
|
1662 |
static bool is_java_frame( frame* f) { return f->is_java_frame(); } |
|
1663 |
static bool is_native_frame(frame* f) { return f->is_native_frame(); } |
|
1664 |
||
1665 |
||
1666 |
void OptoRuntime::zap_dead_java_or_native_locals(JavaThread* thread, |
|
1667 |
bool (*is_this_the_right_frame_to_zap)(frame*)) { |
|
1668 |
assert(JavaThread::current() == thread, "is this needed?"); |
|
1669 |
||
1670 |
if ( !ZapDeadCompiledLocals ) return; |
|
1671 |
||
1672 |
bool skip = false; |
|
1673 |
||
1674 |
if ( ZapDeadCompiledLocalsFirst == 0 ) ; // nothing special |
|
1675 |
else if ( ZapDeadCompiledLocalsFirst > ZapDeadCompiledLocals_count ) skip = true; |
|
1676 |
else if ( ZapDeadCompiledLocalsFirst == ZapDeadCompiledLocals_count ) |
|
1677 |
warning("starting zapping after skipping"); |
|
1678 |
||
1679 |
if ( ZapDeadCompiledLocalsLast == -1 ) ; // nothing special |
|
1680 |
else if ( ZapDeadCompiledLocalsLast < ZapDeadCompiledLocals_count ) skip = true; |
|
1681 |
else if ( ZapDeadCompiledLocalsLast == ZapDeadCompiledLocals_count ) |
|
1682 |
warning("about to zap last zap"); |
|
1683 |
||
1684 |
++ZapDeadCompiledLocals_count; // counts skipped zaps, too |
|
1685 |
||
1686 |
if ( skip ) return; |
|
1687 |
||
1688 |
// find java frame and zap it |
|
1689 |
||
1690 |
for (StackFrameStream sfs(thread); !sfs.is_done(); sfs.next()) { |
|
1691 |
if (is_this_the_right_frame_to_zap(sfs.current()) ) { |
|
1692 |
sfs.current()->zap_dead_locals(thread, sfs.register_map()); |
|
1693 |
return; |
|
1694 |
} |
|
1695 |
} |
|
1696 |
warning("no frame found to zap in zap_dead_Java_locals_C"); |
|
1697 |
} |
|
1698 |
||
1699 |
JRT_LEAF(void, OptoRuntime::zap_dead_Java_locals_C(JavaThread* thread)) |
|
1700 |
zap_dead_java_or_native_locals(thread, is_java_frame); |
|
1701 |
JRT_END |
|
1702 |
||
1703 |
// The following does not work because for one thing, the |
|
1704 |
// thread state is wrong; it expects java, but it is native. |
|
2131 | 1705 |
// Also, the invariants in a native stub are different and |
1 | 1706 |
// I'm not sure it is safe to have a MachCalRuntimeDirectNode |
1707 |
// in there. |
|
1708 |
// So for now, we do not zap in native stubs. |
|
1709 |
||
1710 |
JRT_LEAF(void, OptoRuntime::zap_dead_native_locals_C(JavaThread* thread)) |
|
1711 |
zap_dead_java_or_native_locals(thread, is_native_frame); |
|
1712 |
JRT_END |
|
1713 |
||
1714 |
# endif |