< prev index next >
src/cpu/x86/vm/templateTable_x86.cpp
Print this page
rev 12906 : [mq]: gc_interface
*** 22,31 ****
--- 22,33 ----
*
*/
#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
+ #include "gc/shared/barrierSet.hpp"
+ #include "gc/shared/barrierSetCodeGen.hpp"
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp"
#include "interpreter/interp_masm.hpp"
#include "interpreter/templateTable.hpp"
#include "memory/universe.inline.hpp"
*** 145,233 ****
// Store an oop (or NULL) at the address described by obj.
// If val == noreg this means store a NULL
static void do_oop_store(InterpreterMacroAssembler* _masm,
! Address obj,
Register val,
! BarrierSet::Name barrier,
! bool precise) {
assert(val == noreg || val == rax, "parameter is just for looks");
! switch (barrier) {
! #if INCLUDE_ALL_GCS
! case BarrierSet::G1SATBCTLogging:
! {
! // flatten object address if needed
! // We do it regardless of precise because we need the registers
! if (obj.index() == noreg && obj.disp() == 0) {
! if (obj.base() != rdx) {
! __ movptr(rdx, obj.base());
! }
! } else {
! __ lea(rdx, obj);
! }
!
! Register rtmp = LP64_ONLY(r8) NOT_LP64(rsi);
! Register rthread = LP64_ONLY(r15_thread) NOT_LP64(rcx);
!
! NOT_LP64(__ get_thread(rcx));
! NOT_LP64(__ save_bcp());
!
! __ g1_write_barrier_pre(rdx /* obj */,
! rbx /* pre_val */,
! rthread /* thread */,
! rtmp /* tmp */,
! val != noreg /* tosca_live */,
! false /* expand_call */);
! if (val == noreg) {
! __ store_heap_oop_null(Address(rdx, 0));
! } else {
! // G1 barrier needs uncompressed oop for region cross check.
! Register new_val = val;
! if (UseCompressedOops) {
! new_val = rbx;
! __ movptr(new_val, val);
! }
! __ store_heap_oop(Address(rdx, 0), val);
! __ g1_write_barrier_post(rdx /* store_adr */,
! new_val /* new_val */,
! rthread /* thread */,
! rtmp /* tmp */,
! rbx /* tmp2 */);
! }
! NOT_LP64( __ restore_bcp());
! }
! break;
! #endif // INCLUDE_ALL_GCS
! case BarrierSet::CardTableForRS:
! case BarrierSet::CardTableExtension:
! {
! if (val == noreg) {
! __ store_heap_oop_null(obj);
! } else {
! __ store_heap_oop(obj, val);
! // flatten object address if needed
! if (!precise || (obj.index() == noreg && obj.disp() == 0)) {
! __ store_check(obj.base());
! } else {
! __ lea(rdx, obj);
! __ store_check(rdx);
! }
! }
! }
! break;
! case BarrierSet::ModRef:
! if (val == noreg) {
! __ store_heap_oop_null(obj);
! } else {
! __ store_heap_oop(obj, val);
! }
! break;
! default :
! ShouldNotReachHere();
! }
}
Address TemplateTable::at_bcp(int offset) {
assert(_desc->uses_bcp(), "inconsistent uses_bcp information");
return Address(rbcp, offset);
--- 147,170 ----
// Store an oop (or NULL) at the address described by obj.
// If val == noreg this means store a NULL
static void do_oop_store(InterpreterMacroAssembler* _masm,
! Address dst,
Register val,
! DecoratorSet decorators) {
assert(val == noreg || val == rax, "parameter is just for looks");
! BarrierSetCodeGen *code_gen = Universe::heap()->barrier_set()->code_gen();
! code_gen->store_at(_masm, decorators, T_OBJECT, dst, val, /*tmp1*/ rdx, /*tmp2*/ rbx);
! }
! static void do_oop_load(InterpreterMacroAssembler* _masm,
! Address src,
! Register dst,
! DecoratorSet decorators) {
! BarrierSetCodeGen *code_gen = Universe::heap()->barrier_set()->code_gen();
! code_gen->load_at(_masm, decorators, T_OBJECT, dst, src, /*tmp1*/ rdx, /*tmp2*/ rbx);
}
Address TemplateTable::at_bcp(int offset) {
assert(_desc->uses_bcp(), "inconsistent uses_bcp information");
return Address(rbcp, offset);
*** 744,756 ****
void TemplateTable::aaload() {
transition(itos, atos);
// rax: index
// rdx: array
index_check(rdx, rax); // kills rbx
! __ load_heap_oop(rax, Address(rdx, rax,
UseCompressedOops ? Address::times_4 : Address::times_ptr,
! arrayOopDesc::base_offset_in_bytes(T_OBJECT)));
}
void TemplateTable::baload() {
transition(itos, itos);
// rax: index
--- 681,696 ----
void TemplateTable::aaload() {
transition(itos, atos);
// rax: index
// rdx: array
index_check(rdx, rax); // kills rbx
! do_oop_load(_masm,
! Address(rdx, rax,
UseCompressedOops ? Address::times_4 : Address::times_ptr,
! arrayOopDesc::base_offset_in_bytes(T_OBJECT)),
! rax,
! ACCESS_ON_HEAP | ACCESS_ON_ARRAY);
}
void TemplateTable::baload() {
transition(itos, itos);
// rax: index
*** 1057,1075 ****
__ bind(ok_is_subtype);
// Get the value we will store
__ movptr(rax, at_tos());
// Now store using the appropriate barrier
! do_oop_store(_masm, Address(rdx, 0), rax, _bs->kind(), true);
__ jmp(done);
// Have a NULL in rax, rdx=array, ecx=index. Store NULL at ary[idx]
__ bind(is_null);
__ profile_null_seen(rbx);
// Store a NULL
! do_oop_store(_masm, element_address, noreg, _bs->kind(), true);
// Pop stack arguments
__ bind(done);
__ addptr(rsp, 3 * Interpreter::stackElementSize);
}
--- 997,1015 ----
__ bind(ok_is_subtype);
// Get the value we will store
__ movptr(rax, at_tos());
// Now store using the appropriate barrier
! do_oop_store(_masm, Address(rdx, 0), rax, ACCESS_ON_HEAP);
__ jmp(done);
// Have a NULL in rax, rdx=array, ecx=index. Store NULL at ary[idx]
__ bind(is_null);
__ profile_null_seen(rbx);
// Store a NULL
! do_oop_store(_masm, element_address, noreg, ACCESS_ON_HEAP);
// Pop stack arguments
__ bind(done);
__ addptr(rsp, 3 * Interpreter::stackElementSize);
}
*** 3074,3084 ****
// atos
{
__ pop(atos);
if (!is_static) pop_and_check_object(obj);
// Store into the field
! do_oop_store(_masm, field, rax, _bs->kind(), false);
if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_aputfield, bc, rbx, true, byte_no);
}
__ jmp(Done);
}
--- 3014,3024 ----
// atos
{
__ pop(atos);
if (!is_static) pop_and_check_object(obj);
// Store into the field
! do_oop_store(_masm, field, rax, ACCESS_ON_HEAP | ACCESS_ON_ARRAY);
if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_aputfield, bc, rbx, true, byte_no);
}
__ jmp(Done);
}
*** 3326,3336 ****
const Address field(rcx, rbx, Address::times_1);
// access field
switch (bytecode()) {
case Bytecodes::_fast_aputfield:
! do_oop_store(_masm, field, rax, _bs->kind(), false);
break;
case Bytecodes::_fast_lputfield:
#ifdef _LP64
__ movq(field, rax);
#else
--- 3266,3276 ----
const Address field(rcx, rbx, Address::times_1);
// access field
switch (bytecode()) {
case Bytecodes::_fast_aputfield:
! do_oop_store(_masm, field, rax, ACCESS_ON_HEAP | ACCESS_ON_ARRAY);
break;
case Bytecodes::_fast_lputfield:
#ifdef _LP64
__ movq(field, rax);
#else
< prev index next >