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
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 //
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 have 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) \
995
996 // ignore do_arch_blob(blob_name, size) declarations
997 #define DO_ARCH_BLOB_EMPTY2(arch, size)
998
999 // ignore do_arch_entry(arch, blob_name, stub_name, fieldname, getter_name) declarations
1000 #define DO_ARCH_ENTRY_EMPTY5(arch, blob_name, stub_name, field_name, getter_name)
1001
1002 // ignore do_arch_entry(arch, blob_name, stub_name, fieldname, getter_name, init_function) declarations
1003 #define DO_ARCH_ENTRY_EMPTY6(arch, blob_name, stub_name, field_name, getter_name, init_function)
1004
1005 // The whole shebang!
1006 //
1007 // client macro for emitting StubGenerator blobs, stubs and entries
1008
1009 #define STUBGEN_ALL_DO(do_blob, end_blob, \
1010 do_stub, \
1011 do_entry, do_entry_init, \
1012 do_entry_array, \
1013 do_arch_blob, \
1014 do_arch_entry, do_arch_entry_init) \
1015 STUBGEN_INITIAL_BLOBS_DO(do_blob, end_blob, \
1016 do_stub, \
1017 do_entry, do_entry_init, \
1018 do_entry_array, \
1019 do_arch_blob, \
1020 do_arch_entry, do_arch_entry_init) \
1021 STUBGEN_CONTINUATION_BLOBS_DO(do_blob, end_blob, \
1022 do_stub, \
1023 do_entry, do_entry_init, \
1024 do_entry_array, \
1025 do_arch_blob, \
1026 do_arch_entry, do_arch_entry_init) \
1027 STUBGEN_COMPILER_BLOBS_DO(do_blob, end_blob, \
1028 do_stub, \
1029 do_entry, do_entry_init, \
1030 do_entry_array, \
1031 do_arch_blob, \
1032 do_arch_entry, do_arch_entry_init) \
1033 STUBGEN_FINAL_BLOBS_DO(do_blob, end_blob, \
1034 do_stub, \
|
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 do_stub(class_init_barrier, 0, false, false) \
171
172 #else
173 #define C2_STUBS_DO(do_blob, do_stub, do_jvmti_stub)
174 #endif
175
176 // Stub Generator Blobs and Stubs Overview
177 //
178 // StubGenerator stubs do not require their own individual blob. They
179 // are generated in batches into one of five distinct BufferBlobs:
180 //
181 // 1) PreUniverse stubs
182 // 2) Initial stubs
183 // 3) Continuation stubs
184 // 4) Compiler stubs
185 // 5) Final stubs
186 //
187 // Creation of each successive BufferBlobs is staged to ensure that
188 // specific VM subsystems required by those stubs are suitably
189 // initialized before generated code attempt to reference data or
190 // addresses exported by those subsystems. The sequencing of
191 // initialization must be taken into account when adding a new stub
192 // declaration.
193 //
194 // StubGenerator stubs are declared using template macros, one set of
195 // declarations per blob (see below), with arch-specific stubs for any
196 // gven blob declared after generic stubs for that blob. Blobs are
197 // created in a fixed order during startup, which is reflected in the
198 // order of the declaration set. Stubs within a blob are currently
199 // created in an order determined by the arch-specific generator code
200 // which may not reflect the order of stub declarations. It is not
201 // straightforward to enforce a strict ordering. not least because
202 // arch-specific stub creation may need to be interleaved with generic
203 // stub creation.
204 //
205 // Blob and stub declaration templates are used to generate a variety
253 //
254 // const char* StubRoutines::get_blob_name(StubGenBlobId id)
255 // const char* StubRoutines::get_stub_name(StubGenStubId id)
256 //
257 // These name lookup methods should be used by generic and
258 // cpu-specific client code to ensure that blobs and stubs are
259 // identified consistently.
260 //
261 // Blob code buffer sizes:
262 //
263 // An enumeration enum platform_dependent_constants is generated in
264 // the architecture specific StubRoutines header. For each blob named
265 // <nnn> an associated enum tag is generated which defines the
266 // relevant size
267 //
268 // _<nnn>_stubs_code_size = <size>,
269 //
270 // For example,
271 //
272 // enum platform_dependent_constants {
273 // _preuniverse_stubs_code_size = 500,
274 // _initial_stubs_code_size = 10000,
275 // _continuation_stubs_code_size = 2000,
276 // . . .
277 //
278 // Blob fields and associated getters:
279 //
280 // For each blob named <nnn> a private field declaration will be
281 // generated: static field address StubRoutines::_<nnn>_stubs_code and
282 // a declaration provided to initialise it to nullptr. A corresponding
283 // public getter method address StubRoutines::_<nnn>_stubs_code() will
284 // be generated.
285 //
286 // Blob initialization routines:
287 //
288 // For each blob named <nnn> an initalization function is defined
289 // which allows clients to schedule blob and stub generation during
290 // JVM bootstrap:
291 //
292 // void <nnn>_stubs_init() { StubRoutines::initialize_<nnn>_stubs(); }
293 //
487 //
488 // Architecture-specific entries need to be declared using the
489 // do_arch_entry template
490 //
491 // do_arch_entry(arch, blob_name, stub_name, field_name, getter_name)
492 //
493 // do_arch_entry_init(arch, blob_name, stub_name, field_name,
494 // getter_name, init_function)
495 //
496 // The only difference between these templates and the generic ones is
497 // that they receive an extra argument which identifies the current
498 // architecture e.g. x86, aarch64 etc.
499 //
500 // Currently there is no support for a do_arch_array_entry template.
501
502 // Include arch-specific stub and entry declarations and make sure the
503 // relevant template macros have been defined
504
505 #include CPU_HEADER(stubDeclarations)
506
507 #ifndef STUBGEN_PREUNIVERSE_BLOBS_ARCH_DO
508 #error "Arch-specific directory failed to declare required initial stubs and entries"
509 #endif
510
511 #ifndef STUBGEN_INITIAL_BLOBS_ARCH_DO
512 #error "Arch-specific directory failed to declare required initial stubs and entries"
513 #endif
514
515 #ifndef STUBGEN_CONTINUATION_BLOBS_ARCH_DO
516 #error "Arch-specific directory failed to declare required continuation stubs and entries"
517 #endif
518
519 #ifndef STUBGEN_COMPILER_BLOBS_ARCH_DO
520 #error "Arch-specific directory failed to declare required compiler stubs and entries"
521 #endif
522
523 #ifndef STUBGEN_FINAL_BLOBS_ARCH_DO
524 #error "Arch-specific directory failed to declare required final stubs and entries"
525 #endif
526
527 // Iterator macros to apply templates to all relevant blobs, stubs and
528 // entries. Clients should use STUBGEN_ALL_DO, STUBGEN_BLOBS_DO,
529 // STUBGEN_STUBS_DO, STUBGEN_BLOBS_STUBS_DO, STUBGEN_ENTRIES_DO,
530 // STUBGEN_ARCH_BLOBS_DO and STUBGEN_ARCH_ENTRIES_DO.
531 //
532 // n.b. Client macros appear after the STUBGEN_<BLOB_NAME>_BLOBS_DO
533 // submacros which follow next. These submacros are not intended to be
534 // called directly. They serve to define the main client macro
535 // STUBGEN_ALL_DO and, from there, the other more specific client
536 // macros. n.b. multiple, 'per-blob' submacros are used to declare
537 // each group of stubs and entries, because that makes it simpler to
538 // lookup and update related elements. If you need to update these
539 // submacros to change the list of stubs or entries be sure to locate
540 // stubs within the correct blob and locate entry declarations
541 // immediately after their associated stub declaration.
542
543 #define STUBGEN_PREUNIVERSE_BLOBS_DO(do_blob, end_blob, \
544 do_stub, \
545 do_entry, do_entry_init, \
546 do_entry_array, \
547 do_arch_blob, \
548 do_arch_entry, do_arch_entry_init) \
549 do_blob(preuniverse) \
550 do_stub(preuniverse, fence) \
551 do_entry(preuniverse, fence, fence_entry, fence_entry) \
552 do_stub(preuniverse, atomic_add) \
553 do_entry(preuniverse, atomic_add, atomic_add_entry, atomic_add_entry) \
554 do_stub(preuniverse, atomic_xchg) \
555 do_entry(preuniverse, atomic_xchg, atomic_xchg_entry, \
556 atomic_xchg_entry) \
557 do_stub(preuniverse, atomic_cmpxchg) \
558 do_entry(preuniverse, atomic_cmpxchg, atomic_cmpxchg_entry, \
559 atomic_cmpxchg_entry) \
560 do_stub(preuniverse, atomic_cmpxchg_long) \
561 do_entry(preuniverse, atomic_cmpxchg_long, atomic_cmpxchg_long_entry, \
562 atomic_cmpxchg_long_entry) \
563 /* merge in stubs and entries declared in arch header */ \
564 STUBGEN_PREUNIVERSE_BLOBS_ARCH_DO(do_stub, do_arch_blob, \
565 do_arch_entry, do_arch_entry_init) \
566 end_blob(preuniverse) \
567
568 #define STUBGEN_INITIAL_BLOBS_DO(do_blob, end_blob, \
569 do_stub, \
570 do_entry, do_entry_init, \
571 do_entry_array, \
572 do_arch_blob, \
573 do_arch_entry, do_arch_entry_init) \
574 do_blob(initial) \
575 do_stub(initial, call_stub) \
576 do_entry(initial, call_stub, call_stub_entry, call_stub_entry) \
577 do_entry(initial, call_stub, call_stub_return_address, \
578 call_stub_return_address) \
579 do_stub(initial, forward_exception) \
580 do_entry(initial, forward_exception, forward_exception_entry, \
581 forward_exception_entry) \
582 do_stub(initial, catch_exception) \
583 do_entry(initial, catch_exception, catch_exception_entry, \
584 catch_exception_entry) \
585 do_stub(initial, updateBytesCRC32) \
586 do_entry(initial, updateBytesCRC32, updateBytesCRC32, \
587 updateBytesCRC32) \
588 do_entry(initial, updateBytesCRC32, crc_table_adr, crc_table_addr) \
589 do_stub(initial, updateBytesCRC32C) \
590 do_entry(initial, updateBytesCRC32C, updateBytesCRC32C, \
591 updateBytesCRC32C) \
592 do_entry(initial, updateBytesCRC32C, crc32c_table_addr, \
593 crc32c_table_addr) \
594 do_stub(initial, f2hf) \
595 do_entry(initial, f2hf, f2hf, f2hf_adr) \
596 do_stub(initial, hf2f) \
597 do_entry(initial, hf2f, hf2f, hf2f_adr) \
598 do_stub(initial, dexp) \
599 do_entry(initial, dexp, dexp, dexp) \
600 do_stub(initial, dlog) \
601 do_entry(initial, dlog, dlog, dlog) \
602 do_stub(initial, dlog10) \
603 do_entry(initial, dlog10, dlog10, dlog10) \
604 do_stub(initial, dpow) \
1015
1016 // ignore do_arch_blob(blob_name, size) declarations
1017 #define DO_ARCH_BLOB_EMPTY2(arch, size)
1018
1019 // ignore do_arch_entry(arch, blob_name, stub_name, fieldname, getter_name) declarations
1020 #define DO_ARCH_ENTRY_EMPTY5(arch, blob_name, stub_name, field_name, getter_name)
1021
1022 // ignore do_arch_entry(arch, blob_name, stub_name, fieldname, getter_name, init_function) declarations
1023 #define DO_ARCH_ENTRY_EMPTY6(arch, blob_name, stub_name, field_name, getter_name, init_function)
1024
1025 // The whole shebang!
1026 //
1027 // client macro for emitting StubGenerator blobs, stubs and entries
1028
1029 #define STUBGEN_ALL_DO(do_blob, end_blob, \
1030 do_stub, \
1031 do_entry, do_entry_init, \
1032 do_entry_array, \
1033 do_arch_blob, \
1034 do_arch_entry, do_arch_entry_init) \
1035 STUBGEN_PREUNIVERSE_BLOBS_DO(do_blob, end_blob, \
1036 do_stub, \
1037 do_entry, do_entry_init, \
1038 do_entry_array, \
1039 do_arch_blob, \
1040 do_arch_entry, do_arch_entry_init) \
1041 STUBGEN_INITIAL_BLOBS_DO(do_blob, end_blob, \
1042 do_stub, \
1043 do_entry, do_entry_init, \
1044 do_entry_array, \
1045 do_arch_blob, \
1046 do_arch_entry, do_arch_entry_init) \
1047 STUBGEN_CONTINUATION_BLOBS_DO(do_blob, end_blob, \
1048 do_stub, \
1049 do_entry, do_entry_init, \
1050 do_entry_array, \
1051 do_arch_blob, \
1052 do_arch_entry, do_arch_entry_init) \
1053 STUBGEN_COMPILER_BLOBS_DO(do_blob, end_blob, \
1054 do_stub, \
1055 do_entry, do_entry_init, \
1056 do_entry_array, \
1057 do_arch_blob, \
1058 do_arch_entry, do_arch_entry_init) \
1059 STUBGEN_FINAL_BLOBS_DO(do_blob, end_blob, \
1060 do_stub, \
|