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/g1BarrierSetAssembler.hpp"
28 #include "gc/g1/g1CardTable.hpp"
29 #include "gc/g1/g1ThreadLocalData.hpp"
30 #include "gc/g1/heapRegion.hpp"
31 #include "interpreter/interp_masm.hpp"
32 #include "runtime/sharedRuntime.hpp"
33 #include "utilities/macros.hpp"
34 #ifdef COMPILER1
35 #include "c1/c1_LIRAssembler.hpp"
36 #include "c1/c1_MacroAssembler.hpp"
37 #include "gc/g1/c1/g1BarrierSetC1.hpp"
38 #endif
39
40 #define __ masm->
41
42 void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
43 Register addr, Register count) {
44 bool dest_uninitialized = (decorators & AS_DEST_NOT_INITIALIZED) != 0;
45 // With G1, don't generate the call if we statically know that the target in uninitialized
46 if (!dest_uninitialized) {
|
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/g1BarrierSetAssembler.hpp"
28 #include "gc/g1/g1BarrierSetRuntime.hpp"
29 #include "gc/g1/g1CardTable.hpp"
30 #include "gc/g1/g1ThreadLocalData.hpp"
31 #include "gc/g1/heapRegion.hpp"
32 #include "interpreter/interp_masm.hpp"
33 #include "runtime/sharedRuntime.hpp"
34 #include "utilities/macros.hpp"
35 #ifdef COMPILER1
36 #include "c1/c1_LIRAssembler.hpp"
37 #include "c1/c1_MacroAssembler.hpp"
38 #include "gc/g1/c1/g1BarrierSetC1.hpp"
39 #endif
40
41 #define __ masm->
42
43 void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
44 Register addr, Register count) {
45 bool dest_uninitialized = (decorators & AS_DEST_NOT_INITIALIZED) != 0;
46 // With G1, don't generate the call if we statically know that the target in uninitialized
47 if (!dest_uninitialized) {
|
50 // Is marking active?
51 if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
52 __ ld(G2, in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset()), tmp);
53 } else {
54 guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
55 __ ldsb(G2, in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset()), tmp);
56 }
57 // Is marking active?
58 __ cmp_and_br_short(tmp, G0, Assembler::equal, Assembler::pt, filtered);
59
60 __ save_frame(0);
61 // Save the necessary global regs... will be used after.
62 if (addr->is_global()) {
63 __ mov(addr, L0);
64 }
65 if (count->is_global()) {
66 __ mov(count, L1);
67 }
68 __ mov(addr->after_save(), O0);
69 // Get the count into O1
70 address slowpath = UseCompressedOops ? CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_narrow_oop_entry)
71 : CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry);
72 __ call(slowpath);
73 __ delayed()->mov(count->after_save(), O1);
74 if (addr->is_global()) {
75 __ mov(L0, addr);
76 }
77 if (count->is_global()) {
78 __ mov(L1, count);
79 }
80 __ restore();
81
82 __ bind(filtered);
83 DEBUG_ONLY(__ set(0xDEADC0DE, tmp);) // we have killed tmp
84 }
85 }
86
87 void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
88 Register addr, Register count, Register tmp) {
89 // Get some new fresh output registers.
90 __ save_frame(0);
91 __ mov(addr->after_save(), O0);
92 __ call(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_post_entry));
93 __ delayed()->mov(count->after_save(), O1);
94 __ restore();
95 }
96
97 #undef __
98
99 static address satb_log_enqueue_with_frame = NULL;
100 static u_char* satb_log_enqueue_with_frame_end = NULL;
101
102 static address satb_log_enqueue_frameless = NULL;
103 static u_char* satb_log_enqueue_frameless_end = NULL;
104
105 static int EnqueueCodeSize = 128 DEBUG_ONLY( + 256); // Instructions?
106
107 static void generate_satb_log_enqueue(bool with_frame) {
108 BufferBlob* bb = BufferBlob::create("enqueue_with_frame", EnqueueCodeSize);
109 CodeBuffer buf(bb);
110 MacroAssembler masm(&buf);
111
|
51 // Is marking active?
52 if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
53 __ ld(G2, in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset()), tmp);
54 } else {
55 guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
56 __ ldsb(G2, in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset()), tmp);
57 }
58 // Is marking active?
59 __ cmp_and_br_short(tmp, G0, Assembler::equal, Assembler::pt, filtered);
60
61 __ save_frame(0);
62 // Save the necessary global regs... will be used after.
63 if (addr->is_global()) {
64 __ mov(addr, L0);
65 }
66 if (count->is_global()) {
67 __ mov(count, L1);
68 }
69 __ mov(addr->after_save(), O0);
70 // Get the count into O1
71 address slowpath = UseCompressedOops ? CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_pre_narrow_oop_entry)
72 : CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_pre_oop_entry);
73 __ call(slowpath);
74 __ delayed()->mov(count->after_save(), O1);
75 if (addr->is_global()) {
76 __ mov(L0, addr);
77 }
78 if (count->is_global()) {
79 __ mov(L1, count);
80 }
81 __ restore();
82
83 __ bind(filtered);
84 DEBUG_ONLY(__ set(0xDEADC0DE, tmp);) // we have killed tmp
85 }
86 }
87
88 void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
89 Register addr, Register count, Register tmp) {
90 // Get some new fresh output registers.
91 __ save_frame(0);
92 __ mov(addr->after_save(), O0);
93 __ call(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_post_entry));
94 __ delayed()->mov(count->after_save(), O1);
95 __ restore();
96 }
97
98 #undef __
99
100 static address satb_log_enqueue_with_frame = NULL;
101 static u_char* satb_log_enqueue_with_frame_end = NULL;
102
103 static address satb_log_enqueue_frameless = NULL;
104 static u_char* satb_log_enqueue_frameless_end = NULL;
105
106 static int EnqueueCodeSize = 128 DEBUG_ONLY( + 256); // Instructions?
107
108 static void generate_satb_log_enqueue(bool with_frame) {
109 BufferBlob* bb = BufferBlob::create("enqueue_with_frame", EnqueueCodeSize);
110 CodeBuffer buf(bb);
111 MacroAssembler masm(&buf);
112
|