Mercurial > hg > truffle
annotate src/share/vm/opto/runtime.hpp @ 17716:cdb71841f4bc
6498581: ThreadInterruptTest3 produces wrong output on Windows
Summary: There is race condition between os::interrupt and os::is_interrupted on Windows. In JVM_Sleep(Thread.sleep), check if thread gets interrupted, it may see interrupted but not really interrupted so cause spurious waking up (early return from sleep). Fix by checking if interrupt event really gets set thus prevent false return. For intrinsic of _isInterrupted, on Windows, go fastpath only on bit not set.
Reviewed-by: acorn, kvn
Contributed-by: david.holmes@oracle.com, yumin.qi@oracle.com
author | minqi |
---|---|
date | Wed, 26 Feb 2014 15:20:41 -0800 |
parents | 469216acdb28 |
children | 606acabe7b5c |
rev | line source |
---|---|
0 | 1 /* |
11080
b800986664f4
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
7428
diff
changeset
|
2 * Copyright (c) 1998, 2013, 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" | |
32 #include "runtime/deoptimization.hpp" | |
33 #include "runtime/vframe.hpp" | |
34 | |
0 | 35 //------------------------------OptoRuntime------------------------------------ |
36 // Opto compiler runtime routines | |
37 // | |
38 // These are all generated from Ideal graphs. They are called with the | |
39 // Java calling convention. Internally they call C++. They are made once at | |
40 // startup time and Opto compiles calls to them later. | |
41 // Things are broken up into quads: the signature they will be called with, | |
42 // the address of the generated code, the corresponding C++ code and an | |
43 // nmethod. | |
44 | |
45 // The signature (returned by "xxx_Type()") is used at startup time by the | |
46 // Generator to make the generated code "xxx_Java". Opto compiles calls | |
47 // to the generated code "xxx_Java". When the compiled code gets executed, | |
48 // it calls the C++ code "xxx_C". The generated nmethod is saved in the | |
49 // CodeCache. Exception handlers use the nmethod to get the callee-save | |
50 // register OopMaps. | |
51 class CallInfo; | |
52 | |
53 // | |
54 // NamedCounters are tagged counters which can be used for profiling | |
55 // code in various ways. Currently they are used by the lock coarsening code | |
56 // | |
57 | |
6197 | 58 class NamedCounter : public CHeapObj<mtCompiler> { |
0 | 59 public: |
60 enum CounterTag { | |
61 NoTag, | |
62 LockCounter, | |
63 EliminatedLockCounter, | |
64 BiasedLockingCounter | |
65 }; | |
66 | |
67 private: | |
68 const char * _name; | |
69 int _count; | |
70 CounterTag _tag; | |
71 NamedCounter* _next; | |
72 | |
73 public: | |
74 NamedCounter(const char *n, CounterTag tag = NoTag): | |
75 _name(n), | |
76 _count(0), | |
77 _next(NULL), | |
78 _tag(tag) {} | |
79 | |
80 const char * name() const { return _name; } | |
81 int count() const { return _count; } | |
82 address addr() { return (address)&_count; } | |
83 CounterTag tag() const { return _tag; } | |
84 void set_tag(CounterTag tag) { _tag = tag; } | |
85 | |
86 NamedCounter* next() const { return _next; } | |
87 void set_next(NamedCounter* next) { | |
88 assert(_next == NULL, "already set"); | |
89 _next = next; | |
90 } | |
91 | |
92 }; | |
93 | |
94 class BiasedLockingNamedCounter : public NamedCounter { | |
95 private: | |
96 BiasedLockingCounters _counters; | |
97 | |
98 public: | |
99 BiasedLockingNamedCounter(const char *n) : | |
100 NamedCounter(n, BiasedLockingCounter), _counters() {} | |
101 | |
102 BiasedLockingCounters* counters() { return &_counters; } | |
103 }; | |
104 | |
105 typedef const TypeFunc*(*TypeFunc_generator)(); | |
106 | |
107 class OptoRuntime : public AllStatic { | |
108 friend class Matcher; // allow access to stub names | |
109 | |
110 private: | |
111 // define stubs | |
112 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); | |
113 | |
114 // References to generated stubs | |
115 static address _new_instance_Java; | |
116 static address _new_array_Java; | |
3961
a92cdbac8b9e
7081933: Use zeroing elimination optimization for large array
kvn
parents:
3805
diff
changeset
|
117 static address _new_array_nozero_Java; |
0 | 118 static address _multianewarray2_Java; |
119 static address _multianewarray3_Java; | |
120 static address _multianewarray4_Java; | |
121 static address _multianewarray5_Java; | |
3805
263247c478c5
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
1972
diff
changeset
|
122 static address _multianewarrayN_Java; |
342 | 123 static address _g1_wb_pre_Java; |
124 static address _g1_wb_post_Java; | |
0 | 125 static address _vtable_must_compile_Java; |
126 static address _complete_monitor_locking_Java; | |
127 static address _rethrow_Java; | |
128 | |
129 static address _slow_arraycopy_Java; | |
130 static address _register_finalizer_Java; | |
131 | |
132 # ifdef ENABLE_ZAP_DEAD_LOCALS | |
133 static address _zap_dead_Java_locals_Java; | |
134 static address _zap_dead_native_locals_Java; | |
135 # endif | |
136 | |
137 | |
138 // | |
139 // Implementation of runtime methods | |
140 // ================================= | |
141 | |
142 // Allocate storage for a Java instance. | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
143 static void new_instance_C(Klass* instance_klass, JavaThread *thread); |
0 | 144 |
145 // Allocate storage for a objArray or typeArray | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
146 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
|
147 static void new_array_nozero_C(Klass* array_klass, int len, JavaThread *thread); |
0 | 148 |
1166 | 149 // Post-slow-path-allocation, pre-initializing-stores step for |
150 // implementing ReduceInitialCardMarks | |
151 static void new_store_pre_barrier(JavaThread* thread); | |
0 | 152 |
153 // Allocate storage for a multi-dimensional arrays | |
154 // 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
|
155 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
|
156 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
|
157 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
|
158 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
|
159 static void multianewarrayN_C(Klass* klass, arrayOopDesc* dims, JavaThread *thread); |
342 | 160 static void g1_wb_pre_C(oopDesc* orig, JavaThread* thread); |
161 static void g1_wb_post_C(void* card_addr, JavaThread* thread); | |
0 | 162 |
163 public: | |
164 // Slow-path Locking and Unlocking | |
165 static void complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread); | |
166 static void complete_monitor_unlocking_C(oopDesc* obj, BasicLock* lock); | |
167 | |
168 private: | |
169 | |
170 // Implicit exception support | |
171 static void throw_null_exception_C(JavaThread* thread); | |
172 | |
173 // Exception handling | |
174 static address handle_exception_C (JavaThread* thread); | |
175 static address handle_exception_C_helper(JavaThread* thread, nmethod*& nm); | |
176 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
|
177 static void deoptimize_caller_frame (JavaThread *thread); |
0 | 178 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
|
179 static bool is_deoptimized_caller_frame (JavaThread *thread); |
0 | 180 |
181 // CodeBlob support | |
182 // =================================================================== | |
183 | |
184 static ExceptionBlob* _exception_blob; | |
185 static void generate_exception_blob(); | |
186 | |
187 static void register_finalizer(oopDesc* obj, JavaThread* thread); | |
188 | |
189 // zaping dead locals, either from Java frames or from native frames | |
190 # ifdef ENABLE_ZAP_DEAD_LOCALS | |
191 static void zap_dead_Java_locals_C( JavaThread* thread); | |
192 static void zap_dead_native_locals_C( JavaThread* thread); | |
193 | |
194 static void zap_dead_java_or_native_locals( JavaThread*, bool (*)(frame*)); | |
195 | |
196 public: | |
197 static int ZapDeadCompiledLocals_count; | |
198 | |
199 # endif | |
200 | |
201 | |
202 public: | |
203 | |
204 static bool is_callee_saved_register(MachRegisterNumbers reg); | |
205 | |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
11080
diff
changeset
|
206 // One time only generate runtime code stubs. Returns true |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
11080
diff
changeset
|
207 // when runtime stubs have been generated successfully and |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
11080
diff
changeset
|
208 // false otherwise. |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
11080
diff
changeset
|
209 static bool generate(ciEnv* env); |
0 | 210 |
211 // Returns the name of a stub | |
212 static const char* stub_name(address entry); | |
213 | |
214 // access to runtime stubs entry points for java code | |
215 static address new_instance_Java() { return _new_instance_Java; } | |
216 static address new_array_Java() { return _new_array_Java; } | |
3961
a92cdbac8b9e
7081933: Use zeroing elimination optimization for large array
kvn
parents:
3805
diff
changeset
|
217 static address new_array_nozero_Java() { return _new_array_nozero_Java; } |
0 | 218 static address multianewarray2_Java() { return _multianewarray2_Java; } |
219 static address multianewarray3_Java() { return _multianewarray3_Java; } | |
220 static address multianewarray4_Java() { return _multianewarray4_Java; } | |
221 static address multianewarray5_Java() { return _multianewarray5_Java; } | |
3805
263247c478c5
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
1972
diff
changeset
|
222 static address multianewarrayN_Java() { return _multianewarrayN_Java; } |
342 | 223 static address g1_wb_pre_Java() { return _g1_wb_pre_Java; } |
224 static address g1_wb_post_Java() { return _g1_wb_post_Java; } | |
0 | 225 static address vtable_must_compile_stub() { return _vtable_must_compile_Java; } |
226 static address complete_monitor_locking_Java() { return _complete_monitor_locking_Java; } | |
227 | |
228 static address slow_arraycopy_Java() { return _slow_arraycopy_Java; } | |
229 static address register_finalizer_Java() { return _register_finalizer_Java; } | |
230 | |
231 | |
232 # ifdef ENABLE_ZAP_DEAD_LOCALS | |
233 static address zap_dead_locals_stub(bool is_native) { return is_native | |
234 ? _zap_dead_native_locals_Java | |
235 : _zap_dead_Java_locals_Java; } | |
236 static MachNode* node_to_call_zap_dead_locals(Node* n, int block_num, bool is_native); | |
237 # endif | |
238 | |
239 static ExceptionBlob* exception_blob() { return _exception_blob; } | |
240 | |
241 // Leaf routines helping with method data update | |
242 static void profile_receiver_type_C(DataLayout* data, oopDesc* receiver); | |
243 | |
244 // Implicit exception support | |
245 static void throw_div0_exception_C (JavaThread* thread); | |
246 static void throw_stack_overflow_error_C(JavaThread* thread); | |
247 | |
248 // Exception handling | |
249 static address rethrow_stub() { return _rethrow_Java; } | |
250 | |
251 | |
252 // Type functions | |
253 // ====================================================== | |
254 | |
255 static const TypeFunc* new_instance_Type(); // object allocation (slow case) | |
256 static const TypeFunc* new_array_Type (); // [a]newarray (slow case) | |
257 static const TypeFunc* multianewarray_Type(int ndim); // multianewarray | |
258 static const TypeFunc* multianewarray2_Type(); // multianewarray | |
259 static const TypeFunc* multianewarray3_Type(); // multianewarray | |
260 static const TypeFunc* multianewarray4_Type(); // multianewarray | |
261 static const TypeFunc* multianewarray5_Type(); // multianewarray | |
3805
263247c478c5
7058510: multinewarray with 6 dimensions uncommon traps in server compiler
iveresov
parents:
1972
diff
changeset
|
262 static const TypeFunc* multianewarrayN_Type(); // multianewarray |
342 | 263 static const TypeFunc* g1_wb_pre_Type(); |
264 static const TypeFunc* g1_wb_post_Type(); | |
0 | 265 static const TypeFunc* complete_monitor_enter_Type(); |
266 static const TypeFunc* complete_monitor_exit_Type(); | |
267 static const TypeFunc* uncommon_trap_Type(); | |
268 static const TypeFunc* athrow_Type(); | |
269 static const TypeFunc* rethrow_Type(); | |
270 static const TypeFunc* Math_D_D_Type(); // sin,cos & friends | |
271 static const TypeFunc* Math_DD_D_Type(); // mod,pow & friends | |
272 static const TypeFunc* modf_Type(); | |
273 static const TypeFunc* l2f_Type(); | |
6006
0105f367a14c
7160570: Intrinsification support for tracing framework
rbackman
parents:
4063
diff
changeset
|
274 static const TypeFunc* void_long_Type(); |
0 | 275 |
276 static const TypeFunc* flush_windows_Type(); | |
277 | |
278 // arraycopy routine types | |
279 static const TypeFunc* fast_arraycopy_Type(); // bit-blasters | |
280 static const TypeFunc* checkcast_arraycopy_Type(); | |
281 static const TypeFunc* generic_arraycopy_Type(); | |
282 static const TypeFunc* slow_arraycopy_Type(); // the full routine | |
283 | |
1763 | 284 static const TypeFunc* array_fill_Type(); |
285 | |
6894 | 286 static const TypeFunc* aescrypt_block_Type(); |
287 static const TypeFunc* cipherBlockChaining_aescrypt_Type(); | |
288 | |
11080
b800986664f4
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
7428
diff
changeset
|
289 static const TypeFunc* updateBytesCRC32_Type(); |
b800986664f4
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
7428
diff
changeset
|
290 |
0 | 291 // leaf on stack replacement interpreter accessor types |
292 static const TypeFunc* osr_end_Type(); | |
293 | |
294 // leaf methodData routine types | |
295 static const TypeFunc* profile_receiver_type_Type(); | |
296 | |
297 // leaf on stack replacement interpreter accessor types | |
298 static const TypeFunc* fetch_int_Type(); | |
299 static const TypeFunc* fetch_long_Type(); | |
300 static const TypeFunc* fetch_float_Type(); | |
301 static const TypeFunc* fetch_double_Type(); | |
302 static const TypeFunc* fetch_oop_Type(); | |
303 static const TypeFunc* fetch_monitor_Type(); | |
304 | |
305 static const TypeFunc* register_finalizer_Type(); | |
306 | |
307 // Dtrace support | |
308 static const TypeFunc* dtrace_method_entry_exit_Type(); | |
309 static const TypeFunc* dtrace_object_alloc_Type(); | |
310 | |
311 # ifdef ENABLE_ZAP_DEAD_LOCALS | |
312 static const TypeFunc* zap_dead_locals_Type(); | |
313 # endif | |
314 | |
315 private: | |
316 static NamedCounter * volatile _named_counters; | |
317 | |
318 public: | |
319 // helper function which creates a named counter labeled with the | |
320 // if they are available | |
321 static NamedCounter* new_named_counter(JVMState* jvms, NamedCounter::CounterTag tag); | |
322 | |
323 // dumps all the named counters | |
324 static void print_named_counters(); | |
325 | |
326 }; | |
1972 | 327 |
328 #endif // SHARE_VM_OPTO_RUNTIME_HPP |