< prev index next >

src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp

Print this page

  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  *
 23  */
 24 
 25 #include "precompiled.hpp"
 26 #include "asm/macroAssembler.inline.hpp"

 27 #include "gc/g1/g1BarrierSet.hpp"
 28 #include "gc/g1/g1BarrierSetAssembler.hpp"
 29 #include "gc/g1/g1BarrierSetRuntime.hpp"
 30 #include "gc/g1/g1CardTable.hpp"
 31 #include "gc/g1/g1ThreadLocalData.hpp"
 32 #include "gc/g1/heapRegion.hpp"
 33 #include "interpreter/interp_masm.hpp"
 34 #include "runtime/sharedRuntime.hpp"
 35 #include "utilities/debug.hpp"
 36 #include "utilities/macros.hpp"
 37 #ifdef COMPILER1
 38 #include "c1/c1_LIRAssembler.hpp"
 39 #include "c1/c1_MacroAssembler.hpp"
 40 #include "gc/g1/c1/g1BarrierSetC1.hpp"
 41 #endif
 42 
 43 #define __ masm->
 44 
 45 void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
 46                                                             Register addr, Register count) {

288 
289   __ movptr(tmp, store_addr);
290   __ xorptr(tmp, new_val);
291   __ shrptr(tmp, HeapRegion::LogOfHRGrainBytes);
292   __ jcc(Assembler::equal, done);
293 
294   // crosses regions, storing null?
295 
296   __ cmpptr(new_val, NULL_WORD);
297   __ jcc(Assembler::equal, done);
298 
299   // storing region crossing non-null, is card already dirty?
300 
301   const Register card_addr = tmp;
302   const Register cardtable = tmp2;
303 
304   __ movptr(card_addr, store_addr);
305   __ shrptr(card_addr, CardTable::card_shift());
306   // Do not use ExternalAddress to load 'byte_map_base', since 'byte_map_base' is NOT
307   // a valid address and therefore is not properly handled by the relocation code.
308   __ movptr(cardtable, (intptr_t)ct->card_table()->byte_map_base());





309   __ addptr(card_addr, cardtable);
310 
311   __ cmpb(Address(card_addr, 0), G1CardTable::g1_young_card_val());
312   __ jcc(Assembler::equal, done);
313 
314   __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad));
315   __ cmpb(Address(card_addr, 0), G1CardTable::dirty_card_val());
316   __ jcc(Assembler::equal, done);
317 
318 
319   // storing a region crossing, non-null oop, card is clean.
320   // dirty card and log.
321 
322   __ movb(Address(card_addr, 0), G1CardTable::dirty_card_val());
323 
324   __ movptr(tmp2, queue_index);
325   __ testptr(tmp2, tmp2);
326   __ jcc(Assembler::zero, runtime);
327   __ subptr(tmp2, wordSize);
328   __ movptr(queue_index, tmp2);

520   Label runtime;
521 
522   // At this point we know new_value is non-null and the new_value crosses regions.
523   // Must check to see if card is already dirty
524 
525   const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
526 
527   Address queue_index(thread, in_bytes(G1ThreadLocalData::dirty_card_queue_index_offset()));
528   Address buffer(thread, in_bytes(G1ThreadLocalData::dirty_card_queue_buffer_offset()));
529 
530   __ push(rax);
531   __ push(rcx);
532 
533   const Register cardtable = rax;
534   const Register card_addr = rcx;
535 
536   __ load_parameter(0, card_addr);
537   __ shrptr(card_addr, CardTable::card_shift());
538   // Do not use ExternalAddress to load 'byte_map_base', since 'byte_map_base' is NOT
539   // a valid address and therefore is not properly handled by the relocation code.
540   __ movptr(cardtable, (intptr_t)ct->card_table()->byte_map_base());





