< prev index next >

src/hotspot/cpu/sparc/gc/g1/g1BarrierSetAssembler_sparc.cpp

Print this page




  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "asm/macroAssembler.inline.hpp"
  27 #include "gc/g1/g1BarrierSet.hpp"
  28 #include "gc/g1/g1CardTable.hpp"
  29 #include "gc/g1/g1BarrierSetAssembler.hpp"
  30 #include "gc/g1/g1ThreadLocalData.hpp"
  31 #include "gc/g1/heapRegion.hpp"
  32 #include "gc/shared/collectedHeap.hpp"
  33 #include "interpreter/interp_masm.hpp"
  34 #include "runtime/sharedRuntime.hpp"
  35 #include "utilities/macros.hpp"
  36 
  37 #define __ masm->
  38 
  39 void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
  40                                                             Register addr, Register count) {
  41   bool dest_uninitialized = (decorators & AS_DEST_NOT_INITIALIZED) != 0;
  42   // With G1, don't generate the call if we statically know that the target in uninitialized
  43   if (!dest_uninitialized) {
  44     Register tmp = O5;
  45     assert_different_registers(addr, count, tmp);
  46     Label filtered;
  47     // Is marking active?
  48     if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
  49       __ ld(G2, in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset()), tmp);
  50     } else {
  51       guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
  52       __ ldsb(G2, in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset()), tmp);


 345   __ br(Assembler::always, /*annul*/false, Assembler::pt, restart);
 346   __ delayed()->mov(L4, O7);
 347 
 348   dirty_card_log_enqueue = start;
 349   dirty_card_log_enqueue_end = __ pc();
 350   // XXX Should have a guarantee here about not going off the end!
 351   // Does it already do so?  Do an experiment...
 352 
 353 #undef __
 354 
 355 }
 356 
 357 #define __ masm->
 358 
 359 void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm, Register store_addr, Register new_val, Register tmp) {
 360   Label filtered;
 361   MacroAssembler* post_filter_masm = masm;
 362 
 363   if (new_val == G0) return;
 364 
 365   G1BarrierSet* bs = barrier_set_cast<G1BarrierSet>(Universe::heap()->barrier_set());
 366 
 367   if (G1RSBarrierRegionFilter) {
 368     __ xor3(store_addr, new_val, tmp);
 369     __ srlx(tmp, HeapRegion::LogOfHRGrainBytes, tmp);
 370 
 371     __ cmp_and_brx_short(tmp, G0, Assembler::equal, Assembler::pt, filtered);
 372   }
 373 
 374   // If the "store_addr" register is an "in" or "local" register, move it to
 375   // a scratch reg so we can pass it as an argument.
 376   bool use_scr = !(store_addr->is_global() || store_addr->is_out());
 377   // Pick a scratch register different from "tmp".
 378   Register scr = (tmp == G1_scratch ? G3_scratch : G1_scratch);
 379   // Make sure we use up the delay slot!
 380   if (use_scr) {
 381     post_filter_masm->mov(store_addr, scr);
 382   } else {
 383     post_filter_masm->nop();
 384   }
 385   __ save_frame(0);




  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "asm/macroAssembler.inline.hpp"
  27 #include "gc/g1/g1BarrierSet.hpp"
  28 #include "gc/g1/g1CardTable.hpp"
  29 #include "gc/g1/g1BarrierSetAssembler.hpp"
  30 #include "gc/g1/g1ThreadLocalData.hpp"
  31 #include "gc/g1/heapRegion.hpp"

  32 #include "interpreter/interp_masm.hpp"
  33 #include "runtime/sharedRuntime.hpp"
  34 #include "utilities/macros.hpp"
  35 
  36 #define __ masm->
  37 
  38 void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
  39                                                             Register addr, Register count) {
  40   bool dest_uninitialized = (decorators & AS_DEST_NOT_INITIALIZED) != 0;
  41   // With G1, don't generate the call if we statically know that the target in uninitialized
  42   if (!dest_uninitialized) {
  43     Register tmp = O5;
  44     assert_different_registers(addr, count, tmp);
  45     Label filtered;
  46     // Is marking active?
  47     if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
  48       __ ld(G2, in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset()), tmp);
  49     } else {
  50       guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
  51       __ ldsb(G2, in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset()), tmp);


 344   __ br(Assembler::always, /*annul*/false, Assembler::pt, restart);
 345   __ delayed()->mov(L4, O7);
 346 
 347   dirty_card_log_enqueue = start;
 348   dirty_card_log_enqueue_end = __ pc();
 349   // XXX Should have a guarantee here about not going off the end!
 350   // Does it already do so?  Do an experiment...
 351 
 352 #undef __
 353 
 354 }
 355 
 356 #define __ masm->
 357 
 358 void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm, Register store_addr, Register new_val, Register tmp) {
 359   Label filtered;
 360   MacroAssembler* post_filter_masm = masm;
 361 
 362   if (new_val == G0) return;
 363 
 364   G1BarrierSet* bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
 365 
 366   if (G1RSBarrierRegionFilter) {
 367     __ xor3(store_addr, new_val, tmp);
 368     __ srlx(tmp, HeapRegion::LogOfHRGrainBytes, tmp);
 369 
 370     __ cmp_and_brx_short(tmp, G0, Assembler::equal, Assembler::pt, filtered);
 371   }
 372 
 373   // If the "store_addr" register is an "in" or "local" register, move it to
 374   // a scratch reg so we can pass it as an argument.
 375   bool use_scr = !(store_addr->is_global() || store_addr->is_out());
 376   // Pick a scratch register different from "tmp".
 377   Register scr = (tmp == G1_scratch ? G3_scratch : G1_scratch);
 378   // Make sure we use up the delay slot!
 379   if (use_scr) {
 380     post_filter_masm->mov(store_addr, scr);
 381   } else {
 382     post_filter_masm->nop();
 383   }
 384   __ save_frame(0);


< prev index next >