1 /*
2 * Copyright (c) 1997, 2014, 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 *
940 if (NOLp == NULL)
941 __ brx(Assembler::greaterEqualUnsigned, false, Assembler::pt, no_overlap_target);
942 else
943 __ brx(Assembler::greaterEqualUnsigned, false, Assembler::pt, (*NOLp));
944 __ delayed()->nop();
945 }
946
947 //
948 // Generate pre-write barrier for array.
949 //
950 // Input:
951 // addr - register containing starting address
952 // count - register containing element count
953 // tmp - scratch register
954 //
955 // The input registers are overwritten.
956 //
957 void gen_write_ref_array_pre_barrier(Register addr, Register count, bool dest_uninitialized) {
958 BarrierSet* bs = Universe::heap()->barrier_set();
959 switch (bs->kind()) {
960 case BarrierSet::G1SATBCT:
961 case BarrierSet::G1SATBCTLogging:
962 // With G1, don't generate the call if we statically know that the target in uninitialized
963 if (!dest_uninitialized) {
964 __ save_frame(0);
965 // Save the necessary global regs... will be used after.
966 if (addr->is_global()) {
967 __ mov(addr, L0);
968 }
969 if (count->is_global()) {
970 __ mov(count, L1);
971 }
972 __ mov(addr->after_save(), O0);
973 // Get the count into O1
974 __ call(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre));
975 __ delayed()->mov(count->after_save(), O1);
976 if (addr->is_global()) {
977 __ mov(L0, addr);
978 }
979 if (count->is_global()) {
980 __ mov(L1, count);
988 break;
989 default:
990 ShouldNotReachHere();
991 }
992 }
993 //
994 // Generate post-write barrier for array.
995 //
996 // Input:
997 // addr - register containing starting address
998 // count - register containing element count
999 // tmp - scratch register
1000 //
1001 // The input registers are overwritten.
1002 //
1003 void gen_write_ref_array_post_barrier(Register addr, Register count,
1004 Register tmp) {
1005 BarrierSet* bs = Universe::heap()->barrier_set();
1006
1007 switch (bs->kind()) {
1008 case BarrierSet::G1SATBCT:
1009 case BarrierSet::G1SATBCTLogging:
1010 {
1011 // Get some new fresh output registers.
1012 __ save_frame(0);
1013 __ mov(addr->after_save(), O0);
1014 __ call(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post));
1015 __ delayed()->mov(count->after_save(), O1);
1016 __ restore();
1017 }
1018 break;
1019 case BarrierSet::CardTableModRef:
1020 case BarrierSet::CardTableExtension:
1021 {
1022 CardTableModRefBS* ct = (CardTableModRefBS*)bs;
1023 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
1024 assert_different_registers(addr, count, tmp);
1025
1026 Label L_loop;
1027
1028 __ sll_ptr(count, LogBytesPerHeapOop, count);
|
1 /*
2 * Copyright (c) 1997, 2015, 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 *
940 if (NOLp == NULL)
941 __ brx(Assembler::greaterEqualUnsigned, false, Assembler::pt, no_overlap_target);
942 else
943 __ brx(Assembler::greaterEqualUnsigned, false, Assembler::pt, (*NOLp));
944 __ delayed()->nop();
945 }
946
947 //
948 // Generate pre-write barrier for array.
949 //
950 // Input:
951 // addr - register containing starting address
952 // count - register containing element count
953 // tmp - scratch register
954 //
955 // The input registers are overwritten.
956 //
957 void gen_write_ref_array_pre_barrier(Register addr, Register count, bool dest_uninitialized) {
958 BarrierSet* bs = Universe::heap()->barrier_set();
959 switch (bs->kind()) {
960 case BarrierSet::G1SATBCTLogging:
961 // With G1, don't generate the call if we statically know that the target in uninitialized
962 if (!dest_uninitialized) {
963 __ save_frame(0);
964 // Save the necessary global regs... will be used after.
965 if (addr->is_global()) {
966 __ mov(addr, L0);
967 }
968 if (count->is_global()) {
969 __ mov(count, L1);
970 }
971 __ mov(addr->after_save(), O0);
972 // Get the count into O1
973 __ call(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre));
974 __ delayed()->mov(count->after_save(), O1);
975 if (addr->is_global()) {
976 __ mov(L0, addr);
977 }
978 if (count->is_global()) {
979 __ mov(L1, count);
987 break;
988 default:
989 ShouldNotReachHere();
990 }
991 }
992 //
993 // Generate post-write barrier for array.
994 //
995 // Input:
996 // addr - register containing starting address
997 // count - register containing element count
998 // tmp - scratch register
999 //
1000 // The input registers are overwritten.
1001 //
1002 void gen_write_ref_array_post_barrier(Register addr, Register count,
1003 Register tmp) {
1004 BarrierSet* bs = Universe::heap()->barrier_set();
1005
1006 switch (bs->kind()) {
1007 case BarrierSet::G1SATBCTLogging:
1008 {
1009 // Get some new fresh output registers.
1010 __ save_frame(0);
1011 __ mov(addr->after_save(), O0);
1012 __ call(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post));
1013 __ delayed()->mov(count->after_save(), O1);
1014 __ restore();
1015 }
1016 break;
1017 case BarrierSet::CardTableModRef:
1018 case BarrierSet::CardTableExtension:
1019 {
1020 CardTableModRefBS* ct = (CardTableModRefBS*)bs;
1021 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
1022 assert_different_registers(addr, count, tmp);
1023
1024 Label L_loop;
1025
1026 __ sll_ptr(count, LogBytesPerHeapOop, count);
|