1 /*
2 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2018, 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.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "asm/macroAssembler.inline.hpp"
28 #include "registerSaver_s390.hpp"
29 #include "gc/g1/g1CardTable.hpp"
30 #include "gc/g1/g1BarrierSet.hpp"
31 #include "gc/g1/g1BarrierSetAssembler.hpp"
32 #include "gc/g1/g1BarrierSetRuntime.hpp"
33 #include "gc/g1/g1SATBMarkQueueSet.hpp"
34 #include "gc/g1/g1ThreadLocalData.hpp"
35 #include "gc/g1/heapRegion.hpp"
36 #include "interpreter/interp_masm.hpp"
37 #include "runtime/sharedRuntime.hpp"
38 #ifdef COMPILER1
39 #include "c1/c1_LIRAssembler.hpp"
40 #include "c1/c1_MacroAssembler.hpp"
41 #include "gc/g1/c1/g1BarrierSetC1.hpp"
42 #endif
43
44 #define __ masm->
45
46 #define BLOCK_COMMENT(str) if (PrintAssembly) __ block_comment(str)
47
48 void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
49 Register addr, Register count) {
50 bool dest_uninitialized = (decorators & IS_DEST_UNINITIALIZED) != 0;
51
52 // With G1, don't generate the call if we statically know that the target is uninitialized.
570 __ z_br(Z_R14);
571
572 // Not dirty.
573 __ bind(not_already_dirty);
574
575 // First, dirty it: [addr_card] := 0
576 __ z_mvi(0, addr_card, CardTable::dirty_card_val());
577
578 Register idx = cardtable; // Must be non-volatile, because it is used to save addr_card.
579 Register buf = r2;
580 cardtable = noreg; // now dead
581
582 // Save registers used below (see assertion in G1PreBarrierStub::emit_code()).
583 __ z_stg(r2, 1*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
584
585 ByteSize dirty_card_q_index_byte_offset = G1ThreadLocalData::dirty_card_queue_index_offset();
586 ByteSize dirty_card_q_buf_byte_offset = G1ThreadLocalData::dirty_card_queue_buffer_offset();
587
588 __ bind(restart);
589
590 // Get the index into the update buffer. DirtyCardQueue::_index is
591 // a size_t so z_ltg is appropriate here.
592 __ z_ltg(idx, Address(Z_thread, dirty_card_q_index_byte_offset));
593
594 // index == 0?
595 __ z_brz(refill);
596
597 __ z_lg(buf, Address(Z_thread, dirty_card_q_buf_byte_offset));
598 __ add2reg(idx, -oopSize);
599
600 __ z_stg(addr_card, 0, idx, buf); // [_buf + index] := <address_of_card>
601 __ z_stg(idx, Address(Z_thread, dirty_card_q_index_byte_offset));
602 // Restore killed registers and return.
603 __ z_lg(r1, 0*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
604 __ z_lg(r2, 1*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
605 __ z_br(Z_R14);
606
607 __ bind(refill);
608 save_volatile_registers(sasm);
609 __ z_lgr(idx, addr_card); // Save addr_card, tmp3 must be non-volatile.
610 __ call_VM_leaf(CAST_FROM_FN_PTR(address, DirtyCardQueueSet::handle_zero_index_for_thread),
611 Z_thread);
612 __ z_lgr(addr_card, idx);
613 restore_volatile_registers(sasm); // Restore addr_card.
614 __ z_bru(restart);
615 }
616
617 #undef __
618
619 #endif // COMPILER1
|
1 /*
2 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2018, 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.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "asm/macroAssembler.inline.hpp"
28 #include "registerSaver_s390.hpp"
29 #include "gc/g1/g1CardTable.hpp"
30 #include "gc/g1/g1BarrierSet.hpp"
31 #include "gc/g1/g1BarrierSetAssembler.hpp"
32 #include "gc/g1/g1BarrierSetRuntime.hpp"
33 #include "gc/g1/g1DirtyCardQueue.hpp"
34 #include "gc/g1/g1SATBMarkQueueSet.hpp"
35 #include "gc/g1/g1ThreadLocalData.hpp"
36 #include "gc/g1/heapRegion.hpp"
37 #include "interpreter/interp_masm.hpp"
38 #include "runtime/sharedRuntime.hpp"
39 #ifdef COMPILER1
40 #include "c1/c1_LIRAssembler.hpp"
41 #include "c1/c1_MacroAssembler.hpp"
42 #include "gc/g1/c1/g1BarrierSetC1.hpp"
43 #endif
44
45 #define __ masm->
46
47 #define BLOCK_COMMENT(str) if (PrintAssembly) __ block_comment(str)
48
49 void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
50 Register addr, Register count) {
51 bool dest_uninitialized = (decorators & IS_DEST_UNINITIALIZED) != 0;
52
53 // With G1, don't generate the call if we statically know that the target is uninitialized.
571 __ z_br(Z_R14);
572
573 // Not dirty.
574 __ bind(not_already_dirty);
575
576 // First, dirty it: [addr_card] := 0
577 __ z_mvi(0, addr_card, CardTable::dirty_card_val());
578
579 Register idx = cardtable; // Must be non-volatile, because it is used to save addr_card.
580 Register buf = r2;
581 cardtable = noreg; // now dead
582
583 // Save registers used below (see assertion in G1PreBarrierStub::emit_code()).
584 __ z_stg(r2, 1*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
585
586 ByteSize dirty_card_q_index_byte_offset = G1ThreadLocalData::dirty_card_queue_index_offset();
587 ByteSize dirty_card_q_buf_byte_offset = G1ThreadLocalData::dirty_card_queue_buffer_offset();
588
589 __ bind(restart);
590
591 // Get the index into the update buffer. G1DirtyCardQueue::_index is
592 // a size_t so z_ltg is appropriate here.
593 __ z_ltg(idx, Address(Z_thread, dirty_card_q_index_byte_offset));
594
595 // index == 0?
596 __ z_brz(refill);
597
598 __ z_lg(buf, Address(Z_thread, dirty_card_q_buf_byte_offset));
599 __ add2reg(idx, -oopSize);
600
601 __ z_stg(addr_card, 0, idx, buf); // [_buf + index] := <address_of_card>
602 __ z_stg(idx, Address(Z_thread, dirty_card_q_index_byte_offset));
603 // Restore killed registers and return.
604 __ z_lg(r1, 0*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
605 __ z_lg(r2, 1*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
606 __ z_br(Z_R14);
607
608 __ bind(refill);
609 save_volatile_registers(sasm);
610 __ z_lgr(idx, addr_card); // Save addr_card, tmp3 must be non-volatile.
611 __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1DirtyCardQueueSet::handle_zero_index_for_thread),
612 Z_thread);
613 __ z_lgr(addr_card, idx);
614 restore_volatile_registers(sasm); // Restore addr_card.
615 __ z_bru(restart);
616 }
617
618 #undef __
619
620 #endif // COMPILER1
|