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