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 "interpreter/interp_masm.hpp" 33 #include "runtime/sharedRuntime.hpp" 34 #include "runtime/thread.hpp" 35 #include "utilities/macros.hpp" 36 37 #define __ masm-> 38 39 void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators, 40 Register addr, Register count) { 41 bool dest_uninitialized = (decorators & AS_DEST_NOT_INITIALIZED) != 0; 42 // With G1, don't generate the call if we statically know that the target in uninitialized 43 if (!dest_uninitialized) { 44 Register tmp = O5; 45 assert_different_registers(addr, count, tmp); 46 Label filtered; 47 // Is marking active? 48 if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) { 49 __ ld(G2, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active()), tmp); 50 } else { 51 guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, 52 "Assumption"); 53 __ ldsb(G2, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active()), tmp); 54 } 55 // Is marking active? 56 __ cmp_and_br_short(tmp, G0, Assembler::equal, Assembler::pt, filtered); 57 58 __ save_frame(0); 59 // Save the necessary global regs... will be used after. 60 if (addr->is_global()) { 61 __ mov(addr, L0); 62 } 63 if (count->is_global()) { 64 __ mov(count, L1); 65 } 66 __ mov(addr->after_save(), O0); 67 // Get the count into O1 68 address slowpath = UseCompressedOops ? CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_narrow_oop_entry) 69 : CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry); 70 __ call(slowpath); 71 __ delayed()->mov(count->after_save(), O1); 72 if (addr->is_global()) { 73 __ mov(L0, addr); | 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/g1ThreadLocalData.hpp" 31 #include "gc/g1/heapRegion.hpp" 32 #include "gc/shared/collectedHeap.hpp" 33 #include "interpreter/interp_masm.hpp" 34 #include "runtime/sharedRuntime.hpp" 35 #include "utilities/macros.hpp" 36 37 #define __ masm-> 38 39 void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators, 40 Register addr, Register count) { 41 bool dest_uninitialized = (decorators & AS_DEST_NOT_INITIALIZED) != 0; 42 // With G1, don't generate the call if we statically know that the target in uninitialized 43 if (!dest_uninitialized) { 44 Register tmp = O5; 45 assert_different_registers(addr, count, tmp); 46 Label filtered; 47 // Is marking active? 48 if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) { 49 __ ld(G2, in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset()), tmp); 50 } else { 51 guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption"); 52 __ ldsb(G2, in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset()), 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. 59 if (addr->is_global()) { 60 __ mov(addr, L0); 61 } 62 if (count->is_global()) { 63 __ mov(count, L1); 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); |