Skip to content

Commit ee35f63

Browse files
committed
8359373: Split stubgen initial blob into pre and post-universe blobs
Reviewed-by: kvn
1 parent 12a0dd0 commit ee35f63

18 files changed

+143
-12
lines changed

src/hotspot/cpu/aarch64/stubDeclarations_aarch64.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
#ifndef CPU_AARCH64_STUBDECLARATIONS_HPP
2727
#define CPU_AARCH64_STUBDECLARATIONS_HPP
2828

29+
#define STUBGEN_PREUNIVERSE_BLOBS_ARCH_DO(do_stub, \
30+
do_arch_blob, \
31+
do_arch_entry, \
32+
do_arch_entry_init) \
33+
do_arch_blob(preuniverse, 0) \
34+
35+
2936
#define STUBGEN_INITIAL_BLOBS_ARCH_DO(do_stub, \
3037
do_arch_blob, \
3138
do_arch_entry, \

src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11653,6 +11653,10 @@ class StubGenerator: public StubCodeGenerator {
1165311653
};
1165411654

1165511655
// Initialization
11656+
void generate_preuniverse_stubs() {
11657+
// preuniverse stubs are not needed for aarch64
11658+
}
11659+
1165611660
void generate_initial_stubs() {
1165711661
// Generate initial stubs and initializes the entry points
1165811662

@@ -11898,6 +11902,9 @@ class StubGenerator: public StubCodeGenerator {
1189811902
public:
1189911903
StubGenerator(CodeBuffer* code, StubGenBlobId blob_id) : StubCodeGenerator(code, blob_id) {
1190011904
switch(blob_id) {
11905+
case preuniverse_id:
11906+
generate_preuniverse_stubs();
11907+
break;
1190111908
case initial_id:
1190211909
generate_initial_stubs();
1190311910
break;

src/hotspot/cpu/arm/stubDeclarations_arm.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
#ifndef CPU_ARM_STUBDECLARATIONS_HPP
2727
#define CPU_ARM_STUBDECLARATIONS_HPP
2828

29+
#define STUBGEN_PREUNIVERSE_BLOBS_ARCH_DO(do_stub, \
30+
do_arch_blob, \
31+
do_arch_entry, \
32+
do_arch_entry_init) \
33+
do_arch_blob(preuniverse, 0) \
34+
35+
2936
#define STUBGEN_INITIAL_BLOBS_ARCH_DO(do_stub, \
3037
do_arch_blob, \
3138
do_arch_entry, \

src/hotspot/cpu/arm/stubGenerator_arm.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3126,6 +3126,10 @@ class StubGenerator: public StubCodeGenerator {
31263126
//---------------------------------------------------------------------------
31273127
// Initialization
31283128

3129+
void generate_preuniverse_stubs() {
3130+
// preuniverse stubs are not needed for arm
3131+
}
3132+
31293133
void generate_initial_stubs() {
31303134
// Generates all stubs and initializes the entry points
31313135

@@ -3201,6 +3205,9 @@ class StubGenerator: public StubCodeGenerator {
32013205
public:
32023206
StubGenerator(CodeBuffer* code, StubGenBlobId blob_id) : StubCodeGenerator(code, blob_id) {
32033207
switch(blob_id) {
3208+
case preuniverse_id:
3209+
generate_preuniverse_stubs();
3210+
break;
32043211
case initial_id:
32053212
generate_initial_stubs();
32063213
break;

src/hotspot/cpu/ppc/stubDeclarations_ppc.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
#ifndef CPU_PPC_STUBDECLARATIONS_HPP
2727
#define CPU_PPC_STUBDECLARATIONS_HPP
2828

29+
#define STUBGEN_PREUNIVERSE_BLOBS_ARCH_DO(do_stub, \
30+
do_arch_blob, \
31+
do_arch_entry, \
32+
do_arch_entry_init) \
33+
do_arch_blob(preuniverse, 0) \
34+
35+
2936
#define STUBGEN_INITIAL_BLOBS_ARCH_DO(do_stub, \
3037
do_arch_blob, \
3138
do_arch_entry, \

src/hotspot/cpu/ppc/stubGenerator_ppc.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4938,6 +4938,10 @@ void generate_lookup_secondary_supers_table_stub() {
49384938
}
49394939

49404940
// Initialization
4941+
void generate_preuniverse_stubs() {
4942+
// preuniverse stubs are not needed for ppc
4943+
}
4944+
49414945
void generate_initial_stubs() {
49424946
// Generates all stubs and initializes the entry points
49434947

@@ -5067,6 +5071,9 @@ void generate_lookup_secondary_supers_table_stub() {
50675071
public:
50685072
StubGenerator(CodeBuffer* code, StubGenBlobId blob_id) : StubCodeGenerator(code, blob_id) {
50695073
switch(blob_id) {
5074+
case preuniverse_id:
5075+
generate_preuniverse_stubs();
5076+
break;
50705077
case initial_id:
50715078
generate_initial_stubs();
50725079
break;

src/hotspot/cpu/riscv/stubDeclarations_riscv.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
#ifndef CPU_RISCV_STUBDECLARATIONS_HPP
2727
#define CPU_RISCV_STUBDECLARATIONS_HPP
2828

29+
#define STUBGEN_PREUNIVERSE_BLOBS_ARCH_DO(do_stub, \
30+
do_arch_blob, \
31+
do_arch_entry, \
32+
do_arch_entry_init) \
33+
do_arch_blob(preuniverse, 0) \
34+
35+
2936
#define STUBGEN_INITIAL_BLOBS_ARCH_DO(do_stub, \
3037
do_arch_blob, \
3138
do_arch_entry, \

src/hotspot/cpu/riscv/stubGenerator_riscv.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6660,6 +6660,10 @@ static const int64_t right_3_bits = right_n_bits(3);
66606660
#undef __
66616661

66626662
// Initialization
6663+
void generate_preuniverse_stubs() {
6664+
// preuniverse stubs are not needed for riscv
6665+
}
6666+
66636667
void generate_initial_stubs() {
66646668
// Generate initial stubs and initializes the entry points
66656669

@@ -6815,6 +6819,9 @@ static const int64_t right_3_bits = right_n_bits(3);
68156819
public:
68166820
StubGenerator(CodeBuffer* code, StubGenBlobId blob_id) : StubCodeGenerator(code, blob_id) {
68176821
switch(blob_id) {
6822+
case preuniverse_id:
6823+
generate_preuniverse_stubs();
6824+
break;
68186825
case initial_id:
68196826
generate_initial_stubs();
68206827
break;

src/hotspot/cpu/s390/stubDeclarations_s390.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
#ifndef CPU_S390_STUBDECLARATIONS_HPP
2727
#define CPU_S390_STUBDECLARATIONS_HPP
2828

29+
#define STUBGEN_PREUNIVERSE_BLOBS_ARCH_DO(do_stub, \
30+
do_arch_blob, \
31+
do_arch_entry, \
32+
do_arch_entry_init) \
33+
do_arch_blob(preuniverse, 0) \
34+
35+
2936
#define STUBGEN_INITIAL_BLOBS_ARCH_DO(do_stub, \
3037
do_arch_blob, \
3138
do_arch_entry, \

src/hotspot/cpu/s390/stubGenerator_s390.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3283,6 +3283,10 @@ class StubGenerator: public StubCodeGenerator {
32833283
return start;
32843284
}
32853285

3286+
void generate_preuniverse_stubs() {
3287+
// preuniverse stubs are not needed for s390
3288+
}
3289+
32863290
void generate_initial_stubs() {
32873291
// Generates all stubs and initializes the entry points.
32883292

@@ -3418,6 +3422,9 @@ class StubGenerator: public StubCodeGenerator {
34183422
public:
34193423
StubGenerator(CodeBuffer* code, StubGenBlobId blob_id) : StubCodeGenerator(code, blob_id) {
34203424
switch(blob_id) {
3425+
case preuniverse_id:
3426+
generate_preuniverse_stubs();
3427+
break;
34213428
case initial_id:
34223429
generate_initial_stubs();
34233430
break;

src/hotspot/cpu/x86/stubDeclarations_x86.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
#ifndef CPU_X86_STUBDECLARATIONS_HPP
2727
#define CPU_X86_STUBDECLARATIONS_HPP
2828

29+
#define STUBGEN_PREUNIVERSE_BLOBS_ARCH_DO(do_stub, \
30+
do_arch_blob, \
31+
do_arch_entry, \
32+
do_arch_entry_init) \
33+
do_arch_blob(preuniverse, 500) \
34+
35+
2936
#define STUBGEN_INITIAL_BLOBS_ARCH_DO(do_stub, \
3037
do_arch_blob, \
3138
do_arch_entry, \

src/hotspot/cpu/x86/stubGenerator_x86_64.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4049,6 +4049,11 @@ void StubGenerator::create_control_words() {
40494049
}
40504050

40514051
// Initialization
4052+
void StubGenerator::generate_preuniverse_stubs() {
4053+
// atomic calls
4054+
StubRoutines::_fence_entry = generate_orderaccess_fence();
4055+
}
4056+
40524057
void StubGenerator::generate_initial_stubs() {
40534058
// Generates all stubs and initializes the entry points
40544059

@@ -4074,9 +4079,6 @@ void StubGenerator::generate_initial_stubs() {
40744079
// is referenced by megamorphic call
40754080
StubRoutines::_catch_exception_entry = generate_catch_exception();
40764081

4077-
// atomic calls
4078-
StubRoutines::_fence_entry = generate_orderaccess_fence();
4079-
40804082
// platform dependent
40814083
StubRoutines::x86::_get_previous_sp_entry = generate_get_previous_sp();
40824084

@@ -4344,6 +4346,9 @@ void StubGenerator::generate_compiler_stubs() {
43444346

43454347
StubGenerator::StubGenerator(CodeBuffer* code, StubGenBlobId blob_id) : StubCodeGenerator(code, blob_id) {
43464348
switch(blob_id) {
4349+
case preuniverse_id:
4350+
generate_preuniverse_stubs();
4351+
break;
43474352
case initial_id:
43484353
generate_initial_stubs();
43494354
break;

src/hotspot/cpu/x86/stubGenerator_x86_64.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ class StubGenerator: public StubCodeGenerator {
634634
void create_control_words();
635635

636636
// Initialization
637+
void generate_preuniverse_stubs();
637638
void generate_initial_stubs();
638639
void generate_continuation_stubs();
639640
void generate_compiler_stubs();

src/hotspot/cpu/zero/stubDeclarations_zero.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
#ifndef CPU_ZERO_STUBDECLARATIONS_HPP
2727
#define CPU_ZERO_STUBDECLARATIONS_HPP
2828

29+
#define STUBGEN_PREUNIVERSE_BLOBS_ARCH_DO(do_stub, \
30+
do_arch_blob, \
31+
do_arch_entry, \
32+
do_arch_entry_init) \
33+
do_arch_blob(preuniverse, 0) \
34+
35+
2936
#define STUBGEN_INITIAL_BLOBS_ARCH_DO(do_stub, \
3037
do_arch_blob, \
3138
do_arch_entry, \

src/hotspot/cpu/zero/stubGenerator_zero.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ class StubGenerator: public StubCodeGenerator {
178178
StubRoutines::_oop_arraycopy;
179179
}
180180

181+
void generate_preuniverse_stubs() {
182+
StubRoutines::_fence_entry = ShouldNotCallThisStub();
183+
}
184+
181185
void generate_initial_stubs() {
182186
// entry points that exist in all platforms Note: This is code
183187
// that could be shared among different platforms - however the
@@ -194,7 +198,6 @@ class StubGenerator: public StubCodeGenerator {
194198
StubRoutines::_atomic_cmpxchg_entry = ShouldNotCallThisStub();
195199
StubRoutines::_atomic_cmpxchg_long_entry = ShouldNotCallThisStub();
196200
StubRoutines::_atomic_add_entry = ShouldNotCallThisStub();
197-
StubRoutines::_fence_entry = ShouldNotCallThisStub();
198201
}
199202

200203
void generate_continuation_stubs() {
@@ -214,6 +217,9 @@ class StubGenerator: public StubCodeGenerator {
214217
public:
215218
StubGenerator(CodeBuffer* code, StubGenBlobId blob_id) : StubCodeGenerator(code, blob_id) {
216219
switch(blob_id) {
220+
case preuniverse_id:
221+
generate_preuniverse_stubs();
222+
break;
217223
case initial_id:
218224
generate_initial_stubs();
219225
break;

src/hotspot/share/runtime/init.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ void compilationPolicy_init();
6868
void codeCache_init();
6969
void VM_Version_init();
7070
void icache_init2();
71+
void preuniverse_stubs_init();
7172
void initial_stubs_init();
7273

7374
jint universe_init(); // depends on codeCache_init and initial_stubs_init
@@ -129,6 +130,8 @@ jint init_globals() {
129130
codeCache_init();
130131
VM_Version_init(); // depends on codeCache_init for emitting code
131132
icache_init2(); // depends on VM_Version for choosing the mechanism
133+
// initialize stubs needed before we can init the universe
134+
preuniverse_stubs_init();
132135
// stub routines in initial blob are referenced by later generated code
133136
initial_stubs_init();
134137
// stack overflow exception blob is referenced by the interpreter

src/hotspot/share/runtime/stubDeclarations.hpp

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,13 @@
175175
// Stub Generator Blobs and Stubs Overview
176176
//
177177
// StubGenerator stubs do not require their own individual blob. They
178-
// are generated in batches into one of four distinct BufferBlobs:
178+
// are generated in batches into one of five distinct BufferBlobs:
179179
//
180-
// 1) Initial stubs
181-
// 2) Continuation stubs
182-
// 3) Compiler stubs
183-
// 4) Final stubs
180+
// 1) PreUniverse stubs
181+
// 2) Initial stubs
182+
// 3) Continuation stubs
183+
// 4) Compiler stubs
184+
// 5) Final stubs
184185
//
185186
// Creation of each successive BufferBlobs is staged to ensure that
186187
// specific VM subsystems required by those stubs are suitably
@@ -268,6 +269,7 @@
268269
// For example,
269270
//
270271
// enum platform_dependent_constants {
272+
// _preuniverse_stubs_code_size = 500,
271273
// _initial_stubs_code_size = 10000,
272274
// _continuation_stubs_code_size = 2000,
273275
// . . .
@@ -501,6 +503,10 @@
501503

502504
#include CPU_HEADER(stubDeclarations)
503505

506+
#ifndef STUBGEN_PREUNIVERSE_BLOBS_ARCH_DO
507+
#error "Arch-specific directory failed to declare required initial stubs and entries"
508+
#endif
509+
504510
#ifndef STUBGEN_INITIAL_BLOBS_ARCH_DO
505511
#error "Arch-specific directory failed to declare required initial stubs and entries"
506512
#endif
@@ -533,7 +539,21 @@
533539
// stubs within the correct blob and locate entry declarations
534540
// immediately after their associated stub declaration.
535541

536-
#define STUBGEN_INITIAL_BLOBS_DO(do_blob, end_blob, \
542+
#define STUBGEN_PREUNIVERSE_BLOBS_DO(do_blob, end_blob, \
543+
do_stub, \
544+
do_entry, do_entry_init, \
545+
do_entry_array, \
546+
do_arch_blob, \
547+
do_arch_entry, do_arch_entry_init) \
548+
do_blob(preuniverse) \
549+
do_stub(preuniverse, fence) \
550+
do_entry(preuniverse, fence, fence_entry, fence_entry) \
551+
/* merge in stubs and entries declared in arch header */ \
552+
STUBGEN_PREUNIVERSE_BLOBS_ARCH_DO(do_stub, do_arch_blob, \
553+
do_arch_entry, do_arch_entry_init) \
554+
end_blob(preuniverse) \
555+
556+
#define STUBGEN_INITIAL_BLOBS_DO(do_blob, end_blob, \
537557
do_stub, \
538558
do_entry, do_entry_init, \
539559
do_entry_array, \
@@ -550,8 +570,6 @@
550570
do_stub(initial, catch_exception) \
551571
do_entry(initial, catch_exception, catch_exception_entry, \
552572
catch_exception_entry) \
553-
do_stub(initial, fence) \
554-
do_entry(initial, fence, fence_entry, fence_entry) \
555573
do_stub(initial, atomic_add) \
556574
do_entry(initial, atomic_add, atomic_add_entry, atomic_add_entry) \
557575
do_stub(initial, atomic_xchg) \
@@ -1012,6 +1030,12 @@
10121030
do_entry_array, \
10131031
do_arch_blob, \
10141032
do_arch_entry, do_arch_entry_init) \
1033+
STUBGEN_PREUNIVERSE_BLOBS_DO(do_blob, end_blob, \
1034+
do_stub, \
1035+
do_entry, do_entry_init, \
1036+
do_entry_array, \
1037+
do_arch_blob, \
1038+
do_arch_entry, do_arch_entry_init) \
10151039
STUBGEN_INITIAL_BLOBS_DO(do_blob, end_blob, \
10161040
do_stub, \
10171041
do_entry, do_entry_init, \

src/hotspot/share/runtime/stubRoutines.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,14 @@ static BufferBlob* initialize_stubs(StubGenBlobId blob_id,
220220
const char* buffer_name,
221221
const char* assert_msg) {
222222
ResourceMark rm;
223+
if (code_size == 0) {
224+
LogTarget(Info, stubs) lt;
225+
if (lt.is_enabled()) {
226+
LogStream ls(lt);
227+
ls.print_cr("%s\t not generated", buffer_name);
228+
return nullptr;
229+
}
230+
}
223231
TraceTime timer(timer_msg, TRACETIME_LOG(Info, startuptime));
224232
// Add extra space for large CodeEntryAlignment
225233
int size = code_size + CodeEntryAlignment * max_aligned_stubs;

0 commit comments

Comments
 (0)