Mercurial > hg > graal-jvmci-8
annotate src/share/vm/opto/runtime.hpp @ 20452:f8afcfbdbf1c
8046698: assert(false) failed: only Initialize or AddP expected macro.cpp:943
Summary: PhiNode inserted between AllocateNode and Initialization node confuses allocation elimination
Reviewed-by: kvn
author | roland |
---|---|
date | Sat, 02 Aug 2014 07:06:08 +0200 |
parents | 166d744df0de |
children | daaf806995b3 |
rev | line source |
---|---|
0 | 1 /* |
20313
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17780
diff
changeset
|
2 * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1166
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1166
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1166
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_OPTO_RUNTIME_HPP |
26 #define SHARE_VM_OPTO_RUNTIME_HPP | |
27 | |
28 #include "code/codeBlob.hpp" | |
29 #include "opto/machnode.hpp" | |
30 #include "opto/type.hpp" | |
31 #include "runtime/biasedLocking.hpp" | |
17780 | 32 #include "runtime/rtmLocking.hpp" |
1972 | 33 #include "runtime/deoptimization.hpp" |
34 #include "runtime/vframe.hpp" | |
35 | |
0 | 36 //------------------------------OptoRuntime------------------------------------ |
37 // Opto compiler runtime routines | |
38 // | |
39 // These are all generated from Ideal graphs. They are called with the | |
40 // Java calling convention. Internally they call C++. They are made once at | |
41 // startup time and Opto compiles calls to them later. | |
42 // Things are broken up into quads: the signature they will be called with, | |
43 // the address of the generated code, the corresponding C++ code and an | |
44 // nmethod. | |
45 | |
46 // The signature (returned by "xxx_Type()") is used at startup time by the | |
47 // Generator to make the generated code "xxx_Java". Opto compiles calls | |
48 // to the generated code "xxx_Java". When the compiled code gets executed, | |
49 // it calls the C++ code "xxx_C". The generated nmethod is saved in the | |
50 // CodeCache. Exception handlers use the nmethod to get the callee-save | |
51 // register OopMaps. | |
52 class CallInfo; | |
53 | |
54 // | |
55 // NamedCounters are tagged counters which can be used for profiling | |
56 // code in various ways. Currently they are used by the lock coarsening code | |
57 // | |
58 | |
6197 | 59 class NamedCounter : public CHeapObj<mtCompiler> { |
0 | 60 public: |
61 enum CounterTag { | |
62 NoTag, | |
63 LockCounter, | |
64 EliminatedLockCounter, | |
17780 | 65 BiasedLockingCounter, |
66 RTMLockingCounter | |
0 | 67 }; |
68 | |
69 private: | |
70 const char * _name; | |
71 int _count; | |
72 CounterTag _tag; | |
73 NamedCounter* _next; | |
74 | |
75 public: | |
76 NamedCounter(const char *n, CounterTag tag = NoTag): | |
77 _name(n), | |
78 _count(0), | |
79 _next(NULL), | |
80 _tag(tag) {} | |
81 | |
82 const char * name() const { return _name; } | |
83 int count() const { return _count; } | |
84 address addr() { return (address)&_count; } | |
85 CounterTag tag() const { return _tag; } | |
86 void set_tag(CounterTag tag) { _tag = tag; } | |
87 | |
88 NamedCounter* next() const { return _next; } | |
89 void set_next(NamedCounter* next) { | |
17780 | 90 assert(_next == NULL || next == NULL, "already set"); |
0 | 91 _next = next; |
92 } | |
93 | |
94 }; | |
95 | |
96 class BiasedLockingNamedCounter : public NamedCounter { | |
97 private: | |
98 BiasedLockingCounters _counters; | |
99 | |
100 public: | |
101 BiasedLockingNamedCounter(const char *n) : | |
102 NamedCounter(n, BiasedLockingCounter), _counters() {} | |
103 | |
104 BiasedLockingCounters* counters() { return &_counters; } | |
105 }; | |
106 | |
17780 | 107 |
108 class RTMLockingNamedCounter : public NamedCounter { | |
109 private: | |
110 RTMLockingCounters _counters; | |
111 | |
112 public: | |
113 RTMLockingNamedCounter(const char *n) : | |
114 NamedCounter(n, RTMLockingCounter), _counters() {} | |
115 | |
116 RTMLockingCounters* counters() { return &_counters; } | |
117 }; | |
118 | |
0 | 119 typedef const TypeFunc*(*TypeFunc_generator)(); |
120 | |
121 class OptoRuntime : public AllStatic { | |
122 friend class Matcher; // allow access to stub names | |
123 | |
124 private: | |
125 // define stubs | |
126 static address generate_stub(ciEnv* ci_env, TypeFunc_generator gen, address C_function, const char *name, int is_fancy_jump, bool pass_tls, bool save_arguments, bool return_pc); | |
127 | |
128 // References to generated stubs | |
129 static address _new_instance_Java; | |
130 static address _new_array_Java; | |
3961
a92cdbac8b9e
7081933: Use zeroing elimination optimization for large array
kvn
parents:
3805
diff
changeset
|
131 static address _new_array_nozero_Java; |
0 | 132 static address _multianewarray2_Java; |
133 static address _multianewarray3_Java; | |
134 static address _multianewarray4_Java; | |
135 static address _multianewarray5_Java; | |
3805
263247c478c5
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
1972
diff
changeset
|
136 static address _multianewarrayN_Java; |
342 | 137 static address _g1_wb_pre_Java; |
138 static address _g1_wb_post_Java; | |
0 | 139 static address _vtable_must_compile_Java; |
140 static address _complete_monitor_locking_Java; | |
141 static address _rethrow_Java; | |
142 | |
143 static address _slow_arraycopy_Java; | |
144 static address _register_finalizer_Java; | |
145 | |
146 # ifdef ENABLE_ZAP_DEAD_LOCALS | |
147 static address _zap_dead_Java_locals_Java; | |
148 static address _zap_dead_native_locals_Java; | |
149 # endif | |
150 | |
151 | |
152 // | |
153 // Implementation of runtime methods | |
154 // ================================= | |
155 | |
156 // Allocate storage for a Java instance. | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
157 static void new_instance_C(Klass* instance_klass, JavaThread *thread); |
0 | 158 |
159 // Allocate storage for a objArray or typeArray | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
160 static void new_array_C(Klass* array_klass, int len, JavaThread *thread); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
161 static void new_array_nozero_C(Klass* array_klass, int len, JavaThread *thread); |
0 | 162 |
1166 | 163 // Post-slow-path-allocation, pre-initializing-stores step for |
164 // implementing ReduceInitialCardMarks | |
165 static void new_store_pre_barrier(JavaThread* thread); | |
0 | 166 |
167 // Allocate storage for a multi-dimensional arrays | |
168 // Note: needs to be fixed for arbitrary number of dimensions | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
169 static void multianewarray2_C(Klass* klass, int len1, int len2, JavaThread *thread); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
170 static void multianewarray3_C(Klass* klass, int len1, int len2, int len3, JavaThread *thread); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
171 static void multianewarray4_C(Klass* klass, int len1, int len2, int len3, int len4, JavaThread *thread); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
172 static void multianewarray5_C(Klass* klass, int len1, int len2, int len3, int len4, int len5, JavaThread *thread); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
173 static void multianewarrayN_C(Klass* klass, arrayOopDesc* dims, JavaThread *thread); |
342 | 174 static void g1_wb_pre_C(oopDesc* orig, JavaThread* thread); |
175 static void g1_wb_post_C(void* card_addr, JavaThread* thread); | |
0 | 176 |
177 public: | |
178 // Slow-path Locking and Unlocking | |
179 static void complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread); | |
180 static void complete_monitor_unlocking_C(oopDesc* obj, BasicLock* lock); | |
181 | |
182 private: | |
183 | |
184 // Implicit exception support | |
185 static void throw_null_exception_C(JavaThread* thread); | |
186 | |
187 // Exception handling | |
188 static address handle_exception_C (JavaThread* thread); | |
189 static address handle_exception_C_helper(JavaThread* thread, nmethod*& nm); | |
190 static address rethrow_C (oopDesc* exception, JavaThread *thread, address return_pc ); | |
7428
2d6c433b1f38
8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
6894
diff
changeset
|
191 static void deoptimize_caller_frame (JavaThread *thread); |
0 | 192 static void deoptimize_caller_frame (JavaThread *thread, bool doit); |
4063
7e0e43cf86d6
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
kvn
parents:
3961
diff
changeset
|
193 static bool is_deoptimized_caller_frame (JavaThread *thread); |
0 | 194 |
195 // CodeBlob support | |
196 // =================================================================== | |
197 | |
198 static ExceptionBlob* _exception_blob; | |
199 static void generate_exception_blob(); | |
200 | |
201 static void register_finalizer(oopDesc* obj, JavaThread* thread); | |
202 | |
203 // zaping dead locals, either from Java frames or from native frames | |
204 # ifdef ENABLE_ZAP_DEAD_LOCALS | |
205 static void zap_dead_Java_locals_C( JavaThread* thread); | |
206 static void zap_dead_native_locals_C( JavaThread* thread); | |
207 | |
208 static void zap_dead_java_or_native_locals( JavaThread*, bool (*)(frame*)); | |
209 | |
210 public: | |
211 static int ZapDeadCompiledLocals_count; | |
212 | |
213 # endif | |
214 | |
215 | |
216 public: | |
217 | |
218 static bool is_callee_saved_register(MachRegisterNumbers reg); | |
219 | |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
11080
diff
changeset
|
220 // One time only generate runtime code stubs. Returns true |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
11080
diff
changeset
|
221 // when runtime stubs have been generated successfully and |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
11080
diff
changeset
|
222 // false otherwise. |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
11080
diff
changeset
|
223 static bool generate(ciEnv* env); |
0 | 224 |
225 // Returns the name of a stub | |
226 static const char* stub_name(address entry); | |
227 | |
228 // access to runtime stubs entry points for java code | |
229 static address new_instance_Java() { return _new_instance_Java; } | |
230 static address new_array_Java() { return _new_array_Java; } | |
3961
a92cdbac8b9e
7081933: Use zeroing elimination optimization for large array
kvn
parents:
3805
diff
changeset
|
231 static address new_array_nozero_Java() { return _new_array_nozero_Java; } |
0 | 232 static address multianewarray2_Java() { return _multianewarray2_Java; } |
233 static address multianewarray3_Java() { return _multianewarray3_Java; } | |
234 static address multianewarray4_Java() { return _multianewarray4_Java; } | |
235 static address multianewarray5_Java() { return _multianewarray5_Java; } | |
3805
263247c478c5
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
1972
diff
changeset
|
236 static address multianewarrayN_Java() { return _multianewarrayN_Java; } |
342 | 237 static address g1_wb_pre_Java() { return _g1_wb_pre_Java; } |
238 static address g1_wb_post_Java() { return _g1_wb_post_Java; } | |
0 | 239 static address vtable_must_compile_stub() { return _vtable_must_compile_Java; } |
240 static address complete_monitor_locking_Java() { return _complete_monitor_locking_Java; } | |
241 | |
242 static address slow_arraycopy_Java() { return _slow_arraycopy_Java; } | |
243 static address register_finalizer_Java() { return _register_finalizer_Java; } | |
244 | |
245 | |
246 # ifdef ENABLE_ZAP_DEAD_LOCALS | |
247 static address zap_dead_locals_stub(bool is_native) { return is_native | |
248 ? _zap_dead_native_locals_Java | |
249 : _zap_dead_Java_locals_Java; } | |
250 static MachNode* node_to_call_zap_dead_locals(Node* n, int block_num, bool is_native); | |
251 # endif | |
252 | |
253 static ExceptionBlob* exception_blob() { return _exception_blob; } | |
254 | |
255 // Leaf routines helping with method data update | |
256 static void profile_receiver_type_C(DataLayout* data, oopDesc* receiver); | |
257 | |
258 // Implicit exception support | |
259 static void throw_div0_exception_C (JavaThread* thread); | |
260 static void throw_stack_overflow_error_C(JavaThread* thread); | |
261 | |
262 // Exception handling | |
263 static address rethrow_stub() { return _rethrow_Java; } | |
264 | |
265 | |
266 // Type functions | |
267 // ====================================================== | |
268 | |
269 static const TypeFunc* new_instance_Type(); // object allocation (slow case) | |
270 static const TypeFunc* new_array_Type (); // [a]newarray (slow case) | |
271 static const TypeFunc* multianewarray_Type(int ndim); // multianewarray | |
272 static const TypeFunc* multianewarray2_Type(); // multianewarray | |
273 static const TypeFunc* multianewarray3_Type(); // multianewarray | |
274 static const TypeFunc* multianewarray4_Type(); // multianewarray | |
275 static const TypeFunc* multianewarray5_Type(); // multianewarray | |
3805
263247c478c5
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
1972
diff
changeset
|
276 static const TypeFunc* multianewarrayN_Type(); // multianewarray |
342 | 277 static const TypeFunc* g1_wb_pre_Type(); |
278 static const TypeFunc* g1_wb_post_Type(); | |
0 | 279 static const TypeFunc* complete_monitor_enter_Type(); |
280 static const TypeFunc* complete_monitor_exit_Type(); | |
281 static const TypeFunc* uncommon_trap_Type(); | |
282 static const TypeFunc* athrow_Type(); | |
283 static const TypeFunc* rethrow_Type(); | |
284 static const TypeFunc* Math_D_D_Type(); // sin,cos & friends | |
285 static const TypeFunc* Math_DD_D_Type(); // mod,pow & friends | |
286 static const TypeFunc* modf_Type(); | |
287 static const TypeFunc* l2f_Type(); | |
6006
0105f367a14c
7160570: Intrinsification support for tracing framework
rbackman
parents:
4063
diff
changeset
|
288 static const TypeFunc* void_long_Type(); |
0 | 289 |
290 static const TypeFunc* flush_windows_Type(); | |
291 | |
292 // arraycopy routine types | |
293 static const TypeFunc* fast_arraycopy_Type(); // bit-blasters | |
294 static const TypeFunc* checkcast_arraycopy_Type(); | |
295 static const TypeFunc* generic_arraycopy_Type(); | |
296 static const TypeFunc* slow_arraycopy_Type(); // the full routine | |
297 | |
1763 | 298 static const TypeFunc* array_fill_Type(); |
299 | |
6894 | 300 static const TypeFunc* aescrypt_block_Type(); |
301 static const TypeFunc* cipherBlockChaining_aescrypt_Type(); | |
302 | |
20313
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17780
diff
changeset
|
303 static const TypeFunc* sha_implCompress_Type(); |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17780
diff
changeset
|
304 static const TypeFunc* digestBase_implCompressMB_Type(); |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17780
diff
changeset
|
305 |
20438
166d744df0de
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
20313
diff
changeset
|
306 static const TypeFunc* multiplyToLen_Type(); |
166d744df0de
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
20313
diff
changeset
|
307 |
11080
b800986664f4
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
7428
diff
changeset
|
308 static const TypeFunc* updateBytesCRC32_Type(); |
b800986664f4
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
7428
diff
changeset
|
309 |
0 | 310 // leaf on stack replacement interpreter accessor types |
311 static const TypeFunc* osr_end_Type(); | |
312 | |
313 // leaf methodData routine types | |
314 static const TypeFunc* profile_receiver_type_Type(); | |
315 | |
316 // leaf on stack replacement interpreter accessor types | |
317 static const TypeFunc* fetch_int_Type(); | |
318 static const TypeFunc* fetch_long_Type(); | |
319 static const TypeFunc* fetch_float_Type(); | |
320 static const TypeFunc* fetch_double_Type(); | |
321 static const TypeFunc* fetch_oop_Type(); | |
322 static const TypeFunc* fetch_monitor_Type(); | |
323 | |
324 static const TypeFunc* register_finalizer_Type(); | |
325 | |
326 // Dtrace support | |
327 static const TypeFunc* dtrace_method_entry_exit_Type(); | |
328 static const TypeFunc* dtrace_object_alloc_Type(); | |
329 | |
330 # ifdef ENABLE_ZAP_DEAD_LOCALS | |
331 static const TypeFunc* zap_dead_locals_Type(); | |
332 # endif | |
333 | |
334 private: | |
335 static NamedCounter * volatile _named_counters; | |
336 | |
337 public: | |
338 // helper function which creates a named counter labeled with the | |
339 // if they are available | |
340 static NamedCounter* new_named_counter(JVMState* jvms, NamedCounter::CounterTag tag); | |
341 | |
342 // dumps all the named counters | |
343 static void print_named_counters(); | |
344 | |
345 }; | |
1972 | 346 |
347 #endif // SHARE_VM_OPTO_RUNTIME_HPP |