1 /*
   2  * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2025, Red Hat, Inc. All rights reserved.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 
  26 #ifndef SHARE_RUNTIME_STUBDECLARATIONS_HPP
  27 #define SHARE_RUNTIME_STUBDECLARATIONS_HPP
  28 
  29 #include "utilities/macros.hpp"
  30 
  31 // macros for generating definitions and declarations for shared, c1
  32 // and opto blob fields and associated stub ids
  33 
  34 // Different shared stubs can have different blob types and may
  35 // include some JFR stubs
  36 //
  37 // n.b resolve, handler and throw stubs must remain grouped in the
  38 // same order to allow id values to be range checked
  39 
  40 #if INCLUDE_JFR
  41 // do_blob(name, type)
  42 #define SHARED_JFR_STUBS_DO(do_blob)                                   \
  43   do_blob(jfr_write_checkpoint, RuntimeStub*)                          \
  44   do_blob(jfr_return_lease, RuntimeStub*)                              \
  45 
  46 #else
  47 #define SHARED_JFR_STUBS_DO(do_blob)
  48 #endif
  49 
  50 // client macro to operate on shared stubs
  51 //
  52 // do_blob(name, type)
  53 #define SHARED_STUBS_DO(do_blob)                                       \
  54   do_blob(deopt, DeoptimizationBlob*)                                  \
  55   /* resolve stubs */                                                  \
  56   do_blob(wrong_method, RuntimeStub*)                                  \
  57   do_blob(wrong_method_abstract, RuntimeStub*)                         \
  58   do_blob(ic_miss, RuntimeStub*)                                       \
  59   do_blob(resolve_opt_virtual_call, RuntimeStub*)                      \
  60   do_blob(resolve_virtual_call, RuntimeStub*)                          \
  61   do_blob(resolve_static_call, RuntimeStub*)                           \
  62   /* handler stubs */                                                  \
  63   do_blob(polling_page_vectors_safepoint_handler, SafepointBlob*)      \
  64   do_blob(polling_page_safepoint_handler, SafepointBlob*)              \
  65   do_blob(polling_page_return_handler, SafepointBlob*)                 \
  66   /* throw stubs */                                                    \
  67   do_blob(throw_AbstractMethodError, RuntimeStub*)                     \
  68   do_blob(throw_IncompatibleClassChangeError, RuntimeStub*)            \
  69   do_blob(throw_NullPointerException_at_call, RuntimeStub*)            \
  70   do_blob(throw_StackOverflowError, RuntimeStub*)                      \
  71   do_blob(throw_delayed_StackOverflowError, RuntimeStub*)              \
  72   /* other stubs */                                                    \
  73   SHARED_JFR_STUBS_DO(do_blob)                                         \
  74 
  75 // C1 stubs are always generated in a generic CodeBlob
  76 
  77 #ifdef COMPILER1
  78 // client macro to operate on c1 stubs
  79 //
  80 // do_blob(name)
  81 #define C1_STUBS_DO(do_blob)                                           \
  82   do_blob(dtrace_object_alloc)                                         \
  83   do_blob(unwind_exception)                                            \
  84   do_blob(forward_exception)                                           \
  85   do_blob(throw_range_check_failed)       /* throws ArrayIndexOutOfBoundsException */ \
  86   do_blob(throw_index_exception)          /* throws IndexOutOfBoundsException */ \
  87   do_blob(throw_div0_exception)                                        \
  88   do_blob(throw_null_pointer_exception)                                \
  89   do_blob(register_finalizer)                                          \
  90   do_blob(new_instance)                                                \
  91   do_blob(fast_new_instance)                                           \
  92   do_blob(fast_new_instance_init_check)                                \
  93   do_blob(new_type_array)                                              \
  94   do_blob(new_object_array)                                            \
  95   do_blob(new_null_free_array)                                         \
  96   do_blob(new_multi_array)                                             \
  97   do_blob(load_flat_array)                                             \
  98   do_blob(store_flat_array)                                            \
  99   do_blob(substitutability_check)                                      \
 100   do_blob(buffer_inline_args)                                          \
 101   do_blob(buffer_inline_args_no_receiver)                              \
 102   do_blob(handle_exception_nofpu)         /* optimized version that does not preserve fpu registers */ \
 103   do_blob(handle_exception)                                            \
 104   do_blob(handle_exception_from_callee)                                \
 105   do_blob(throw_array_store_exception)                                 \
 106   do_blob(throw_class_cast_exception)                                  \
 107   do_blob(throw_incompatible_class_change_error)                       \
 108   do_blob(throw_illegal_monitor_state_exception)                       \
 109   do_blob(throw_identity_exception)                                    \
 110   do_blob(slow_subtype_check)                                          \
 111   do_blob(is_instance_of)                                              \
 112   do_blob(monitorenter)                                                \
 113   do_blob(monitorenter_nofpu)             /* optimized version that does not preserve fpu registers */ \
 114   do_blob(monitorexit)                                                 \
 115   do_blob(monitorexit_nofpu)              /* optimized version that does not preserve fpu registers */ \
 116   do_blob(deoptimize)                                                  \
 117   do_blob(access_field_patching)                                       \
 118   do_blob(load_klass_patching)                                         \
 119   do_blob(load_mirror_patching)                                        \
 120   do_blob(load_appendix_patching)                                      \
 121   do_blob(fpu2long_stub)                                               \
 122   do_blob(counter_overflow)                                            \
 123   do_blob(predicate_failed_trap)                                       \
 124 
 125 #else
 126 #define C1_STUBS_DO(do_blob)
 127 #endif
 128 
 129 // Opto stubs can be stored as entries with just an address or as
 130 // blobs of different types. The former may include some JVMTI stubs.
 131 //
 132 // n.b. blobs and stub defines are generated in the order defined by
 133 // C2_STUBS_DO, allowing dependencies from any givem stub on its
 134 // predecessors to be guaranteed. That explains the initial placement
 135 // of the blob declarations and intermediate placement of the jvmti
 136 // stubs.
 137 
 138 #ifdef COMPILER2
 139 // do_jvmti_stub(name)
 140 #if INCLUDE_JVMTI
 141 #define C2_JVMTI_STUBS_DO(do_jvmti_stub)                               \
 142   do_jvmti_stub(notify_jvmti_vthread_start)                            \
 143   do_jvmti_stub(notify_jvmti_vthread_end)                              \
 144   do_jvmti_stub(notify_jvmti_vthread_mount)                            \
 145   do_jvmti_stub(notify_jvmti_vthread_unmount)                          \
 146 
 147 #else
 148 #define C2_JVMTI_STUBS_DO(do_jvmti_stub)
 149 #endif // INCLUDE_JVMTI
 150 
 151 // client macro to operate on c2 stubs
 152 //
 153 // do_blob(name, type)
 154 // do_stub(name, fancy_jump, pass_tls, return_pc)
 155 // do_jvmti_stub(name)
 156 //
 157 // n.b. non-jvmti stubs may employ a special type of jump (0, 1 or 2)
 158 // and require access to TLS and the return pc. jvmti stubs always
 159 // employ jump 0, and require no special access
 160 #define C2_STUBS_DO(do_blob, do_stub, do_jvmti_stub)                   \
 161   do_blob(uncommon_trap, UncommonTrapBlob*)                            \
 162   do_blob(exception, ExceptionBlob*)                                   \
 163   do_stub(new_instance, 0, true, false)                                \
 164   do_stub(new_array, 0, true, false)                                   \
 165   do_stub(new_array_nozero, 0, true, false)                            \
 166   do_stub(multianewarray2, 0, true, false)                             \
 167   do_stub(multianewarray3, 0, true, false)                             \
 168   do_stub(multianewarray4, 0, true, false)                             \
 169   do_stub(multianewarray5, 0, true, false)                             \
 170   do_stub(multianewarrayN, 0, true, false)                             \
 171   C2_JVMTI_STUBS_DO(do_jvmti_stub)                                     \
 172   do_stub(complete_monitor_locking, 0, false, false)                   \
 173   do_stub(monitor_notify, 0, false, false)                             \
 174   do_stub(monitor_notifyAll, 0, false, false)                          \
 175   do_stub(rethrow, 2, true, true)                                      \
 176   do_stub(slow_arraycopy, 0, false, false)                             \
 177   do_stub(register_finalizer, 0, false, false)                         \
 178   do_stub(load_unknown_inline, 0, true, false)                         \
 179   do_stub(store_unknown_inline, 0, true, false)                        \
 180 
 181 #else
 182 #define C2_STUBS_DO(do_blob, do_stub, do_jvmti_stub)
 183 #endif
 184 
 185 // Stub Generator Blobs and Stubs Overview
 186 //
 187 // StubGenerator stubs do not require their own individual blob. They
 188 // are generated in batches into one of five distinct BufferBlobs:
 189 //
 190 // 1) PreUniverse stubs
 191 // 2) Initial stubs
 192 // 3) Continuation stubs
 193 // 4) Compiler stubs
 194 // 5) Final stubs
 195 //
 196 // Creation of each successive BufferBlobs is staged to ensure that
 197 // specific VM subsystems required by those stubs are suitably
 198 // initialized before generated code attempt to reference data or
 199 // addresses exported by those subsystems. The sequencing of
 200 // initialization must be taken into account when adding a new stub
 201 // declaration.
 202 //
 203 // StubGenerator stubs are declared using template macros, one set of
 204 // declarations per blob (see below), with arch-specific stubs for any
 205 // gven blob declared after generic stubs for that blob. Blobs are
 206 // created in a fixed order during startup, which is reflected in the
 207 // order of the declaration set. Stubs within a blob are currently
 208 // created in an order determined by the arch-specific generator code
 209 // which may not reflect the order of stub declarations. It is not
 210 // straightforward to enforce a strict ordering. not least because
 211 // arch-specific stub creation may need to be interleaved with generic
 212 // stub creation.
 213 //
 214 // Blob and stub declaration templates are used to generate a variety
 215 // of C++ code elements needed to manage stubs.
 216 //
 217 // Blob identifiers:
 218 //
 219 // public enum StubGenBlobId is generated to identify each of the
 220 // StubGenerator blobs in blob declaration order. This enum is
 221 // provided for use by client code to identify a specific blob. For a
 222 // blob declared with name <blob_name> the associated enum value is
 223 // StubGenBlobId::<blob_name>_id.
 224 //
 225 // Global stub identifiers:
 226 //
 227 // public enum StubGenStubId is generated to identify all declared
 228 // stubs across all blobs, sorted first by blob declaration order and
 229 // then within a blob by stub declaration order, generic stubs before
 230 // arch-specific stubs. This enum is provided for use by client code
 231 // to identify a specific stub, independent of the blob it belongs to.
 232 // For a stub declared with name <stub_name> the associated enum value
 233 // is StubGenStubId::<stub_name>_id.
 234 //
 235 // Blob-local stub identifiers:
 236 //
 237 // For each blob <blob_name>, public enum StubGenStubId_<blob_name> is
 238 // generated to enumerate all stubs within the blob in stub
 239 // declaration order, generic stubs before arch-specific stubs. This
 240 // enum is provided only in a non-product build and is intended for
 241 // internal use by class StubRoutines to validate stub declarations.
 242 // For a stub declared with name <stub_name> belonging to blob
 243 // <blob_name> the associated enum value is
 244 // StubGenStubId::<blob_name>_<stub_name>_id.
 245 //
 246 // Stub names and associated getters:
 247 //
 248 // Two private static fields are generated to hold the names of the
 249 // four generated blobs and all the generated stubs.
 250 //
 251 //  const char* StubRoutines::_blob_names[];
 252 //  const char* StubRoutines::_stub_names[];
 253 //
 254 // The entry in _blob_names for a blob declared with name <blob_name>
 255 // will be "<blob_name>".
 256 //
 257 // The entry in _stub_names for a stub declared with name <stub_name>
 258 // will be "<stub_name>".
 259 //
 260 // Corresponding public static lookup methods are generated to allow
 261 // names to be looked up by blob or global stub id.
 262 //
 263 //  const char* StubRoutines::get_blob_name(StubGenBlobId id)
 264 //  const char* StubRoutines::get_stub_name(StubGenStubId id)
 265 //
 266 // These name lookup methods should be used by generic and
 267 // cpu-specific client code to ensure that blobs and stubs are
 268 // identified consistently.
 269 //
 270 // Blob code buffer sizes:
 271 //
 272 // An enumeration enum platform_dependent_constants is generated in
 273 // the architecture specific StubRoutines header. For each blob named
 274 // <nnn> an associated enum tag is generated which defines the
 275 // relevant size
 276 //
 277 //  _<nnn>_stubs_code_size      = <size>,
 278 //
 279 // For example,
 280 //
 281 // enum platform_dependent_constants {
 282 //   _preuniverse_stubs_code_size  =   500,
 283 //   _initial_stubs_code_size      = 10000,
 284 //   _continuation_stubs_code_size =  2000,
 285 //   . . .
 286 //
 287 // Blob fields and associated getters:
 288 //
 289 // For each blob named <nnn> a private field declaration will be
 290 // generated: static field address StubRoutines::_<nnn>_stubs_code and
 291 // a declaration provided to initialise it to nullptr. A corresponding
 292 // public getter method address StubRoutines::_<nnn>_stubs_code() will
 293 // be generated.
 294 //
 295 // Blob initialization routines:
 296 //
 297 // For each blob named <nnn> an initalization function is defined
 298 // which allows clients to schedule blob and stub generation during
 299 // JVM bootstrap:
 300 //
 301 // void <nnn>_stubs_init() { StubRoutines::initialize_<nnn>_stubs(); }
 302 //
 303 // A declaration and definition of each underlying implementation
 304 // method StubRoutines::initialize_<nnn>_stubs() is also generated.
 305 //
 306 // Stub entry points and associated getters:
 307 //
 308 // Some generated stubs require their main entry point and, possibly,
 309 // auxiliary entry points to be stored in fields declared either as
 310 // members of class SharedRuntime. For stubs that are specific to a
 311 // given cpu, the field needs to be declared in an arch-specific inner
 312 // class of SharedRuntime.
 313 //
 314 // For a generic stub named <nnn> the corresponding main entry usually
 315 // has the same name: static field address StubRoutines::_<nnn> modulo
 316 // an _ prefix.  An associated getter method is also generated, again
 317 // normally using the same name: address StubRoutines::<nnn>() e.g.
 318 //
 319 //  class StubRoutines {
 320 //    . . .
 321 //    static address _aescrypt_encryptBlock;
 322 //    . . .
 323 //    address aescrypt_encryptBlock() { return _aescrypt_encryptBlock; }
 324 //
 325 // Multiple fields and getters may be generated where a stub has more
 326 // than one entry point, each provided with their own unique field and
 327 // getter name e.g.
 328 //
 329 //    . . .
 330 //    static address _call_stub;
 331 //    static address _call_stub_return_address;
 332 //    . . .
 333 //    static address call_stub_entry() { return _call_stub; }
 334 //    static address call_stub_return_address() { return _call_stub_return_address; }
 335 //
 336 // In special cases a stub may declare a (compile-time) fixed size
 337 // array of entries, in which case an address array field is
 338 // generated,along with a getter that accepts an index as argument:
 339 //
 340 //    . . .
 341 //   static address _lookup_secondary_supers_table[Klass::SECONDARY_SUPERS_TABLE_SIZE];
 342 //   . . .
 343 //   static address lookup_secondary_supers_table(int i);
 344 //
 345 // CPU-specific stub entry points and associated getters:
 346 //
 347 // For an arch-specific stub with name <nnn> belonging to architecture
 348 // <arch> private field address StubRoutines::<arch>::_<nnn> is
 349 // generated to hold the entry address. An associated public getter
 350 // method address StubRoutines::<arch>::<nnn>() is also generated e.g.
 351 //
 352 //  class StubRoutines {
 353 //    . . .
 354 //    class x86 {
 355 //      . . .
 356 //      static address _f2i_fixup;
 357 //      . . .
 358 //      static address f2i_fixup() { return _f2i_fixup; }
 359 //      static void set_f2i_fixup(address a) { _f2i_fixup = a; }
 360 //
 361 
 362 
 363 //--------------------------------------------------
 364 // Stub Generator Blob, Stub and Entry Declarations
 365 // -------------------------------------------------
 366 //
 367 // The formal declarations of blobs, stubs and entries provided below
 368 // are used to schedule application of template macros that either
 369 // declare or define the C++ code we need to manage those blobs, stubs
 370 // and entries.
 371 //
 372 // All ports employ the same blobs. However, the organization of the
 373 // stubs and entry points in a blob can vary from one port to the
 374 // next. A template macro is provided to specify the details of each
 375 // blob, including generic and arch-specific variations.
 376 //
 377 // If you want to define a new stub or entry then you can do so by
 378 // adding suitable declarations within the scope of the relevant blob.
 379 // For the blob with name BLOB_NAME add your declarations to macro
 380 // STUBGEN_<BLOB_NAME>_STUBS_DO. Generic stubs and entries are
 381 // declared using the do_stub, do_entry and do_entry_init and
 382 // array_entry templates (see below for full details). The do_blob
 383 // and end_blob templates should never need to be modified.
 384 //
 385 // Some stubs and their associated entries are architecture-specific.
 386 // They need to be declared in the architecture-specific header file
 387 // src/cpu/<arch>stubDecolaration_<arch>.cpp. For the blob with name
 388 // BLOB_NAME the correspnding declarations macro are provided by macro
 389 // STUBGEN_<BLOB_NAME>_STUBS_ARCH_DO. Arch-specific stubs and entries
 390 // are declared using the do_stub, do_arch_entry and
 391 // do_arch_entry_init templates (see below for details). An
 392 // architecure also needs to specify architecture parameters used when
 393 // creating each blob. These are defined using the do_arch_blob
 394 // template (see below).
 395 //
 396 // Note, the client macro STUBGEN_ALL_DO is provided to allow client
 397 // code to iterate over all blob, stub or entry declarations. It has
 398 // only been split into separate per-blob generic submacros,
 399 // STUBGEN_<BLOB_NAME>_BLOBS_DO and arch-specific per-blob submacros
 400 // STUBGEN_<BLOB_NAME>_BLOBS_ARCH_DO for convenience, to make it
 401 // easier to manage definitions. The blob_specific sub-macros should
 402 // not be called directly by client code (in class StubRoutines and
 403 // StubGenerator),
 404 //
 405 // A client wishing to generate blob, stub or entry code elements is
 406 // expected to pass template macros as arguments to STUBGEN_ALL_DO.
 407 // This will schedule code generation code for whatever C++ code
 408 // elements are required to implement a declaration or definition
 409 // relevant to each blob, stub or entry. Alternatively, a client can
 410 // operate on a subset of the declarations by calling macros
 411 // STUBGEN_BLOBS_DO, STUBGEN_STUBS_DO, STUBGEN_BLOBS_STUBS_DO,
 412 // STUBGEN_ENTRIES_DO and STUBGEN_ARCH_ENTRIES_DO.
 413 //
 414 // The do_blob and end_blob templates receive a blob name as argument.
 415 //
 416 // do_blob(blob_name)
 417 // end_blob(blob_name)
 418 //
 419 // do_blob is primarily used to define a global enum tag for a blob
 420 // and an associated constant string name, both for use by client
 421 // code.
 422 //
 423 // end_blob is provided for use in combination with do_blob to to open
 424 // and close a blob-local enum type identifying all stubs within a
 425 // given blob. This enum is private to the stub management code and
 426 // used to validate correct use of stubs within a given blob.
 427 //
 428 // The do_stub template receives a blob name and stub name as argument.
 429 //
 430 // do_stub(blob_name, stub_name)
 431 //
 432 // do_stub is primarily used to define a global enum tag for a stub
 433 // and a constant string name, both for use by client code. It is also
 434 // used to declare a tag within the blob-local enum type used to
 435 // validate correct use of stubs within their declared blob. Finally,
 436 // it is also used to declare a name for each stub.
 437 //
 438 // The do_entry and do_entry_array templates receive 4 or 5 arguments
 439 //
 440 // do_entry(blob_name, stub_name, field_name, getter_name)
 441 //
 442 // do_entry_init(blob_name, stub_name, field_name, getter_name, init_function)
 443 //
 444 // do_entry_array(blob_name, stub_name, field_name, getter_name, count)
 445 //
 446 // do_entry is used to declare or define a static field of class
 447 // StubRoutines with type address that stores a specific entry point
 448 // for a given stub. n.b. the number of entries associated with a stub
 449 // is often one but it can be more than one and, in a few special
 450 // cases, it is zero. do_entry is also used to declare and define an
 451 // associated getter method for the field. do_entry is used to declare
 452 // fields that should be initialized to nullptr.
 453 //
 454 // do_entry_init is used when the field needs to be initialized a
 455 // specific function or method .
 456 //
 457 // do_entry_array is used for the special case where a stub employs an
 458 // array to store multiple entries which are stored at generate time
 459 // and subsequently accessed using an associated index (e.g. the
 460 // secondary supers table stub which has 63 qassociated entries).
 461 // Note that this distinct from the case where a stub generates
 462 // multiple entries each of them stored in its own named field with
 463 // its own named getter. In the latter case multiple do_entry or
 464 // do_entry_init declarations are associated with the stub.
 465 //
 466 // blob_name and stub_name are the names of the blob and stub to which
 467 // the entry belongs.
 468 //
 469 // field_name is prefixed with a leading '_' to produce the name of
 470 // the field used to store an entry address for the stub. For stubs
 471 // with one entry field_name is normally, but not always, the same as
 472 // stub_name.  Obviously when a stub has multiple entries secondary
 473 // names must be different to stub_name. For normal entry declarations
 474 // the field type is address. For do_entry_array declarations the field
 475 // type is an address[] whose size is defined by then parameter.
 476 //
 477 // getter_name is the name of a getter that is generated to allow
 478 // access to the field. It is normally, but not always, the same as
 479 // stub_name. For normal entry declarations the getter signature is
 480 // (void).  For do_entry_array declarations the getter signature is
 481 // (int).
 482 //
 483 // init_function is the name of an function or method which should be
 484 // assigned to the field as a default value (n.b. fields declared
 485 // using do_entry are intialised to nullptr, array fields declared
 486 // using do_entry_array have their elements initalized to nullptr).
 487 //
 488 // Architecture-specific blob details need to be specified using the
 489 // do_arch_blob template
 490 //
 491 // do_arch_blob(blob_name, size)
 492 //
 493 // Currently, the do_arch_blob macro is only used to define the size
 494 // of the code buffer into which blob-specific stub code is to be
 495 // generated.
 496 //
 497 // Architecture-specific entries need to be declared using the
 498 // do_arch_entry template
 499 //
 500 // do_arch_entry(arch, blob_name, stub_name, field_name, getter_name)
 501 //
 502 // do_arch_entry_init(arch, blob_name, stub_name, field_name,
 503 //                    getter_name, init_function)
 504 //
 505 // The only difference between these templates and the generic ones is
 506 // that they receive an extra argument which identifies the current
 507 // architecture e.g. x86, aarch64 etc.
 508 //
 509 // Currently there is no support for a do_arch_array_entry template.
 510 
 511 // Include arch-specific stub and entry declarations and make sure the
 512 // relevant template macros have been defined
 513 
 514 #include CPU_HEADER(stubDeclarations)
 515 
 516 #ifndef STUBGEN_PREUNIVERSE_BLOBS_ARCH_DO
 517 #error "Arch-specific directory failed to declare required initial stubs and entries"
 518 #endif
 519 
 520 #ifndef STUBGEN_INITIAL_BLOBS_ARCH_DO
 521 #error "Arch-specific directory failed to declare required initial stubs and entries"
 522 #endif
 523 
 524 #ifndef STUBGEN_CONTINUATION_BLOBS_ARCH_DO
 525 #error "Arch-specific directory failed to declare required continuation stubs and entries"
 526 #endif
 527 
 528 #ifndef STUBGEN_COMPILER_BLOBS_ARCH_DO
 529 #error "Arch-specific directory failed to declare required compiler stubs and entries"
 530 #endif
 531 
 532 #ifndef STUBGEN_FINAL_BLOBS_ARCH_DO
 533 #error "Arch-specific directory failed to declare required final stubs and entries"
 534 #endif
 535 
 536 // Iterator macros to apply templates to all relevant blobs, stubs and
 537 // entries. Clients should use STUBGEN_ALL_DO, STUBGEN_BLOBS_DO,
 538 // STUBGEN_STUBS_DO, STUBGEN_BLOBS_STUBS_DO, STUBGEN_ENTRIES_DO,
 539 // STUBGEN_ARCH_BLOBS_DO and STUBGEN_ARCH_ENTRIES_DO.
 540 //
 541 // n.b. Client macros appear after the STUBGEN_<BLOB_NAME>_BLOBS_DO
 542 // submacros which follow next. These submacros are not intended to be
 543 // called directly. They serve to define the main client macro
 544 // STUBGEN_ALL_DO and, from there, the other more specific client
 545 // macros. n.b. multiple, 'per-blob' submacros are used to declare
 546 // each group of stubs and entries, because that makes it simpler to
 547 // lookup and update related elements. If you need to update these
 548 // submacros to change the list of stubs or entries be sure to locate
 549 // stubs within the correct blob and locate entry declarations
 550 // immediately after their associated stub declaration.
 551 
 552 #define STUBGEN_PREUNIVERSE_BLOBS_DO(do_blob, end_blob,                 \
 553                                      do_stub,                           \
 554                                      do_entry, do_entry_init,           \
 555                                      do_entry_array,                    \
 556                                      do_arch_blob,                      \
 557                                      do_arch_entry, do_arch_entry_init) \
 558   do_blob(preuniverse)                                                  \
 559   do_stub(preuniverse, fence)                                           \
 560   do_entry(preuniverse, fence, fence_entry, fence_entry)                \
 561   /* merge in stubs and entries declared in arch header */              \
 562   STUBGEN_PREUNIVERSE_BLOBS_ARCH_DO(do_stub, do_arch_blob,              \
 563                                     do_arch_entry, do_arch_entry_init)  \
 564   end_blob(preuniverse)                                                 \
 565 
 566 #define STUBGEN_INITIAL_BLOBS_DO(do_blob, end_blob,                      \
 567                                  do_stub,                               \
 568                                  do_entry, do_entry_init,               \
 569                                  do_entry_array,                        \
 570                                  do_arch_blob,                          \
 571                                  do_arch_entry, do_arch_entry_init)     \
 572   do_blob(initial)                                                      \
 573   do_stub(initial, call_stub)                                           \
 574   do_entry(initial, call_stub, call_stub_entry, call_stub_entry)        \
 575   do_entry(initial, call_stub, call_stub_return_address,                \
 576            call_stub_return_address)                                    \
 577   do_stub(initial, forward_exception)                                   \
 578   do_entry(initial, forward_exception, forward_exception_entry,         \
 579            forward_exception_entry)                                     \
 580   do_stub(initial, catch_exception)                                     \
 581   do_entry(initial, catch_exception, catch_exception_entry,             \
 582            catch_exception_entry)                                       \
 583   do_stub(initial, atomic_add)                                          \
 584   do_entry(initial, atomic_add, atomic_add_entry, atomic_add_entry)     \
 585   do_stub(initial, atomic_xchg)                                         \
 586   do_entry(initial, atomic_xchg, atomic_xchg_entry, atomic_xchg_entry)  \
 587   do_stub(initial, atomic_cmpxchg)                                      \
 588   do_entry(initial, atomic_cmpxchg, atomic_cmpxchg_entry,               \
 589            atomic_cmpxchg_entry)                                        \
 590   do_stub(initial, atomic_cmpxchg_long)                                 \
 591   do_entry(initial, atomic_cmpxchg_long, atomic_cmpxchg_long_entry,     \
 592            atomic_cmpxchg_long_entry)                                   \
 593   do_stub(initial, updateBytesCRC32)                                    \
 594   do_entry(initial, updateBytesCRC32, updateBytesCRC32,                 \
 595            updateBytesCRC32)                                            \
 596   do_entry(initial, updateBytesCRC32, crc_table_adr, crc_table_addr)    \
 597   do_stub(initial, updateBytesCRC32C)                                   \
 598   do_entry(initial, updateBytesCRC32C, updateBytesCRC32C,               \
 599            updateBytesCRC32C)                                           \
 600   do_entry(initial, updateBytesCRC32C, crc32c_table_addr,               \
 601            crc32c_table_addr)                                           \
 602   do_stub(initial, f2hf)                                                \
 603   do_entry(initial, f2hf, f2hf, f2hf_adr)                               \
 604   do_stub(initial, hf2f)                                                \
 605   do_entry(initial, hf2f, hf2f, hf2f_adr)                               \
 606   do_stub(initial, dexp)                                                \
 607   do_entry(initial, dexp, dexp, dexp)                                   \
 608   do_stub(initial, dlog)                                                \
 609   do_entry(initial, dlog, dlog, dlog)                                   \
 610   do_stub(initial, dlog10)                                              \
 611   do_entry(initial, dlog10, dlog10, dlog10)                             \
 612   do_stub(initial, dpow)                                                \
 613   do_entry(initial, dpow, dpow, dpow)                                   \
 614   do_stub(initial, dsin)                                                \
 615   do_entry(initial, dsin, dsin, dsin)                                   \
 616   do_stub(initial, dcos)                                                \
 617   do_entry(initial, dcos, dcos, dcos)                                   \
 618   do_stub(initial, dtan)                                                \
 619   do_entry(initial, dtan, dtan, dtan)                                   \
 620   do_stub(initial, dtanh)                                               \
 621   do_entry(initial, dtanh, dtanh, dtanh)                                \
 622   do_stub(initial, dcbrt)                                               \
 623   do_entry(initial, dcbrt, dcbrt, dcbrt)                                \
 624   do_stub(initial, fmod)                                                \
 625   do_entry(initial, fmod, fmod, fmod)                                   \
 626   /* following generic entries should really be x86_32 only */          \
 627   do_stub(initial, dlibm_sin_cos_huge)                                  \
 628   do_entry(initial, dlibm_sin_cos_huge, dlibm_sin_cos_huge,             \
 629            dlibm_sin_cos_huge)                                          \
 630   do_stub(initial, dlibm_reduce_pi04l)                                  \
 631   do_entry(initial, dlibm_reduce_pi04l, dlibm_reduce_pi04l,             \
 632            dlibm_reduce_pi04l)                                          \
 633   do_stub(initial, dlibm_tan_cot_huge)                                  \
 634   do_entry(initial, dlibm_tan_cot_huge, dlibm_tan_cot_huge,             \
 635            dlibm_tan_cot_huge)                                          \
 636   /* merge in stubs and entries declared in arch header */              \
 637   STUBGEN_INITIAL_BLOBS_ARCH_DO(do_stub, do_arch_blob,                  \
 638                                 do_arch_entry, do_arch_entry_init)      \
 639   end_blob(initial)                                                     \
 640 
 641 
 642 #define STUBGEN_CONTINUATION_BLOBS_DO(do_blob, end_blob,                \
 643                                       do_stub,                          \
 644                                       do_entry, do_entry_init,          \
 645                                       do_entry_array,                   \
 646                                       do_arch_blob,                     \
 647                                       do_arch_entry, do_arch_entry_init) \
 648   do_blob(continuation)                                                 \
 649   do_stub(continuation, cont_thaw)                                      \
 650   do_entry(continuation, cont_thaw, cont_thaw, cont_thaw)               \
 651   do_stub(continuation, cont_preempt)                                   \
 652   do_entry(continuation, cont_prempt, cont_preempt_stub,                \
 653            cont_preempt_stub)                                           \
 654   do_stub(continuation, cont_returnBarrier)                             \
 655   do_entry(continuation, cont_returnBarrier, cont_returnBarrier,        \
 656            cont_returnBarrier)                                          \
 657   do_stub(continuation, cont_returnBarrierExc)                          \
 658   do_entry(continuation, cont_returnBarrierExc, cont_returnBarrierExc,  \
 659            cont_returnBarrierExc)                                       \
 660   /* merge in stubs and entries declared in arch header */              \
 661   STUBGEN_CONTINUATION_BLOBS_ARCH_DO(do_stub,  do_arch_blob,            \
 662                                      do_arch_entry, do_arch_entry_init) \
 663   end_blob(continuation)                                                \
 664 
 665 
 666 #define STUBGEN_COMPILER_BLOBS_DO(do_blob, end_blob,                    \
 667                                   do_stub,                              \
 668                                   do_entry, do_entry_init,              \
 669                                   do_entry_array,                       \
 670                                   do_arch_blob,                         \
 671                                   do_arch_entry, do_arch_entry_init)    \
 672   do_blob(compiler)                                                     \
 673   do_stub(compiler, array_sort)                                         \
 674   do_entry(compiler, array_sort, array_sort, select_arraysort_function) \
 675   do_stub(compiler, array_partition)                                    \
 676   do_entry(compiler, array_partition, array_partition,                  \
 677            select_array_partition_function)                             \
 678   do_stub(compiler, aescrypt_encryptBlock)                              \
 679   do_entry(compiler, aescrypt_encryptBlock, aescrypt_encryptBlock,      \
 680            aescrypt_encryptBlock)                                       \
 681   do_stub(compiler, aescrypt_decryptBlock)                              \
 682   do_entry(compiler, aescrypt_decryptBlock, aescrypt_decryptBlock,      \
 683            aescrypt_decryptBlock)                                       \
 684   do_stub(compiler, cipherBlockChaining_encryptAESCrypt)                \
 685   do_entry(compiler, cipherBlockChaining_encryptAESCrypt,               \
 686            cipherBlockChaining_encryptAESCrypt,                         \
 687            cipherBlockChaining_encryptAESCrypt)                         \
 688   do_stub(compiler, cipherBlockChaining_decryptAESCrypt)                \
 689   do_entry(compiler, cipherBlockChaining_decryptAESCrypt,               \
 690            cipherBlockChaining_decryptAESCrypt,                         \
 691            cipherBlockChaining_decryptAESCrypt)                         \
 692   do_stub(compiler, electronicCodeBook_encryptAESCrypt)                 \
 693   do_entry(compiler, electronicCodeBook_encryptAESCrypt,                \
 694            electronicCodeBook_encryptAESCrypt,                          \
 695            electronicCodeBook_encryptAESCrypt)                          \
 696   do_stub(compiler, electronicCodeBook_decryptAESCrypt)                 \
 697   do_entry(compiler, electronicCodeBook_decryptAESCrypt,                \
 698            electronicCodeBook_decryptAESCrypt,                          \
 699            electronicCodeBook_decryptAESCrypt)                          \
 700   do_stub(compiler, counterMode_AESCrypt)                               \
 701   do_entry(compiler, counterMode_AESCrypt, counterMode_AESCrypt,        \
 702            counterMode_AESCrypt)                                        \
 703   do_stub(compiler, galoisCounterMode_AESCrypt)                         \
 704   do_entry(compiler, galoisCounterMode_AESCrypt,                        \
 705            galoisCounterMode_AESCrypt, galoisCounterMode_AESCrypt)      \
 706   do_stub(compiler, ghash_processBlocks)                                \
 707   do_entry(compiler, ghash_processBlocks, ghash_processBlocks,          \
 708            ghash_processBlocks)                                         \
 709   do_stub(compiler, chacha20Block)                                      \
 710   do_entry(compiler, chacha20Block, chacha20Block, chacha20Block)       \
 711   do_stub(compiler, kyberNtt)                                           \
 712   do_entry(compiler, kyberNtt, kyberNtt, kyberNtt)                      \
 713   do_stub(compiler, kyberInverseNtt)                                    \
 714   do_entry(compiler, kyberInverseNtt, kyberInverseNtt, kyberInverseNtt) \
 715   do_stub(compiler, kyberNttMult)                                       \
 716   do_entry(compiler, kyberNttMult, kyberNttMult, kyberNttMult)          \
 717   do_stub(compiler, kyberAddPoly_2)                                     \
 718   do_entry(compiler, kyberAddPoly_2, kyberAddPoly_2, kyberAddPoly_2)    \
 719   do_stub(compiler, kyberAddPoly_3)                                     \
 720   do_entry(compiler, kyberAddPoly_3, kyberAddPoly_3, kyberAddPoly_3)    \
 721   do_stub(compiler, kyber12To16)                                        \
 722   do_entry(compiler, kyber12To16, kyber12To16, kyber12To16)             \
 723   do_stub(compiler, kyberBarrettReduce)                                 \
 724   do_entry(compiler, kyberBarrettReduce, kyberBarrettReduce,            \
 725            kyberBarrettReduce)                                          \
 726   do_stub(compiler, dilithiumAlmostNtt)                                 \
 727   do_entry(compiler, dilithiumAlmostNtt,                                \
 728            dilithiumAlmostNtt, dilithiumAlmostNtt)                      \
 729   do_stub(compiler, dilithiumAlmostInverseNtt)                          \
 730   do_entry(compiler, dilithiumAlmostInverseNtt,                         \
 731            dilithiumAlmostInverseNtt, dilithiumAlmostInverseNtt)        \
 732   do_stub(compiler, dilithiumNttMult)                                   \
 733   do_entry(compiler, dilithiumNttMult,                                  \
 734            dilithiumNttMult, dilithiumNttMult)                          \
 735   do_stub(compiler, dilithiumMontMulByConstant)                         \
 736   do_entry(compiler, dilithiumMontMulByConstant,                        \
 737            dilithiumMontMulByConstant, dilithiumMontMulByConstant)      \
 738   do_stub(compiler, dilithiumDecomposePoly)                             \
 739   do_entry(compiler, dilithiumDecomposePoly,                            \
 740            dilithiumDecomposePoly, dilithiumDecomposePoly)              \
 741   do_stub(compiler, data_cache_writeback)                               \
 742   do_entry(compiler, data_cache_writeback, data_cache_writeback,        \
 743            data_cache_writeback)                                        \
 744   do_stub(compiler, data_cache_writeback_sync)                          \
 745   do_entry(compiler, data_cache_writeback_sync,                         \
 746            data_cache_writeback_sync, data_cache_writeback_sync)        \
 747   do_stub(compiler, base64_encodeBlock)                                 \
 748   do_entry(compiler, base64_encodeBlock, base64_encodeBlock,            \
 749            base64_encodeBlock)                                          \
 750   do_stub(compiler, base64_decodeBlock)                                 \
 751   do_entry(compiler, base64_decodeBlock, base64_decodeBlock,            \
 752            base64_decodeBlock)                                          \
 753   do_stub(compiler, poly1305_processBlocks)                             \
 754   do_entry(compiler, poly1305_processBlocks, poly1305_processBlocks,    \
 755            poly1305_processBlocks)                                      \
 756   do_stub(compiler, intpoly_montgomeryMult_P256)                        \
 757   do_entry(compiler, intpoly_montgomeryMult_P256,                       \
 758            intpoly_montgomeryMult_P256, intpoly_montgomeryMult_P256)    \
 759   do_stub(compiler, intpoly_assign)                                     \
 760   do_entry(compiler, intpoly_assign, intpoly_assign, intpoly_assign)    \
 761   do_stub(compiler, md5_implCompress)                                   \
 762   do_entry(compiler, md5_implCompress, md5_implCompress,                \
 763            md5_implCompress)                                            \
 764   do_stub(compiler, md5_implCompressMB)                                 \
 765   do_entry(compiler, md5_implCompressMB, md5_implCompressMB,            \
 766            md5_implCompressMB)                                          \
 767   do_stub(compiler, sha1_implCompress)                                  \
 768   do_entry(compiler, sha1_implCompress, sha1_implCompress,              \
 769            sha1_implCompress)                                           \
 770   do_stub(compiler, sha1_implCompressMB)                                \
 771   do_entry(compiler, sha1_implCompressMB, sha1_implCompressMB,          \
 772            sha1_implCompressMB)                                         \
 773   do_stub(compiler, sha256_implCompress)                                \
 774   do_entry(compiler, sha256_implCompress, sha256_implCompress,          \
 775            sha256_implCompress)                                         \
 776   do_stub(compiler, sha256_implCompressMB)                              \
 777   do_entry(compiler, sha256_implCompressMB, sha256_implCompressMB,      \
 778            sha256_implCompressMB)                                       \
 779   do_stub(compiler, sha512_implCompress)                                \
 780   do_entry(compiler, sha512_implCompress, sha512_implCompress,          \
 781            sha512_implCompress)                                         \
 782   do_stub(compiler, sha512_implCompressMB)                              \
 783   do_entry(compiler, sha512_implCompressMB, sha512_implCompressMB,      \
 784            sha512_implCompressMB)                                       \
 785   do_stub(compiler, sha3_implCompress)                                  \
 786   do_entry(compiler, sha3_implCompress, sha3_implCompress,              \
 787            sha3_implCompress)                                           \
 788   do_stub(compiler, double_keccak)                                      \
 789   do_entry(compiler, double_keccak, double_keccak, double_keccak)       \
 790   do_stub(compiler, sha3_implCompressMB)                                \
 791   do_entry(compiler, sha3_implCompressMB, sha3_implCompressMB,          \
 792            sha3_implCompressMB)                                         \
 793   do_stub(compiler, updateBytesAdler32)                                 \
 794   do_entry(compiler, updateBytesAdler32, updateBytesAdler32,            \
 795            updateBytesAdler32)                                          \
 796   do_stub(compiler, multiplyToLen)                                      \
 797   do_entry(compiler, multiplyToLen, multiplyToLen, multiplyToLen)       \
 798   do_stub(compiler, squareToLen)                                        \
 799   do_entry(compiler, squareToLen, squareToLen, squareToLen)             \
 800   do_stub(compiler, mulAdd)                                             \
 801   do_entry(compiler, mulAdd, mulAdd, mulAdd)                            \
 802   do_stub(compiler, montgomeryMultiply)                                 \
 803   do_entry(compiler, montgomeryMultiply, montgomeryMultiply,            \
 804            montgomeryMultiply)                                          \
 805   do_stub(compiler, montgomerySquare)                                   \
 806   do_entry(compiler, montgomerySquare, montgomerySquare,                \
 807            montgomerySquare)                                            \
 808   do_stub(compiler, bigIntegerRightShiftWorker)                         \
 809   do_entry(compiler, bigIntegerRightShiftWorker,                        \
 810            bigIntegerRightShiftWorker, bigIntegerRightShift)            \
 811   do_stub(compiler, bigIntegerLeftShiftWorker)                          \
 812   do_entry(compiler, bigIntegerLeftShiftWorker,                         \
 813            bigIntegerLeftShiftWorker, bigIntegerLeftShift)              \
 814   /* merge in stubs and entries declared in arch header */              \
 815   STUBGEN_COMPILER_BLOBS_ARCH_DO(do_stub,  do_arch_blob,                \
 816                                      do_arch_entry, do_arch_entry_init) \
 817   end_blob(compiler)                                                    \
 818 
 819 
 820 #define STUBGEN_FINAL_BLOBS_DO(do_blob, end_blob,                       \
 821                                do_stub,                                 \
 822                                do_entry, do_entry_init,                 \
 823                                do_entry_array,                          \
 824                                do_arch_blob,                            \
 825                                do_arch_entry, do_arch_entry_init)       \
 826   do_blob(final)                                                        \
 827   do_stub(final, verify_oop)                                            \
 828   do_entry(final, verify_oop, verify_oop_subroutine_entry,              \
 829            verify_oop_subroutine_entry)                                 \
 830   do_stub(final, jbyte_arraycopy)                                       \
 831   do_entry_init(final, jbyte_arraycopy, jbyte_arraycopy,                \
 832                 jbyte_arraycopy, StubRoutines::jbyte_copy)              \
 833   do_stub(final, jshort_arraycopy)                                      \
 834   do_entry_init(final, jshort_arraycopy, jshort_arraycopy,              \
 835                 jshort_arraycopy, StubRoutines::jshort_copy)            \
 836   do_stub(final, jint_arraycopy)                                        \
 837   do_entry_init(final, jint_arraycopy, jint_arraycopy,                  \
 838                 jint_arraycopy, StubRoutines::jint_copy)                \
 839   do_stub(final, jlong_arraycopy)                                       \
 840   do_entry_init(final, jlong_arraycopy, jlong_arraycopy,                \
 841                 jlong_arraycopy, StubRoutines::jlong_copy)              \
 842   do_stub(final, oop_arraycopy)                                         \
 843   do_entry_init(final, oop_arraycopy, oop_arraycopy,                    \
 844                 oop_arraycopy_entry, StubRoutines::oop_copy)            \
 845   do_stub(final, oop_arraycopy_uninit)                                  \
 846   do_entry_init(final, oop_arraycopy_uninit, oop_arraycopy_uninit,      \
 847                 oop_arraycopy_uninit_entry,                             \
 848                 StubRoutines::oop_copy_uninit)                          \
 849   do_stub(final, jbyte_disjoint_arraycopy)                              \
 850   do_entry_init(final, jbyte_disjoint_arraycopy,                        \
 851                 jbyte_disjoint_arraycopy, jbyte_disjoint_arraycopy,     \
 852                 StubRoutines::jbyte_copy)                               \
 853   do_stub(final, jshort_disjoint_arraycopy)                             \
 854   do_entry_init(final, jshort_disjoint_arraycopy,                       \
 855                 jshort_disjoint_arraycopy, jshort_disjoint_arraycopy,   \
 856                 StubRoutines::jshort_copy)                              \
 857   do_stub(final, jint_disjoint_arraycopy)                               \
 858   do_entry_init(final, jint_disjoint_arraycopy,                         \
 859                 jint_disjoint_arraycopy, jint_disjoint_arraycopy,       \
 860                 StubRoutines::jint_copy)                                \
 861   do_stub(final, jlong_disjoint_arraycopy)                              \
 862   do_entry_init(final, jlong_disjoint_arraycopy,                        \
 863                 jlong_disjoint_arraycopy, jlong_disjoint_arraycopy,     \
 864                 StubRoutines::jlong_copy)                               \
 865   do_stub(final, oop_disjoint_arraycopy)                                \
 866   do_entry_init(final, oop_disjoint_arraycopy, oop_disjoint_arraycopy,  \
 867                 oop_disjoint_arraycopy_entry, StubRoutines::oop_copy)   \
 868   do_stub(final, oop_disjoint_arraycopy_uninit)                         \
 869   do_entry_init(final, oop_disjoint_arraycopy_uninit,                   \
 870                 oop_disjoint_arraycopy_uninit,                          \
 871                 oop_disjoint_arraycopy_uninit_entry,                    \
 872                 StubRoutines::oop_copy_uninit)                          \
 873   do_stub(final, arrayof_jbyte_arraycopy)                               \
 874   do_entry_init(final, arrayof_jbyte_arraycopy,                         \
 875                 arrayof_jbyte_arraycopy, arrayof_jbyte_arraycopy,       \
 876                 StubRoutines::arrayof_jbyte_copy)                       \
 877   do_stub(final, arrayof_jshort_arraycopy)                              \
 878   do_entry_init(final, arrayof_jshort_arraycopy,                        \
 879                 arrayof_jshort_arraycopy, arrayof_jshort_arraycopy,     \
 880                 StubRoutines::arrayof_jshort_copy)                      \
 881   do_stub(final, arrayof_jint_arraycopy)                                \
 882   do_entry_init(final, arrayof_jint_arraycopy, arrayof_jint_arraycopy,  \
 883                 arrayof_jint_arraycopy,                                 \
 884                 StubRoutines::arrayof_jint_copy)                        \
 885   do_stub(final, arrayof_jlong_arraycopy)                               \
 886   do_entry_init(final, arrayof_jlong_arraycopy,                         \
 887                 arrayof_jlong_arraycopy, arrayof_jlong_arraycopy,       \
 888                 StubRoutines::arrayof_jlong_copy)                       \
 889   do_stub(final, arrayof_oop_arraycopy)                                 \
 890   do_entry_init(final, arrayof_oop_arraycopy, arrayof_oop_arraycopy,    \
 891                 arrayof_oop_arraycopy, StubRoutines::arrayof_oop_copy)  \
 892   do_stub(final, arrayof_oop_arraycopy_uninit)                          \
 893   do_entry_init(final, arrayof_oop_arraycopy_uninit,                    \
 894                 arrayof_oop_arraycopy_uninit,                           \
 895                 arrayof_oop_arraycopy_uninit,                           \
 896                 StubRoutines::arrayof_oop_copy_uninit)                  \
 897   do_stub(final, arrayof_jbyte_disjoint_arraycopy)                      \
 898   do_entry_init(final, arrayof_jbyte_disjoint_arraycopy,                \
 899                 arrayof_jbyte_disjoint_arraycopy,                       \
 900                 arrayof_jbyte_disjoint_arraycopy,                       \
 901                 StubRoutines::arrayof_jbyte_copy)                       \
 902   do_stub(final, arrayof_jshort_disjoint_arraycopy)                     \
 903   do_entry_init(final, arrayof_jshort_disjoint_arraycopy,               \
 904                 arrayof_jshort_disjoint_arraycopy,                      \
 905                 arrayof_jshort_disjoint_arraycopy,                      \
 906                 StubRoutines::arrayof_jshort_copy)                      \
 907   do_stub(final, arrayof_jint_disjoint_arraycopy)                       \
 908   do_entry_init(final, arrayof_jint_disjoint_arraycopy,                 \
 909                 arrayof_jint_disjoint_arraycopy,                        \
 910                 arrayof_jint_disjoint_arraycopy,                        \
 911                 StubRoutines::arrayof_jint_copy)                        \
 912   do_stub(final, arrayof_jlong_disjoint_arraycopy)                      \
 913   do_entry_init(final, arrayof_jlong_disjoint_arraycopy,                \
 914                 arrayof_jlong_disjoint_arraycopy,                       \
 915                 arrayof_jlong_disjoint_arraycopy,                       \
 916                 StubRoutines::arrayof_jlong_copy)                       \
 917   do_stub(final, arrayof_oop_disjoint_arraycopy)                        \
 918   do_entry_init(final, arrayof_oop_disjoint_arraycopy,                  \
 919                 arrayof_oop_disjoint_arraycopy,                         \
 920                 arrayof_oop_disjoint_arraycopy_entry,                   \
 921                 StubRoutines::arrayof_oop_copy)                         \
 922   do_stub(final, arrayof_oop_disjoint_arraycopy_uninit)                 \
 923   do_entry_init(final, arrayof_oop_disjoint_arraycopy_uninit,           \
 924                 arrayof_oop_disjoint_arraycopy_uninit,                  \
 925                 arrayof_oop_disjoint_arraycopy_uninit_entry,            \
 926                 StubRoutines::arrayof_oop_copy_uninit)                  \
 927   do_stub(final, checkcast_arraycopy)                                   \
 928   do_entry(final, checkcast_arraycopy, checkcast_arraycopy,             \
 929            checkcast_arraycopy_entry)                                   \
 930   do_stub(final, checkcast_arraycopy_uninit)                            \
 931   do_entry(final, checkcast_arraycopy_uninit,                           \
 932            checkcast_arraycopy_uninit,                                  \
 933            checkcast_arraycopy_uninit_entry)                            \
 934   do_stub(final, unsafe_arraycopy)                                      \
 935   do_entry(final, unsafe_arraycopy, unsafe_arraycopy, unsafe_arraycopy) \
 936   do_stub(final, generic_arraycopy)                                     \
 937   do_entry(final, generic_arraycopy, generic_arraycopy,                 \
 938            generic_arraycopy)                                           \
 939   do_stub(final, unsafe_setmemory)                                      \
 940   do_entry(final, unsafe_setmemory, unsafe_setmemory, unsafe_setmemory) \
 941   do_stub(final, jbyte_fill)                                            \
 942   do_entry(final, jbyte_fill, jbyte_fill, jbyte_fill)                   \
 943   do_stub(final, jshort_fill)                                           \
 944   do_entry(final, jshort_fill, jshort_fill, jshort_fill)                \
 945   do_stub(final, jint_fill)                                             \
 946   do_entry(final, jint_fill, jint_fill, jint_fill)                      \
 947   do_stub(final, arrayof_jbyte_fill)                                    \
 948   do_entry(final, arrayof_jbyte_fill, arrayof_jbyte_fill,               \
 949            arrayof_jbyte_fill)                                          \
 950   do_stub(final, arrayof_jshort_fill)                                   \
 951   do_entry(final, arrayof_jshort_fill, arrayof_jshort_fill,             \
 952            arrayof_jshort_fill)                                         \
 953   do_stub(final, arrayof_jint_fill)                                     \
 954   do_entry(final, arrayof_jint_fill, arrayof_jint_fill,                 \
 955            arrayof_jint_fill)                                           \
 956   do_stub(final, method_entry_barrier)                                  \
 957   do_entry(final, method_entry_barrier, method_entry_barrier,           \
 958            method_entry_barrier)                                        \
 959   do_stub(final, vectorizedMismatch) /* only used by x86! */            \
 960   do_entry(final, vectorizedMismatch, vectorizedMismatch,               \
 961            vectorizedMismatch)                                          \
 962   do_stub(final, upcall_stub_exception_handler)                         \
 963   do_entry(final, upcall_stub_exception_handler,                        \
 964            upcall_stub_exception_handler,                               \
 965            upcall_stub_exception_handler)                               \
 966   do_stub(final, upcall_stub_load_target)                               \
 967   do_entry(final, upcall_stub_load_target, upcall_stub_load_target,     \
 968            upcall_stub_load_target)                                     \
 969   do_stub(final, lookup_secondary_supers_table)                         \
 970   do_entry_array(final, lookup_secondary_supers_table,                  \
 971                  lookup_secondary_supers_table_stubs,                   \
 972                  lookup_secondary_supers_table_stub,                    \
 973                  Klass::SECONDARY_SUPERS_TABLE_SIZE)                    \
 974   do_stub(final, lookup_secondary_supers_table_slow_path)               \
 975   do_entry(final, lookup_secondary_supers_table_slow_path,              \
 976            lookup_secondary_supers_table_slow_path_stub,                \
 977            lookup_secondary_supers_table_slow_path_stub)                \
 978   /* merge in stubs and entries declared in arch header */              \
 979   STUBGEN_FINAL_BLOBS_ARCH_DO(do_stub,  do_arch_blob,                   \
 980                               do_arch_entry, do_arch_entry_init)        \
 981   end_blob(final)                                                       \
 982 
 983 
 984 // Convenience macros for use by template implementations
 985 
 986 #define STUB_ID_NAME(base) base##_id
 987 
 988 // emit a runtime or stubgen stub field name
 989 
 990 #define STUB_FIELD_NAME(base) _##base
 991 
 992 // emit a runtime blob field name
 993 
 994 #define BLOB_FIELD_NAME(base) _##base##_blob
 995 
 996 // emit a stubgen blob field name
 997 
 998 #define STUBGEN_BLOB_FIELD_NAME(base) _ ## base ## _stubs_code
 999 
