8 * This code is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #include "precompiled.hpp"
25 #include "asm/macroAssembler.inline.hpp"
26 #include "gc/g1/g1BarrierSet.hpp"
27 #include "gc/g1/g1CardTable.hpp"
28 #include "gc/g1/g1BarrierSetCodeGen.hpp"
29 #include "gc/g1/heapRegion.hpp"
30 #include "gc/shared/collectedHeap.hpp"
31 #include "interpreter/interp_masm.hpp"
32 #include "runtime/sharedRuntime.hpp"
33 #include "runtime/thread.hpp"
34 #include "utilities/macros.hpp"
35
36 #define __ masm->
37
38 void G1BarrierSetCodeGen::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators, Register addr, Register coun
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 Register tmp = O5;
43 assert_different_registers(addr, count, tmp);
44 Label filtered;
45 // Is marking active?
46 if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
47 __ ld(G2, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active()), tmp);
48 } else {
49 guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1,
50 "Assumption");
51 __ ldsb(G2, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active()), tmp);
52 }
53 // Is marking active?
54 __ cmp_and_br_short(tmp, G0, Assembler::equal, Assembler::pt, filtered);
55
56 __ save_frame(0);
57 // Save the necessary global regs... will be used after.
|
8 * This code is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #include "precompiled.hpp"
25 #include "asm/macroAssembler.inline.hpp"
26 #include "gc/g1/g1BarrierSet.hpp"
27 #include "gc/g1/g1CardTable.hpp"
28 #include "gc/g1/g1BarrierSetAssembler.hpp"
29 #include "gc/g1/heapRegion.hpp"
30 #include "gc/shared/collectedHeap.hpp"
31 #include "interpreter/interp_masm.hpp"
32 #include "runtime/sharedRuntime.hpp"
33 #include "runtime/thread.hpp"
34 #include "utilities/macros.hpp"
35
36 #define __ masm->
37
38 void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
39 Register addr, Register count) {
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 Register tmp = O5;
44 assert_different_registers(addr, count, tmp);
45 Label filtered;
46 // Is marking active?
47 if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
48 __ ld(G2, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active()), tmp);
49 } else {
50 guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1,
51 "Assumption");
52 __ ldsb(G2, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active()), tmp);
53 }
54 // Is marking active?
55 __ cmp_and_br_short(tmp, G0, Assembler::equal, Assembler::pt, filtered);
56
57 __ save_frame(0);
58 // Save the necessary global regs... will be used after.
|
63 }
64 __ mov(addr->after_save(), O0);
65 // Get the count into O1
66 address slowpath = UseCompressedOops ? CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_narrow_oop_entry)
67 : CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry);
68 __ call(slowpath);
69 __ delayed()->mov(count->after_save(), O1);
70 if (addr->is_global()) {
71 __ mov(L0, addr);
72 }
73 if (count->is_global()) {
74 __ mov(L1, count);
75 }
76 __ restore();
77
78 __ bind(filtered);
79 DEBUG_ONLY(__ set(0xDEADC0DE, tmp);) // we have killed tmp
80 }
81 }
82
83 void G1BarrierSetCodeGen::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators, Register addr, Register cou
84 // Get some new fresh output registers.
85 __ save_frame(0);
86 __ mov(addr->after_save(), O0);
87 __ call(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_post_entry));
88 __ delayed()->mov(count->after_save(), O1);
89 __ restore();
90 }
|
64 }
65 __ mov(addr->after_save(), O0);
66 // Get the count into O1
67 address slowpath = UseCompressedOops ? CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_narrow_oop_entry)
68 : CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry);
69 __ call(slowpath);
70 __ delayed()->mov(count->after_save(), O1);
71 if (addr->is_global()) {
72 __ mov(L0, addr);
73 }
74 if (count->is_global()) {
75 __ mov(L1, count);
76 }
77 __ restore();
78
79 __ bind(filtered);
80 DEBUG_ONLY(__ set(0xDEADC0DE, tmp);) // we have killed tmp
81 }
82 }
83
84 void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
85 Register addr, Register count, Register tmp) {
86 // Get some new fresh output registers.
87 __ save_frame(0);
88 __ mov(addr->after_save(), O0);
89 __ call(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_post_entry));
90 __ delayed()->mov(count->after_save(), O1);
91 __ restore();
92 }
|