83 }
84
85 const char * name() const { return _name; }
86 int count() const { return _count; }
87 address addr() { return (address)&_count; }
88 CounterTag tag() const { return _tag; }
89 void set_tag(CounterTag tag) { _tag = tag; }
90
91 NamedCounter* next() const { return _next; }
92 void set_next(NamedCounter* next) {
93 assert(_next == nullptr || next == nullptr, "already set");
94 _next = next;
95 }
96
97 };
98
99 typedef const TypeFunc*(*TypeFunc_generator)();
100
101 class OptoRuntime : public AllStatic {
102 friend class Matcher; // allow access to stub names
103
104 private:
105 // define stubs
106 static address generate_stub(ciEnv* ci_env, TypeFunc_generator gen, address C_function, const char* name, int is_fancy_jump, bool pass_tls, bool return_pc);
107
108 // References to generated stubs
109 static address _new_instance_Java;
110 static address _new_array_Java;
111 static address _new_array_nozero_Java;
112 static address _multianewarray2_Java;
113 static address _multianewarray3_Java;
114 static address _multianewarray4_Java;
115 static address _multianewarray5_Java;
116 static address _multianewarrayN_Java;
117 static address _vtable_must_compile_Java;
118 static address _complete_monitor_locking_Java;
119 static address _rethrow_Java;
120 static address _monitor_notify_Java;
121 static address _monitor_notifyAll_Java;
122
123 static address _slow_arraycopy_Java;
124 static address _register_finalizer_Java;
125 #if INCLUDE_JVMTI
126 static address _notify_jvmti_vthread_start;
127 static address _notify_jvmti_vthread_end;
128 static address _notify_jvmti_vthread_mount;
129 static address _notify_jvmti_vthread_unmount;
130 #endif
131
132 //
133 // Implementation of runtime methods
134 // =================================
135
136 // Allocate storage for a Java instance.
137 static void new_instance_C(Klass* instance_klass, JavaThread* current);
138
139 // Allocate storage for a objArray or typeArray
140 static void new_array_C(Klass* array_klass, int len, JavaThread* current);
141 static void new_array_nozero_C(Klass* array_klass, int len, JavaThread* current);
142
143 // Allocate storage for a multi-dimensional arrays
144 // Note: needs to be fixed for arbitrary number of dimensions
156
157 // Implicit exception support
158 static void throw_null_exception_C(JavaThread* thread);
159
160 // Exception handling
161 static address handle_exception_C (JavaThread* current);
162 static address handle_exception_C_helper(JavaThread* current, nmethod*& nm);
163 static address rethrow_C (oopDesc* exception, JavaThread *thread, address return_pc );
164 static void deoptimize_caller_frame (JavaThread *thread);
165 static void deoptimize_caller_frame (JavaThread *thread, bool doit);
166 static bool is_deoptimized_caller_frame (JavaThread *thread);
167
168 // CodeBlob support
169 // ===================================================================
170
171 static ExceptionBlob* _exception_blob;
172 static void generate_exception_blob();
173
174 static void register_finalizer(oopDesc* obj, JavaThread* current);
175
176 public:
177
178 static bool is_callee_saved_register(MachRegisterNumbers reg);
179
180 // One time only generate runtime code stubs. Returns true
181 // when runtime stubs have been generated successfully and
182 // false otherwise.
183 static bool generate(ciEnv* env);
184
185 // Returns the name of a stub
186 static const char* stub_name(address entry);
187
188 // access to runtime stubs entry points for java code
189 static address new_instance_Java() { return _new_instance_Java; }
190 static address new_array_Java() { return _new_array_Java; }
191 static address new_array_nozero_Java() { return _new_array_nozero_Java; }
192 static address multianewarray2_Java() { return _multianewarray2_Java; }
193 static address multianewarray3_Java() { return _multianewarray3_Java; }
194 static address multianewarray4_Java() { return _multianewarray4_Java; }
195 static address multianewarray5_Java() { return _multianewarray5_Java; }
196 static address multianewarrayN_Java() { return _multianewarrayN_Java; }
197 static address vtable_must_compile_stub() { return _vtable_must_compile_Java; }
198 static address complete_monitor_locking_Java() { return _complete_monitor_locking_Java; }
199 static address monitor_notify_Java() { return _monitor_notify_Java; }
200 static address monitor_notifyAll_Java() { return _monitor_notifyAll_Java; }
201
202 static address slow_arraycopy_Java() { return _slow_arraycopy_Java; }
203 static address register_finalizer_Java() { return _register_finalizer_Java; }
204 #if INCLUDE_JVMTI
205 static address notify_jvmti_vthread_start() { return _notify_jvmti_vthread_start; }
206 static address notify_jvmti_vthread_end() { return _notify_jvmti_vthread_end; }
207 static address notify_jvmti_vthread_mount() { return _notify_jvmti_vthread_mount; }
208 static address notify_jvmti_vthread_unmount() { return _notify_jvmti_vthread_unmount; }
209 #endif
210
211 static ExceptionBlob* exception_blob() { return _exception_blob; }
212
213 // Implicit exception support
214 static void throw_div0_exception_C (JavaThread* thread);
215 static void throw_stack_overflow_error_C(JavaThread* thread);
216
217 // Exception handling
218 static address rethrow_stub() { return _rethrow_Java; }
219
220
221 // Type functions
222 // ======================================================
223
282
283 static const TypeFunc* ghash_processBlocks_Type();
284 static const TypeFunc* chacha20Block_Type();
285 static const TypeFunc* base64_encodeBlock_Type();
286 static const TypeFunc* base64_decodeBlock_Type();
287 static const TypeFunc* string_IndexOf_Type();
288 static const TypeFunc* poly1305_processBlocks_Type();
289 static const TypeFunc* intpoly_montgomeryMult_P256_Type();
290 static const TypeFunc* intpoly_assign_Type();
291
292 static const TypeFunc* updateBytesCRC32_Type();
293 static const TypeFunc* updateBytesCRC32C_Type();
294
295 static const TypeFunc* updateBytesAdler32_Type();
296
297 // leaf on stack replacement interpreter accessor types
298 static const TypeFunc* osr_end_Type();
299
300 static const TypeFunc* register_finalizer_Type();
301
302 JFR_ONLY(static const TypeFunc* class_id_load_barrier_Type();)
303 #if INCLUDE_JVMTI
304 static const TypeFunc* notify_jvmti_vthread_Type();
305 #endif
306
307 // Dtrace support
308 static const TypeFunc* dtrace_method_entry_exit_Type();
309 static const TypeFunc* dtrace_object_alloc_Type();
310
311 private:
312 static NamedCounter * volatile _named_counters;
313
314 public:
315 // helper function which creates a named counter labeled with the
316 // if they are available
317 static NamedCounter* new_named_counter(JVMState* jvms, NamedCounter::CounterTag tag);
318
319 // dumps all the named counters
320 static void print_named_counters();
321
322 };
323
324 #endif // SHARE_OPTO_RUNTIME_HPP
|
83 }
84
85 const char * name() const { return _name; }
86 int count() const { return _count; }
87 address addr() { return (address)&_count; }
88 CounterTag tag() const { return _tag; }
89 void set_tag(CounterTag tag) { _tag = tag; }
90
91 NamedCounter* next() const { return _next; }
92 void set_next(NamedCounter* next) {
93 assert(_next == nullptr || next == nullptr, "already set");
94 _next = next;
95 }
96
97 };
98
99 typedef const TypeFunc*(*TypeFunc_generator)();
100
101 class OptoRuntime : public AllStatic {
102 friend class Matcher; // allow access to stub names
103 friend class SCAddressTable;
104 private:
105 // define stubs
106 static address generate_stub(ciEnv* ci_env, TypeFunc_generator gen, address C_function, const char* name, int is_fancy_jump, bool pass_tls, bool return_pc);
107
108 // References to generated stubs
109 static address _new_instance_Java;
110 static address _new_array_Java;
111 static address _new_array_nozero_Java;
112 static address _multianewarray2_Java;
113 static address _multianewarray3_Java;
114 static address _multianewarray4_Java;
115 static address _multianewarray5_Java;
116 static address _multianewarrayN_Java;
117 static address _vtable_must_compile_Java;
118 static address _complete_monitor_locking_Java;
119 static address _rethrow_Java;
120 static address _monitor_notify_Java;
121 static address _monitor_notifyAll_Java;
122
123 static address _slow_arraycopy_Java;
124 static address _register_finalizer_Java;
125 static address _class_init_barrier_Java;
126 #if INCLUDE_JVMTI
127 static address _notify_jvmti_vthread_start;
128 static address _notify_jvmti_vthread_end;
129 static address _notify_jvmti_vthread_mount;
130 static address _notify_jvmti_vthread_unmount;
131 #endif
132
133 //
134 // Implementation of runtime methods
135 // =================================
136
137 // Allocate storage for a Java instance.
138 static void new_instance_C(Klass* instance_klass, JavaThread* current);
139
140 // Allocate storage for a objArray or typeArray
141 static void new_array_C(Klass* array_klass, int len, JavaThread* current);
142 static void new_array_nozero_C(Klass* array_klass, int len, JavaThread* current);
143
144 // Allocate storage for a multi-dimensional arrays
145 // Note: needs to be fixed for arbitrary number of dimensions
157
158 // Implicit exception support
159 static void throw_null_exception_C(JavaThread* thread);
160
161 // Exception handling
162 static address handle_exception_C (JavaThread* current);
163 static address handle_exception_C_helper(JavaThread* current, nmethod*& nm);
164 static address rethrow_C (oopDesc* exception, JavaThread *thread, address return_pc );
165 static void deoptimize_caller_frame (JavaThread *thread);
166 static void deoptimize_caller_frame (JavaThread *thread, bool doit);
167 static bool is_deoptimized_caller_frame (JavaThread *thread);
168
169 // CodeBlob support
170 // ===================================================================
171
172 static ExceptionBlob* _exception_blob;
173 static void generate_exception_blob();
174
175 static void register_finalizer(oopDesc* obj, JavaThread* current);
176
177 static void class_init_barrier(Klass* k, JavaThread* current);
178 public:
179
180 static bool is_callee_saved_register(MachRegisterNumbers reg);
181
182 // One time only generate runtime code stubs. Returns true
183 // when runtime stubs have been generated successfully and
184 // false otherwise.
185 static bool generate(ciEnv* env);
186
187 // Returns the name of a stub
188 static const char* stub_name(address entry);
189
190 // access to runtime stubs entry points for java code
191 static address new_instance_Java() { return _new_instance_Java; }
192 static address new_array_Java() { return _new_array_Java; }
193 static address new_array_nozero_Java() { return _new_array_nozero_Java; }
194 static address multianewarray2_Java() { return _multianewarray2_Java; }
195 static address multianewarray3_Java() { return _multianewarray3_Java; }
196 static address multianewarray4_Java() { return _multianewarray4_Java; }
197 static address multianewarray5_Java() { return _multianewarray5_Java; }
198 static address multianewarrayN_Java() { return _multianewarrayN_Java; }
199 static address vtable_must_compile_stub() { return _vtable_must_compile_Java; }
200 static address complete_monitor_locking_Java() { return _complete_monitor_locking_Java; }
201 static address monitor_notify_Java() { return _monitor_notify_Java; }
202 static address monitor_notifyAll_Java() { return _monitor_notifyAll_Java; }
203
204 static address slow_arraycopy_Java() { return _slow_arraycopy_Java; }
205 static address register_finalizer_Java() { return _register_finalizer_Java; }
206 static address class_init_barrier_Java() { return _class_init_barrier_Java; }
207 #if INCLUDE_JVMTI
208 static address notify_jvmti_vthread_start() { return _notify_jvmti_vthread_start; }
209 static address notify_jvmti_vthread_end() { return _notify_jvmti_vthread_end; }
210 static address notify_jvmti_vthread_mount() { return _notify_jvmti_vthread_mount; }
211 static address notify_jvmti_vthread_unmount() { return _notify_jvmti_vthread_unmount; }
212 #endif
213
214 static ExceptionBlob* exception_blob() { return _exception_blob; }
215
216 // Implicit exception support
217 static void throw_div0_exception_C (JavaThread* thread);
218 static void throw_stack_overflow_error_C(JavaThread* thread);
219
220 // Exception handling
221 static address rethrow_stub() { return _rethrow_Java; }
222
223
224 // Type functions
225 // ======================================================
226
285
286 static const TypeFunc* ghash_processBlocks_Type();
287 static const TypeFunc* chacha20Block_Type();
288 static const TypeFunc* base64_encodeBlock_Type();
289 static const TypeFunc* base64_decodeBlock_Type();
290 static const TypeFunc* string_IndexOf_Type();
291 static const TypeFunc* poly1305_processBlocks_Type();
292 static const TypeFunc* intpoly_montgomeryMult_P256_Type();
293 static const TypeFunc* intpoly_assign_Type();
294
295 static const TypeFunc* updateBytesCRC32_Type();
296 static const TypeFunc* updateBytesCRC32C_Type();
297
298 static const TypeFunc* updateBytesAdler32_Type();
299
300 // leaf on stack replacement interpreter accessor types
301 static const TypeFunc* osr_end_Type();
302
303 static const TypeFunc* register_finalizer_Type();
304
305 static const TypeFunc* class_init_barrier_Type();
306
307 JFR_ONLY(static const TypeFunc* class_id_load_barrier_Type();)
308 #if INCLUDE_JVMTI
309 static const TypeFunc* notify_jvmti_vthread_Type();
310 #endif
311
312 // Dtrace support
313 static const TypeFunc* dtrace_method_entry_exit_Type();
314 static const TypeFunc* dtrace_object_alloc_Type();
315
316 private:
317 static NamedCounter * volatile _named_counters;
318
319 public:
320 // helper function which creates a named counter labeled with the
321 // if they are available
322 static NamedCounter* new_named_counter(JVMState* jvms, NamedCounter::CounterTag tag);
323
324 // dumps all the named counters
325 static void print_named_counters();
326
327 public:
328 static void init_counters();
329 static void print_counters_on(outputStream* st);
330 };
331
332 #endif // SHARE_OPTO_RUNTIME_HPP
|