src/cpu/ppc/vm/c1_Runtime1_ppc.cpp

Print this page


   1 /*
   2  * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2012, 2015 SAP SE. All rights reserved.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.


 724 //        __ delayed()->restore();
 725       }
 726       break;
 727 
 728 #if INCLUDE_ALL_GCS
 729     case g1_pre_barrier_slow_id:
 730       {
 731         BarrierSet* bs = Universe::heap()->barrier_set();
 732         if (bs->kind() != BarrierSet::G1SATBCTLogging) {
 733           goto unimplemented_entry;
 734         }
 735 
 736         __ set_info("g1_pre_barrier_slow_id", dont_gc_arguments);
 737 
 738         // Using stack slots: pre_val (pre-pushed), spill tmp, spill tmp2.
 739         const int stack_slots = 3;
 740         Register pre_val = R0; // previous value of memory
 741         Register tmp  = R14;
 742         Register tmp2 = R15;
 743 
 744         Label refill, restart;




 745         int satb_q_index_byte_offset =
 746           in_bytes(JavaThread::satb_mark_queue_offset() +
 747                    SATBMarkQueue::byte_offset_of_index());
 748         int satb_q_buf_byte_offset =
 749           in_bytes(JavaThread::satb_mark_queue_offset() +
 750                    SATBMarkQueue::byte_offset_of_buf());
 751 
 752         // Spill
 753         __ std(tmp, -16, R1_SP);
 754         __ std(tmp2, -24, R1_SP);
 755 










 756         __ bind(restart);
 757         // Load the index into the SATB buffer. SATBMarkQueue::_index is a
 758         // size_t so ld_ptr is appropriate.
 759         __ ld(tmp, satb_q_index_byte_offset, R16_thread);
 760 
 761         // index == 0?
 762         __ cmpdi(CCR0, tmp, 0);
 763         __ beq(CCR0, refill);
 764 
 765         __ ld(tmp2, satb_q_buf_byte_offset, R16_thread);
 766         __ ld(pre_val, -8, R1_SP); // Load from stack.
 767         __ addi(tmp, tmp, -oopSize);
 768 
 769         __ std(tmp, satb_q_index_byte_offset, R16_thread);
 770         __ stdx(pre_val, tmp2, tmp); // [_buf + index] := <address_of_card>
 771 

 772         // Restore temp registers and return-from-leaf.
 773         __ ld(tmp2, -24, R1_SP);
 774         __ ld(tmp, -16, R1_SP);
 775         __ blr();
 776 
 777         __ bind(refill);
 778         const int nbytes_save = (MacroAssembler::num_volatile_regs + stack_slots) * BytesPerWord;
 779         __ save_volatile_gprs(R1_SP, -nbytes_save); // except R0
 780         __ mflr(R0);
 781         __ std(R0, _abi(lr), R1_SP);
 782         __ push_frame_reg_args(nbytes_save, R0); // dummy frame for C call
 783         __ call_VM_leaf(CAST_FROM_FN_PTR(address, SATBMarkQueueSet::handle_zero_index_for_thread), R16_thread);
 784         __ pop_frame();
 785         __ ld(R0, _abi(lr), R1_SP);
 786         __ mtlr(R0);
 787         __ restore_volatile_gprs(R1_SP, -nbytes_save); // except R0
 788         __ b(restart);
 789       }
 790       break;
 791 


   1 /*
   2  * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2012, 2015 SAP SE. All rights reserved.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.


 724 //        __ delayed()->restore();
 725       }
 726       break;
 727 
 728 #if INCLUDE_ALL_GCS
 729     case g1_pre_barrier_slow_id:
 730       {
 731         BarrierSet* bs = Universe::heap()->barrier_set();
 732         if (bs->kind() != BarrierSet::G1SATBCTLogging) {
 733           goto unimplemented_entry;
 734         }
 735 
 736         __ set_info("g1_pre_barrier_slow_id", dont_gc_arguments);
 737 
 738         // Using stack slots: pre_val (pre-pushed), spill tmp, spill tmp2.
 739         const int stack_slots = 3;
 740         Register pre_val = R0; // previous value of memory
 741         Register tmp  = R14;
 742         Register tmp2 = R15;
 743 
 744         Label refill, restart, marking_not_active;
 745    
 746         int satb_q_active_byte_offset =
 747           in_bytes(JavaThread::satb_mark_queue_offset() +
 748                    SATBMarkQueue::byte_offset_of_active());
 749         int satb_q_index_byte_offset =
 750           in_bytes(JavaThread::satb_mark_queue_offset() +
 751                    SATBMarkQueue::byte_offset_of_index());
 752         int satb_q_buf_byte_offset =
 753           in_bytes(JavaThread::satb_mark_queue_offset() +
 754                    SATBMarkQueue::byte_offset_of_buf());
 755 
 756         // Spill
 757         __ std(tmp, -16, R1_SP);
 758         __ std(tmp2, -24, R1_SP);
 759 
 760         // Is marking still active?
 761         if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
 762           __ lwz(tmp, satb_q_active_byte_offset, R16_thread);
 763         } else {
 764           guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
 765           __ lbz(tmp, satb_q_active_byte_offset, R16_thread);
 766         }
 767         __ cmpdi(CCR0, tmp, 0);
 768         __ beq(CCR0, marking_not_active);
 769 
 770         __ bind(restart);
 771         // Load the index into the SATB buffer. SATBMarkQueue::_index is a
 772         // size_t so ld_ptr is appropriate.
 773         __ ld(tmp, satb_q_index_byte_offset, R16_thread);
 774 
 775         // index == 0?
 776         __ cmpdi(CCR0, tmp, 0);
 777         __ beq(CCR0, refill);
 778 
 779         __ ld(tmp2, satb_q_buf_byte_offset, R16_thread);
 780         __ ld(pre_val, -8, R1_SP); // Load from stack.
 781         __ addi(tmp, tmp, -oopSize);
 782 
 783         __ std(tmp, satb_q_index_byte_offset, R16_thread);
 784         __ stdx(pre_val, tmp2, tmp); // [_buf + index] := <address_of_card>
 785 
 786         __ bind(marking_not_active);
 787         // Restore temp registers and return-from-leaf.
 788         __ ld(tmp2, -24, R1_SP);
 789         __ ld(tmp, -16, R1_SP);
 790         __ blr();
 791 
 792         __ bind(refill);
 793         const int nbytes_save = (MacroAssembler::num_volatile_regs + stack_slots) * BytesPerWord;
 794         __ save_volatile_gprs(R1_SP, -nbytes_save); // except R0
 795         __ mflr(R0);
 796         __ std(R0, _abi(lr), R1_SP);
 797         __ push_frame_reg_args(nbytes_save, R0); // dummy frame for C call
 798         __ call_VM_leaf(CAST_FROM_FN_PTR(address, SATBMarkQueueSet::handle_zero_index_for_thread), R16_thread);
 799         __ pop_frame();
 800         __ ld(R0, _abi(lr), R1_SP);
 801         __ mtlr(R0);
 802         __ restore_volatile_gprs(R1_SP, -nbytes_save); // except R0
 803         __ b(restart);
 804       }
 805       break;
 806