< prev index next >

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

Print this page
rev 50922 : Don't generate arraycopy pre-barrier calls for traversal GC


  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 2 along with this work; if not, write to the Free Software Foundation,
  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #include "precompiled.hpp"
  25 #include "gc/shenandoah/brooksPointer.hpp"
  26 #include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp"
  27 #include "gc/shenandoah/shenandoahConnectionMatrix.hpp"
  28 #include "gc/shenandoah/shenandoahHeap.hpp"
  29 #include "gc/shenandoah/shenandoahHeapRegion.hpp"

  30 #include "gc/shenandoah/shenandoahRuntime.hpp"
  31 #include "gc/shenandoah/shenandoahThreadLocalData.hpp"
  32 #include "interpreter/interpreter.hpp"
  33 #include "interpreter/interp_masm.hpp"
  34 #include "runtime/sharedRuntime.hpp"
  35 #include "runtime/thread.hpp"
  36 #include "utilities/macros.hpp"
  37 #ifdef COMPILER1
  38 #include "c1/c1_LIRAssembler.hpp"
  39 #include "c1/c1_MacroAssembler.hpp"
  40 #include "gc/shenandoah/c1/shenandoahBarrierSetC1.hpp"
  41 #endif
  42 
  43 #define __ masm->
  44 
  45 address ShenandoahBarrierSetAssembler::_shenandoah_wb = NULL;
  46 address ShenandoahBarrierSetAssembler::_shenandoah_wb_C = NULL;
  47 
  48 void ShenandoahBarrierSetAssembler::arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
  49                                                        Register src, Register dst, Register count) {


  51   bool checkcast = (decorators & ARRAYCOPY_CHECKCAST) != 0;
  52   bool disjoint = (decorators & ARRAYCOPY_DISJOINT) != 0;
  53   bool obj_int = type == T_OBJECT LP64_ONLY(&& UseCompressedOops);
  54   bool dest_uninitialized = (decorators & AS_DEST_NOT_INITIALIZED) != 0;
  55 
  56   if (type == T_OBJECT || type == T_ARRAY) {
  57 #ifdef _LP64
  58     if (!checkcast && !obj_int) {
  59       // Save count for barrier
  60       __ movptr(r11, count);
  61     } else if (disjoint && obj_int) {
  62       // Save dst in r11 in the disjoint case
  63       __ movq(r11, dst);
  64     }
  65 #else
  66     if (disjoint) {
  67       __ mov(rdx, dst);          // save 'to'
  68     }
  69 #endif
  70 
  71     if (!dest_uninitialized) {
  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 filtered;
  79       Address in_progress(thread, in_bytes(ShenandoahThreadLocalData::satb_mark_queue_active_offset()));
  80       // Is marking active?
  81       if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
  82         __ cmpl(in_progress, 0);
  83       } else {
  84         assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
  85         __ cmpb(in_progress, 0);
  86       }
  87 
  88       NOT_LP64(__ pop(thread);)
  89 
  90         __ jcc(Assembler::equal, filtered);
  91 




  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 2 along with this work; if not, write to the Free Software Foundation,
  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #include "precompiled.hpp"
  25 #include "gc/shenandoah/brooksPointer.hpp"
  26 #include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp"
  27 #include "gc/shenandoah/shenandoahConnectionMatrix.hpp"
  28 #include "gc/shenandoah/shenandoahHeap.hpp"
  29 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
  30 #include "gc/shenandoah/shenandoahHeuristics.hpp"
  31 #include "gc/shenandoah/shenandoahRuntime.hpp"
  32 #include "gc/shenandoah/shenandoahThreadLocalData.hpp"
  33 #include "interpreter/interpreter.hpp"
  34 #include "interpreter/interp_masm.hpp"
  35 #include "runtime/sharedRuntime.hpp"
  36 #include "runtime/thread.hpp"
  37 #include "utilities/macros.hpp"
  38 #ifdef COMPILER1
  39 #include "c1/c1_LIRAssembler.hpp"
  40 #include "c1/c1_MacroAssembler.hpp"
  41 #include "gc/shenandoah/c1/shenandoahBarrierSetC1.hpp"
  42 #endif
  43 
  44 #define __ masm->
  45 
  46 address ShenandoahBarrierSetAssembler::_shenandoah_wb = NULL;
  47 address ShenandoahBarrierSetAssembler::_shenandoah_wb_C = NULL;
  48 
  49 void ShenandoahBarrierSetAssembler::arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
  50                                                        Register src, Register dst, Register count) {


  52   bool checkcast = (decorators & ARRAYCOPY_CHECKCAST) != 0;
  53   bool disjoint = (decorators & ARRAYCOPY_DISJOINT) != 0;
  54   bool obj_int = type == T_OBJECT LP64_ONLY(&& UseCompressedOops);
  55   bool dest_uninitialized = (decorators & AS_DEST_NOT_INITIALIZED) != 0;
  56 
  57   if (type == T_OBJECT || type == T_ARRAY) {
  58 #ifdef _LP64
  59     if (!checkcast && !obj_int) {
  60       // Save count for barrier
  61       __ movptr(r11, count);
  62     } else if (disjoint && obj_int) {
  63       // Save dst in r11 in the disjoint case
  64       __ movq(r11, dst);
  65     }
  66 #else
  67     if (disjoint) {
  68       __ mov(rdx, dst);          // save 'to'
  69     }
  70 #endif
  71 
  72     if (!dest_uninitialized && !ShenandoahHeap::heap()->heuristics()->can_do_traversal_gc()) {
  73       Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
  74 #ifndef _LP64
  75       __ push(thread);
  76       __ get_thread(thread);
  77 #endif
  78 
  79       Label filtered;
  80       Address in_progress(thread, in_bytes(ShenandoahThreadLocalData::satb_mark_queue_active_offset()));
  81       // Is marking active?
  82       if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
  83         __ cmpl(in_progress, 0);
  84       } else {
  85         assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
  86         __ cmpb(in_progress, 0);
  87       }
  88 
  89       NOT_LP64(__ pop(thread);)
  90 
  91         __ jcc(Assembler::equal, filtered);
  92 


< prev index next >