Path: blob/master/src/hotspot/cpu/s390/gc/shared/barrierSetAssembler_s390.cpp
41153 views
/*1* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.2* Copyright (c) 2018 SAP SE. All rights reserved.3* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4*5* This code is free software; you can redistribute it and/or modify it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 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 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425#include "precompiled.hpp"26#include "asm/macroAssembler.inline.hpp"27#include "gc/shared/barrierSetAssembler.hpp"28#include "interpreter/interp_masm.hpp"29#include "oops/compressedOops.hpp"30#include "runtime/jniHandles.hpp"3132#define __ masm->3334void BarrierSetAssembler::arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, BasicType type,35Register dst, Register count, bool do_return) {36if (do_return) { __ z_br(Z_R14); }37}3839void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,40const Address& addr, Register dst, Register tmp1, Register tmp2, Label *L_handle_null) {41bool in_heap = (decorators & IN_HEAP) != 0;42bool in_native = (decorators & IN_NATIVE) != 0;43bool not_null = (decorators & IS_NOT_NULL) != 0;44assert(in_heap || in_native, "where?");4546switch (type) {47case T_ARRAY:48case T_OBJECT: {49if (UseCompressedOops && in_heap) {50__ z_llgf(dst, addr);51if (L_handle_null != NULL) { // Label provided.52__ compareU32_and_branch(dst, (intptr_t)0, Assembler::bcondEqual, *L_handle_null);53__ oop_decoder(dst, dst, false);54} else {55__ oop_decoder(dst, dst, !not_null);56}57} else {58__ z_lg(dst, addr);59if (L_handle_null != NULL) {60__ compareU64_and_branch(dst, (intptr_t)0, Assembler::bcondEqual, *L_handle_null);61}62}63break;64}65default: Unimplemented();66}67}6869void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,70const Address& addr, Register val, Register tmp1, Register tmp2, Register tmp3) {71bool in_heap = (decorators & IN_HEAP) != 0;72bool in_native = (decorators & IN_NATIVE) != 0;73bool not_null = (decorators & IS_NOT_NULL) != 0;74assert(in_heap || in_native, "where?");75assert_different_registers(val, tmp1, tmp2);7677switch (type) {78case T_ARRAY:79case T_OBJECT: {80if (UseCompressedOops && in_heap) {81if (val == noreg) {82__ clear_mem(addr, 4);83} else if (CompressedOops::mode() == CompressedOops::UnscaledNarrowOop) {84__ z_st(val, addr);85} else {86Register tmp = (tmp1 != Z_R1) ? tmp1 : tmp2; // Avoid tmp == Z_R1 (see oop_encoder).87__ oop_encoder(tmp, val, !not_null);88__ z_st(tmp, addr);89}90} else {91if (val == noreg) {92__ clear_mem(addr, 8);93} else {94__ z_stg(val, addr);95}96}97break;98}99default: Unimplemented();100}101}102103void BarrierSetAssembler::resolve_jobject(MacroAssembler* masm, Register value, Register tmp1, Register tmp2) {104NearLabel Ldone;105__ z_ltgr(tmp1, value);106__ z_bre(Ldone); // Use NULL result as-is.107108__ z_nill(value, ~JNIHandles::weak_tag_mask);109__ z_lg(value, 0, value); // Resolve (untagged) jobject.110111__ verify_oop(value, FILE_AND_LINE);112__ bind(Ldone);113}114115void BarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler* masm, Register jni_env,116Register obj, Register tmp, Label& slowpath) {117__ z_nill(obj, ~JNIHandles::weak_tag_mask);118__ z_lg(obj, 0, obj); // Resolve (untagged) jobject.119}120121122