< prev index next >

src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp

Print this page
rev 12906 : [mq]: gc_interface

@@ -22,10 +22,11 @@
  *
  */
 
 #include "precompiled.hpp"
 #include "asm/macroAssembler.hpp"
+#include "gc/shared/barrierSetCodeGen.hpp"
 #include "interpreter/bytecodeHistogram.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/interpreterRuntime.hpp"
 #include "interpreter/interp_masm.hpp"
 #include "interpreter/templateInterpreterGenerator.hpp"

@@ -834,11 +835,10 @@
 
 }
 
 // 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
   //
   // The code that gets generated by this routine is split into 2 parts:
   //    1. The "intrinsified" code for G1 (or any SATB based GC),

@@ -865,11 +865,10 @@
   address entry = __ pc();
 
   const int referent_offset = java_lang_ref_Reference::referent_offset;
   guarantee(referent_offset > 0, "referent offset not initialized");
 
-  if (UseG1GC) {
      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.
 

@@ -877,43 +876,22 @@
     // 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);
-    }
-
-    // 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 */);
+  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);
 
     // _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
-
-  // If G1 is not enabled then attempt to go through the accessor entry point
-  // Reference.get is an accessor
-  return NULL;
 }
 
 /**
  * Method entry for static native methods:
  *   int java.util.zip.CRC32.update(int crc, int b)

@@ -1434,37 +1412,19 @@
 
   // If we have an oop result store it where it will be safe for any further gc
   // 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);
-
   }
 
 
   // handle exceptions (exception handling will handle unlocking!)
   { Label L;
< prev index next >