8200235: Generalize jniFastGetField jobject/jweak resolve
Reviewed-by: kbarrett, dholmes
This commit is contained in:
parent
2df7aa7b9f
commit
4e252915c5
@ -24,6 +24,7 @@
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "gc/shared/barrierSetAssembler.hpp"
|
||||
#include "runtime/jniHandles.hpp"
|
||||
|
||||
#define __ masm->
|
||||
|
||||
@ -64,3 +65,10 @@ void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators
|
||||
default: Unimplemented();
|
||||
}
|
||||
}
|
||||
|
||||
void BarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler* masm, Register robj, Register tmp, Label& slowpath) {
|
||||
// If mask changes we need to ensure that the inverse is still encodable as an immediate
|
||||
STATIC_ASSERT(JNIHandles::weak_tag_mask == 1);
|
||||
__ andr(robj, robj, ~JNIHandles::weak_tag_mask);
|
||||
__ ldr(robj, Address(robj, 0)); // *obj
|
||||
}
|
||||
|
@ -40,6 +40,8 @@ public:
|
||||
virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
|
||||
Address dst, Register val, Register tmp1, Register tmp2);
|
||||
|
||||
virtual void try_resolve_jobject_in_native(MacroAssembler* masm, Register robj, Register tmp, Label& slowpath);
|
||||
|
||||
virtual void barrier_stubs_init() {}
|
||||
};
|
||||
|
||||
|
@ -25,6 +25,8 @@
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "asm/macroAssembler.hpp"
|
||||
#include "gc/shared/barrierSet.hpp"
|
||||
#include "gc/shared/barrierSetAssembler.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "prims/jniFastGetField.hpp"
|
||||
#include "prims/jvm_misc.hpp"
|
||||
@ -82,11 +84,9 @@ address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
|
||||
// robj ^ rcounter ^ rcounter == robj
|
||||
// robj is address dependent on rcounter.
|
||||
|
||||
// If mask changes we need to ensure that the inverse is still encodable as an immediate
|
||||
STATIC_ASSERT(JNIHandles::weak_tag_mask == 1);
|
||||
__ andr(robj, robj, ~JNIHandles::weak_tag_mask);
|
||||
BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
|
||||
bs->try_resolve_jobject_in_native(masm, robj, rscratch1, slow);
|
||||
|
||||
__ ldr(robj, Address(robj, 0)); // *obj
|
||||
__ lsr(roffset, c_rarg2, 2); // offset
|
||||
|
||||
assert(count < LIST_CAPACITY, "LIST_CAPACITY too small");
|
||||
@ -177,4 +177,3 @@ address JNI_FastGetField::generate_fast_get_float_field() {
|
||||
address JNI_FastGetField::generate_fast_get_double_field() {
|
||||
return generate_fast_get_int_field0(T_DOUBLE);
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "precompiled.hpp"
|
||||
#include "gc/shared/barrierSetAssembler.hpp"
|
||||
#include "interpreter/interp_masm.hpp"
|
||||
#include "runtime/jniHandles.hpp"
|
||||
|
||||
#define __ masm->
|
||||
|
||||
@ -98,3 +99,8 @@ void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators,
|
||||
default: Unimplemented();
|
||||
}
|
||||
}
|
||||
|
||||
void BarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler* masm, Register robj, Register tmp, Label& slowpath) {
|
||||
__ andn (robj, JNIHandles::weak_tag_mask, robj);
|
||||
__ ld_ptr(robj, 0, robj);
|
||||
}
|
||||
|
@ -44,6 +44,9 @@ public:
|
||||
virtual void load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
|
||||
Address src, Register dst, Register tmp);
|
||||
|
||||
// Support for jniFastGetField to try resolving a jobject/jweak in native
|
||||
virtual void try_resolve_jobject_in_native(MacroAssembler* masm, Register robj, Register tmp, Label& slowpath);
|
||||
|
||||
virtual void barrier_stubs_init() {}
|
||||
};
|
||||
|
||||
|
@ -24,6 +24,8 @@
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "asm/macroAssembler.inline.hpp"
|
||||
#include "gc/shared/barrierSet.hpp"
|
||||
#include "gc/shared/barrierSetAssembler.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "prims/jniFastGetField.hpp"
|
||||
#include "prims/jvm_misc.hpp"
|
||||
@ -68,17 +70,18 @@ address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
|
||||
__ andcc (G4, 1, G0);
|
||||
__ br (Assembler::notZero, false, Assembler::pn, label1);
|
||||
__ delayed()->srl (O2, 2, O4);
|
||||
__ andn (O1, JNIHandles::weak_tag_mask, O1);
|
||||
__ ld_ptr (O1, 0, O5);
|
||||
|
||||
BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
|
||||
bs->try_resolve_jobject_in_native(masm, O1, G3_scratch, label1);
|
||||
|
||||
assert(count < LIST_CAPACITY, "LIST_CAPACITY too small");
|
||||
speculative_load_pclist[count] = __ pc();
|
||||
switch (type) {
|
||||
case T_BOOLEAN: __ ldub (O5, O4, G3); break;
|
||||
case T_BYTE: __ ldsb (O5, O4, G3); break;
|
||||
case T_CHAR: __ lduh (O5, O4, G3); break;
|
||||
case T_SHORT: __ ldsh (O5, O4, G3); break;
|
||||
case T_INT: __ ld (O5, O4, G3); break;
|
||||
case T_BOOLEAN: __ ldub (O1, O4, G3); break;
|
||||
case T_BYTE: __ ldsb (O1, O4, G3); break;
|
||||
case T_CHAR: __ lduh (O1, O4, G3); break;
|
||||
case T_SHORT: __ ldsh (O1, O4, G3); break;
|
||||
case T_INT: __ ld (O1, O4, G3); break;
|
||||
default: ShouldNotReachHere();
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "precompiled.hpp"
|
||||
#include "gc/shared/barrierSetAssembler.hpp"
|
||||
#include "interpreter/interp_masm.hpp"
|
||||
#include "runtime/jniHandles.hpp"
|
||||
|
||||
#define __ masm->
|
||||
|
||||
@ -108,3 +109,8 @@ void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators
|
||||
default: Unimplemented();
|
||||
}
|
||||
}
|
||||
|
||||
void BarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler* masm, Register robj, Register tmp, Label& slowpath) {
|
||||
__ clear_jweak_tag(robj);
|
||||
__ movptr(robj, Address(robj, 0));
|
||||
}
|
||||
|
@ -44,6 +44,9 @@ public:
|
||||
virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
|
||||
Address dst, Register val, Register tmp1, Register tmp2);
|
||||
|
||||
// Support for jniFastGetField to try resolving a jobject/jweak in native
|
||||
virtual void try_resolve_jobject_in_native(MacroAssembler* masm, Register robj, Register tmp, Label& slowpath);
|
||||
|
||||
virtual void barrier_stubs_init() {}
|
||||
};
|
||||
|
||||
|
@ -24,6 +24,8 @@
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "asm/macroAssembler.hpp"
|
||||
#include "gc/shared/barrierSet.hpp"
|
||||
#include "gc/shared/barrierSetAssembler.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "prims/jniFastGetField.hpp"
|
||||
#include "prims/jvm_misc.hpp"
|
||||
@ -81,12 +83,12 @@ address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
|
||||
// robj is data dependent on rcounter.
|
||||
}
|
||||
|
||||
__ clear_jweak_tag(robj);
|
||||
|
||||
__ movptr(robj, Address(robj, 0)); // *obj
|
||||
__ mov (roffset, c_rarg2);
|
||||
__ shrptr(roffset, 2); // offset
|
||||
|
||||
BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
|
||||
bs->try_resolve_jobject_in_native(masm, robj, rscratch1, slow);
|
||||
|
||||
assert(count < LIST_CAPACITY, "LIST_CAPACITY too small");
|
||||
speculative_load_pclist[count] = __ pc();
|
||||
switch (type) {
|
||||
|
Loading…
Reference in New Issue
Block a user