710 // Input: |
710 // Input: |
711 // start - starting address |
711 // start - starting address |
712 // end - element count |
712 // end - element count |
713 void gen_write_ref_array_pre_barrier(Register start, Register count) { |
713 void gen_write_ref_array_pre_barrier(Register start, Register count) { |
714 assert_different_registers(start, count); |
714 assert_different_registers(start, count); |
715 #if 0 // G1 only |
|
716 BarrierSet* bs = Universe::heap()->barrier_set(); |
715 BarrierSet* bs = Universe::heap()->barrier_set(); |
717 switch (bs->kind()) { |
716 switch (bs->kind()) { |
718 case BarrierSet::G1SATBCT: |
717 case BarrierSet::G1SATBCT: |
719 case BarrierSet::G1SATBCTLogging: |
718 case BarrierSet::G1SATBCTLogging: |
720 { |
719 { |
721 __ pusha(); // push registers |
720 __ pusha(); // push registers |
722 __ push(count); |
721 __ push(count); |
723 __ push(start); |
722 __ push(start); |
724 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre)); |
723 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre))); |
725 __ addl(esp, wordSize * 2); |
724 __ addptr(rsp, 2*wordSize); |
726 __ popa(); |
725 __ popa(); |
727 } |
726 } |
728 break; |
727 break; |
729 case BarrierSet::CardTableModRef: |
728 case BarrierSet::CardTableModRef: |
730 case BarrierSet::CardTableExtension: |
729 case BarrierSet::CardTableExtension: |
748 // |
746 // |
749 void gen_write_ref_array_post_barrier(Register start, Register count) { |
747 void gen_write_ref_array_post_barrier(Register start, Register count) { |
750 BarrierSet* bs = Universe::heap()->barrier_set(); |
748 BarrierSet* bs = Universe::heap()->barrier_set(); |
751 assert_different_registers(start, count); |
749 assert_different_registers(start, count); |
752 switch (bs->kind()) { |
750 switch (bs->kind()) { |
753 #if 0 // G1 only |
|
754 case BarrierSet::G1SATBCT: |
751 case BarrierSet::G1SATBCT: |
755 case BarrierSet::G1SATBCTLogging: |
752 case BarrierSet::G1SATBCTLogging: |
756 { |
753 { |
757 __ pusha(); // push registers |
754 __ pusha(); // push registers |
758 __ push(count); |
755 __ push(count); |
759 __ push(start); |
756 __ push(start); |
760 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post)); |
757 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post))); |
761 __ addl(esp, wordSize * 2); |
758 __ addptr(rsp, 2*wordSize); |
762 __ popa(); |
759 __ popa(); |
763 |
760 |
764 } |
761 } |
765 break; |
762 break; |
766 #endif // 0 G1 only |
|
767 |
763 |
768 case BarrierSet::CardTableModRef: |
764 case BarrierSet::CardTableModRef: |
769 case BarrierSet::CardTableExtension: |
765 case BarrierSet::CardTableExtension: |
770 { |
766 { |
771 CardTableModRefBS* ct = (CardTableModRefBS*)bs; |
767 CardTableModRefBS* ct = (CardTableModRefBS*)bs; |
1376 Address from_element_addr(end_from, count, Address::times_ptr, 0); |
1372 Address from_element_addr(end_from, count, Address::times_ptr, 0); |
1377 Address to_element_addr(end_to, count, Address::times_ptr, 0); |
1373 Address to_element_addr(end_to, count, Address::times_ptr, 0); |
1378 Address elem_klass_addr(elem, oopDesc::klass_offset_in_bytes()); |
1374 Address elem_klass_addr(elem, oopDesc::klass_offset_in_bytes()); |
1379 |
1375 |
1380 // Copy from low to high addresses, indexed from the end of each array. |
1376 // Copy from low to high addresses, indexed from the end of each array. |
|
1377 gen_write_ref_array_pre_barrier(to, count); |
1381 __ lea(end_from, end_from_addr); |
1378 __ lea(end_from, end_from_addr); |
1382 __ lea(end_to, end_to_addr); |
1379 __ lea(end_to, end_to_addr); |
1383 gen_write_ref_array_pre_barrier(to, count); |
|
1384 assert(length == count, ""); // else fix next line: |
1380 assert(length == count, ""); // else fix next line: |
1385 __ negptr(count); // negate and test the length |
1381 __ negptr(count); // negate and test the length |
1386 __ jccb(Assembler::notZero, L_load_element); |
1382 __ jccb(Assembler::notZero, L_load_element); |
1387 |
1383 |
1388 // Empty array: Nothing to do. |
1384 // Empty array: Nothing to do. |