8339416: [s390x] Provide implementation for resolve_global_jobject
Reviewed-by: mdoerr, lucy
This commit is contained in:
parent
537447f881
commit
ac58b6102a
@ -105,16 +105,60 @@ void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators
|
||||
}
|
||||
}
|
||||
|
||||
// Generic implementation. GCs can provide an optimized one.
|
||||
void BarrierSetAssembler::resolve_jobject(MacroAssembler* masm, Register value, Register tmp1, Register tmp2) {
|
||||
NearLabel Ldone;
|
||||
__ z_ltgr(tmp1, value);
|
||||
__ z_bre(Ldone); // Use null result as-is.
|
||||
|
||||
__ z_nill(value, ~JNIHandles::tag_mask);
|
||||
__ z_lg(value, 0, value); // Resolve (untagged) jobject.
|
||||
assert_different_registers(value, tmp1, tmp2);
|
||||
NearLabel done, weak_tag, verify, tagged;
|
||||
__ z_ltgr(value, value);
|
||||
__ z_bre(done); // Use null result as-is.
|
||||
|
||||
__ z_tmll(value, JNIHandles::tag_mask);
|
||||
__ z_btrue(tagged); // not zero
|
||||
|
||||
// Resolve Local handle
|
||||
__ access_load_at(T_OBJECT, IN_NATIVE | AS_RAW, Address(value, 0), value, tmp1, tmp2);
|
||||
__ z_bru(verify);
|
||||
|
||||
__ bind(tagged);
|
||||
__ testbit(value, exact_log2(JNIHandles::TypeTag::weak_global)); // test for weak tag
|
||||
__ z_btrue(weak_tag);
|
||||
|
||||
// resolve global handle
|
||||
__ access_load_at(T_OBJECT, IN_NATIVE, Address(value, -JNIHandles::TypeTag::global), value, tmp1, tmp2);
|
||||
__ z_bru(verify);
|
||||
|
||||
__ bind(weak_tag);
|
||||
// resolve jweak.
|
||||
__ access_load_at(T_OBJECT, IN_NATIVE | ON_PHANTOM_OOP_REF,
|
||||
Address(value, -JNIHandles::TypeTag::weak_global), value, tmp1, tmp2);
|
||||
__ bind(verify);
|
||||
__ verify_oop(value, FILE_AND_LINE);
|
||||
__ bind(Ldone);
|
||||
__ bind(done);
|
||||
}
|
||||
|
||||
// Generic implementation. GCs can provide an optimized one.
|
||||
void BarrierSetAssembler::resolve_global_jobject(MacroAssembler* masm, Register value, Register tmp1, Register tmp2) {
|
||||
assert_different_registers(value, tmp1, tmp2);
|
||||
NearLabel done;
|
||||
|
||||
__ z_ltgr(value, value);
|
||||
__ z_bre(done); // use null as-is.
|
||||
|
||||
#ifdef ASSERT
|
||||
{
|
||||
NearLabel valid_global_tag;
|
||||
__ testbit(value, exact_log2(JNIHandles::TypeTag::global)); // test for global tag
|
||||
__ z_btrue(valid_global_tag);
|
||||
__ stop("non global jobject using resolve_global_jobject");
|
||||
__ bind(valid_global_tag);
|
||||
}
|
||||
#endif // ASSERT
|
||||
|
||||
// Resolve global handle
|
||||
__ access_load_at(T_OBJECT, IN_NATIVE, Address(value, -JNIHandles::TypeTag::global), value, tmp1, tmp2);
|
||||
__ verify_oop(value, FILE_AND_LINE);
|
||||
__ bind(done);
|
||||
}
|
||||
|
||||
void BarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler* masm, Register jni_env,
|
||||
|
@ -51,6 +51,7 @@ public:
|
||||
const Address& addr, Register val, Register tmp1, Register tmp2, Register tmp3);
|
||||
|
||||
virtual void resolve_jobject(MacroAssembler* masm, Register value, Register tmp1, Register tmp2);
|
||||
virtual void resolve_global_jobject(MacroAssembler* masm, Register value, Register tmp1, Register tmp2);
|
||||
|
||||
virtual void try_resolve_jobject_in_native(MacroAssembler* masm, Register jni_env,
|
||||
Register obj, Register tmp, Label& slowpath);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2019 SAP SE. All rights reserved.
|
||||
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2024 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,6 +26,7 @@
|
||||
#include "precompiled.hpp"
|
||||
#include "asm/macroAssembler.inline.hpp"
|
||||
#include "gc/shared/modRefBarrierSetAssembler.hpp"
|
||||
#include "runtime/jniHandles.hpp"
|
||||
|
||||
#define __ masm->
|
||||
|
||||
@ -58,3 +59,16 @@ void ModRefBarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet deco
|
||||
BarrierSetAssembler::store_at(masm, decorators, type, dst, val, tmp1, tmp2, tmp3);
|
||||
}
|
||||
}
|
||||
|
||||
void ModRefBarrierSetAssembler::resolve_jobject(MacroAssembler* masm, Register value, Register tmp1, Register tmp2) {
|
||||
NearLabel done;
|
||||
|
||||
__ z_ltgr(value, value);
|
||||
__ z_bre(done); // use null as-is.
|
||||
|
||||
__ z_nill(value, ~JNIHandles::tag_mask);
|
||||
__ z_lg(value, 0, value); // Resolve (untagged) jobject.
|
||||
|
||||
__ verify_oop(value, FILE_AND_LINE);
|
||||
__ bind(done);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018 SAP SE. All rights reserved.
|
||||
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2024 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -48,6 +48,8 @@ public:
|
||||
|
||||
virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
|
||||
const Address& dst, Register val, Register tmp1, Register tmp2, Register tmp3);
|
||||
|
||||
virtual void resolve_jobject(MacroAssembler* masm, Register value, Register tmp1, Register tmp2);
|
||||
};
|
||||
|
||||
#endif // CPU_S390_GC_SHARED_MODREFBARRIERSETASSEMBLER_S390_HPP
|
||||
|
@ -3674,6 +3674,11 @@ void MacroAssembler::resolve_jobject(Register value, Register tmp1, Register tmp
|
||||
bs->resolve_jobject(this, value, tmp1, tmp2);
|
||||
}
|
||||
|
||||
void MacroAssembler::resolve_global_jobject(Register value, Register tmp1, Register tmp2) {
|
||||
BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
|
||||
bs->resolve_global_jobject(this, value, tmp1, tmp2);
|
||||
}
|
||||
|
||||
// Last_Java_sp must comply to the rules in frame_s390.hpp.
|
||||
void MacroAssembler::set_last_Java_frame(Register last_Java_sp, Register last_Java_pc, bool allow_relocation) {
|
||||
BLOCK_COMMENT("set_last_Java_frame {");
|
||||
|
@ -758,6 +758,7 @@ class MacroAssembler: public Assembler {
|
||||
void compiler_fast_unlock_lightweight_object(Register obj, Register tmp1, Register tmp2);
|
||||
|
||||
void resolve_jobject(Register value, Register tmp1, Register tmp2);
|
||||
void resolve_global_jobject(Register value, Register tmp1, Register tmp2);
|
||||
|
||||
// Support for last Java frame (but use call_VM instead where possible).
|
||||
private:
|
||||
@ -819,7 +820,6 @@ class MacroAssembler: public Assembler {
|
||||
void compare_klass_ptr(Register Rop1, int64_t disp, Register Rbase, bool maybenull);
|
||||
|
||||
// Access heap oop, handle encoding and GC barriers.
|
||||
private:
|
||||
void access_store_at(BasicType type, DecoratorSet decorators,
|
||||
const Address& addr, Register val,
|
||||
Register tmp1, Register tmp2, Register tmp3);
|
||||
|
Loading…
Reference in New Issue
Block a user