< prev index next >

src/hotspot/share/opto/runtime.hpp

Print this page

  1 /*
  2  * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
  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  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *

127   static address     STUB_FIELD_NAME(name);
128 
129   C2_STUBS_DO(C2_BLOB_FIELD_DECLARE, C2_STUB_FIELD_DECLARE, C2_JVMTI_STUB_FIELD_DECLARE)
130 
131 #undef C2_BLOB_FIELD_DECLARE
132 #undef C2_STUB_FIELD_NAME
133 #undef C2_STUB_FIELD_DECLARE
134 #undef C2_JVMTI_STUB_FIELD_DECLARE
135 
136   // Stub names indexed by sharedStubId
137   static const char *_stub_names[];
138 
139   // define stubs
140   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);
141 
142   //
143   // Implementation of runtime methods
144   // =================================
145 
146   // Allocate storage for a Java instance.
147   static void new_instance_C(Klass* instance_klass, JavaThread* current);
148 
149   // Allocate storage for a objArray or typeArray
150   static void new_array_C(Klass* array_klass, int len, JavaThread* current);
151   static void new_array_nozero_C(Klass* array_klass, int len, JavaThread* current);
152 
153   // Allocate storage for a multi-dimensional arrays
154   // Note: needs to be fixed for arbitrary number of dimensions
155   static void multianewarray2_C(Klass* klass, int len1, int len2, JavaThread* current);
156   static void multianewarray3_C(Klass* klass, int len1, int len2, int len3, JavaThread* current);
157   static void multianewarray4_C(Klass* klass, int len1, int len2, int len3, int len4, JavaThread* current);
158   static void multianewarray5_C(Klass* klass, int len1, int len2, int len3, int len4, int len5, JavaThread* current);
159   static void multianewarrayN_C(Klass* klass, arrayOopDesc* dims, JavaThread* current);
160 
161   // local methods passed as arguments to stub generator that forward
162   // control to corresponding JRT methods of SharedRuntime
163   static void slow_arraycopy_C(oopDesc* src,  jint src_pos,
164                                oopDesc* dest, jint dest_pos,
165                                jint length, JavaThread* thread);
166   static void complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* current);
167 

174   // Implicit exception support
175   static void throw_null_exception_C(JavaThread* thread);
176 
177   // Exception handling
178   static address handle_exception_C       (JavaThread* current);
179   static address handle_exception_C_helper(JavaThread* current, nmethod*& nm);
180   static address rethrow_C                (oopDesc* exception, JavaThread *thread, address return_pc );
181   static void deoptimize_caller_frame     (JavaThread *thread);
182   static void deoptimize_caller_frame     (JavaThread *thread, bool doit);
183   static bool is_deoptimized_caller_frame (JavaThread *thread);
184 
185   // CodeBlob support
186   // ===================================================================
187 
188   static void generate_uncommon_trap_blob(void);
189   static void generate_exception_blob();
190 
191   static void register_finalizer_C(oopDesc* obj, JavaThread* current);
192 
193  public:


194 
195   static bool is_callee_saved_register(MachRegisterNumbers reg);
196 
197   // One time only generate runtime code stubs. Returns true
198   // when runtime stubs have been generated successfully and
199   // false otherwise.
200   static bool generate(ciEnv* env);
201 
202   // Returns the name of a stub
203   static const char* stub_name(address entry);
204 
205   // Returns the name associated with a given stub id
206   static const char* stub_name(OptoStubId id) {
207     assert(id > OptoStubId::NO_STUBID && id < OptoStubId::NUM_STUBIDS, "stub id out of range");
208     return _stub_names[(int)id];
209   }
210 
211   // access to runtime stubs entry points for java code
212   static address new_instance_Java()                     { return _new_instance_Java; }
213   static address new_array_Java()                        { return _new_array_Java; }
214   static address new_array_nozero_Java()                 { return _new_array_nozero_Java; }
215   static address multianewarray2_Java()                  { return _multianewarray2_Java; }
216   static address multianewarray3_Java()                  { return _multianewarray3_Java; }
217   static address multianewarray4_Java()                  { return _multianewarray4_Java; }
218   static address multianewarray5_Java()                  { return _multianewarray5_Java; }
219   static address multianewarrayN_Java()                  { return _multianewarrayN_Java; }
220   static address complete_monitor_locking_Java()         { return _complete_monitor_locking_Java; }
221   static address monitor_notify_Java()                   { return _monitor_notify_Java; }
222   static address monitor_notifyAll_Java()                { return _monitor_notifyAll_Java; }
223 
224   static address slow_arraycopy_Java()                   { return _slow_arraycopy_Java; }
225   static address register_finalizer_Java()               { return _register_finalizer_Java; }


226 #if INCLUDE_JVMTI
227   static address notify_jvmti_vthread_start()            { return _notify_jvmti_vthread_start; }
228   static address notify_jvmti_vthread_end()              { return _notify_jvmti_vthread_end; }
229   static address notify_jvmti_vthread_mount()            { return _notify_jvmti_vthread_mount; }
230   static address notify_jvmti_vthread_unmount()          { return _notify_jvmti_vthread_unmount; }
231 #endif
232 
233   static UncommonTrapBlob* uncommon_trap_blob()                  { return _uncommon_trap_blob; }
234   static ExceptionBlob*    exception_blob()                      { return _exception_blob; }
235 
236   // Implicit exception support
237   static void throw_div0_exception_C      (JavaThread* thread);
238   static void throw_stack_overflow_error_C(JavaThread* thread);
239 
240   // Exception handling
241   static address rethrow_stub()             { return _rethrow_Java; }
242 
243 
244   // Type functions
245   // ======================================================

308 
309   static const TypeFunc* ghash_processBlocks_Type();
310   static const TypeFunc* chacha20Block_Type();
311   static const TypeFunc* base64_encodeBlock_Type();
312   static const TypeFunc* base64_decodeBlock_Type();
313   static const TypeFunc* string_IndexOf_Type();
314   static const TypeFunc* poly1305_processBlocks_Type();
315   static const TypeFunc* intpoly_montgomeryMult_P256_Type();
316   static const TypeFunc* intpoly_assign_Type();
317 
318   static const TypeFunc* updateBytesCRC32_Type();
319   static const TypeFunc* updateBytesCRC32C_Type();
320 
321   static const TypeFunc* updateBytesAdler32_Type();
322 
323   // leaf on stack replacement interpreter accessor types
324   static const TypeFunc* osr_end_Type();
325 
326   static const TypeFunc* register_finalizer_Type();
327 






328   JFR_ONLY(static const TypeFunc* class_id_load_barrier_Type();)
329 #if INCLUDE_JVMTI
330   static const TypeFunc* notify_jvmti_vthread_Type();
331 #endif
332 
333   // Dtrace support
334   static const TypeFunc* dtrace_method_entry_exit_Type();
335   static const TypeFunc* dtrace_object_alloc_Type();
336 
337  private:
338  static NamedCounter * volatile _named_counters;
339 
340  public:
341  // helper function which creates a named counter labeled with the
342  // if they are available
343  static NamedCounter* new_named_counter(JVMState* jvms, NamedCounter::CounterTag tag);
344 
345  // dumps all the named counters
346  static void          print_named_counters();
347 

  1 /*
  2  * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
  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  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *

127   static address     STUB_FIELD_NAME(name);
128 
129   C2_STUBS_DO(C2_BLOB_FIELD_DECLARE, C2_STUB_FIELD_DECLARE, C2_JVMTI_STUB_FIELD_DECLARE)
130 
131 #undef C2_BLOB_FIELD_DECLARE
132 #undef C2_STUB_FIELD_NAME
133 #undef C2_STUB_FIELD_DECLARE
134 #undef C2_JVMTI_STUB_FIELD_DECLARE
135 
136   // Stub names indexed by sharedStubId
137   static const char *_stub_names[];
138 
139   // define stubs
140   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);
141 
142   //
143   // Implementation of runtime methods
144   // =================================
145 
146   // Allocate storage for a Java instance.
147   static void new_instance_C(Klass* instance_klass, bool is_larval, JavaThread* current);
148 
149   // Allocate storage for a objArray or typeArray
150   static void new_array_C(Klass* array_klass, int len, JavaThread* current);
151   static void new_array_nozero_C(Klass* array_klass, int len, JavaThread* current);
152 
153   // Allocate storage for a multi-dimensional arrays
154   // Note: needs to be fixed for arbitrary number of dimensions
155   static void multianewarray2_C(Klass* klass, int len1, int len2, JavaThread* current);
156   static void multianewarray3_C(Klass* klass, int len1, int len2, int len3, JavaThread* current);
157   static void multianewarray4_C(Klass* klass, int len1, int len2, int len3, int len4, JavaThread* current);
158   static void multianewarray5_C(Klass* klass, int len1, int len2, int len3, int len4, int len5, JavaThread* current);
159   static void multianewarrayN_C(Klass* klass, arrayOopDesc* dims, JavaThread* current);
160 
161   // local methods passed as arguments to stub generator that forward
162   // control to corresponding JRT methods of SharedRuntime
163   static void slow_arraycopy_C(oopDesc* src,  jint src_pos,
164                                oopDesc* dest, jint dest_pos,
165                                jint length, JavaThread* thread);
166   static void complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* current);
167 

174   // Implicit exception support
175   static void throw_null_exception_C(JavaThread* thread);
176 
177   // Exception handling
178   static address handle_exception_C       (JavaThread* current);
179   static address handle_exception_C_helper(JavaThread* current, nmethod*& nm);
180   static address rethrow_C                (oopDesc* exception, JavaThread *thread, address return_pc );
181   static void deoptimize_caller_frame     (JavaThread *thread);
182   static void deoptimize_caller_frame     (JavaThread *thread, bool doit);
183   static bool is_deoptimized_caller_frame (JavaThread *thread);
184 
185   // CodeBlob support
186   // ===================================================================
187 
188   static void generate_uncommon_trap_blob(void);
189   static void generate_exception_blob();
190 
191   static void register_finalizer_C(oopDesc* obj, JavaThread* current);
192 
193  public:
194   static void load_unknown_inline_C(flatArrayOopDesc* array, int index, JavaThread* current);
195   static void store_unknown_inline_C(instanceOopDesc* buffer, flatArrayOopDesc* array, int index, JavaThread* current);
196 
197   static bool is_callee_saved_register(MachRegisterNumbers reg);
198 
199   // One time only generate runtime code stubs. Returns true
200   // when runtime stubs have been generated successfully and
201   // false otherwise.
202   static bool generate(ciEnv* env);
203 
204   // Returns the name of a stub
205   static const char* stub_name(address entry);
206 
207   // Returns the name associated with a given stub id
208   static const char* stub_name(OptoStubId id) {
209     assert(id > OptoStubId::NO_STUBID && id < OptoStubId::NUM_STUBIDS, "stub id out of range");
210     return _stub_names[(int)id];
211   }
212 
213   // access to runtime stubs entry points for java code
214   static address new_instance_Java()                     { return _new_instance_Java; }
215   static address new_array_Java()                        { return _new_array_Java; }
216   static address new_array_nozero_Java()                 { return _new_array_nozero_Java; }
217   static address multianewarray2_Java()                  { return _multianewarray2_Java; }
218   static address multianewarray3_Java()                  { return _multianewarray3_Java; }
219   static address multianewarray4_Java()                  { return _multianewarray4_Java; }
220   static address multianewarray5_Java()                  { return _multianewarray5_Java; }
221   static address multianewarrayN_Java()                  { return _multianewarrayN_Java; }
222   static address complete_monitor_locking_Java()         { return _complete_monitor_locking_Java; }
223   static address monitor_notify_Java()                   { return _monitor_notify_Java; }
224   static address monitor_notifyAll_Java()                { return _monitor_notifyAll_Java; }
225 
226   static address slow_arraycopy_Java()                   { return _slow_arraycopy_Java; }
227   static address register_finalizer_Java()               { return _register_finalizer_Java; }
228   static address load_unknown_inline_Java()              { return _load_unknown_inline_Java; }
229   static address store_unknown_inline_Java()             { return _store_unknown_inline_Java; }
230 #if INCLUDE_JVMTI
231   static address notify_jvmti_vthread_start()            { return _notify_jvmti_vthread_start; }
232   static address notify_jvmti_vthread_end()              { return _notify_jvmti_vthread_end; }
233   static address notify_jvmti_vthread_mount()            { return _notify_jvmti_vthread_mount; }
234   static address notify_jvmti_vthread_unmount()          { return _notify_jvmti_vthread_unmount; }
235 #endif
236 
237   static UncommonTrapBlob* uncommon_trap_blob()                  { return _uncommon_trap_blob; }
238   static ExceptionBlob*    exception_blob()                      { return _exception_blob; }
239 
240   // Implicit exception support
241   static void throw_div0_exception_C      (JavaThread* thread);
242   static void throw_stack_overflow_error_C(JavaThread* thread);
243 
244   // Exception handling
245   static address rethrow_stub()             { return _rethrow_Java; }
246 
247 
248   // Type functions
249   // ======================================================

312 
313   static const TypeFunc* ghash_processBlocks_Type();
314   static const TypeFunc* chacha20Block_Type();
315   static const TypeFunc* base64_encodeBlock_Type();
316   static const TypeFunc* base64_decodeBlock_Type();
317   static const TypeFunc* string_IndexOf_Type();
318   static const TypeFunc* poly1305_processBlocks_Type();
319   static const TypeFunc* intpoly_montgomeryMult_P256_Type();
320   static const TypeFunc* intpoly_assign_Type();
321 
322   static const TypeFunc* updateBytesCRC32_Type();
323   static const TypeFunc* updateBytesCRC32C_Type();
324 
325   static const TypeFunc* updateBytesAdler32_Type();
326 
327   // leaf on stack replacement interpreter accessor types
328   static const TypeFunc* osr_end_Type();
329 
330   static const TypeFunc* register_finalizer_Type();
331 
332   static const TypeFunc* load_unknown_inline_Type();
333   static const TypeFunc* store_unknown_inline_Type();
334 
335   static const TypeFunc* store_inline_type_fields_Type();
336   static const TypeFunc* pack_inline_type_Type();
337 
338   JFR_ONLY(static const TypeFunc* class_id_load_barrier_Type();)
339 #if INCLUDE_JVMTI
340   static const TypeFunc* notify_jvmti_vthread_Type();
341 #endif
342 
343   // Dtrace support
344   static const TypeFunc* dtrace_method_entry_exit_Type();
345   static const TypeFunc* dtrace_object_alloc_Type();
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 
< prev index next >