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.inline.hpp"
27 #include "gc/g1/g1BarrierSet.hpp"
28 #include "gc/g1/g1CardTable.hpp"
29 #include "gc/g1/g1BarrierSetCodeGen.hpp"
30 #include "gc/g1/heapRegion.hpp"
31 #include "gc/shared/collectedHeap.hpp"
32 #include "runtime/thread.hpp"
33 #include "interpreter/interp_masm.hpp"
34
35 #define __ masm->
36
37 void G1BarrierSetCodeGen::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators, Register from, Register to,
38 Register preserve1, Register preserve2) {
39 bool dest_uninitialized = (decorators & AS_DEST_NOT_INITIALIZED) != 0;
40 // With G1, don't generate the call if we statically know that the target in uninitialized
41 if (!dest_uninitialized) {
42 int spill_slots = 3;
43 if (preserve1 != noreg) { spill_slots++; }
44 if (preserve2 != noreg) { spill_slots++; }
45 const int frame_size = align_up(frame::abi_reg_args_size + spill_slots * BytesPerWord, frame::alignment_in_bytes);
46 Label filtered;
47
48 // Is marking active?
49 if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
50 __ lwz(R0, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active()), R16_thread);
51 } else {
52 guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
53 __ lbz(R0, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active()), R16_thread);
54 }
55 __ cmpdi(CCR0, R0, 0);
56 __ beq(CCR0, filtered);
57
|
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.inline.hpp"
27 #include "gc/g1/g1BarrierSet.hpp"
28 #include "gc/g1/g1CardTable.hpp"
29 #include "gc/g1/g1BarrierSetAssembler.hpp"
30 #include "gc/g1/heapRegion.hpp"
31 #include "gc/shared/collectedHeap.hpp"
32 #include "runtime/thread.hpp"
33 #include "interpreter/interp_masm.hpp"
34
35 #define __ masm->
36
37 void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
38 Register from, Register to, Register count,
39 Register preserve1, Register preserve2) {
40 bool dest_uninitialized = (decorators & AS_DEST_NOT_INITIALIZED) != 0;
41 // With G1, don't generate the call if we statically know that the target in uninitialized
42 if (!dest_uninitialized) {
43 int spill_slots = 3;
44 if (preserve1 != noreg) { spill_slots++; }
45 if (preserve2 != noreg) { spill_slots++; }
46 const int frame_size = align_up(frame::abi_reg_args_size + spill_slots * BytesPerWord, frame::alignment_in_bytes);
47 Label filtered;
48
49 // Is marking active?
50 if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
51 __ lwz(R0, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active()), R16_thread);
52 } else {
53 guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
54 __ lbz(R0, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active()), R16_thread);
55 }
56 __ cmpdi(CCR0, R0, 0);
57 __ beq(CCR0, filtered);
58
|
66
67 if (UseCompressedOops) {
68 __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_narrow_oop_entry), to, count);
69 } else {
70 __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry), to, count);
71 }
72
73 slot_nr = 0;
74 __ ld(from, frame_size - (++slot_nr) * wordSize, R1_SP);
75 __ ld(to, frame_size - (++slot_nr) * wordSize, R1_SP);
76 __ ld(count, frame_size - (++slot_nr) * wordSize, R1_SP);
77 if (preserve1 != noreg) { __ ld(preserve1, frame_size - (++slot_nr) * wordSize, R1_SP); }
78 if (preserve2 != noreg) { __ ld(preserve2, frame_size - (++slot_nr) * wordSize, R1_SP); }
79 __ addi(R1_SP, R1_SP, frame_size); // pop_frame()
80 __ restore_LR_CR(R0);
81
82 __ bind(filtered);
83 }
84 }
85
86 void G1BarrierSetCodeGen::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators, Register addr, Register cou
87 int spill_slots = (preserve != noreg) ? 1 : 0;
88 const int frame_size = align_up(frame::abi_reg_args_size + spill_slots * BytesPerWord, frame::alignment_in_bytes);
89
90 __ save_LR_CR(R0);
91 __ push_frame(frame_size, R0);
92 if (preserve != noreg) { __ std(preserve, frame_size - 1 * wordSize, R1_SP); }
93 __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_post_entry), addr, count);
94 if (preserve != noreg) { __ ld(preserve, frame_size - 1 * wordSize, R1_SP); }
95 __ addi(R1_SP, R1_SP, frame_size); // pop_frame();
96 __ restore_LR_CR(R0);
97 }
|
67
68 if (UseCompressedOops) {
69 __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_narrow_oop_entry), to, count);
70 } else {
71 __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry), to, count);
72 }
73
74 slot_nr = 0;
75 __ ld(from, frame_size - (++slot_nr) * wordSize, R1_SP);
76 __ ld(to, frame_size - (++slot_nr) * wordSize, R1_SP);
77 __ ld(count, frame_size - (++slot_nr) * wordSize, R1_SP);
78 if (preserve1 != noreg) { __ ld(preserve1, frame_size - (++slot_nr) * wordSize, R1_SP); }
79 if (preserve2 != noreg) { __ ld(preserve2, frame_size - (++slot_nr) * wordSize, R1_SP); }
80 __ addi(R1_SP, R1_SP, frame_size); // pop_frame()
81 __ restore_LR_CR(R0);
82
83 __ bind(filtered);
84 }
85 }
86
87 void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
88 Register addr, Register count, Register preserve) {
89 int spill_slots = (preserve != noreg) ? 1 : 0;
90 const int frame_size = align_up(frame::abi_reg_args_size + spill_slots * BytesPerWord, frame::alignment_in_bytes);
91
92 __ save_LR_CR(R0);
93 __ push_frame(frame_size, R0);
94 if (preserve != noreg) { __ std(preserve, frame_size - 1 * wordSize, R1_SP); }
95 __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_post_entry), addr, count);
96 if (preserve != noreg) { __ ld(preserve, frame_size - 1 * wordSize, R1_SP); }
97 __ addi(R1_SP, R1_SP, frame_size); // pop_frame();
98 __ restore_LR_CR(R0);
99 }
|