541   __ addptr(card_addr, cardtable);
542 
543   NOT_LP64(__ get_thread(thread);)
544 
545   __ cmpb(Address(card_addr, 0), G1CardTable::g1_young_card_val());
546   __ jcc(Assembler::equal, done);
547 
548   __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad));
549   __ cmpb(Address(card_addr, 0), CardTable::dirty_card_val());
550   __ jcc(Assembler::equal, done);
551 
552   // storing region crossing non-null, card is clean.
553   // dirty card and log.
554 
555   __ movb(Address(card_addr, 0), CardTable::dirty_card_val());
556 
557   const Register tmp = rdx;
558   __ push(rdx);
559 
560   __ movptr(tmp, queue_index);

  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  *
 23  */
 24 
 25 #include "precompiled.hpp"
 26 #include "asm/macroAssembler.inline.hpp"
 27 #include "code/SCCache.hpp"
 28 #include "gc/g1/g1BarrierSet.hpp"
 29 #include "gc/g1/g1BarrierSetAssembler.hpp"
 30 #include "gc/g1/g1BarrierSetRuntime.hpp"
 31 #include "gc/g1/g1CardTable.hpp"
 32 #include "gc/g1/g1ThreadLocalData.hpp"
 33 #include "gc/g1/heapRegion.hpp"
 34 #include "interpreter/interp_masm.hpp"
 35 #include "runtime/sharedRuntime.hpp"
 36 #include "utilities/debug.hpp"
 37 #include "utilities/macros.hpp"
 38 #ifdef COMPILER1
 39 #include "c1/c1_LIRAssembler.hpp"
 40 #include "c1/c1_MacroAssembler.hpp"
 41 #include "gc/g1/c1/g1BarrierSetC1.hpp"
 42 #endif
 43 
 44 #define __ masm->
 45 
 46 void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
 47                                                             Register addr, Register count) {

289 
290   __ movptr(tmp, store_addr);
291   __ xorptr(tmp, new_val);
292   __ shrptr(tmp, HeapRegion::LogOfHRGrainBytes);
293   __ jcc(Assembler::equal, done);
294 
295   // crosses regions, storing null?
296 
297   __ cmpptr(new_val, NULL_WORD);
298   __ jcc(Assembler::equal, done);
299 
300   // storing region crossing non-null, is card already dirty?
301 
302   const Register card_addr = tmp;
303   const Register cardtable = tmp2;
304 
305   __ movptr(card_addr, store_addr);
306   __ shrptr(card_addr, CardTable::card_shift());
307   // Do not use ExternalAddress to load 'byte_map_base', since 'byte_map_base' is NOT
308   // a valid address and therefore is not properly handled by the relocation code.
309   if (SCCache::is_on_for_write()) {
310     // SCA needs relocation info for this address
311     __ lea(cardtable, ExternalAddress((address)ct->card_table()->byte_map_base()));
312   } else {
313     __ movptr(cardtable, (intptr_t)ct->card_table()->byte_map_base());
314   }
315   __ addptr(card_addr, cardtable);
316 
317   __ cmpb(Address(card_addr, 0), G1CardTable::g1_young_card_val());
318   __ jcc(Assembler::equal, done);
319 
320   __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad));
321   __ cmpb(Address(card_addr, 0), G1CardTable::dirty_card_val());
322   __ jcc(Assembler::equal, done);
323 
324 
325   // storing a region crossing, non-null oop, card is clean.
326   // dirty card and log.
327 
328   __ movb(Address(card_addr, 0), G1CardTable::dirty_card_val());
329 
330   __ movptr(tmp2, queue_index);
331   __ testptr(tmp2, tmp2);
332   __ jcc(Assembler::zero, runtime);
333   __ subptr(tmp2, wordSize);
334   __ movptr(queue_index, tmp2);

526   Label runtime;
527 
528   // At this point we know new_value is non-null and the new_value crosses regions.
529   // Must check to see if card is already dirty
530 
531   const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
532 
533   Address queue_index(thread, in_bytes(G1ThreadLocalData::dirty_card_queue_index_offset()));
534   Address buffer(thread, in_bytes(G1ThreadLocalData::dirty_card_queue_buffer_offset()));
535 
536   __ push(rax);
537   __ push(rcx);
538 
539   const Register cardtable = rax;
540   const Register card_addr = rcx;
541 
542   __ load_parameter(0, card_addr);
543   __ shrptr(card_addr, CardTable::card_shift());
544   // Do not use ExternalAddress to load 'byte_map_base', since 'byte_map_base' is NOT
545   // a valid address and therefore is not properly handled by the relocation code.
546   if (SCCache::is_on()) {
547     // SCA needs relocation info for this address
548     __ lea(cardtable, ExternalAddress((address)ct->card_table()->byte_map_base()));
549   } else {
550     __ movptr(cardtable, (intptr_t)ct->card_table()->byte_map_base());
551   }
552   __ addptr(card_addr, cardtable);
553 
554   NOT_LP64(__ get_thread(thread);)
555 
556   __ cmpb(Address(card_addr, 0), G1CardTable::g1_young_card_val());
557   __ jcc(Assembler::equal, done);
558 
559   __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad));
560   __ cmpb(Address(card_addr, 0), CardTable::dirty_card_val());
561   __ jcc(Assembler::equal, done);
562 
563   // storing region crossing non-null, card is clean.
564   // dirty card and log.
565 
566   __ movb(Address(card_addr, 0), CardTable::dirty_card_val());
567 
568   const Register tmp = rdx;
569   __ push(rdx);
570 
571   __ movptr(tmp, queue_index);
< prev index next >