Skip to content

Commit faebec6

Browse files
committed
8367532: Declare all stubgen stub entries including internal cross-stub entries
Reviewed-by: fyang, asmehra
1 parent 005f3a3 commit faebec6

File tree

8 files changed

+481
-262
lines changed

8 files changed

+481
-262
lines changed

src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1623,7 +1623,7 @@ class MacroAssembler: public Assembler {
16231623
FloatRegister p, FloatRegister z, FloatRegister t1);
16241624
void ghash_reduce_wide(int index, FloatRegister result, FloatRegister lo, FloatRegister hi,
16251625
FloatRegister p, FloatRegister z, FloatRegister t1);
1626-
void ghash_processBlocks_wide(address p, Register state, Register subkeyH,
1626+
void ghash_processBlocks_wide(Label& p, Register state, Register subkeyH,
16271627
Register data, Register blocks, int unrolls);
16281628

16291629

src/hotspot/cpu/aarch64/macroAssembler_aarch64_aes.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ void MacroAssembler::ghash_modmul(FloatRegister result,
507507
//
508508
// Clobbers all vector registers.
509509
//
510-
void MacroAssembler::ghash_processBlocks_wide(address field_polynomial, Register state,
510+
void MacroAssembler::ghash_processBlocks_wide(Label& field_polynomial, Register state,
511511
Register subkeyH,
512512
Register data, Register blocks, int unrolls) {
513513
int register_stride = 7;
@@ -531,7 +531,10 @@ void MacroAssembler::ghash_processBlocks_wide(address field_polynomial, Register
531531
FloatRegister p = v31;
532532
eor(vzr, T16B, vzr, vzr); // zero register
533533

534-
ldrq(p, field_polynomial); // The field polynomial
534+
// load polynomial via label which must identify local data in the
535+
// same code stub
536+
adr(rscratch1, field_polynomial);
537+
ldrq(p, rscratch1); // The field polynomial
535538

536539
ldrq(v0, Address(state));
537540
ldrq(Hprime, Address(subkeyH));

src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp

Lines changed: 218 additions & 156 deletions
Large diffs are not rendered by default.

src/hotspot/cpu/arm/stubGenerator_arm.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3011,6 +3011,10 @@ class StubGenerator: public StubCodeGenerator {
30113011
// Note: the disjoint stubs must be generated first, some of
30123012
// the conjoint stubs use them.
30133013

3014+
// Note: chaining of stubs does not rely on branching to an
3015+
// auxiliary post-push entry because none of the stubs
3016+
// push/pop a frame.
3017+
30143018
// these need always status in case they are called from generic_arraycopy
30153019
StubRoutines::_jbyte_disjoint_arraycopy = generate_primitive_copy(StubId::stubgen_jbyte_disjoint_arraycopy_id);
30163020
StubRoutines::_jshort_disjoint_arraycopy = generate_primitive_copy(StubId::stubgen_jshort_disjoint_arraycopy_id);
@@ -3024,6 +3028,7 @@ class StubGenerator: public StubCodeGenerator {
30243028
StubRoutines::_arrayof_jlong_disjoint_arraycopy = generate_primitive_copy(StubId::stubgen_arrayof_jlong_disjoint_arraycopy_id);
30253029
StubRoutines::_arrayof_oop_disjoint_arraycopy = generate_oop_copy (StubId::stubgen_arrayof_oop_disjoint_arraycopy_id);
30263030

3031+
// disjoint copy entry is needed by conjoint copy
30273032
// these need always status in case they are called from generic_arraycopy
30283033
StubRoutines::_jbyte_arraycopy = generate_primitive_copy(StubId::stubgen_jbyte_arraycopy_id, StubRoutines::_jbyte_disjoint_arraycopy);
30293034
StubRoutines::_jshort_arraycopy = generate_primitive_copy(StubId::stubgen_jshort_arraycopy_id, StubRoutines::_jshort_disjoint_arraycopy);

src/hotspot/cpu/ppc/stubGenerator_ppc.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3277,8 +3277,12 @@ class StubGenerator: public StubCodeGenerator {
32773277
// register the stub as the default exit with class UnsafeMemoryAccess
32783278
UnsafeMemoryAccess::set_common_exit_stub_pc(StubRoutines::_unsafecopy_common_exit);
32793279

3280-
// Note: the disjoint stubs must be generated first, some of
3281-
// the conjoint stubs use them.
3280+
// Note: the disjoint stubs must be generated first, some of the
3281+
// conjoint stubs use them.
3282+
3283+
// Note: chaining of stubs does not rely on branching to an
3284+
// auxiliary post-push entry because none of the stubs
3285+
// push/pop a frame.
32823286

32833287
// non-aligned disjoint versions
32843288
StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(StubId::stubgen_jbyte_disjoint_arraycopy_id);

src/hotspot/cpu/riscv/stubGenerator_riscv.cpp

Lines changed: 114 additions & 62 deletions
Large diffs are not rendered by default.

src/hotspot/cpu/x86/stubGenerator_x86_64_arraycopy.cpp

Lines changed: 84 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -76,50 +76,95 @@ static uint& get_profile_ctr(int shift) {
7676
#endif // !PRODUCT
7777

7878
void StubGenerator::generate_arraycopy_stubs() {
79-
address entry;
80-
address entry_jbyte_arraycopy;
81-
address entry_jshort_arraycopy;
82-
address entry_jint_arraycopy;
83-
address entry_oop_arraycopy;
84-
address entry_jlong_arraycopy;
85-
address entry_checkcast_arraycopy;
86-
87-
StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(&entry);
88-
StubRoutines::_jbyte_arraycopy = generate_conjoint_byte_copy(entry, &entry_jbyte_arraycopy);
89-
90-
StubRoutines::_jshort_disjoint_arraycopy = generate_disjoint_short_copy(&entry);
91-
StubRoutines::_jshort_arraycopy = generate_conjoint_short_copy(entry, &entry_jshort_arraycopy);
92-
93-
StubRoutines::_jint_disjoint_arraycopy = generate_disjoint_int_oop_copy(StubId::stubgen_jint_disjoint_arraycopy_id, &entry);
94-
StubRoutines::_jint_arraycopy = generate_conjoint_int_oop_copy(StubId::stubgen_jint_arraycopy_id, entry, &entry_jint_arraycopy);
79+
// Some copy stubs publish a normal entry and then a 2nd 'fallback'
80+
// entry immediately following their stack push. This can be used
81+
// as a post-push branch target for compatible stubs when they
82+
// identify a special case that can be handled by the fallback
83+
// stub e.g a disjoint copy stub may be use as a special case
84+
// fallback for its compatible conjoint copy stub.
85+
//
86+
// A no push entry is always returned in the following local and
87+
// then published by assigning to the appropriate entry field in
88+
// class StubRoutines. The entry value is then passed to the
89+
// generator for the compatible stub. That means the entry must be
90+
// listed when saving to/restoring from the AOT cache, ensuring
91+
// that the inter-stub jumps are noted at AOT-cache save and
92+
// relocated at AOT cache load.
93+
address nopush_entry;
94+
95+
StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(&nopush_entry);
96+
// disjoint nopush entry is needed by conjoint copy
97+
StubRoutines::_jbyte_disjoint_arraycopy_nopush = nopush_entry;
98+
StubRoutines::_jbyte_arraycopy = generate_conjoint_byte_copy(StubRoutines::_jbyte_disjoint_arraycopy_nopush, &nopush_entry);
99+
// conjoint nopush entry is needed by generic/unsafe copy
100+
StubRoutines::_jbyte_arraycopy_nopush = nopush_entry;
101+
102+
StubRoutines::_jshort_disjoint_arraycopy = generate_disjoint_short_copy(&nopush_entry);
103+
// disjoint nopush entry is needed by conjoint copy
104+
StubRoutines::_jshort_disjoint_arraycopy_nopush = nopush_entry;
105+
StubRoutines::_jshort_arraycopy = generate_conjoint_short_copy(StubRoutines::_jshort_disjoint_arraycopy_nopush, &nopush_entry);
106+
// conjoint nopush entry is needed by generic/unsafe copy
107+
StubRoutines::_jshort_arraycopy_nopush = nopush_entry;
108+
109+
StubRoutines::_jint_disjoint_arraycopy = generate_disjoint_int_oop_copy(StubId::stubgen_jint_disjoint_arraycopy_id, &nopush_entry);
110+
// disjoint nopush entry is needed by conjoint copy
111+
StubRoutines::_jint_disjoint_arraycopy_nopush = nopush_entry;
112+
StubRoutines::_jint_arraycopy = generate_conjoint_int_oop_copy(StubId::stubgen_jint_arraycopy_id, StubRoutines::_jint_disjoint_arraycopy_nopush, &nopush_entry);
113+
// conjoint nopush entry is needed by generic/unsafe copy
114+
StubRoutines::_jint_arraycopy_nopush = nopush_entry;
115+
116+
StubRoutines::_jlong_disjoint_arraycopy = generate_disjoint_long_oop_copy(StubId::stubgen_jlong_disjoint_arraycopy_id, &nopush_entry);
117+
// disjoint nopush entry is needed by conjoint copy
118+
StubRoutines::_jlong_disjoint_arraycopy_nopush = nopush_entry;
119+
StubRoutines::_jlong_arraycopy = generate_conjoint_long_oop_copy(StubId::stubgen_jlong_arraycopy_id, StubRoutines::_jlong_disjoint_arraycopy_nopush, &nopush_entry);
120+
// conjoint nopush entry is needed by generic/unsafe copy
121+
StubRoutines::_jlong_arraycopy_nopush = nopush_entry;
95122

96-
StubRoutines::_jlong_disjoint_arraycopy = generate_disjoint_long_oop_copy(StubId::stubgen_jlong_disjoint_arraycopy_id, &entry);
97-
StubRoutines::_jlong_arraycopy = generate_conjoint_long_oop_copy(StubId::stubgen_jlong_arraycopy_id, entry, &entry_jlong_arraycopy);
98123
if (UseCompressedOops) {
99-
StubRoutines::_oop_disjoint_arraycopy = generate_disjoint_int_oop_copy(StubId::stubgen_oop_disjoint_arraycopy_id, &entry);
100-
StubRoutines::_oop_arraycopy = generate_conjoint_int_oop_copy(StubId::stubgen_oop_arraycopy_id, entry, &entry_oop_arraycopy);
101-
StubRoutines::_oop_disjoint_arraycopy_uninit = generate_disjoint_int_oop_copy(StubId::stubgen_oop_disjoint_arraycopy_uninit_id, &entry);
102-
StubRoutines::_oop_arraycopy_uninit = generate_conjoint_int_oop_copy(StubId::stubgen_oop_arraycopy_uninit_id, entry, nullptr);
124+
StubRoutines::_oop_disjoint_arraycopy = generate_disjoint_int_oop_copy(StubId::stubgen_oop_disjoint_arraycopy_id, &nopush_entry);
125+
// disjoint nopush entry is needed by conjoint copy
126+
StubRoutines::_oop_disjoint_arraycopy_nopush = nopush_entry;
127+
StubRoutines::_oop_arraycopy = generate_conjoint_int_oop_copy(StubId::stubgen_oop_arraycopy_id, StubRoutines::_oop_disjoint_arraycopy_nopush, &nopush_entry);
128+
// conjoint nopush entry is needed by generic/unsafe copy
129+
StubRoutines::_oop_arraycopy_nopush = nopush_entry;
130+
StubRoutines::_oop_disjoint_arraycopy_uninit = generate_disjoint_int_oop_copy(StubId::stubgen_oop_disjoint_arraycopy_uninit_id, &nopush_entry);
131+
// disjoint nopush entry is needed by conjoint copy
132+
StubRoutines::_oop_disjoint_arraycopy_uninit_nopush = nopush_entry;
133+
// note that we don't need a returned nopush entry because the
134+
// generic/unsafe copy does not cater for uninit arrays.
135+
StubRoutines::_oop_arraycopy_uninit = generate_conjoint_int_oop_copy(StubId::stubgen_oop_arraycopy_uninit_id, StubRoutines::_oop_disjoint_arraycopy_uninit_nopush, nullptr);
103136
} else {
104-
StubRoutines::_oop_disjoint_arraycopy = generate_disjoint_long_oop_copy(StubId::stubgen_oop_disjoint_arraycopy_id, &entry);
105-
StubRoutines::_oop_arraycopy = generate_conjoint_long_oop_copy(StubId::stubgen_oop_arraycopy_id, entry, &entry_oop_arraycopy);
106-
StubRoutines::_oop_disjoint_arraycopy_uninit = generate_disjoint_long_oop_copy(StubId::stubgen_oop_disjoint_arraycopy_uninit_id, &entry);
107-
StubRoutines::_oop_arraycopy_uninit = generate_conjoint_long_oop_copy(StubId::stubgen_oop_arraycopy_uninit_id, entry, nullptr);
108-
}
109-
110-
StubRoutines::_checkcast_arraycopy = generate_checkcast_copy(StubId::stubgen_checkcast_arraycopy_id, &entry_checkcast_arraycopy);
137+
StubRoutines::_oop_disjoint_arraycopy = generate_disjoint_long_oop_copy(StubId::stubgen_oop_disjoint_arraycopy_id, &nopush_entry);
138+
// disjoint nopush entry is needed by conjoint copy
139+
StubRoutines::_oop_disjoint_arraycopy_nopush = nopush_entry;
140+
StubRoutines::_oop_arraycopy = generate_conjoint_long_oop_copy(StubId::stubgen_oop_arraycopy_id, StubRoutines::_oop_disjoint_arraycopy_nopush, &nopush_entry);
141+
// conjoint nopush entry is needed by generic/unsafe copy
142+
StubRoutines::_oop_arraycopy_nopush = nopush_entry;
143+
StubRoutines::_oop_disjoint_arraycopy_uninit = generate_disjoint_long_oop_copy(StubId::stubgen_oop_disjoint_arraycopy_uninit_id, &nopush_entry);
144+
// disjoint nopush entry is needed by conjoint copy
145+
StubRoutines::_oop_disjoint_arraycopy_uninit_nopush = nopush_entry;
146+
// note that we don't need a returned nopush entry because the
147+
// generic/unsafe copy does not cater for uninit arrays.
148+
StubRoutines::_oop_arraycopy_uninit = generate_conjoint_long_oop_copy(StubId::stubgen_oop_arraycopy_uninit_id, StubRoutines::_oop_disjoint_arraycopy_uninit_nopush, nullptr);
149+
}
150+
151+
StubRoutines::_checkcast_arraycopy = generate_checkcast_copy(StubId::stubgen_checkcast_arraycopy_id, &nopush_entry);
152+
// checkcast nopush entry is needed by generic copy
153+
StubRoutines::_checkcast_arraycopy_nopush = nopush_entry;
154+
// note that we don't need a returned nopush entry because the
155+
// generic copy does not cater for uninit arrays.
111156
StubRoutines::_checkcast_arraycopy_uninit = generate_checkcast_copy(StubId::stubgen_checkcast_arraycopy_uninit_id, nullptr);
112157

113-
StubRoutines::_unsafe_arraycopy = generate_unsafe_copy(entry_jbyte_arraycopy,
114-
entry_jshort_arraycopy,
115-
entry_jint_arraycopy,
116-
entry_jlong_arraycopy);
117-
StubRoutines::_generic_arraycopy = generate_generic_copy(entry_jbyte_arraycopy,
118-
entry_jshort_arraycopy,
119-
entry_jint_arraycopy,
120-
entry_oop_arraycopy,
121-
entry_jlong_arraycopy,
122-
entry_checkcast_arraycopy);
158+
StubRoutines::_unsafe_arraycopy = generate_unsafe_copy(StubRoutines::_jbyte_arraycopy_nopush,
159+
StubRoutines::_jshort_arraycopy_nopush,
160+
StubRoutines::_jint_arraycopy_nopush,
161+
StubRoutines::_jlong_arraycopy_nopush);
162+
StubRoutines::_generic_arraycopy = generate_generic_copy(StubRoutines::_jbyte_arraycopy_nopush,
163+
StubRoutines::_jshort_arraycopy_nopush,
164+
StubRoutines::_jint_arraycopy_nopush,
165+
StubRoutines::_oop_arraycopy_nopush,
166+
StubRoutines::_jlong_arraycopy_nopush,
167+
StubRoutines::_checkcast_arraycopy_nopush);
123168

124169
StubRoutines::_jbyte_fill = generate_fill(StubId::stubgen_jbyte_fill_id);
125170
StubRoutines::_jshort_fill = generate_fill(StubId::stubgen_jshort_fill_id);

0 commit comments

Comments
 (0)