671 //
672 // Input:
673 // start - starting address
674 // count - element count
675 void gen_write_ref_array_pre_barrier(Register start, Register count, bool uninitialized_target) {
676 assert_different_registers(start, count);
677 BarrierSet* bs = Universe::heap()->barrier_set();
678 switch (bs->kind()) {
679 case BarrierSet::G1SATBCTLogging:
680 // With G1, don't generate the call if we statically know that the target in uninitialized
681 if (!uninitialized_target) {
682 __ pusha(); // push registers
683 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre),
684 start, count);
685 __ popa();
686 }
687 break;
688 case BarrierSet::CardTableForRS:
689 case BarrierSet::CardTableExtension:
690 case BarrierSet::ModRef:
691 break;
692 default :
693 ShouldNotReachHere();
694
695 }
696 }
697
698
699 //
700 // Generate a post-barrier for an array store
701 //
702 // start - starting address
703 // count - element count
704 //
705 // The two input registers are overwritten.
706 //
707 void gen_write_ref_array_post_barrier(Register start, Register count) {
708 BarrierSet* bs = Universe::heap()->barrier_set();
709 assert_different_registers(start, count);
710 switch (bs->kind()) {
723 CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
724 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
725
726 Label L_loop;
727 const Register end = count; // elements count; end == start+count-1
728 assert_different_registers(start, end);
729
730 __ lea(end, Address(start, count, Address::times_ptr, -wordSize));
731 __ shrptr(start, CardTableModRefBS::card_shift);
732 __ shrptr(end, CardTableModRefBS::card_shift);
733 __ subptr(end, start); // end --> count
734 __ BIND(L_loop);
735 intptr_t disp = (intptr_t) ct->byte_map_base;
736 Address cardtable(start, count, Address::times_1, disp);
737 __ movb(cardtable, 0);
738 __ decrement(count);
739 __ jcc(Assembler::greaterEqual, L_loop);
740 }
741 break;
742 case BarrierSet::ModRef:
743 break;
744 default :
745 ShouldNotReachHere();
746
747 }
748 }
749
750
751 // Copy 64 bytes chunks
752 //
753 // Inputs:
754 // from - source array address
755 // to_from - destination array address - from
756 // qword_count - 8-bytes element count, negative
757 //
758 void xmm_copy_forward(Register from, Register to_from, Register qword_count) {
759 assert( UseSSE >= 2, "supported cpu only" );
760 Label L_copy_64_bytes_loop, L_copy_64_bytes, L_copy_8_bytes, L_exit;
761 if (UseAVX > 2) {
762 __ push(rbx);
|
671 //
672 // Input:
673 // start - starting address
674 // count - element count
675 void gen_write_ref_array_pre_barrier(Register start, Register count, bool uninitialized_target) {
676 assert_different_registers(start, count);
677 BarrierSet* bs = Universe::heap()->barrier_set();
678 switch (bs->kind()) {
679 case BarrierSet::G1SATBCTLogging:
680 // With G1, don't generate the call if we statically know that the target in uninitialized
681 if (!uninitialized_target) {
682 __ pusha(); // push registers
683 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre),
684 start, count);
685 __ popa();
686 }
687 break;
688 case BarrierSet::CardTableForRS:
689 case BarrierSet::CardTableExtension:
690 case BarrierSet::ModRef:
691 case BarrierSet::Epsilon:
692 break;
693 default :
694 ShouldNotReachHere();
695
696 }
697 }
698
699
700 //
701 // Generate a post-barrier for an array store
702 //
703 // start - starting address
704 // count - element count
705 //
706 // The two input registers are overwritten.
707 //
708 void gen_write_ref_array_post_barrier(Register start, Register count) {
709 BarrierSet* bs = Universe::heap()->barrier_set();
710 assert_different_registers(start, count);
711 switch (bs->kind()) {
724 CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
725 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
726
727 Label L_loop;
728 const Register end = count; // elements count; end == start+count-1
729 assert_different_registers(start, end);
730
731 __ lea(end, Address(start, count, Address::times_ptr, -wordSize));
732 __ shrptr(start, CardTableModRefBS::card_shift);
733 __ shrptr(end, CardTableModRefBS::card_shift);
734 __ subptr(end, start); // end --> count
735 __ BIND(L_loop);
736 intptr_t disp = (intptr_t) ct->byte_map_base;
737 Address cardtable(start, count, Address::times_1, disp);
738 __ movb(cardtable, 0);
739 __ decrement(count);
740 __ jcc(Assembler::greaterEqual, L_loop);
741 }
742 break;
743 case BarrierSet::ModRef:
744 case BarrierSet::Epsilon:
745 break;
746 default :
747 ShouldNotReachHere();
748
749 }
750 }
751
752
753 // Copy 64 bytes chunks
754 //
755 // Inputs:
756 // from - source array address
757 // to_from - destination array address - from
758 // qword_count - 8-bytes element count, negative
759 //
760 void xmm_copy_forward(Register from, Register to_from, Register qword_count) {
761 assert( UseSSE >= 2, "supported cpu only" );
762 Label L_copy_64_bytes_loop, L_copy_64_bytes, L_copy_8_bytes, L_exit;
763 if (UseAVX > 2) {
764 __ push(rbx);
|