1 /*
2 * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
534 // - pre_val pushed on the stack
535
536 __ set_info("g1_pre_barrier_slow_id", dont_gc_arguments);
537
538 // save at least the registers that need saving if the runtime is called
539 #ifdef AARCH64
540 __ raw_push(R0, R1);
541 __ raw_push(R2, R3);
542 const int nb_saved_regs = 4;
543 #else // AARCH64
544 const RegisterSet saved_regs = RegisterSet(R0,R3) | RegisterSet(R12) | RegisterSet(LR);
545 const int nb_saved_regs = 6;
546 assert(nb_saved_regs == saved_regs.size(), "fix nb_saved_regs");
547 __ push(saved_regs);
548 #endif // AARCH64
549
550 const Register r_pre_val_0 = R0; // must be R0, to be ready for the runtime call
551 const Register r_index_1 = R1;
552 const Register r_buffer_2 = R2;
553
554 Address queue_index(Rthread, in_bytes(JavaThread::satb_mark_queue_offset() +
555 SATBMarkQueue::byte_offset_of_index()));
556 Address buffer(Rthread, in_bytes(JavaThread::satb_mark_queue_offset() +
557 SATBMarkQueue::byte_offset_of_buf()));
558
559 Label done;
560 Label runtime;
561
562 __ ldr(r_index_1, queue_index);
563 __ ldr(r_pre_val_0, Address(SP, nb_saved_regs*wordSize));
564 __ ldr(r_buffer_2, buffer);
565
566 __ subs(r_index_1, r_index_1, wordSize);
567 __ b(runtime, lt);
568
569 __ str(r_index_1, queue_index);
570 __ str(r_pre_val_0, Address(r_buffer_2, r_index_1));
571
572 __ bind(done);
573
574 #ifdef AARCH64
575 __ raw_pop(R2, R3);
576 __ raw_pop(R0, R1);
577 #else // AARCH64
578 __ pop(saved_regs);
579 #endif // AARCH64
580
|
1 /*
2 * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
534 // - pre_val pushed on the stack
535
536 __ set_info("g1_pre_barrier_slow_id", dont_gc_arguments);
537
538 // save at least the registers that need saving if the runtime is called
539 #ifdef AARCH64
540 __ raw_push(R0, R1);
541 __ raw_push(R2, R3);
542 const int nb_saved_regs = 4;
543 #else // AARCH64
544 const RegisterSet saved_regs = RegisterSet(R0,R3) | RegisterSet(R12) | RegisterSet(LR);
545 const int nb_saved_regs = 6;
546 assert(nb_saved_regs == saved_regs.size(), "fix nb_saved_regs");
547 __ push(saved_regs);
548 #endif // AARCH64
549
550 const Register r_pre_val_0 = R0; // must be R0, to be ready for the runtime call
551 const Register r_index_1 = R1;
552 const Register r_buffer_2 = R2;
553
554 Address queue_active(Rthread, in_bytes(JavaThread::satb_mark_queue_offset() +
555 SATBMarkQueue::byte_offset_of_active()));
556 Address queue_index(Rthread, in_bytes(JavaThread::satb_mark_queue_offset() +
557 SATBMarkQueue::byte_offset_of_index()));
558 Address buffer(Rthread, in_bytes(JavaThread::satb_mark_queue_offset() +
559 SATBMarkQueue::byte_offset_of_buf()));
560
561 Label done;
562 Label runtime;
563
564 // Is marking still active?
565 assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "adjust this code");
566 __ ldrb(R1, queue_active);
567 __ cbz(R1, done);
568
569 __ ldr(r_index_1, queue_index);
570 __ ldr(r_pre_val_0, Address(SP, nb_saved_regs*wordSize));
571 __ ldr(r_buffer_2, buffer);
572
573 __ subs(r_index_1, r_index_1, wordSize);
574 __ b(runtime, lt);
575
576 __ str(r_index_1, queue_index);
577 __ str(r_pre_val_0, Address(r_buffer_2, r_index_1));
578
579 __ bind(done);
580
581 #ifdef AARCH64
582 __ raw_pop(R2, R3);
583 __ raw_pop(R0, R1);
584 #else // AARCH64
585 __ pop(saved_regs);
586 #endif // AARCH64
587
|