< prev index next >

src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.cpp

Print this page


   1 /*
   2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  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  *


 113     Address index(noreg, obj, Address::times_1);
 114     card_addr = __ as_Address(ArrayAddress(cardtable, index));
 115   }
 116 
 117   int dirty = CardTable::dirty_card_val();
 118   if (UseCondCardMark) {
 119     Label L_already_dirty;
 120     if (ct->scanned_concurrently()) {
 121       __ membar(Assembler::StoreLoad);
 122     }
 123     __ cmpb(card_addr, dirty);
 124     __ jcc(Assembler::equal, L_already_dirty);
 125     __ movb(card_addr, dirty);
 126     __ bind(L_already_dirty);
 127   } else {
 128     __ movb(card_addr, dirty);
 129   }
 130 }
 131 
 132 void CardTableBarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
 133                                                 Address dst, Register val, Register tmp1, Register tmp2) {
 134   bool in_heap = (decorators & IN_HEAP) != 0;
 135 
 136   bool is_array = (decorators & IS_ARRAY) != 0;
 137   bool on_anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0;
 138   bool precise = is_array || on_anonymous;
 139 
 140   bool needs_post_barrier = val != noreg && in_heap;
 141 
 142   BarrierSetAssembler::store_at(masm, decorators, type, dst, val, noreg, noreg);
 143   if (needs_post_barrier) {
 144     // flatten object address if needed
 145     if (!precise || (dst.index() == noreg && dst.disp() == 0)) {
 146       store_check(masm, dst.base(), dst);







 147     } else {
 148       __ lea(tmp1, dst);
 149       store_check(masm, tmp1, dst);
 150     }
 151   }
 152 }
   1 /*
   2  * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  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  *


 113     Address index(noreg, obj, Address::times_1);
 114     card_addr = __ as_Address(ArrayAddress(cardtable, index));
 115   }
 116 
 117   int dirty = CardTable::dirty_card_val();
 118   if (UseCondCardMark) {
 119     Label L_already_dirty;
 120     if (ct->scanned_concurrently()) {
 121       __ membar(Assembler::StoreLoad);
 122     }
 123     __ cmpb(card_addr, dirty);
 124     __ jcc(Assembler::equal, L_already_dirty);
 125     __ movb(card_addr, dirty);
 126     __ bind(L_already_dirty);
 127   } else {
 128     __ movb(card_addr, dirty);
 129   }
 130 }
 131 
 132 void CardTableBarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
 133                                                 Address dst, Register val, Register tmp1, Register tmp2, Register tmp3) {
 134   bool in_heap = (decorators & IN_HEAP) != 0;
 135 
 136   bool is_array = (decorators & IS_ARRAY) != 0;
 137   bool on_anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0;
 138   bool precise = is_array || on_anonymous;
 139 
 140   bool needs_post_barrier = val != noreg && in_heap;
 141 
 142   BarrierSetAssembler::store_at(masm, decorators, type, dst, val, noreg, noreg, noreg);
 143   if (needs_post_barrier) {
 144     // flatten object address if needed
 145     if (!precise || (dst.index() == noreg && dst.disp() == 0)) {
 146       if (tmp3 != noreg) {
 147         // Called by MacroAssembler::pack_value_helper. We cannot corrupt the dst.base() register
 148         __ movptr(tmp3, dst.base());
 149         store_check(masm, tmp3, dst);
 150       } else {
 151         // It's OK to corrupt the dst.base() register.
 152         store_check(masm, dst.base(), dst);
 153       }
 154     } else {
 155       __ lea(tmp1, dst);
 156       store_check(masm, tmp1, dst);
 157     }
 158   }
 159 }
< prev index next >