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/g1ThreadLocalData.hpp"
34 #include "gc/g1/heapRegion.hpp"
35 #include "interpreter/interp_masm.hpp"
36 #include "runtime/sharedRuntime.hpp"
37 #ifdef COMPILER1
38 #include "c1/c1_LIRAssembler.hpp"
39 #include "c1/c1_MacroAssembler.hpp"
40 #include "gc/g1/c1/g1BarrierSetC1.hpp"
41 #endif
42
43 #define __ masm->
44
45 #define BLOCK_COMMENT(str) if (PrintAssembly) __ block_comment(str)
46
47 void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
48 Register addr, Register count) {
49 bool dest_uninitialized = (decorators & IS_DEST_UNINITIALIZED) != 0;
50
51 // With G1, don't generate the call if we statically know that the target is uninitialized.
52 if (!dest_uninitialized) {
503 __ z_ltg(tmp, satb_q_index_byte_offset, Z_R0, Z_thread);
504
505 // index == 0?
506 __ z_brz(refill);
507
508 __ z_lg(tmp2, satb_q_buf_byte_offset, Z_thread);
509 __ add2reg(tmp, -oopSize);
510
511 __ z_stg(pre_val, 0, tmp, tmp2); // [_buf + index] := <address_of_card>
512 __ z_stg(tmp, satb_q_index_byte_offset, Z_thread);
513
514 __ bind(marking_not_active);
515 // Restore tmp registers (see assertion in G1PreBarrierStub::emit_code()).
516 __ z_lg(tmp, 0*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
517 __ z_lg(tmp2, 1*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
518 __ z_br(Z_R14);
519
520 __ bind(refill);
521 save_volatile_registers(sasm);
522 __ z_lgr(tmp, pre_val); // save pre_val
523 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SATBMarkQueueSet::handle_zero_index_for_thread),
524 Z_thread);
525 __ z_lgr(pre_val, tmp); // restore pre_val
526 restore_volatile_registers(sasm);
527 __ z_bru(restart);
528 }
529
530 void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler* sasm) {
531 // Z_R1_scratch: oop address, address of updated memory slot
532
533 BarrierSet* bs = BarrierSet::barrier_set();
534 __ set_info("g1_post_barrier_slow_id", false);
535
536 Register addr_oop = Z_R1_scratch;
537 Register addr_card = Z_R1_scratch;
538 Register r1 = Z_R6; // Must be saved/restored.
539 Register r2 = Z_R7; // Must be saved/restored.
540 Register cardtable = r1; // Must be non-volatile, because it is used to save addr_card.
541 CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(bs);
542 CardTable* ct = ctbs->card_table();
543 jbyte* byte_map_base = ct->byte_map_base();
|
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.
53 if (!dest_uninitialized) {
504 __ z_ltg(tmp, satb_q_index_byte_offset, Z_R0, Z_thread);
505
506 // index == 0?
507 __ z_brz(refill);
508
509 __ z_lg(tmp2, satb_q_buf_byte_offset, Z_thread);
510 __ add2reg(tmp, -oopSize);
511
512 __ z_stg(pre_val, 0, tmp, tmp2); // [_buf + index] := <address_of_card>
513 __ z_stg(tmp, satb_q_index_byte_offset, Z_thread);
514
515 __ bind(marking_not_active);
516 // Restore tmp registers (see assertion in G1PreBarrierStub::emit_code()).
517 __ z_lg(tmp, 0*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
518 __ z_lg(tmp2, 1*BytesPerWord + FrameMap::first_available_sp_in_frame, Z_SP);
519 __ z_br(Z_R14);
520
521 __ bind(refill);
522 save_volatile_registers(sasm);
523 __ z_lgr(tmp, pre_val); // save pre_val
524 __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1SATBMarkQueueSet::handle_zero_index_for_thread),
525 Z_thread);
526 __ z_lgr(pre_val, tmp); // restore pre_val
527 restore_volatile_registers(sasm);
528 __ z_bru(restart);
529 }
530
531 void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler* sasm) {
532 // Z_R1_scratch: oop address, address of updated memory slot
533
534 BarrierSet* bs = BarrierSet::barrier_set();
535 __ set_info("g1_post_barrier_slow_id", false);
536
537 Register addr_oop = Z_R1_scratch;
538 Register addr_card = Z_R1_scratch;
539 Register r1 = Z_R6; // Must be saved/restored.
540 Register r2 = Z_R7; // Must be saved/restored.
541 Register cardtable = r1; // Must be non-volatile, because it is used to save addr_card.
542 CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(bs);
543 CardTable* ct = ctbs->card_table();
544 jbyte* byte_map_base = ct->byte_map_base();
|