8209408: Primitive heap access for interpreter BarrierSetAssembler/arm32

Reviewed-by: rkennke
This commit is contained in:
Boris Ulasevich 2018-09-03 13:42:58 +03:00
parent bf7cd96146
commit d2e84521c0
5 changed files with 205 additions and 117 deletions

View file

@ -50,6 +50,43 @@ void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators,
} }
break; break;
} }
case T_BOOLEAN: __ ldrb (dst, src); break;
case T_BYTE: __ ldrsb (dst, src); break;
case T_CHAR: __ ldrh (dst, src); break;
case T_SHORT: __ ldrsh (dst, src); break;
case T_INT: __ ldr_s32 (dst, src); break;
case T_ADDRESS: __ ldr (dst, src); break;
case T_LONG:
#ifdef AARCH64
__ ldr (dst, src); break;
#else
assert(dst == noreg, "only to ltos");
__ add (src.index(), src.index(), src.base());
__ ldmia (src.index(), RegisterSet(R0_tos_lo) | RegisterSet(R1_tos_hi));
#endif // AARCH64
break;
#ifdef __SOFTFP__
case T_FLOAT:
assert(dst == noreg, "only to ftos");
__ ldr (R0_tos, src);
break;
case T_DOUBLE:
assert(dst == noreg, "only to dtos");
__ add (src.index(), src.index(), src.base());
__ ldmia (src.index(), RegisterSet(R0_tos_lo) | RegisterSet(R1_tos_hi));
break;
#else
case T_FLOAT:
assert(dst == noreg, "only to ftos");
__ add(src.index(), src.index(), src.base());
__ ldr_float (S0_tos, src.index());
break;
case T_DOUBLE:
assert(dst == noreg, "only to dtos");
__ add (src.index(), src.index(), src.base());
__ ldr_double (D0_tos, src.index());
break;
#endif
default: Unimplemented(); default: Unimplemented();
} }
@ -81,6 +118,46 @@ void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators
} }
break; break;
} }
case T_BOOLEAN:
__ and_32(val, val, 1);
__ strb(val, obj);
break;
case T_BYTE: __ strb (val, obj); break;
case T_CHAR: __ strh (val, obj); break;
case T_SHORT: __ strh (val, obj); break;
case T_INT: __ str (val, obj); break;
case T_ADDRESS: __ str (val, obj); break;
case T_LONG:
#ifdef AARCH64
__ str (val, obj); break;
#else // AARCH64
assert(val == noreg, "only tos");
__ add (obj.index(), obj.index(), obj.base());
__ stmia (obj.index(), RegisterSet(R0_tos_lo) | RegisterSet(R1_tos_hi));
#endif // AARCH64
break;
#ifdef __SOFTFP__
case T_FLOAT:
assert(val == noreg, "only tos");
__ str (R0_tos, obj);
break;
case T_DOUBLE:
assert(val == noreg, "only tos");
__ add (obj.index(), obj.index(), obj.base());
__ stmia (obj.index(), RegisterSet(R0_tos_lo) | RegisterSet(R1_tos_hi));
break;
#else
case T_FLOAT:
assert(val == noreg, "only tos");
__ add (obj.index(), obj.index(), obj.base());
__ str_float (S0_tos, obj.index());
break;
case T_DOUBLE:
assert(val == noreg, "only tos");
__ add (obj.index(), obj.index(), obj.base());
__ str_double (D0_tos, obj.index());
break;
#endif
default: Unimplemented(); default: Unimplemented();
} }
} }

View file

