Path: blob/master/src/hotspot/cpu/x86/gc/shared/modRefBarrierSetAssembler_x86.cpp
41155 views
/*1* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 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 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "asm/macroAssembler.inline.hpp"26#include "gc/shared/modRefBarrierSetAssembler.hpp"2728#define __ masm->2930void ModRefBarrierSetAssembler::arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, BasicType type,31Register src, Register dst, Register count) {32bool checkcast = (decorators & ARRAYCOPY_CHECKCAST) != 0;33bool disjoint = (decorators & ARRAYCOPY_DISJOINT) != 0;34bool obj_int = type == T_OBJECT LP64_ONLY(&& UseCompressedOops);3536if (is_reference_type(type)) {37#ifdef _LP6438if (!checkcast) {39if (!obj_int) {40// Save count for barrier41__ movptr(r11, count);42} else if (disjoint) {43// Save dst in r11 in the disjoint case44__ movq(r11, dst);45}46}47#else48if (disjoint) {49__ mov(rdx, dst); // save 'to'50}51#endif52gen_write_ref_array_pre_barrier(masm, decorators, dst, count);53}54}5556void ModRefBarrierSetAssembler::arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, BasicType type,57Register src, Register dst, Register count) {58bool checkcast = (decorators & ARRAYCOPY_CHECKCAST) != 0;59bool disjoint = (decorators & ARRAYCOPY_DISJOINT) != 0;60bool obj_int = type == T_OBJECT LP64_ONLY(&& UseCompressedOops);61Register tmp = rax;6263if (is_reference_type(type)) {64#ifdef _LP6465if (!checkcast) {66if (!obj_int) {67// Save count for barrier68count = r11;69} else if (disjoint) {70// Use the saved dst in the disjoint case71dst = r11;72}73} else {74tmp = rscratch1;75}76#else77if (disjoint) {78__ mov(dst, rdx); // restore 'to'79}80#endif81gen_write_ref_array_post_barrier(masm, decorators, dst, count, tmp);82}83}8485void ModRefBarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,86Address dst, Register val, Register tmp1, Register tmp2) {87if (is_reference_type(type)) {88oop_store_at(masm, decorators, type, dst, val, tmp1, tmp2);89} else {90BarrierSetAssembler::store_at(masm, decorators, type, dst, val, tmp1, tmp2);91}92}939495