--- old/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp 2017-04-25 16:43:46.567176880 +0200 +++ new/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp 2017-04-25 16:43:46.399176886 +0200 @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "asm/macroAssembler.hpp" +#include "gc/shared/barrierSetCodeGen.hpp" #include "interpreter/bytecodeHistogram.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" @@ -836,7 +837,6 @@ // Method entry for java.lang.ref.Reference.get. address TemplateInterpreterGenerator::generate_Reference_get_entry(void) { -#if INCLUDE_ALL_GCS // Code: _aload_0, _getfield, _areturn // parameter size = 1 // @@ -867,51 +867,29 @@ const int referent_offset = java_lang_ref_Reference::referent_offset; guarantee(referent_offset > 0, "referent offset not initialized"); - if (UseG1GC) { - Label slow_path; + Label slow_path; - // In the G1 code we don't check if we need to reach a safepoint. We - // continue and the thread will safepoint at the next bytecode dispatch. + // In the G1 code we don't check if we need to reach a safepoint. We + // continue and the thread will safepoint at the next bytecode dispatch. - // Check if local 0 != NULL - // If the receiver is null then it is OK to jump to the slow path. - __ ld_ptr(Gargs, G0, Otos_i ); // get local 0 - // check if local 0 == NULL and go the slow path - __ cmp_and_brx_short(Otos_i, 0, Assembler::equal, Assembler::pn, slow_path); - - - // Load the value of the referent field. - if (Assembler::is_simm13(referent_offset)) { - __ load_heap_oop(Otos_i, referent_offset, Otos_i); - } else { - __ set(referent_offset, G3_scratch); - __ load_heap_oop(Otos_i, G3_scratch, Otos_i); - } + // Check if local 0 != NULL + // If the receiver is null then it is OK to jump to the slow path. + __ ld_ptr(Gargs, G0, Otos_i ); // get local 0 + // check if local 0 == NULL and go the slow path + __ cmp_and_brx_short(Otos_i, 0, Assembler::equal, Assembler::pn, slow_path); + + BarrierSetCodeGen *code_gen = Universe::heap()->barrier_set()->code_gen(); + code_gen->load_at(_masm, ACCESS_ON_HEAP | GC_ACCESS_ON_WEAK, T_OBJECT, + Otos_i, noreg, referent_offset, Otos_i, G3_scratch); - // Generate the G1 pre-barrier code to log the value of - // the referent field in an SATB buffer. Note with - // these parameters the pre-barrier does not generate - // the load of the previous value - - __ g1_write_barrier_pre(noreg /* obj */, noreg /* index */, 0 /* offset */, - Otos_i /* pre_val */, - G3_scratch /* tmp */, - true /* preserve_o_regs */); - - // _areturn - __ retl(); // return from leaf routine - __ delayed()->mov(O5_savedSP, SP); - - // Generate regular method entry - __ bind(slow_path); - __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::zerolocals)); - return entry; - } -#endif // INCLUDE_ALL_GCS + // _areturn + __ retl(); // return from leaf routine + __ delayed()->mov(O5_savedSP, SP); - // If G1 is not enabled then attempt to go through the accessor entry point - // Reference.get is an accessor - return NULL; + // Generate regular method entry + __ bind(slow_path); + __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::zerolocals)); + return entry; } /** @@ -1436,33 +1414,15 @@ // until we return now that we've released the handle it might be protected by { - Label no_oop, store_result; + Label no_oop; __ set((intptr_t)AbstractInterpreter::result_handler(T_OBJECT), G3_scratch); __ cmp_and_brx_short(G3_scratch, Lscratch, Assembler::notEqual, Assembler::pt, no_oop); - // Unbox oop result, e.g. JNIHandles::resolve value in O0. - __ br_null(O0, false, Assembler::pn, store_result); // Use NULL as-is. - __ delayed()->andcc(O0, JNIHandles::weak_tag_mask, G0); // Test for jweak - __ brx(Assembler::zero, true, Assembler::pt, store_result); - __ delayed()->ld_ptr(O0, 0, O0); // Maybe resolve (untagged) jobject. - // Resolve jweak. - __ ld_ptr(O0, -JNIHandles::weak_tag_value, O0); -#if INCLUDE_ALL_GCS - if (UseG1GC) { - __ g1_write_barrier_pre(noreg /* obj */, - noreg /* index */, - 0 /* offset */, - O0 /* pre_val */, - G3_scratch /* tmp */, - true /* preserve_o_regs */); - } -#endif // INCLUDE_ALL_GCS - __ bind(store_result); + __ resolve_jobject(O0, G3_scratch); // Store it where gc will look for it and result handler expects it. __ st_ptr(O0, FP, (frame::interpreter_frame_oop_temp_offset*wordSize) + STACK_BIAS); __ bind(no_oop); - }