src/cpu/s390/vm/c1_Runtime1_s390.cpp

Print this page


   1 /*
   2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2016 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.


 767       }
 768       break;
 769 #endif // TODO
 770 
 771 #if INCLUDE_ALL_GCS
 772     case g1_pre_barrier_slow_id:
 773       { // Z_R1_scratch: previous value of memory
 774 
 775         BarrierSet* bs = Universe::heap()->barrier_set();
 776         if (bs->kind() != BarrierSet::G1SATBCTLogging) {
 777           __ should_not_reach_here(FILE_AND_LINE);
 778           break;
 779         }
 780 
 781         __ set_info("g1_pre_barrier_slow_id", dont_gc_arguments);
 782 
 783         Register pre_val = Z_R1_scratch;
 784         Register tmp  = Z_R6; // Must be non-volatile because it is used to save pre_val.
 785         Register tmp2 = Z_R7;
 786 
 787         Label refill, restart;



 788         int satb_q_index_byte_offset =
 789           in_bytes(JavaThread::satb_mark_queue_offset() +
 790                    SATBMarkQueue::byte_offset_of_index());
 791         int satb_q_buf_byte_offset =
 792           in_bytes(JavaThread::satb_mark_queue_offset() +
 793                    SATBMarkQueue::byte_offset_of_buf());
 794 
 795         // Save tmp registers (see assertion in G1PreBarrierStub::emit_code()).
 796         __ z_stg(tmp,  0*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
 797         __ z_stg(tmp2, 1*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
 798 









 799         __ bind(restart);
 800         // Load the index into the SATB buffer. SATBMarkQueue::_index is a
 801         // size_t so ld_ptr is appropriate.
 802         __ z_ltg(tmp, satb_q_index_byte_offset, Z_R0, Z_thread);
 803 
 804         // index == 0?
 805         __ z_brz(refill);
 806 
 807         __ z_lg(tmp2, satb_q_buf_byte_offset, Z_thread);
 808         __ add2reg(tmp, -oopSize);
 809 
 810         __ z_stg(pre_val, 0, tmp, tmp2); // [_buf + index] := <address_of_card>
 811         __ z_stg(tmp, satb_q_index_byte_offset, Z_thread);
 812 

 813         // Restore tmp registers (see assertion in G1PreBarrierStub::emit_code()).
 814         __ z_lg(tmp,  0*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
 815         __ z_lg(tmp2, 1*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
 816         __ z_br(Z_R14);
 817 
 818         __ bind(refill);
 819         save_volatile_registers(sasm);
 820         __ z_lgr(tmp, pre_val); // save pre_val
 821         __ call_VM_leaf(CAST_FROM_FN_PTR(address, SATBMarkQueueSet::handle_zero_index_for_thread),
 822                         Z_thread);
 823         __ z_lgr(pre_val, tmp); // restore pre_val
 824         restore_volatile_registers(sasm);
 825         __ z_bru(restart);
 826       }
 827       break;
 828 
 829     case g1_post_barrier_slow_id:
 830       { // Z_R1_scratch: oop address, address of updated memory slot
 831         BarrierSet* bs = Universe::heap()->barrier_set();
 832         if (bs->kind() != BarrierSet::G1SATBCTLogging) {


   1 /*
   2  * Copyright (c) 2016, 2017 Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2016 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.


 767       }
 768       break;
 769 #endif // TODO
 770 
 771 #if INCLUDE_ALL_GCS
 772     case g1_pre_barrier_slow_id:
 773       { // Z_R1_scratch: previous value of memory
 774 
 775         BarrierSet* bs = Universe::heap()->barrier_set();
 776         if (bs->kind() != BarrierSet::G1SATBCTLogging) {
 777           __ should_not_reach_here(FILE_AND_LINE);
 778           break;
 779         }
 780 
 781         __ set_info("g1_pre_barrier_slow_id", dont_gc_arguments);
 782 
 783         Register pre_val = Z_R1_scratch;
 784         Register tmp  = Z_R6; // Must be non-volatile because it is used to save pre_val.
 785         Register tmp2 = Z_R7;
 786 
 787         Label refill, restart, marking_not_active;
 788         int satb_q_active_byte_offset =
 789           in_bytes(JavaThread::satb_mark_queue_offset() +
 790                    SATBMarkQueue::byte_offset_of_active());
 791         int satb_q_index_byte_offset =
 792           in_bytes(JavaThread::satb_mark_queue_offset() +
 793                    SATBMarkQueue::byte_offset_of_index());
 794         int satb_q_buf_byte_offset =
 795           in_bytes(JavaThread::satb_mark_queue_offset() +
 796                    SATBMarkQueue::byte_offset_of_buf());
 797 
 798         // Save tmp registers (see assertion in G1PreBarrierStub::emit_code()).
 799         __ z_stg(tmp,  0*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
 800         __ z_stg(tmp2, 1*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
 801 
 802         // Is marking still active?
 803         if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
 804           __ load_and_test_int(tmp, Address(Z_thread, satb_q_active_byte_offset));
 805         } else {
 806           assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
 807           __ load_and_test_byte(tmp, Address(Z_thread, satb_q_active_byte_offset));
 808         }
 809         __ z_bre(marking_not_active); // Activity indicator is zero, so there is no marking going on currently.
 810 
 811         __ bind(restart);
 812         // Load the index into the SATB buffer. SATBMarkQueue::_index is a
 813         // size_t so ld_ptr is appropriate.
 814         __ z_ltg(tmp, satb_q_index_byte_offset, Z_R0, Z_thread);
 815 
 816         // index == 0?
 817         __ z_brz(refill);
 818 
 819         __ z_lg(tmp2, satb_q_buf_byte_offset, Z_thread);
 820         __ add2reg(tmp, -oopSize);
 821 
 822         __ z_stg(pre_val, 0, tmp, tmp2); // [_buf + index] := <address_of_card>
 823         __ z_stg(tmp, satb_q_index_byte_offset, Z_thread);
 824 
 825         __ bind(marking_not_active);
 826         // Restore tmp registers (see assertion in G1PreBarrierStub::emit_code()).
 827         __ z_lg(tmp,  0*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
 828         __ z_lg(tmp2, 1*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
 829         __ z_br(Z_R14);
 830 
 831         __ bind(refill);
 832         save_volatile_registers(sasm);
 833         __ z_lgr(tmp, pre_val); // save pre_val
 834         __ call_VM_leaf(CAST_FROM_FN_PTR(address, SATBMarkQueueSet::handle_zero_index_for_thread),
 835                         Z_thread);
 836         __ z_lgr(pre_val, tmp); // restore pre_val
 837         restore_volatile_registers(sasm);
 838         __ z_bru(restart);
 839       }
 840       break;
 841 
 842     case g1_post_barrier_slow_id:
 843       { // Z_R1_scratch: oop address, address of updated memory slot
 844         BarrierSet* bs = Universe::heap()->barrier_set();
 845         if (bs->kind() != BarrierSet::G1SATBCTLogging) {