8381811: [S390] Add support for JDK-8200555

Reviewed-by: mdoerr, amitkumar
This commit is contained in:
Harshit 2026-04-24 08:11:53 +00:00 committed by Martin Doerr
parent d32eb4b47e
commit 7aa7f28af6
6 changed files with 42 additions and 20 deletions

View File

@ -281,6 +281,7 @@ void G1BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorator
if (on_oop && on_reference && L_handle_null == nullptr) { L_handle_null = &done; }
CardTableBarrierSetAssembler::load_at(masm, decorators, type, src, dst, tmp1, tmp2, L_handle_null);
if (on_oop && on_reference) {
assert(tmp1 != noreg && tmp2 != noreg, "need temp registers for G1 pre-barrier");
// Generate the G1 pre-barrier code to log the value of
// the referent field in an SATB buffer.
g1_write_barrier_pre(masm, decorators | IS_NOT_NULL,

View File

@ -411,7 +411,7 @@ void InterpreterMacroAssembler::load_resolved_reference_at_index(Register result
// Load pointer for resolved_references[] objArray.
z_lg(result, in_bytes(ConstantPool::cache_offset()), result);
z_lg(result, in_bytes(ConstantPoolCache::resolved_references_offset()), result);
resolve_oop_handle(result); // Load resolved references array itself.
resolve_oop_handle(result, Z_R0_scratch, Z_R1_scratch); // Load resolved references array itself.
#ifdef ASSERT
NearLabel index_ok;
z_lgf(Z_R0, Address(result, arrayOopDesc::length_offset_in_bytes()));

View File

@ -4705,16 +4705,8 @@ void MacroAssembler::oop_decoder(Register Rdst, Register Rsrc, bool maybenull, R
}
// ((OopHandle)result).resolve();
void MacroAssembler::resolve_oop_handle(Register result) {
// OopHandle::resolve is an indirection.
z_lg(result, 0, result);
}
void MacroAssembler::load_mirror_from_const_method(Register mirror, Register const_method) {
mem2reg_opt(mirror, Address(const_method, ConstMethod::constants_offset()));
mem2reg_opt(mirror, Address(mirror, ConstantPool::pool_holder_offset()));
mem2reg_opt(mirror, Address(mirror, Klass::java_mirror_offset()));
resolve_oop_handle(mirror);
void MacroAssembler::resolve_oop_handle(Register result, Register tmp1, Register tmp2) {
access_load_at(T_OBJECT, IN_NATIVE, Address(result, 0), result, tmp1, tmp2);
}
void MacroAssembler::load_method_holder(Register holder, Register method) {
@ -5886,6 +5878,28 @@ void MacroAssembler::asm_assert_frame_size(Register expected_size, Register tmp,
#endif // ASSERT
}
#ifdef ASSERT
bool is_excluded(Register excluded_register[], Register reg, int n) {
for (int i = 0; i < n; i++) {
if (excluded_register[i] == reg) {
return true;
}
}
return false;
}
void MacroAssembler::clobber_volatile_registers(Register excluded_register[], int n) {
const int magic_number = 0x82;
for (int i = 0; i < 6 /* R0 to R5 */; i++) {
Register reg = as_Register(i);
if (!is_excluded(excluded_register, reg, n)) {
load_const_optimized(reg, magic_number);
}
}
}
#endif // ASSERT
// Save and restore functions: Exclude Z_R0.
void MacroAssembler::save_volatile_regs(Register dst, int offset, bool include_fp, bool include_flags) {
z_stmg(Z_R1, Z_R5, offset, dst); offset += 5 * BytesPerWord;

View File

@ -484,6 +484,10 @@ class MacroAssembler: public Assembler {
// Pop current C frame and restore return PC register (Z_R14).
void pop_frame_restore_retPC(int frame_size_in_bytes);
#ifdef ASSERT
void clobber_volatile_registers(Register excluded_register[], int n);
#endif // ASSERT
//
// Calls
//
@ -885,8 +889,7 @@ class MacroAssembler: public Assembler {
void oop_decoder(Register Rdst, Register Rsrc, bool maybenull,
Register Rbase = Z_R1, int pow2_offset = -1);
void resolve_oop_handle(Register result);
void load_mirror_from_const_method(Register mirror, Register const_method);
void resolve_oop_handle(Register result, Register tmp1, Register tmp2);
void load_method_holder(Register holder, Register method);
//--------------------------

View File

@ -1113,6 +1113,7 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
{
// locals
const Register local_addr = Z_ARG4;
const Register constants_addr = Z_ARG2;
BLOCK_COMMENT("generate_fixed_frame: initialize interpreter state {");
@ -1128,8 +1129,8 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
__ z_stg(Z_R10, _z_ijava_state_neg(sender_sp), fp);
// Load cp cache and save it at the end of this block.
__ z_lg(Z_R1_scratch, Address(const_method, ConstMethod::constants_offset()));
__ z_lg(Z_R1_scratch, Address(Z_R1_scratch, ConstantPool::cache_offset()));
__ z_lg(constants_addr, Address(const_method, ConstMethod::constants_offset()));
__ z_lg(Z_R1_scratch, Address(constants_addr, ConstantPool::cache_offset()));
// z_ijava_state->method = method;
__ z_stg(Z_method, _z_ijava_state_neg(method), fp);
@ -1192,7 +1193,9 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
__ z_stg(Z_R1_scratch, _z_ijava_state_neg(cpoolCache), fp);
// Get mirror and store it in the frame as GC root for this Method*.
__ load_mirror_from_const_method(Z_R1_scratch, const_method);
__ mem2reg_opt(Z_R1_scratch, Address(constants_addr, ConstantPool::pool_holder_offset()));
__ mem2reg_opt(Z_R1_scratch, Address(Z_R1_scratch, Klass::java_mirror_offset()));
__ resolve_oop_handle(Z_R1_scratch, Z_R0_scratch, Z_R1_scratch);
__ z_stg(Z_R1_scratch, _z_ijava_state_neg(mirror), fp);
BLOCK_COMMENT("} generate_fixed_frame: initialize interpreter state");
@ -2028,7 +2031,7 @@ address TemplateInterpreterGenerator::generate_currentThread() {
uint64_t entry_off = __ offset();
__ z_lg(Z_RET, Address(Z_thread, JavaThread::threadObj_offset()));
__ resolve_oop_handle(Z_RET);
__ resolve_oop_handle(Z_RET, Z_R0_scratch, Z_R1_scratch);
// Restore caller sp for c2i case.
__ resize_frame_absolute(Z_R10, Z_R0, true); // Cut the stack back to where the caller started.

View File

@ -480,8 +480,9 @@ void TemplateTable::fast_aldc(LdcType type) {
// Convert null sentinel to null.
__ load_const_optimized(Z_R1_scratch, (intptr_t)Universe::the_null_sentinel_addr());
__ resolve_oop_handle(Z_R1_scratch);
__ z_cg(Z_tos, Address(Z_R1_scratch));
__ z_lg(Z_R1_scratch, Address(Z_R1_scratch));
__ resolve_oop_handle(Z_R1_scratch, Z_R0_scratch, Z_R1_scratch);
__ z_cgr(Z_tos, Z_R1_scratch);
__ z_brne(L_resolved);
__ clear_reg(Z_tos);
__ z_bru(L_resolved);
@ -2478,7 +2479,7 @@ void TemplateTable::load_resolved_field_entry(Register obj,
if (is_static) {
__ load_sized_value(obj, Address(cache, ResolvedFieldEntry::field_holder_offset()), sizeof(void*), false);
__ load_sized_value(obj, Address(obj, in_bytes(Klass::java_mirror_offset())), sizeof(void*), false);
__ resolve_oop_handle(obj);
__ resolve_oop_handle(obj, Z_R0_scratch, Z_R1_scratch);
}
}