< prev index next >

src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp

Print this page
rev 54706 : 8223244: Fix usage of ARRAYCOPY_DISJOINT decorator


  36 #ifdef COMPILER1
  37 #include "c1/c1_LIRAssembler.hpp"
  38 #include "c1/c1_MacroAssembler.hpp"
  39 #include "gc/shenandoah/c1/shenandoahBarrierSetC1.hpp"
  40 #endif
  41 
  42 #define __ masm->
  43 
  44 address ShenandoahBarrierSetAssembler::_shenandoah_lrb = NULL;
  45 
  46 void ShenandoahBarrierSetAssembler::arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
  47                                                        Register src, Register dst, Register count) {
  48 
  49   bool checkcast = (decorators & ARRAYCOPY_CHECKCAST) != 0;
  50   bool disjoint = (decorators & ARRAYCOPY_DISJOINT) != 0;
  51   bool obj_int = type == T_OBJECT LP64_ONLY(&& UseCompressedOops);
  52   bool dest_uninitialized = (decorators & IS_DEST_UNINITIALIZED) != 0;
  53 
  54   if (type == T_OBJECT || type == T_ARRAY) {
  55 #ifdef _LP64
  56     if (!checkcast && !obj_int) {

  57       // Save count for barrier
  58       __ movptr(r11, count);
  59     } else if (disjoint && obj_int) {
  60       // Save dst in r11 in the disjoint case
  61       __ movq(r11, dst);
  62     }

  63 #else
  64     if (disjoint) {
  65       __ mov(rdx, dst);          // save 'to'
  66     }
  67 #endif
  68 
  69     if (ShenandoahSATBBarrier && !dest_uninitialized && !ShenandoahHeap::heap()->heuristics()->can_do_traversal_gc()) {
  70       Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
  71 #ifndef _LP64
  72       __ push(thread);
  73       __ get_thread(thread);
  74 #endif
  75 
  76       Label done;
  77       // Short-circuit if count == 0.
  78       __ testptr(count, count);
  79       __ jcc(Assembler::zero, done);
  80 
  81       // Avoid runtime call when not marking.
  82       Address gc_state(thread, in_bytes(ShenandoahThreadLocalData::gc_state_offset()));


 106       __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_pre_oop_entry),
 107                       dst, count);
 108 #endif
 109       __ popa();
 110       __ bind(done);
 111       NOT_LP64(__ pop(thread);)
 112     }
 113   }
 114 
 115 }
 116 
 117 void ShenandoahBarrierSetAssembler::arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
 118                                                        Register src, Register dst, Register count) {
 119   bool checkcast = (decorators & ARRAYCOPY_CHECKCAST) != 0;
 120   bool disjoint = (decorators & ARRAYCOPY_DISJOINT) != 0;
 121   bool obj_int = type == T_OBJECT LP64_ONLY(&& UseCompressedOops);
 122   Register tmp = rax;
 123 
 124   if (type == T_OBJECT || type == T_ARRAY) {
 125 #ifdef _LP64
 126     if (!checkcast && !obj_int) {

 127       // Save count for barrier
 128       count = r11;
 129     } else if (disjoint && obj_int) {
 130       // Use the saved dst in the disjoint case
 131       dst = r11;
 132     } else if (checkcast) {

 133       tmp = rscratch1;
 134     }
 135 #else
 136     if (disjoint) {
 137       __ mov(dst, rdx); // restore 'to'
 138     }
 139 #endif
 140 
 141     Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
 142 #ifndef _LP64
 143     __ push(thread);
 144     __ get_thread(thread);
 145 #endif
 146 
 147     // Short-circuit if count == 0.
 148     Label done;
 149     __ testptr(count, count);
 150     __ jcc(Assembler::zero, done);
 151 
 152     // Skip runtime call if no forwarded objects.




  36 #ifdef COMPILER1
  37 #include "c1/c1_LIRAssembler.hpp"
  38 #include "c1/c1_MacroAssembler.hpp"
  39 #include "gc/shenandoah/c1/shenandoahBarrierSetC1.hpp"
  40 #endif
  41 
  42 #define __ masm->
  43 
  44 address ShenandoahBarrierSetAssembler::_shenandoah_lrb = NULL;
  45 
  46 void ShenandoahBarrierSetAssembler::arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
  47                                                        Register src, Register dst, Register count) {
  48 
  49   bool checkcast = (decorators & ARRAYCOPY_CHECKCAST) != 0;
  50   bool disjoint = (decorators & ARRAYCOPY_DISJOINT) != 0;
  51   bool obj_int = type == T_OBJECT LP64_ONLY(&& UseCompressedOops);
  52   bool dest_uninitialized = (decorators & IS_DEST_UNINITIALIZED) != 0;
  53 
  54   if (type == T_OBJECT || type == T_ARRAY) {
  55 #ifdef _LP64
  56     if (!checkcast) {
  57       if (!obj_int) {
  58         // Save count for barrier
  59         __ movptr(r11, count);
  60       } else if (disjoint) {
  61         // Save dst in r11 in the disjoint case
  62         __ movq(r11, dst);
  63       }
  64     }
  65 #else
  66     if (disjoint) {
  67       __ mov(rdx, dst);          // save 'to'
  68     }
  69 #endif
  70 
  71     if (ShenandoahSATBBarrier && !dest_uninitialized && !ShenandoahHeap::heap()->heuristics()->can_do_traversal_gc()) {
  72       Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
  73 #ifndef _LP64
  74       __ push(thread);
  75       __ get_thread(thread);
  76 #endif
  77 
  78       Label done;
  79       // Short-circuit if count == 0.
  80       __ testptr(count, count);
  81       __ jcc(Assembler::zero, done);
  82 
  83       // Avoid runtime call when not marking.
  84       Address gc_state(thread, in_bytes(ShenandoahThreadLocalData::gc_state_offset()));


 108       __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_pre_oop_entry),
 109                       dst, count);
 110 #endif
 111       __ popa();
 112       __ bind(done);
 113       NOT_LP64(__ pop(thread);)
 114     }
 115   }
 116 
 117 }
 118 
 119 void ShenandoahBarrierSetAssembler::arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
 120                                                        Register src, Register dst, Register count) {
 121   bool checkcast = (decorators & ARRAYCOPY_CHECKCAST) != 0;
 122   bool disjoint = (decorators & ARRAYCOPY_DISJOINT) != 0;
 123   bool obj_int = type == T_OBJECT LP64_ONLY(&& UseCompressedOops);
 124   Register tmp = rax;
 125 
 126   if (type == T_OBJECT || type == T_ARRAY) {
 127 #ifdef _LP64
 128     if (!checkcast) {
 129       if (!obj_int) {
 130         // Save count for barrier
 131         count = r11;
 132       } else if (disjoint && obj_int) {
 133         // Use the saved dst in the disjoint case
 134         dst = r11;
 135       }
 136     } else {
 137       tmp = rscratch1;
 138     }
 139 #else
 140     if (disjoint) {
 141       __ mov(dst, rdx); // restore 'to'
 142     }
 143 #endif
 144 
 145     Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
 146 #ifndef _LP64
 147     __ push(thread);
 148     __ get_thread(thread);
 149 #endif
 150 
 151     // Short-circuit if count == 0.
 152     Label done;
 153     __ testptr(count, count);
 154     __ jcc(Assembler::zero, done);
 155 
 156     // Skip runtime call if no forwarded objects.


< prev index next >