Print this page
Split |
Close |
Expand all |
Collapse all |
--- old/src/share/vm/opto/runtime.hpp
+++ new/src/share/vm/opto/runtime.hpp
1 1 /*
2 2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 *
5 5 * This code is free software; you can redistribute it and/or modify it
6 6 * under the terms of the GNU General Public License version 2 only, as
7 7 * published by the Free Software Foundation.
8 8 *
9 9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 12 * version 2 for more details (a copy is included in the LICENSE file that
13 13 * accompanied this code).
14 14 *
15 15 * You should have received a copy of the GNU General Public License version
16 16 * 2 along with this work; if not, write to the Free Software Foundation,
17 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 18 *
19 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 20 * or visit www.oracle.com if you need additional information or have any
21 21 * questions.
22 22 *
23 23 */
24 24
25 25 #ifndef SHARE_VM_OPTO_RUNTIME_HPP
26 26 #define SHARE_VM_OPTO_RUNTIME_HPP
27 27
28 28 #include "code/codeBlob.hpp"
29 29 #include "opto/machnode.hpp"
30 30 #include "opto/type.hpp"
31 31 #include "runtime/biasedLocking.hpp"
32 32 #include "runtime/deoptimization.hpp"
33 33 #include "runtime/vframe.hpp"
34 34
35 35 //------------------------------OptoRuntime------------------------------------
36 36 // Opto compiler runtime routines
37 37 //
38 38 // These are all generated from Ideal graphs. They are called with the
39 39 // Java calling convention. Internally they call C++. They are made once at
40 40 // startup time and Opto compiles calls to them later.
41 41 // Things are broken up into quads: the signature they will be called with,
42 42 // the address of the generated code, the corresponding C++ code and an
43 43 // nmethod.
44 44
45 45 // The signature (returned by "xxx_Type()") is used at startup time by the
46 46 // Generator to make the generated code "xxx_Java". Opto compiles calls
47 47 // to the generated code "xxx_Java". When the compiled code gets executed,
48 48 // it calls the C++ code "xxx_C". The generated nmethod is saved in the
49 49 // CodeCache. Exception handlers use the nmethod to get the callee-save
50 50 // register OopMaps.
51 51 class CallInfo;
52 52
53 53 //
54 54 // NamedCounters are tagged counters which can be used for profiling
55 55 // code in various ways. Currently they are used by the lock coarsening code
56 56 //
57 57
58 58 class NamedCounter : public CHeapObj {
59 59 public:
60 60 enum CounterTag {
61 61 NoTag,
62 62 LockCounter,
63 63 EliminatedLockCounter,
64 64 BiasedLockingCounter
65 65 };
66 66
67 67 private:
68 68 const char * _name;
69 69 int _count;
70 70 CounterTag _tag;
71 71 NamedCounter* _next;
72 72
73 73 public:
74 74 NamedCounter(const char *n, CounterTag tag = NoTag):
75 75 _name(n),
76 76 _count(0),
77 77 _next(NULL),
78 78 _tag(tag) {}
79 79
80 80 const char * name() const { return _name; }
81 81 int count() const { return _count; }
82 82 address addr() { return (address)&_count; }
83 83 CounterTag tag() const { return _tag; }
84 84 void set_tag(CounterTag tag) { _tag = tag; }
85 85
86 86 NamedCounter* next() const { return _next; }
87 87 void set_next(NamedCounter* next) {
88 88 assert(_next == NULL, "already set");
89 89 _next = next;
90 90 }
91 91
92 92 };
93 93
94 94 class BiasedLockingNamedCounter : public NamedCounter {
95 95 private:
96 96 BiasedLockingCounters _counters;
97 97
98 98 public:
99 99 BiasedLockingNamedCounter(const char *n) :
100 100 NamedCounter(n, BiasedLockingCounter), _counters() {}
101 101
102 102 BiasedLockingCounters* counters() { return &_counters; }
103 103 };
104 104
105 105 typedef const TypeFunc*(*TypeFunc_generator)();
106 106
107 107 class OptoRuntime : public AllStatic {
108 108 friend class Matcher; // allow access to stub names
109 109
110 110 private:
↓ open down ↓ |
110 lines elided |
↑ open up ↑ |
111 111 // define stubs
112 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 113
114 114 // References to generated stubs
115 115 static address _new_instance_Java;
116 116 static address _new_array_Java;
117 117 static address _multianewarray2_Java;
118 118 static address _multianewarray3_Java;
119 119 static address _multianewarray4_Java;
120 120 static address _multianewarray5_Java;
121 + static address _multianewarrayN_Java;
121 122 static address _g1_wb_pre_Java;
122 123 static address _g1_wb_post_Java;
123 124 static address _vtable_must_compile_Java;
124 125 static address _complete_monitor_locking_Java;
125 126 static address _rethrow_Java;
126 127
127 128 static address _slow_arraycopy_Java;
128 129 static address _register_finalizer_Java;
129 130
130 131 # ifdef ENABLE_ZAP_DEAD_LOCALS
131 132 static address _zap_dead_Java_locals_Java;
132 133 static address _zap_dead_native_locals_Java;
133 134 # endif
134 135
135 136
136 137 //
137 138 // Implementation of runtime methods
138 139 // =================================
139 140
140 141 // Allocate storage for a Java instance.
141 142 static void new_instance_C(klassOopDesc* instance_klass, JavaThread *thread);
142 143
143 144 // Allocate storage for a objArray or typeArray
144 145 static void new_array_C(klassOopDesc* array_klass, int len, JavaThread *thread);
145 146
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
146 147 // Post-slow-path-allocation, pre-initializing-stores step for
147 148 // implementing ReduceInitialCardMarks
148 149 static void new_store_pre_barrier(JavaThread* thread);
149 150
150 151 // Allocate storage for a multi-dimensional arrays
151 152 // Note: needs to be fixed for arbitrary number of dimensions
152 153 static void multianewarray2_C(klassOopDesc* klass, int len1, int len2, JavaThread *thread);
153 154 static void multianewarray3_C(klassOopDesc* klass, int len1, int len2, int len3, JavaThread *thread);
154 155 static void multianewarray4_C(klassOopDesc* klass, int len1, int len2, int len3, int len4, JavaThread *thread);
155 156 static void multianewarray5_C(klassOopDesc* klass, int len1, int len2, int len3, int len4, int len5, JavaThread *thread);
157 + static void multianewarrayN_C(klassOopDesc* klass, arrayOopDesc* dims, JavaThread *thread);
156 158 static void g1_wb_pre_C(oopDesc* orig, JavaThread* thread);
157 159 static void g1_wb_post_C(void* card_addr, JavaThread* thread);
158 160
159 161 public:
160 162 // Slow-path Locking and Unlocking
161 163 static void complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* thread);
162 164 static void complete_monitor_unlocking_C(oopDesc* obj, BasicLock* lock);
163 165
164 166 private:
165 167
166 168 // Implicit exception support
167 169 static void throw_null_exception_C(JavaThread* thread);
168 170
169 171 // Exception handling
170 172 static address handle_exception_C (JavaThread* thread);
171 173 static address handle_exception_C_helper(JavaThread* thread, nmethod*& nm);
172 174 static address rethrow_C (oopDesc* exception, JavaThread *thread, address return_pc );
173 175 static void deoptimize_caller_frame (JavaThread *thread, bool doit);
174 176
175 177 // CodeBlob support
176 178 // ===================================================================
177 179
178 180 static ExceptionBlob* _exception_blob;
179 181 static void generate_exception_blob();
180 182
181 183 static void register_finalizer(oopDesc* obj, JavaThread* thread);
182 184
183 185 // zaping dead locals, either from Java frames or from native frames
184 186 # ifdef ENABLE_ZAP_DEAD_LOCALS
185 187 static void zap_dead_Java_locals_C( JavaThread* thread);
186 188 static void zap_dead_native_locals_C( JavaThread* thread);
187 189
188 190 static void zap_dead_java_or_native_locals( JavaThread*, bool (*)(frame*));
189 191
190 192 public:
191 193 static int ZapDeadCompiledLocals_count;
192 194
193 195 # endif
194 196
195 197
196 198 public:
197 199
198 200 static bool is_callee_saved_register(MachRegisterNumbers reg);
199 201
200 202 // One time only generate runtime code stubs
201 203 static void generate(ciEnv* env);
202 204
↓ open down ↓ |
37 lines elided |
↑ open up ↑ |
203 205 // Returns the name of a stub
204 206 static const char* stub_name(address entry);
205 207
206 208 // access to runtime stubs entry points for java code
207 209 static address new_instance_Java() { return _new_instance_Java; }
208 210 static address new_array_Java() { return _new_array_Java; }
209 211 static address multianewarray2_Java() { return _multianewarray2_Java; }
210 212 static address multianewarray3_Java() { return _multianewarray3_Java; }
211 213 static address multianewarray4_Java() { return _multianewarray4_Java; }
212 214 static address multianewarray5_Java() { return _multianewarray5_Java; }
215 + static address multianewarrayN_Java() { return _multianewarrayN_Java; }
213 216 static address g1_wb_pre_Java() { return _g1_wb_pre_Java; }
214 217 static address g1_wb_post_Java() { return _g1_wb_post_Java; }
215 218 static address vtable_must_compile_stub() { return _vtable_must_compile_Java; }
216 219 static address complete_monitor_locking_Java() { return _complete_monitor_locking_Java; }
217 220
218 221 static address slow_arraycopy_Java() { return _slow_arraycopy_Java; }
219 222 static address register_finalizer_Java() { return _register_finalizer_Java; }
220 223
221 224
222 225 # ifdef ENABLE_ZAP_DEAD_LOCALS
223 226 static address zap_dead_locals_stub(bool is_native) { return is_native
224 227 ? _zap_dead_native_locals_Java
225 228 : _zap_dead_Java_locals_Java; }
226 229 static MachNode* node_to_call_zap_dead_locals(Node* n, int block_num, bool is_native);
227 230 # endif
228 231
229 232 static ExceptionBlob* exception_blob() { return _exception_blob; }
230 233
231 234 // Leaf routines helping with method data update
232 235 static void profile_receiver_type_C(DataLayout* data, oopDesc* receiver);
233 236
234 237 // Implicit exception support
235 238 static void throw_div0_exception_C (JavaThread* thread);
236 239 static void throw_stack_overflow_error_C(JavaThread* thread);
237 240
238 241 // Exception handling
239 242 static address rethrow_stub() { return _rethrow_Java; }
240 243
241 244
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
242 245 // Type functions
243 246 // ======================================================
244 247
245 248 static const TypeFunc* new_instance_Type(); // object allocation (slow case)
246 249 static const TypeFunc* new_array_Type (); // [a]newarray (slow case)
247 250 static const TypeFunc* multianewarray_Type(int ndim); // multianewarray
248 251 static const TypeFunc* multianewarray2_Type(); // multianewarray
249 252 static const TypeFunc* multianewarray3_Type(); // multianewarray
250 253 static const TypeFunc* multianewarray4_Type(); // multianewarray
251 254 static const TypeFunc* multianewarray5_Type(); // multianewarray
255 + static const TypeFunc* multianewarrayN_Type(); // multianewarray
252 256 static const TypeFunc* g1_wb_pre_Type();
253 257 static const TypeFunc* g1_wb_post_Type();
254 258 static const TypeFunc* complete_monitor_enter_Type();
255 259 static const TypeFunc* complete_monitor_exit_Type();
256 260 static const TypeFunc* uncommon_trap_Type();
257 261 static const TypeFunc* athrow_Type();
258 262 static const TypeFunc* rethrow_Type();
259 263 static const TypeFunc* Math_D_D_Type(); // sin,cos & friends
260 264 static const TypeFunc* Math_DD_D_Type(); // mod,pow & friends
261 265 static const TypeFunc* modf_Type();
262 266 static const TypeFunc* l2f_Type();
263 267 static const TypeFunc* current_time_millis_Type();
264 268
265 269 static const TypeFunc* flush_windows_Type();
266 270
267 271 // arraycopy routine types
268 272 static const TypeFunc* fast_arraycopy_Type(); // bit-blasters
269 273 static const TypeFunc* checkcast_arraycopy_Type();
270 274 static const TypeFunc* generic_arraycopy_Type();
271 275 static const TypeFunc* slow_arraycopy_Type(); // the full routine
272 276
273 277 static const TypeFunc* array_fill_Type();
274 278
275 279 // leaf on stack replacement interpreter accessor types
276 280 static const TypeFunc* osr_end_Type();
277 281
278 282 // leaf methodData routine types
279 283 static const TypeFunc* profile_receiver_type_Type();
280 284
281 285 // leaf on stack replacement interpreter accessor types
282 286 static const TypeFunc* fetch_int_Type();
283 287 static const TypeFunc* fetch_long_Type();
284 288 static const TypeFunc* fetch_float_Type();
285 289 static const TypeFunc* fetch_double_Type();
286 290 static const TypeFunc* fetch_oop_Type();
287 291 static const TypeFunc* fetch_monitor_Type();
288 292
289 293 static const TypeFunc* register_finalizer_Type();
290 294
291 295 // Dtrace support
292 296 static const TypeFunc* dtrace_method_entry_exit_Type();
293 297 static const TypeFunc* dtrace_object_alloc_Type();
294 298
295 299 # ifdef ENABLE_ZAP_DEAD_LOCALS
296 300 static const TypeFunc* zap_dead_locals_Type();
297 301 # endif
298 302
299 303 private:
300 304 static NamedCounter * volatile _named_counters;
301 305
302 306 public:
303 307 // helper function which creates a named counter labeled with the
304 308 // if they are available
305 309 static NamedCounter* new_named_counter(JVMState* jvms, NamedCounter::CounterTag tag);
306 310
307 311 // dumps all the named counters
308 312 static void print_named_counters();
309 313
310 314 };
311 315
312 316 #endif // SHARE_VM_OPTO_RUNTIME_HPP
↓ open down ↓ |
51 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX