< prev index next >

src/cpu/sparc/vm/templateTable_sparc.cpp

Print this page
rev 12906 : [mq]: gc_interface

@@ -21,10 +21,11 @@
  * questions.
  *
  */
 
 #include "precompiled.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"

@@ -47,82 +48,29 @@
                          Register base,
                          Register index,
                          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
 
 void TemplateTable::pd_initialize() {

@@ -584,11 +532,17 @@
 void TemplateTable::aaload() {
   transition(itos, atos);
   // 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);
 }
 
 
 void TemplateTable::baload() {

@@ -884,17 +838,17 @@
   // Not a subtype; so must throw exception
   __ throw_if_not_x( Assembler::never, Interpreter::_throw_ArrayStoreException_entry, G3_scratch );
 
   // 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)
   __ bind(done);
 }

@@ -2521,11 +2475,11 @@
 
     // atos
     {
       __ 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);
     }
 
     __ bind(notObj);

@@ -2566,11 +2520,11 @@
     // atos
     {
       __ 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);
     }
 

@@ -2747,11 +2701,11 @@
       break;
     case Bytecodes::_fast_dputfield:
       __ 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();
   }
 
< prev index next >