--- old/src/cpu/sparc/vm/templateTable_sparc.cpp 2017-04-25 16:43:47.355176852 +0200 +++ new/src/cpu/sparc/vm/templateTable_sparc.cpp 2017-04-25 16:43:47.187176858 +0200 @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "gc/shared/barrierSetCodeGen.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" #include "interpreter/interp_masm.hpp" @@ -49,78 +50,25 @@ int offset, Register val, Register tmp, - BarrierSet::Name barrier, - bool precise) { + DecoratorSet decorators) { assert(tmp != val && tmp != base && tmp != index, "register collision"); assert(index == noreg || offset == 0, "only one offset"); - switch (barrier) { -#if INCLUDE_ALL_GCS - case BarrierSet::G1SATBCTLogging: - { - // Load and record the previous value. - __ g1_write_barrier_pre(base, index, offset, - noreg /* pre_val */, - tmp, true /*preserve_o_regs*/); - - // G1 barrier needs uncompressed oop for region cross check. - Register new_val = val; - if (UseCompressedOops && val != G0) { - new_val = tmp; - __ mov(val, new_val); - } - - if (index == noreg ) { - assert(Assembler::is_simm13(offset), "fix this code"); - __ store_heap_oop(val, base, offset); - } else { - __ store_heap_oop(val, base, index); - } - - // No need for post barrier if storing NULL - if (val != G0) { - if (precise) { - if (index == noreg) { - __ add(base, offset, base); - } else { - __ add(base, index, base); - } - } - __ g1_write_barrier_post(base, new_val, tmp); - } - } - break; -#endif // INCLUDE_ALL_GCS - case BarrierSet::CardTableForRS: - case BarrierSet::CardTableExtension: - { - if (index == noreg ) { - assert(Assembler::is_simm13(offset), "fix this code"); - __ store_heap_oop(val, base, offset); - } else { - __ store_heap_oop(val, base, index); - } - // No need for post barrier if storing NULL - if (val != G0) { - if (precise) { - if (index == noreg) { - __ add(base, offset, base); - } else { - __ add(base, index, base); - } - } - __ card_write_barrier_post(base, val, tmp); - } - } - break; - case BarrierSet::ModRef: - ShouldNotReachHere(); - break; - default : - ShouldNotReachHere(); - - } + BarrierSetCodeGen *code_gen = Universe::heap()->barrier_set()->code_gen(); + code_gen->store_at(_masm, decorators, T_OBJECT, base, index, offset, val, tmp); } +static void do_oop_load(InterpreterMacroAssembler* _masm, + Register base, + Register index, + int offset, + Register dst, + Register tmp, + DecoratorSet decorators) { + assert(tmp != dst && tmp != base && tmp != index, "register collision"); + assert(index == noreg || offset == 0, "only one offset"); + BarrierSetCodeGen *code_gen = Universe::heap()->barrier_set()->code_gen(); + code_gen->load_at(_masm, decorators, T_OBJECT, base, index, offset, dst, tmp); +} //---------------------------------------------------------------------------------------------------- // Platform-dependent initialization @@ -586,7 +534,13 @@ // Otos_i: index // tos: array __ index_check(O2, Otos_i, UseCompressedOops ? 2 : LogBytesPerWord, G3_scratch, O3); - __ load_heap_oop(O3, arrayOopDesc::base_offset_in_bytes(T_OBJECT), Otos_i); + do_oop_load(_masm, + O3, + noreg, + arrayOopDesc::base_offset_in_bytes(T_OBJECT), + Otos_i, + G3_scratch, + ACCESS_ON_HEAP | ACCESS_ON_ARRAY); __ verify_oop(Otos_i); } @@ -886,13 +840,13 @@ // Store is OK. __ bind(store_ok); - do_oop_store(_masm, O1, noreg, arrayOopDesc::base_offset_in_bytes(T_OBJECT), Otos_i, G3_scratch, _bs->kind(), true); + do_oop_store(_masm, O1, noreg, arrayOopDesc::base_offset_in_bytes(T_OBJECT), Otos_i, G3_scratch, ACCESS_ON_HEAP | ACCESS_ON_ARRAY); __ ba(done); __ delayed()->inc(Lesp, 3* Interpreter::stackElementSize); // adj sp (pops array, index and value) __ bind(is_null); - do_oop_store(_masm, O1, noreg, arrayOopDesc::base_offset_in_bytes(T_OBJECT), G0, G4_scratch, _bs->kind(), true); + do_oop_store(_masm, O1, noreg, arrayOopDesc::base_offset_in_bytes(T_OBJECT), G0, G4_scratch, ACCESS_ON_HEAP | ACCESS_ON_ARRAY); __ profile_null_seen(G3_scratch); __ inc(Lesp, 3* Interpreter::stackElementSize); // adj sp (pops array, index and value) @@ -2523,7 +2477,7 @@ { __ pop_ptr(); __ verify_oop(Otos_i); - do_oop_store(_masm, Rclass, Roffset, 0, Otos_i, G1_scratch, _bs->kind(), false); + do_oop_store(_masm, Rclass, Roffset, 0, Otos_i, G1_scratch, ACCESS_ON_HEAP); __ ba(checkVolatile); __ delayed()->tst(Lscratch); } @@ -2568,7 +2522,7 @@ __ pop_ptr(); pop_and_check_object(Rclass); __ verify_oop(Otos_i); - do_oop_store(_masm, Rclass, Roffset, 0, Otos_i, G1_scratch, _bs->kind(), false); + do_oop_store(_masm, Rclass, Roffset, 0, Otos_i, G1_scratch, ACCESS_ON_HEAP); if (rc == may_rewrite) patch_bytecode(Bytecodes::_fast_aputfield, G3_scratch, G4_scratch, true, byte_no); __ ba(checkVolatile); __ delayed()->tst(Lscratch); @@ -2749,7 +2703,7 @@ __ stf(FloatRegisterImpl::D, Ftos_d, Rclass, Roffset); break; case Bytecodes::_fast_aputfield: - do_oop_store(_masm, Rclass, Roffset, 0, Otos_i, G1_scratch, _bs->kind(), false); + do_oop_store(_masm, Rclass, Roffset, 0, Otos_i, G1_scratch, ACCESS_ON_HEAP); break; default: ShouldNotReachHere();