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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "asm/macroAssembler.hpp"
27 #include "asm/macroAssembler.inline.hpp"
28 #include "gc/shared/cardTable.hpp"
29 #include "gc/shared/cardTableModRefBS.hpp"
30 #include "interpreter/interpreter.hpp"
31 #include "nativeInst_aarch64.hpp"
32 #include "oops/instanceOop.hpp"
33 #include "oops/method.hpp"
34 #include "oops/objArrayKlass.hpp"
35 #include "oops/oop.inline.hpp"
36 #include "prims/methodHandles.hpp"
37 #include "runtime/frame.inline.hpp"
38 #include "runtime/handles.inline.hpp"
39 #include "runtime/sharedRuntime.hpp"
40 #include "runtime/stubCodeGenerator.hpp"
41 #include "runtime/stubRoutines.hpp"
42 #include "runtime/thread.inline.hpp"
43 #include "utilities/align.hpp"
44 #ifdef COMPILER2
45 #include "opto/runtime.hpp"
46 #endif
47
48 #ifdef BUILTIN_SIM
|
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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "asm/macroAssembler.hpp"
27 #include "asm/macroAssembler.inline.hpp"
28 #include "gc/shared/cardTable.hpp"
29 #include "gc/shared/cardTableBarrierSet.hpp"
30 #include "interpreter/interpreter.hpp"
31 #include "nativeInst_aarch64.hpp"
32 #include "oops/instanceOop.hpp"
33 #include "oops/method.hpp"
34 #include "oops/objArrayKlass.hpp"
35 #include "oops/oop.inline.hpp"
36 #include "prims/methodHandles.hpp"
37 #include "runtime/frame.inline.hpp"
38 #include "runtime/handles.inline.hpp"
39 #include "runtime/sharedRuntime.hpp"
40 #include "runtime/stubCodeGenerator.hpp"
41 #include "runtime/stubRoutines.hpp"
42 #include "runtime/thread.inline.hpp"
43 #include "utilities/align.hpp"
44 #ifdef COMPILER2
45 #include "opto/runtime.hpp"
46 #endif
47
48 #ifdef BUILTIN_SIM
|
636 // With G1, don't generate the call if we statically know that the target in uninitialized
637 if (!dest_uninitialized) {
638 __ push(saved_regs, sp);
639 if (count == c_rarg0) {
640 if (addr == c_rarg1) {
641 // exactly backwards!!
642 __ mov(rscratch1, c_rarg0);
643 __ mov(c_rarg0, c_rarg1);
644 __ mov(c_rarg1, rscratch1);
645 } else {
646 __ mov(c_rarg1, count);
647 __ mov(c_rarg0, addr);
648 }
649 } else {
650 __ mov(c_rarg0, addr);
651 __ mov(c_rarg1, count);
652 }
653 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre), 2);
654 __ pop(saved_regs, sp);
655 break;
656 case BarrierSet::CardTableModRef:
657 break;
658 default:
659 ShouldNotReachHere();
660
661 }
662 }
663 }
664
665 //
666 // Generate code for an array write post barrier
667 //
668 // Input:
669 // start - register containing starting address of destination array
670 // end - register containing ending address of destination array
671 // scratch - scratch register
672 // saved_regs - registers to be saved before calling static_write_ref_array_post
673 //
674 // The input registers are overwritten.
675 // The ending address is inclusive.
|
636 // With G1, don't generate the call if we statically know that the target in uninitialized
637 if (!dest_uninitialized) {
638 __ push(saved_regs, sp);
639 if (count == c_rarg0) {
640 if (addr == c_rarg1) {
641 // exactly backwards!!
642 __ mov(rscratch1, c_rarg0);
643 __ mov(c_rarg0, c_rarg1);
644 __ mov(c_rarg1, rscratch1);
645 } else {
646 __ mov(c_rarg1, count);
647 __ mov(c_rarg0, addr);
648 }
649 } else {
650 __ mov(c_rarg0, addr);
651 __ mov(c_rarg1, count);
652 }
653 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre), 2);
654 __ pop(saved_regs, sp);
655 break;
656 case BarrierSet::CardTableBarrierSet:
657 break;
658 default:
659 ShouldNotReachHere();
660
661 }
662 }
663 }
664
665 //
666 // Generate code for an array write post barrier
667 //
668 // Input:
669 // start - register containing starting address of destination array
670 // end - register containing ending address of destination array
671 // scratch - scratch register
672 // saved_regs - registers to be saved before calling static_write_ref_array_post
673 //
674 // The input registers are overwritten.
675 // The ending address is inclusive.
|
677 // Clobbers: r0-r18, v0-v7, v16-v31, except saved_regs.
678 void gen_write_ref_array_post_barrier(Register start, Register end, Register scratch, RegSet saved_regs) {
679 assert_different_registers(start, end, scratch);
680 BarrierSet* bs = Universe::heap()->barrier_set();
681 switch (bs->kind()) {
682 case BarrierSet::G1BarrierSet:
683
684 {
685 __ push(saved_regs, sp);
686 // must compute element count unless barrier set interface is changed (other platforms supply count)
687 assert_different_registers(start, end, scratch);
688 __ lea(scratch, Address(end, BytesPerHeapOop));
689 __ sub(scratch, scratch, start); // subtract start to get #bytes
690 __ lsr(scratch, scratch, LogBytesPerHeapOop); // convert to element count
691 __ mov(c_rarg0, start);
692 __ mov(c_rarg1, scratch);
693 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post), 2);
694 __ pop(saved_regs, sp);
695 }
696 break;
697 case BarrierSet::CardTableModRef:
698 {
699 CardTableModRefBS* ctbs = barrier_set_cast<CardTableModRefBS>(bs);
700 CardTable* ct = ctbs->card_table();
701 assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "adjust this code");
702
703 Label L_loop;
704
705 __ lsr(start, start, CardTable::card_shift);
706 __ lsr(end, end, CardTable::card_shift);
707 __ sub(end, end, start); // number of bytes to copy
708
709 const Register count = end; // 'end' register contains bytes count now
710 __ load_byte_map_base(scratch);
711 __ add(start, start, scratch);
712 if (UseConcMarkSweepGC) {
713 __ membar(__ StoreStore);
714 }
715 __ BIND(L_loop);
716 __ strb(zr, Address(start, count));
717 __ subs(count, count, 1);
718 __ br(Assembler::GE, L_loop);
|
677 // Clobbers: r0-r18, v0-v7, v16-v31, except saved_regs.
678 void gen_write_ref_array_post_barrier(Register start, Register end, Register scratch, RegSet saved_regs) {
679 assert_different_registers(start, end, scratch);
680 BarrierSet* bs = Universe::heap()->barrier_set();
681 switch (bs->kind()) {
682 case BarrierSet::G1BarrierSet:
683
684 {
685 __ push(saved_regs, sp);
686 // must compute element count unless barrier set interface is changed (other platforms supply count)
687 assert_different_registers(start, end, scratch);
688 __ lea(scratch, Address(end, BytesPerHeapOop));
689 __ sub(scratch, scratch, start); // subtract start to get #bytes
690 __ lsr(scratch, scratch, LogBytesPerHeapOop); // convert to element count
691 __ mov(c_rarg0, start);
692 __ mov(c_rarg1, scratch);
693 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post), 2);
694 __ pop(saved_regs, sp);
695 }
696 break;
697 case BarrierSet::CardTableBarrierSet:
698 {
699 CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(bs);
700 CardTable* ct = ctbs->card_table();
701 assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "adjust this code");
702
703 Label L_loop;
704
705 __ lsr(start, start, CardTable::card_shift);
706 __ lsr(end, end, CardTable::card_shift);
707 __ sub(end, end, start); // number of bytes to copy
708
709 const Register count = end; // 'end' register contains bytes count now
710 __ load_byte_map_base(scratch);
711 __ add(start, start, scratch);
712 if (UseConcMarkSweepGC) {
713 __ membar(__ StoreStore);
714 }
715 __ BIND(L_loop);
716 __ strb(zr, Address(start, count));
717 __ subs(count, count, 1);
718 __ br(Assembler::GE, L_loop);
|