1000 // Convenience templates that emit nothing
1001 
1002 // ignore do_blob(blob_name, type) declarations
1003 #define DO_BLOB_EMPTY2(blob_name, type)
1004 
1005 // ignore do_blob(blob_name) and end_blob(blob_name) declarations
1006 #define DO_BLOB_EMPTY1(blob_name)
1007 
1008 // ignore do_stub(name, fancy_jump, pass_tls, return_pc) declarations
1009 #define DO_STUB_EMPTY4(name, fancy_jump, pass_tls, return_pc)
1010 
1011 // ignore do_jvmti_stub(name) declarations
1012 #define DO_JVMTI_STUB_EMPTY1(stub_name)
1013 
1014 // ignore do_stub(blob_name, stub_name) declarations
1015 #define DO_STUB_EMPTY2(blob_name, stub_name)
1016 
1017 // ignore do_entry(blob_name, stub_name, fieldname, getter_name) declarations
1018 #define DO_ENTRY_EMPTY4(blob_name, stub_name, fieldname, getter_name)
1019 
1020 // ignore do_entry(blob_name, stub_name, fieldname, getter_name, init_function) and
1021 // do_entry_array(blob_name, stub_name, fieldname, getter_name, count) declarations
1022 #define DO_ENTRY_EMPTY5(blob_name, stub_name, fieldname, getter_name, init_function)
1023 
1024 // ignore do_arch_blob(blob_name, size) declarations
1025 #define DO_ARCH_BLOB_EMPTY2(arch, size)
1026 
1027 // ignore do_arch_entry(arch, blob_name, stub_name, fieldname, getter_name) declarations
1028 #define DO_ARCH_ENTRY_EMPTY5(arch, blob_name, stub_name, field_name, getter_name)
1029 
1030 // ignore do_arch_entry(arch, blob_name, stub_name, fieldname, getter_name, init_function) declarations
1031 #define DO_ARCH_ENTRY_EMPTY6(arch, blob_name, stub_name, field_name, getter_name, init_function)
1032 
1033 // The whole shebang!
1034 //
1035 // client macro for emitting StubGenerator blobs, stubs and entries
1036 
1037 #define STUBGEN_ALL_DO(do_blob, end_blob,                               \
1038                        do_stub,                                         \
1039                        do_entry, do_entry_init,                         \
1040                        do_entry_array,                                  \
1041                        do_arch_blob,                                    \
1042                        do_arch_entry, do_arch_entry_init)               \
1043   STUBGEN_PREUNIVERSE_BLOBS_DO(do_blob, end_blob,                       \
1044                                do_stub,                                 \
1045                                do_entry, do_entry_init,                 \
1046                                do_entry_array,                          \
1047                                do_arch_blob,                            \
1048                                do_arch_entry, do_arch_entry_init)       \
1049   STUBGEN_INITIAL_BLOBS_DO(do_blob, end_blob,                           \
1050                            do_stub,                                     \
1051                            do_entry, do_entry_init,                     \
1052                            do_entry_array,                              \
1053                            do_arch_blob,                                \
1054                            do_arch_entry, do_arch_entry_init)           \
1055   STUBGEN_CONTINUATION_BLOBS_DO(do_blob, end_blob,                      \
1056                                 do_stub,                                \
1057                                 do_entry, do_entry_init,                \
1058                                 do_entry_array,                         \
1059                                 do_arch_blob,                           \
1060                                 do_arch_entry, do_arch_entry_init)      \
1061   STUBGEN_COMPILER_BLOBS_DO(do_blob, end_blob,                          \
1062                             do_stub,                                    \
1063                             do_entry, do_entry_init,                    \
1064                             do_entry_array,                             \
1065                             do_arch_blob,                               \
1066                             do_arch_entry, do_arch_entry_init)          \
1067   STUBGEN_FINAL_BLOBS_DO(do_blob, end_blob,                             \
1068                          do_stub,                                       \
1069                          do_entry, do_entry_init,                       \
1070                          do_entry_array,                                \
1071                          do_arch_blob,                                  \
1072                          do_arch_entry, do_arch_entry_init)             \
1073 
1074 // client macro to operate only on StubGenerator blobs
1075 
1076 #define STUBGEN_BLOBS_DO(do_blob)                                       \
1077   STUBGEN_ALL_DO(do_blob, DO_BLOB_EMPTY1,                               \
1078                  DO_STUB_EMPTY2,                                        \
1079                  DO_ENTRY_EMPTY4, DO_ENTRY_EMPTY5,                      \
1080                  DO_ENTRY_EMPTY5,                                       \
1081                  DO_ARCH_BLOB_EMPTY2,                                   \
1082                  DO_ARCH_ENTRY_EMPTY5, DO_ARCH_ENTRY_EMPTY6)            \
1083 
1084 // client macro to operate only on StubGenerator stubs
1085 
1086 #define STUBGEN_STUBS_DO(do_stub)                                       \
1087   STUBGEN_ALL_DO(DO_BLOB_EMPTY1, DO_BLOB_EMPTY1,                        \
1088                  do_stub,                                               \
1089                  DO_ENTRY_EMPTY4, DO_ENTRY_EMPTY5,                      \
1090                  DO_ENTRY_EMPTY5,                                       \
1091                  DO_ARCH_BLOB_EMPTY2,                                   \
1092                  DO_ARCH_ENTRY_EMPTY5, DO_ARCH_ENTRY_EMPTY6)            \
1093 
1094 // client macro to operate only on StubGenerator blobs and stubs
1095 
1096 #define STUBGEN_BLOBS_STUBS_DO(do_blob, end_blob, do_stub)              \
1097   STUBGEN_ALL_DO(do_blob, end_blob,                                     \
1098                  do_stub,                                               \
1099                  DO_ENTRY_EMPTY4, DO_ENTRY_EMPTY5,                      \
1100                  DO_ENTRY_EMPTY5,                                       \
1101                  DO_ARCH_BLOB_EMPTY2,                                   \
1102                  DO_ARCH_ENTRY_EMPTY5,DO_ARCH_ENTRY_EMPTY6)             \
1103 
1104 // client macro to operate only on StubGenerator entries
1105 
1106 #define STUBGEN_ENTRIES_DO(do_entry, do_entry_init, do_entry_array)     \
1107   STUBGEN_ALL_DO(DO_BLOB_EMPTY1, DO_BLOB_EMPTY1,                        \
1108                  DO_STUB_EMPTY2,                                        \
1109                  do_entry, do_entry_init,                               \
1110                  do_entry_array,                                        \
1111                  DO_ARCH_BLOB_EMPTY2,                                   \
1112                  DO_ARCH_ENTRY_EMPTY5, DO_ARCH_ENTRY_EMPTY6)            \
1113 
1114 // client macro to operate only on StubGenerator arch blobs
1115 
1116 #define STUBGEN_ARCH_BLOBS_DO(do_arch_blob)                             \
1117   STUBGEN_ALL_DO(DO_BLOB_EMPTY1, DO_BLOB_EMPTY1,                        \
1118                  DO_STUB_EMPTY2,                                        \
1119                  DO_ENTRY_EMPTY4, DO_ENTRY_EMPTY5,                      \
1120                  DO_ENTRY_EMPTY5,                                       \
1121                  do_arch_blob,                                          \
1122                  DO_ARCH_ENTRY_EMPTY5, DO_ARCH_ENTRY_EMPTY6)            \
1123 
1124 // client macro to operate only on StubGenerator arch entries
1125 
1126 #define STUBGEN_ARCH_ENTRIES_DO(do_arch_entry, do_arch_entry_init)      \
1127   STUBGEN_ALL_DO(DO_BLOB_EMPTY1, DO_BLOB_EMPTY1,                        \
1128                  DO_STUB_EMPTY2,                                        \
1129                  DO_ENTRY_EMPTY4, DO_ENTRY_EMPTY5,                      \
1130                  DO_ENTRY_EMPTY5,                                       \
1131                  DO_ARCH_BLOB_EMPTY2,                                   \
1132                  do_arch_entry, do_arch_entry_init)                     \
1133 
1134 #endif // SHARE_RUNTIME_STUBDECLARATIONS_HPP