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