@ -302,8 +302,9 @@ void InterpreterMacroAssembler::load_resolved_reference_at_index(
// Add in the index // Add in the index
// convert from field index to resolved_references() index and from // convert from field index to resolved_references() index and from
// word index to byte offset. Since this is a java object, it can be compressed // word index to byte offset. Since this is a java object, it can be compressed
add(cache, cache, AsmOperand(index, lsl, LogBytesPerHeapOop)); logical_shift_left(index, index, LogBytesPerHeapOop);
load_heap_oop(result, Address(cache, arrayOopDesc::base_offset_in_bytes(T_OBJECT))); add(index, index, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
load_heap_oop(result, Address(cache, index));
} }
void InterpreterMacroAssembler::load_resolved_klass_at_offset( void InterpreterMacroAssembler::load_resolved_klass_at_offset(

View file

@ -162,7 +162,7 @@ void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm,
__ load_heap_oop(Rmethod, Address(tmp, NONZERO(java_lang_invoke_MemberName::method_offset_in_bytes()))); __ load_heap_oop(Rmethod, Address(tmp, NONZERO(java_lang_invoke_MemberName::method_offset_in_bytes())));
__ verify_oop(Rmethod); __ verify_oop(Rmethod);
__ ldr(Rmethod, Address(Rmethod, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset_in_bytes()))); __ access_load_at(T_ADDRESS, IN_HEAP, Address(Rmethod, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset_in_bytes())), Rmethod, noreg, noreg, noreg);
if (VerifyMethodHandles && !for_compiler_entry) { if (VerifyMethodHandles && !for_compiler_entry) {
// make sure recv is already on stack // make sure recv is already on stack
@ -381,7 +381,7 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
verify_ref_kind(_masm, JVM_REF_invokeSpecial, member_reg, temp3); verify_ref_kind(_masm, JVM_REF_invokeSpecial, member_reg, temp3);
} }
__ load_heap_oop(Rmethod, member_vmtarget); __ load_heap_oop(Rmethod, member_vmtarget);
__ ldr(Rmethod, vmtarget_method); __ access_load_at(T_ADDRESS, IN_HEAP, vmtarget_method, Rmethod, noreg, noreg, noreg);
break; break;
case vmIntrinsics::_linkToStatic: case vmIntrinsics::_linkToStatic:
@ -389,7 +389,7 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
verify_ref_kind(_masm, JVM_REF_invokeStatic, member_reg, temp3); verify_ref_kind(_masm, JVM_REF_invokeStatic, member_reg, temp3);
} }
__ load_heap_oop(Rmethod, member_vmtarget); __ load_heap_oop(Rmethod, member_vmtarget);
__ ldr(Rmethod, vmtarget_method); __ access_load_at(T_ADDRESS, IN_HEAP, vmtarget_method, Rmethod, noreg, noreg, noreg);
break; break;
break; break;
@ -404,7 +404,7 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
// pick out the vtable index from the MemberName, and then we can discard it: // pick out the vtable index from the MemberName, and then we can discard it:
Register temp2_index = temp2; Register temp2_index = temp2;
__ ldr(temp2_index, member_vmindex); __ access_load_at(T_ADDRESS, IN_HEAP, member_vmindex, temp2_index, noreg, noreg, noreg);
if (VerifyMethodHandles) { if (VerifyMethodHandles) {
Label L_index_ok; Label L_index_ok;
@ -436,7 +436,7 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
__ verify_klass_ptr(temp3_intf); __ verify_klass_ptr(temp3_intf);
Register rbx_index = rbx_method; Register rbx_index = rbx_method;
__ ldr(rbx_index, member_vmindex); __ access_load_at(T_ADDRESS, IN_HEAP, member_vmindex, rbx_index, noreg, noreg, noreg);
if (VerifyMethodHandles) { if (VerifyMethodHandles) {
Label L; Label L;
__ cmp(rbx_index, 0); __ cmp(rbx_index, 0);

View file

@ -161,6 +161,18 @@ Address TemplateTable::get_array_elem_addr(BasicType elemType, Register array, R
return Address(temp, arrayOopDesc::base_offset_in_bytes(elemType)); return Address(temp, arrayOopDesc::base_offset_in_bytes(elemType));
} }
// Returns address of Java array element using temp register as offset from array base
Address TemplateTable::get_array_elem_addr_same_base(BasicType elemType, Register array, Register index, Register temp) {
int logElemSize = exact_log2(type2aelembytes(elemType));
if (logElemSize == 0) {
__ add(temp, index, arrayOopDesc::base_offset_in_bytes(elemType));
} else {
__ mov(temp, arrayOopDesc::base_offset_in_bytes(elemType));
__ add_ptr_scaled_int32(temp, temp, index, logElemSize);
}
return Address(array, temp);
}
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Condition conversion // Condition conversion
AsmCondition convNegCond(TemplateTable::Condition cc) { AsmCondition convNegCond(TemplateTable::Condition cc) {
@ -883,7 +895,8 @@ void TemplateTable::iaload() {
const Register Rindex = R0_tos; const Register Rindex = R0_tos;
index_check(Rarray, Rindex); index_check(Rarray, Rindex);
__ ldr_s32(R0_tos, get_array_elem_addr(T_INT, Rarray, Rindex, Rtemp)); Address addr = get_array_elem_addr_same_base(T_INT, Rarray, Rindex, Rtemp);
__ access_load_at(T_INT, IN_HEAP | IS_ARRAY, addr, R0_tos, noreg, noreg, noreg);
} }
@ -897,9 +910,8 @@ void TemplateTable::laload() {
#ifdef AARCH64 #ifdef AARCH64
__ ldr(R0_tos, get_array_elem_addr(T_LONG, Rarray, Rindex, Rtemp)); __ ldr(R0_tos, get_array_elem_addr(T_LONG, Rarray, Rindex, Rtemp));
#else #else
__ add(Rtemp, Rarray, AsmOperand(Rindex, lsl, LogBytesPerLong)); Address addr = get_array_elem_addr_same_base(T_LONG, Rarray, Rindex, Rtemp);
__ add(Rtemp, Rtemp, arrayOopDesc::base_offset_in_bytes(T_LONG)); __ access_load_at(T_LONG, IN_HEAP | IS_ARRAY, addr, noreg /* ltos */, noreg, noreg, noreg);
__ ldmia(Rtemp, RegisterSet(R0_tos_lo, R1_tos_hi));
#endif // AARCH64 #endif // AARCH64
} }
@ -911,12 +923,8 @@ void TemplateTable::faload() {
index_check(Rarray, Rindex); index_check(Rarray, Rindex);
Address addr = get_array_elem_addr(T_FLOAT, Rarray, Rindex, Rtemp); Address addr = get_array_elem_addr_same_base(T_FLOAT, Rarray, Rindex, Rtemp);
#ifdef __SOFTFP__ __ access_load_at(T_FLOAT, IN_HEAP | IS_ARRAY, addr, noreg /* ftos */, noreg, noreg, noreg);
__ ldr(R0_tos, addr);
#else
__ ldr_float(S0_tos, addr);
#endif // __SOFTFP__
} }
@ -927,13 +935,8 @@ void TemplateTable::daload() {
index_check(Rarray, Rindex); index_check(Rarray, Rindex);
#ifdef __SOFTFP__ Address addr = get_array_elem_addr_same_base(T_DOUBLE, Rarray, Rindex, Rtemp);
__ add(Rtemp, Rarray, AsmOperand(Rindex, lsl, LogBytesPerLong)); __ access_load_at(T_DOUBLE, IN_HEAP | IS_ARRAY, addr, noreg /* dtos */, noreg, noreg, noreg);
__ add(Rtemp, Rtemp, arrayOopDesc::base_offset_in_bytes(T_DOUBLE));
__ ldmia(Rtemp, RegisterSet(R0_tos_lo, R1_tos_hi));
#else
__ ldr_double(D0_tos, get_array_elem_addr(T_DOUBLE, Rarray, Rindex, Rtemp));
#endif // __SOFTFP__
} }
@ -943,7 +946,7 @@ void TemplateTable::aaload() {
const Register Rindex = R0_tos; const Register Rindex = R0_tos;
index_check(Rarray, Rindex); index_check(Rarray, Rindex);
do_oop_load(_masm, R0_tos, get_array_elem_addr(T_OBJECT, Rarray, Rindex, Rtemp), IS_ARRAY); do_oop_load(_masm, R0_tos, get_array_elem_addr_same_base(T_OBJECT, Rarray, Rindex, Rtemp), IS_ARRAY);
} }
@ -953,7 +956,8 @@ void TemplateTable::baload() {
const Register Rindex = R0_tos; const Register Rindex = R0_tos;
index_check(Rarray, Rindex); index_check(Rarray, Rindex);
__ ldrsb(R0_tos, get_array_elem_addr(T_BYTE, Rarray, Rindex, Rtemp)); Address addr = get_array_elem_addr_same_base(T_BYTE, Rarray, Rindex, Rtemp);
__ access_load_at(T_BYTE, IN_HEAP | IS_ARRAY, addr, R0_tos, noreg, noreg, noreg);
} }
@ -963,7 +967,8 @@ void TemplateTable::caload() {
const Register Rindex = R0_tos; const Register Rindex = R0_tos;
index_check(Rarray, Rindex); index_check(Rarray, Rindex);
__ ldrh(R0_tos, get_array_elem_addr(T_CHAR, Rarray, Rindex, Rtemp)); Address addr = get_array_elem_addr_same_base(T_CHAR, Rarray, Rindex, Rtemp);
__ access_load_at(T_CHAR, IN_HEAP | IS_ARRAY, addr, R0_tos, noreg, noreg, noreg);
} }
@ -983,7 +988,8 @@ void TemplateTable::fast_icaload() {
// get array element // get array element
index_check(Rarray, Rindex); index_check(Rarray, Rindex);
__ ldrh(R0_tos, get_array_elem_addr(T_CHAR, Rarray, Rindex, Rtemp)); Address addr = get_array_elem_addr_same_base(T_CHAR, Rarray, Rindex, Rtemp);
__ access_load_at(T_CHAR, IN_HEAP | IS_ARRAY, addr, R0_tos, noreg, noreg, noreg);
} }
@ -993,7 +999,8 @@ void TemplateTable::saload() {
const Register Rindex = R0_tos; const Register Rindex = R0_tos;
index_check(Rarray, Rindex); index_check(Rarray, Rindex);
__ ldrsh(R0_tos, get_array_elem_addr(T_SHORT, Rarray, Rindex, Rtemp)); Address addr = get_array_elem_addr_same_base(T_SHORT, Rarray, Rindex, Rtemp);
__ access_load_at(T_SHORT, IN_HEAP | IS_ARRAY, addr, R0_tos, noreg, noreg, noreg);
} }
@ -1231,7 +1238,8 @@ void TemplateTable::iastore() {
__ pop_i(Rindex); __ pop_i(Rindex);
index_check(Rarray, Rindex); index_check(Rarray, Rindex);
__ str_32(R0_tos, get_array_elem_addr(T_INT, Rarray, Rindex, Rtemp)); Address addr = get_array_elem_addr_same_base(T_INT, Rarray, Rindex, Rtemp);
__ access_store_at(T_INT, IN_HEAP | IS_ARRAY, addr, R0_tos, noreg, noreg, noreg, false);
} }
@ -1247,9 +1255,8 @@ void TemplateTable::lastore() {
#ifdef AARCH64 #ifdef AARCH64
__ str(R0_tos, get_array_elem_addr(T_LONG, Rarray, Rindex, Rtemp)); __ str(R0_tos, get_array_elem_addr(T_LONG, Rarray, Rindex, Rtemp));
#else #else
__ add(Rtemp, Rarray, AsmOperand(Rindex, lsl, LogBytesPerLong)); Address addr = get_array_elem_addr_same_base(T_LONG, Rarray, Rindex, Rtemp);
__ add(Rtemp, Rtemp, arrayOopDesc::base_offset_in_bytes(T_LONG)); __ access_store_at(T_LONG, IN_HEAP | IS_ARRAY, addr, noreg /* ltos */, noreg, noreg, noreg, false);
__ stmia(Rtemp, RegisterSet(R0_tos_lo, R1_tos_hi));
#endif // AARCH64 #endif // AARCH64
} }
@ -1262,13 +1269,8 @@ void TemplateTable::fastore() {
__ pop_i(Rindex); __ pop_i(Rindex);
index_check(Rarray, Rindex); index_check(Rarray, Rindex);
Address addr = get_array_elem_addr(T_FLOAT, Rarray, Rindex, Rtemp); Address addr = get_array_elem_addr_same_base(T_FLOAT, Rarray, Rindex, Rtemp);
__ access_store_at(T_FLOAT, IN_HEAP | IS_ARRAY, addr, noreg /* ftos */, noreg, noreg, noreg, false);
#ifdef __SOFTFP__
__ str(R0_tos, addr);
#else
__ str_float(S0_tos, addr);
#endif // __SOFTFP__
} }
@ -1281,13 +1283,8 @@ void TemplateTable::dastore() {
__ pop_i(Rindex); __ pop_i(Rindex);
index_check(Rarray, Rindex); index_check(Rarray, Rindex);
#ifdef __SOFTFP__ Address addr = get_array_elem_addr_same_base(T_DOUBLE, Rarray, Rindex, Rtemp);
__ add(Rtemp, Rarray, AsmOperand(Rindex, lsl, LogBytesPerLong)); __ access_store_at(T_DOUBLE, IN_HEAP | IS_ARRAY, addr, noreg /* dtos */, noreg, noreg, noreg, false);
__ add(Rtemp, Rtemp, arrayOopDesc::base_offset_in_bytes(T_DOUBLE));
__ stmia(Rtemp, RegisterSet(R0_tos_lo, R1_tos_hi));
#else
__ str_double(D0_tos, get_array_elem_addr(T_DOUBLE, Rarray, Rindex, Rtemp));
#endif // __SOFTFP__
} }
@ -1370,7 +1367,8 @@ void TemplateTable::bastore() {
__ b(L_skip, eq); __ b(L_skip, eq);
__ and_32(R0_tos, R0_tos, 1); // if it is a T_BOOLEAN array, mask the stored value to 0/1 __ and_32(R0_tos, R0_tos, 1); // if it is a T_BOOLEAN array, mask the stored value to 0/1
__ bind(L_skip); __ bind(L_skip);
__ strb(R0_tos, get_array_elem_addr(T_BYTE, Rarray, Rindex, Rtemp)); Address addr = get_array_elem_addr_same_base(T_BYTE, Rarray, Rindex, Rtemp);
__ access_store_at(T_BYTE, IN_HEAP | IS_ARRAY, addr, R0_tos, noreg, noreg, noreg, false);
} }
@ -1382,8 +1380,8 @@ void TemplateTable::castore() {
__ pop_i(Rindex); __ pop_i(Rindex);
index_check(Rarray, Rindex); index_check(Rarray, Rindex);
Address addr = get_array_elem_addr_same_base(T_CHAR, Rarray, Rindex, Rtemp);
__ strh(R0_tos, get_array_elem_addr(T_CHAR, Rarray, Rindex, Rtemp)); __ access_store_at(T_CHAR, IN_HEAP | IS_ARRAY, addr, R0_tos, noreg, noreg, noreg, false);
} }
@ -3182,7 +3180,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
// modes. // modes.
// Size of fixed size code block for fast_version // Size of fixed size code block for fast_version
const int log_max_block_size = 2; const int log_max_block_size = AARCH64_ONLY(2) NOT_AARCH64(3);
const int max_block_size = 1 << log_max_block_size; const int max_block_size = 1 << log_max_block_size;
// Decide if fast version is enabled // Decide if fast version is enabled
@ -3249,7 +3247,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
assert(btos == seq++, "btos has unexpected value"); assert(btos == seq++, "btos has unexpected value");
FixedSizeCodeBlock btos_block(_masm, max_block_size, fast_version); FixedSizeCodeBlock btos_block(_masm, max_block_size, fast_version);
__ bind(Lbtos); __ bind(Lbtos);
__ ldrsb(R0_tos, Address(Robj, Roffset)); __ access_load_at(T_BYTE, IN_HEAP, Address(Robj, Roffset), R0_tos, noreg, noreg, noreg);
__ push(btos); __ push(btos);
// Rewrite bytecode to be faster // Rewrite bytecode to be faster
if (!is_static && rc == may_rewrite) { if (!is_static && rc == may_rewrite) {
@ -3263,7 +3261,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
assert(ztos == seq++, "btos has unexpected value"); assert(ztos == seq++, "btos has unexpected value");
FixedSizeCodeBlock ztos_block(_masm, max_block_size, fast_version); FixedSizeCodeBlock ztos_block(_masm, max_block_size, fast_version);
__ bind(Lztos); __ bind(Lztos);
__ ldrsb(R0_tos, Address(Robj, Roffset)); __ access_load_at(T_BOOLEAN, IN_HEAP, Address(Robj, Roffset), R0_tos, noreg, noreg, noreg);
__ push(ztos); __ push(ztos);
// Rewrite bytecode to be faster (use btos fast getfield) // Rewrite bytecode to be faster (use btos fast getfield)
if (!is_static && rc == may_rewrite) { if (!is_static && rc == may_rewrite) {
@ -3277,7 +3275,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
assert(ctos == seq++, "ctos has unexpected value"); assert(ctos == seq++, "ctos has unexpected value");
FixedSizeCodeBlock ctos_block(_masm, max_block_size, fast_version); FixedSizeCodeBlock ctos_block(_masm, max_block_size, fast_version);
__ bind(Lctos); __ bind(Lctos);
__ ldrh(R0_tos, Address(Robj, Roffset)); __ access_load_at(T_CHAR, IN_HEAP, Address(Robj, Roffset), R0_tos, noreg, noreg, noreg);
__ push(ctos); __ push(ctos);
if (!is_static && rc == may_rewrite) { if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_cgetfield, R0_tmp, Rtemp); patch_bytecode(Bytecodes::_fast_cgetfield, R0_tmp, Rtemp);
@ -3290,7 +3288,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
assert(stos == seq++, "stos has unexpected value"); assert(stos == seq++, "stos has unexpected value");
FixedSizeCodeBlock stos_block(_masm, max_block_size, fast_version); FixedSizeCodeBlock stos_block(_masm, max_block_size, fast_version);
__ bind(Lstos); __ bind(Lstos);
__ ldrsh(R0_tos, Address(Robj, Roffset)); __ access_load_at(T_SHORT, IN_HEAP, Address(Robj, Roffset), R0_tos, noreg, noreg, noreg);
__ push(stos); __ push(stos);
if (!is_static && rc == may_rewrite) { if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_sgetfield, R0_tmp, Rtemp); patch_bytecode(Bytecodes::_fast_sgetfield, R0_tmp, Rtemp);
@ -3314,8 +3312,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
#ifdef AARCH64 #ifdef AARCH64
__ ldr(R0_tos, Address(Robj, Roffset)); __ ldr(R0_tos, Address(Robj, Roffset));
#else #else
__ add(Roffset, Robj, Roffset); __ access_load_at(T_LONG, IN_HEAP, Address(Robj, Roffset), noreg /* ltos */, noreg, noreg, noreg);
__ ldmia(Roffset, RegisterSet(R0_tos_lo, R1_tos_hi));
#endif // AARCH64 #endif // AARCH64
__ push(ltos); __ push(ltos);
if (!is_static && rc == may_rewrite) { if (!is_static && rc == may_rewrite) {
@ -3331,7 +3328,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
__ bind(Lftos); __ bind(Lftos);
// floats and ints are placed on stack in same way, so // floats and ints are placed on stack in same way, so
// we can use push(itos) to transfer value without using VFP // we can use push(itos) to transfer value without using VFP
__ ldr_u32(R0_tos, Address(Robj, Roffset)); __ access_load_at(T_INT, IN_HEAP, Address(Robj, Roffset), R0_tos, noreg, noreg, noreg);
__ push(itos); __ push(itos);
if (!is_static && rc == may_rewrite) { if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_fgetfield, R0_tmp, Rtemp); patch_bytecode(Bytecodes::_fast_fgetfield, R0_tmp, Rtemp);
@ -3349,8 +3346,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
#ifdef AARCH64 #ifdef AARCH64
__ ldr(R0_tos, Address(Robj, Roffset)); __ ldr(R0_tos, Address(Robj, Roffset));
#else #else
__ add(Rtemp, Robj, Roffset); __ access_load_at(T_LONG, IN_HEAP, Address(Robj, Roffset), noreg /* ltos */, noreg, noreg, noreg);
__ ldmia(Rtemp, RegisterSet(R0_tos_lo, R1_tos_hi));
#endif // AARCH64 #endif // AARCH64
__ push(ltos); __ push(ltos);
if (!is_static && rc == may_rewrite) { if (!is_static && rc == may_rewrite) {
@ -3385,7 +3381,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
// atos case can be merged with itos case (and thus moved out of table switch) on 32-bit ARM, fast version only // atos case can be merged with itos case (and thus moved out of table switch) on 32-bit ARM, fast version only
__ bind(Lint); __ bind(Lint);
__ ldr_s32(R0_tos, Address(Robj, Roffset)); __ access_load_at(T_INT, IN_HEAP, Address(Robj, Roffset), R0_tos, noreg, noreg, noreg);
__ push(itos); __ push(itos);
// Rewrite bytecode to be faster // Rewrite bytecode to be faster
if (!is_static && rc == may_rewrite) { if (!is_static && rc == may_rewrite) {
@ -3597,7 +3593,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
__ bind(Lbtos); __ bind(Lbtos);
__ pop(btos); __ pop(btos);
if (!is_static) pop_and_check_object(Robj); if (!is_static) pop_and_check_object(Robj);
__ strb(R0_tos, Address(Robj, Roffset)); __ access_store_at(T_BYTE, IN_HEAP, Address(Robj, Roffset), R0_tos, noreg, noreg, noreg, false);
if (!is_static && rc == may_rewrite) { if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_bputfield, R0_tmp, Rtemp, true, byte_no); patch_bytecode(Bytecodes::_fast_bputfield, R0_tmp, Rtemp, true, byte_no);
} }
@ -3611,8 +3607,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
__ bind(Lztos); __ bind(Lztos);
__ pop(ztos); __ pop(ztos);
if (!is_static) pop_and_check_object(Robj); if (!is_static) pop_and_check_object(Robj);
__ and_32(R0_tos, R0_tos, 1); __ access_store_at(T_BOOLEAN, IN_HEAP, Address(Robj, Roffset), R0_tos, noreg, noreg, noreg, false);
__ strb(R0_tos, Address(Robj, Roffset));
if (!is_static && rc == may_rewrite) { if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_zputfield, R0_tmp, Rtemp, true, byte_no); patch_bytecode(Bytecodes::_fast_zputfield, R0_tmp, Rtemp, true, byte_no);
} }
@ -3626,7 +3621,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
__ bind(Lctos); __ bind(Lctos);
__ pop(ctos); __ pop(ctos);
if (!is_static) pop_and_check_object(Robj); if (!is_static) pop_and_check_object(Robj);
__ strh(R0_tos, Address(Robj, Roffset)); __ access_store_at(T_CHAR, IN_HEAP, Address(Robj, Roffset), R0_tos, noreg, noreg, noreg, false);
if (!is_static && rc == may_rewrite) { if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_cputfield, R0_tmp, Rtemp, true, byte_no); patch_bytecode(Bytecodes::_fast_cputfield, R0_tmp, Rtemp, true, byte_no);
} }
@ -3640,7 +3635,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
__ bind(Lstos); __ bind(Lstos);
__ pop(stos); __ pop(stos);
if (!is_static) pop_and_check_object(Robj); if (!is_static) pop_and_check_object(Robj);
__ strh(R0_tos, Address(Robj, Roffset)); __ access_store_at(T_SHORT, IN_HEAP, Address(Robj, Roffset), R0_tos, noreg, noreg, noreg, false);
if (!is_static && rc == may_rewrite) { if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_sputfield, R0_tmp, Rtemp, true, byte_no); patch_bytecode(Bytecodes::_fast_sputfield, R0_tmp, Rtemp, true, byte_no);
} }
@ -3665,8 +3660,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
#ifdef AARCH64 #ifdef AARCH64
__ str(R0_tos, Address(Robj, Roffset)); __ str(R0_tos, Address(Robj, Roffset));
#else #else
__ add(Roffset, Robj, Roffset); __ access_store_at(T_LONG, IN_HEAP, Address(Robj, Roffset), noreg /* ltos */, noreg, noreg, noreg, false);
__ stmia(Roffset, RegisterSet(R0_tos_lo, R1_tos_hi));
#endif // AARCH64 #endif // AARCH64
if (!is_static && rc == may_rewrite) { if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_lputfield, R0_tmp, Rtemp, true, byte_no); patch_bytecode(Bytecodes::_fast_lputfield, R0_tmp, Rtemp, true, byte_no);
@ -3683,7 +3677,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
// we can use pop(itos) to transfer value without using VFP // we can use pop(itos) to transfer value without using VFP
__ pop(itos); __ pop(itos);
if (!is_static) pop_and_check_object(Robj); if (!is_static) pop_and_check_object(Robj);
__ str_32(R0_tos, Address(Robj, Roffset)); __ access_store_at(T_INT, IN_HEAP, Address(Robj, Roffset), R0_tos, noreg, noreg, noreg, false);
if (!is_static && rc == may_rewrite) { if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_fputfield, R0_tmp, Rtemp, true, byte_no); patch_bytecode(Bytecodes::_fast_fputfield, R0_tmp, Rtemp, true, byte_no);
} }
@ -3702,8 +3696,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
#ifdef AARCH64 #ifdef AARCH64
__ str(R0_tos, Address(Robj, Roffset)); __ str(R0_tos, Address(Robj, Roffset));
#else #else
__ add(Rtemp, Robj, Roffset); __ access_store_at(T_LONG, IN_HEAP, Address(Robj, Roffset), noreg /* ltos */, noreg, noreg, noreg, false);
__ stmia(Rtemp, RegisterSet(R0_tos_lo, R1_tos_hi));
#endif // AARCH64 #endif // AARCH64
if (!is_static && rc == may_rewrite) { if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_dputfield, R0_tmp, Rtemp, true, byte_no); patch_bytecode(Bytecodes::_fast_dputfield, R0_tmp, Rtemp, true, byte_no);
@ -3732,7 +3725,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
__ bind(Lint); __ bind(Lint);
__ pop(itos); __ pop(itos);
if (!is_static) pop_and_check_object(Robj); if (!is_static) pop_and_check_object(Robj);
__ str_32(R0_tos, Address(Robj, Roffset)); __ access_store_at(T_INT, IN_HEAP, Address(Robj, Roffset), R0_tos, noreg, noreg, noreg, false);
if (!is_static && rc == may_rewrite) { if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_iputfield, R0_tmp, Rtemp, true, byte_no); patch_bytecode(Bytecodes::_fast_iputfield, R0_tmp, Rtemp, true, byte_no);
} }
@ -3867,36 +3860,42 @@ void TemplateTable::fast_storefield(TosState state) {
// Get object from stack // Get object from stack
pop_and_check_object(Robj); pop_and_check_object(Robj);
Address addr = Address(Robj, Roffset);
// access field // access field
switch (bytecode()) { switch (bytecode()) {
case Bytecodes::_fast_zputfield: __ and_32(R0_tos, R0_tos, 1); case Bytecodes::_fast_zputfield:
// fall through __ access_store_at(T_BOOLEAN, IN_HEAP, addr, R0_tos, noreg, noreg, noreg, false);
case Bytecodes::_fast_bputfield: __ strb(R0_tos, Address(Robj, Roffset)); break; break;
case Bytecodes::_fast_sputfield: // fall through case Bytecodes::_fast_bputfield:
case Bytecodes::_fast_cputfield: __ strh(R0_tos, Address(Robj, Roffset)); break; __ access_store_at(T_BYTE, IN_HEAP, addr, R0_tos, noreg, noreg, noreg, false);
case Bytecodes::_fast_iputfield: __ str_32(R0_tos, Address(Robj, Roffset)); break; break;
case Bytecodes::_fast_sputfield:
__ access_store_at(T_SHORT, IN_HEAP, addr, R0_tos, noreg, noreg, noreg, false);
break;
case Bytecodes::_fast_cputfield:
__ access_store_at(T_CHAR, IN_HEAP, addr, R0_tos, noreg, noreg, noreg,false);
break;
case Bytecodes::_fast_iputfield:
__ access_store_at(T_INT, IN_HEAP, addr, R0_tos, noreg, noreg, noreg, false);
break;
#ifdef AARCH64 #ifdef AARCH64
case Bytecodes::_fast_lputfield: __ str (R0_tos, Address(Robj, Roffset)); break; case Bytecodes::_fast_lputfield: __ str (R0_tos, addr); break;
case Bytecodes::_fast_fputfield: __ str_s(S0_tos, Address(Robj, Roffset)); break; case Bytecodes::_fast_fputfield: __ str_s(S0_tos, addr); break;
case Bytecodes::_fast_dputfield: __ str_d(D0_tos, Address(Robj, Roffset)); break; case Bytecodes::_fast_dputfield: __ str_d(D0_tos, addr); break;
#else #else
case Bytecodes::_fast_lputfield: __ add(Robj, Robj, Roffset); case Bytecodes::_fast_lputfield:
__ stmia(Robj, RegisterSet(R0_tos_lo, R1_tos_hi)); break; __ access_store_at(T_LONG, IN_HEAP, addr, noreg, noreg, noreg, noreg, false);
break;
#ifdef __SOFTFP__ case Bytecodes::_fast_fputfield:
case Bytecodes::_fast_fputfield: __ str(R0_tos, Address(Robj, Roffset)); break; __ access_store_at(T_FLOAT, IN_HEAP, addr, noreg, noreg, noreg, noreg, false);
case Bytecodes::_fast_dputfield: __ add(Robj, Robj, Roffset); break;
__ stmia(Robj, RegisterSet(R0_tos_lo, R1_tos_hi)); break; case Bytecodes::_fast_dputfield:
#else __ access_store_at(T_DOUBLE, IN_HEAP, addr, noreg, noreg, noreg, noreg, false);
case Bytecodes::_fast_fputfield: __ add(Robj, Robj, Roffset); break;
__ fsts(S0_tos, Address(Robj)); break;
case Bytecodes::_fast_dputfield: __ add(Robj, Robj, Roffset);
__ fstd(D0_tos, Address(Robj)); break;
#endif // __SOFTFP__
#endif // AARCH64 #endif // AARCH64
case Bytecodes::_fast_aputfield: case Bytecodes::_fast_aputfield:
do_oop_store(_masm, Address(Robj, Roffset), R0_tos, Rtemp, R1_tmp, R2_tmp, false); do_oop_store(_masm, addr, R0_tos, Rtemp, R1_tmp, R2_tmp, false);
break; break;
default: default:
@ -3970,29 +3969,40 @@ void TemplateTable::fast_accessfield(TosState state) {
__ verify_oop(Robj); __ verify_oop(Robj);
__ null_check(Robj, Rtemp); __ null_check(Robj, Rtemp);
Address addr = Address(Robj, Roffset);
// access field // access field
switch (bytecode()) { switch (bytecode()) {
case Bytecodes::_fast_bgetfield: __ ldrsb(R0_tos, Address(Robj, Roffset)); break; case Bytecodes::_fast_bgetfield:
case Bytecodes::_fast_sgetfield: __ ldrsh(R0_tos, Address(Robj, Roffset)); break; __ access_load_at(T_BYTE, IN_HEAP, addr, R0_tos, noreg, noreg, noreg);
case Bytecodes::_fast_cgetfield: __ ldrh (R0_tos, Address(Robj, Roffset)); break; break;
case Bytecodes::_fast_igetfield: __ ldr_s32(R0_tos, Address(Robj, Roffset)); break; case Bytecodes::_fast_sgetfield:
__ access_load_at(T_SHORT, IN_HEAP, addr, R0_tos, noreg, noreg, noreg);
break;
case Bytecodes::_fast_cgetfield:
__ access_load_at(T_CHAR, IN_HEAP, addr, R0_tos, noreg, noreg, noreg);
break;
case Bytecodes::_fast_igetfield:
__ access_load_at(T_INT, IN_HEAP, addr, R0_tos, noreg, noreg, noreg);
break;
#ifdef AARCH64 #ifdef AARCH64
case Bytecodes::_fast_lgetfield: __ ldr (R0_tos, Address(Robj, Roffset)); break; case Bytecodes::_fast_lgetfield: __ ldr (R0_tos, addr); break;
case Bytecodes::_fast_fgetfield: __ ldr_s(S0_tos, Address(Robj, Roffset)); break; case Bytecodes::_fast_fgetfield: __ ldr_s(S0_tos, addr); break;
case Bytecodes::_fast_dgetfield: __ ldr_d(D0_tos, Address(Robj, Roffset)); break; case Bytecodes::_fast_dgetfield: __ ldr_d(D0_tos, addr); break;
#else #else
case Bytecodes::_fast_lgetfield: __ add(Roffset, Robj, Roffset); case Bytecodes::_fast_lgetfield:
__ ldmia(Roffset, RegisterSet(R0_tos_lo, R1_tos_hi)); break; __ access_load_at(T_LONG, IN_HEAP, addr, noreg, noreg, noreg, noreg);
#ifdef __SOFTFP__ break;
case Bytecodes::_fast_fgetfield: __ ldr (R0_tos, Address(Robj, Roffset)); break; case Bytecodes::_fast_fgetfield:
case Bytecodes::_fast_dgetfield: __ add(Roffset, Robj, Roffset); __ access_load_at(T_FLOAT, IN_HEAP, addr, noreg, noreg, noreg, noreg);
__ ldmia(Roffset, RegisterSet(R0_tos_lo, R1_tos_hi)); break; break;
#else case Bytecodes::_fast_dgetfield:
case Bytecodes::_fast_fgetfield: __ add(Roffset, Robj, Roffset); __ flds(S0_tos, Address(Roffset)); break; __ access_load_at(T_DOUBLE, IN_HEAP, addr, noreg, noreg, noreg, noreg);
case Bytecodes::_fast_dgetfield: __ add(Roffset, Robj, Roffset); __ fldd(D0_tos, Address(Roffset)); break; break;
#endif // __SOFTFP__
#endif // AARCH64 #endif // AARCH64
case Bytecodes::_fast_agetfield: do_oop_load(_masm, R0_tos, Address(Robj, Roffset)); __ verify_oop(R0_tos); break; case Bytecodes::_fast_agetfield:
do_oop_load(_masm, R0_tos, addr);
__ verify_oop(R0_tos);
break;
default: default:
ShouldNotReachHere(); ShouldNotReachHere();
} }
@ -4070,7 +4080,7 @@ void TemplateTable::fast_xaccess(TosState state) {
#endif // AARCH64 #endif // AARCH64
if (state == itos) { if (state == itos) {
__ ldr_s32(R0_tos, Address(Robj, Roffset)); __ access_load_at(T_INT, IN_HEAP, Address(Robj, Roffset), R0_tos, noreg, noreg, noreg);
} else if (state == atos) { } else if (state == atos) {
do_oop_load(_masm, R0_tos, Address(Robj, Roffset)); do_oop_load(_masm, R0_tos, Address(Robj, Roffset));
__ verify_oop(R0_tos); __ verify_oop(R0_tos);
@ -4081,8 +4091,7 @@ void TemplateTable::fast_xaccess(TosState state) {
#ifdef __SOFTFP__ #ifdef __SOFTFP__
__ ldr(R0_tos, Address(Robj, Roffset)); __ ldr(R0_tos, Address(Robj, Roffset));
#else #else
__ add(Roffset, Robj, Roffset); __ access_load_at(T_FLOAT, IN_HEAP, Address(Robj, Roffset), noreg /* ftos */, noreg, noreg, noreg);
__ flds(S0_tos, Address(Roffset));
#endif // __SOFTFP__ #endif // __SOFTFP__
#endif // AARCH64 #endif // AARCH64
} else { } else {

View file

@ -55,6 +55,7 @@
static void store_category2_local(Register Rlocal_index, Register tmp); static void store_category2_local(Register Rlocal_index, Register tmp);
static Address get_array_elem_addr(BasicType elemType, Register array, Register index, Register temp); static Address get_array_elem_addr(BasicType elemType, Register array, Register index, Register temp);
static Address get_array_elem_addr_same_base(BasicType elemType, Register array, Register index, Register temp);
static void jvmti_post_fast_field_mod(TosState state); static void jvmti_post_fast_field_mod(TosState state);