1 /*
2 * Copyright (c) 1999, 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 *
839
840 #if INCLUDE_ALL_GCS
841 case g1_pre_barrier_slow_id:
842 { // G4: previous value of memory
843 BarrierSet* bs = Universe::heap()->barrier_set();
844 if (bs->kind() != BarrierSet::G1SATBCTLogging) {
845 __ save_frame(0);
846 __ set((int)id, O1);
847 __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), I0);
848 __ should_not_reach_here();
849 break;
850 }
851
852 __ set_info("g1_pre_barrier_slow_id", dont_gc_arguments);
853
854 Register pre_val = G4;
855 Register tmp = G1_scratch;
856 Register tmp2 = G3_scratch;
857
858 Label refill, restart;
859 bool with_frame = false; // I don't know if we can do with-frame.
860 int satb_q_index_byte_offset =
861 in_bytes(JavaThread::satb_mark_queue_offset() +
862 SATBMarkQueue::byte_offset_of_index());
863 int satb_q_buf_byte_offset =
864 in_bytes(JavaThread::satb_mark_queue_offset() +
865 SATBMarkQueue::byte_offset_of_buf());
866
867 __ bind(restart);
868 // Load the index into the SATB buffer. SATBMarkQueue::_index is a
869 // size_t so ld_ptr is appropriate
870 __ ld_ptr(G2_thread, satb_q_index_byte_offset, tmp);
871
872 // index == 0?
873 __ cmp_and_brx_short(tmp, G0, Assembler::equal, Assembler::pn, refill);
874
875 __ ld_ptr(G2_thread, satb_q_buf_byte_offset, tmp2);
876 __ sub(tmp, oopSize, tmp);
877
878 __ st_ptr(pre_val, tmp2, tmp); // [_buf + index] := <address_of_card>
879 // Use return-from-leaf
880 __ retl();
881 __ delayed()->st_ptr(tmp, G2_thread, satb_q_index_byte_offset);
882
883 __ bind(refill);
884
885 save_live_registers(sasm);
|
1 /*
2 * Copyright (c) 1999, 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 *
839
840 #if INCLUDE_ALL_GCS
841 case g1_pre_barrier_slow_id:
842 { // G4: previous value of memory
843 BarrierSet* bs = Universe::heap()->barrier_set();
844 if (bs->kind() != BarrierSet::G1SATBCTLogging) {
845 __ save_frame(0);
846 __ set((int)id, O1);
847 __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), I0);
848 __ should_not_reach_here();
849 break;
850 }
851
852 __ set_info("g1_pre_barrier_slow_id", dont_gc_arguments);
853
854 Register pre_val = G4;
855 Register tmp = G1_scratch;
856 Register tmp2 = G3_scratch;
857
858 Label refill, restart;
859 int satb_q_active_byte_offset =
860 in_bytes(JavaThread::satb_mark_queue_offset() +
861 SATBMarkQueue::byte_offset_of_active());
862 int satb_q_index_byte_offset =
863 in_bytes(JavaThread::satb_mark_queue_offset() +
864 SATBMarkQueue::byte_offset_of_index());
865 int satb_q_buf_byte_offset =
866 in_bytes(JavaThread::satb_mark_queue_offset() +
867 SATBMarkQueue::byte_offset_of_buf());
868
869 // Is marking still active?
870 if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
871 __ ld(G2_thread, satb_q_active_byte_offset, tmp);
872 } else {
873 assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1,
874 "Assumption");
875 __ ldsb(G2_thread, satb_q_active_byte_offset, tmp);
876 }
877 __ cmp_and_br_short(tmp, G0, Assembler::notEqual, Assembler::pt, restart);
878 __ retl();
879 __ delayed()->nop();
880
881 __ bind(restart);
882 // Load the index into the SATB buffer. SATBMarkQueue::_index is a
883 // size_t so ld_ptr is appropriate
884 __ ld_ptr(G2_thread, satb_q_index_byte_offset, tmp);
885
886 // index == 0?
887 __ cmp_and_brx_short(tmp, G0, Assembler::equal, Assembler::pn, refill);
888
889 __ ld_ptr(G2_thread, satb_q_buf_byte_offset, tmp2);
890 __ sub(tmp, oopSize, tmp);
891
892 __ st_ptr(pre_val, tmp2, tmp); // [_buf + index] := <address_of_card>
893 // Use return-from-leaf
894 __ retl();
895 __ delayed()->st_ptr(tmp, G2_thread, satb_q_index_byte_offset);
896
897 __ bind(refill);
898
899 save_live_registers(sasm);
|