comparison src/cpu/x86/vm/stubGenerator_x86_32.cpp @ 342:37f87013dfd8

6711316: Open source the Garbage-First garbage collector Summary: First mercurial integration of the code for the Garbage-First garbage collector. Reviewed-by: apetrusenko, iveresov, jmasa, sgoldman, tonyp, ysr
author ysr
date Thu, 05 Jun 2008 15:57:56 -0700
parents a73cc31728fe
children 1ee8caae33af
comparison
equal deleted inserted replaced
189:0b27f3512f9e 342:37f87013dfd8
709 // Input: 709 // Input:
710 // start - starting address 710 // start - starting address
711 // end - element count 711 // end - element count
712 void gen_write_ref_array_pre_barrier(Register start, Register count) { 712 void gen_write_ref_array_pre_barrier(Register start, Register count) {
713 assert_different_registers(start, count); 713 assert_different_registers(start, count);
714 #if 0 // G1 only
715 BarrierSet* bs = Universe::heap()->barrier_set(); 714 BarrierSet* bs = Universe::heap()->barrier_set();
716 switch (bs->kind()) { 715 switch (bs->kind()) {
717 case BarrierSet::G1SATBCT: 716 case BarrierSet::G1SATBCT:
718 case BarrierSet::G1SATBCTLogging: 717 case BarrierSet::G1SATBCTLogging:
719 { 718 {
720 __ pushad(); // push registers 719 __ pushad(); // push registers
721 __ pushl(count); 720 __ pushl(count);
722 __ pushl(start); 721 __ pushl(start);
723 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre)); 722 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre)));
724 __ addl(esp, wordSize * 2); 723 __ addl(rsp, wordSize * 2);
725 __ popad(); 724 __ popad();
726 } 725 }
727 break; 726 break;
728 case BarrierSet::CardTableModRef: 727 case BarrierSet::CardTableModRef:
729 case BarrierSet::CardTableExtension: 728 case BarrierSet::CardTableExtension:
731 break; 730 break;
732 default : 731 default :
733 ShouldNotReachHere(); 732 ShouldNotReachHere();
734 733
735 } 734 }
736 #endif // 0 - G1 only
737 } 735 }
738 736
739 737
740 // 738 //
741 // Generate a post-barrier for an array store 739 // Generate a post-barrier for an array store
747 // 745 //
748 void gen_write_ref_array_post_barrier(Register start, Register count) { 746 void gen_write_ref_array_post_barrier(Register start, Register count) {
749 BarrierSet* bs = Universe::heap()->barrier_set(); 747 BarrierSet* bs = Universe::heap()->barrier_set();
750 assert_different_registers(start, count); 748 assert_different_registers(start, count);
751 switch (bs->kind()) { 749 switch (bs->kind()) {
752 #if 0 // G1 only
753 case BarrierSet::G1SATBCT: 750 case BarrierSet::G1SATBCT:
754 case BarrierSet::G1SATBCTLogging: 751 case BarrierSet::G1SATBCTLogging:
755 { 752 {
756 __ pushad(); // push registers 753 __ pushad(); // push registers
757 __ pushl(count); 754 __ pushl(count);
758 __ pushl(start); 755 __ pushl(start);
759 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post)); 756 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post)));
760 __ addl(esp, wordSize * 2); 757 __ addl(rsp, wordSize * 2);
761 __ popad(); 758 __ popad();
762 759
763 } 760 }
764 break; 761 break;
765 #endif // 0 G1 only
766 762
767 case BarrierSet::CardTableModRef: 763 case BarrierSet::CardTableModRef:
768 case BarrierSet::CardTableExtension: 764 case BarrierSet::CardTableExtension:
769 { 765 {
770 CardTableModRefBS* ct = (CardTableModRefBS*)bs; 766 CardTableModRefBS* ct = (CardTableModRefBS*)bs;
1375 Address from_element_addr(end_from, count, Address::times_4, 0); 1371 Address from_element_addr(end_from, count, Address::times_4, 0);
1376 Address to_element_addr(end_to, count, Address::times_4, 0); 1372 Address to_element_addr(end_to, count, Address::times_4, 0);
1377 Address elem_klass_addr(elem, oopDesc::klass_offset_in_bytes()); 1373 Address elem_klass_addr(elem, oopDesc::klass_offset_in_bytes());
1378 1374
1379 // Copy from low to high addresses, indexed from the end of each array. 1375 // Copy from low to high addresses, indexed from the end of each array.
1376 gen_write_ref_array_pre_barrier(to, count);
1380 __ leal(end_from, end_from_addr); 1377 __ leal(end_from, end_from_addr);
1381 __ leal(end_to, end_to_addr); 1378 __ leal(end_to, end_to_addr);
1382 gen_write_ref_array_pre_barrier(to, count);
1383 assert(length == count, ""); // else fix next line: 1379 assert(length == count, ""); // else fix next line:
1384 __ negl(count); // negate and test the length 1380 __ negl(count); // negate and test the length
1385 __ jccb(Assembler::notZero, L_load_element); 1381 __ jccb(Assembler::notZero, L_load_element);
1386 1382
1387 // Empty array: Nothing to do. 1383 // Empty array: Nothing to do.