/* * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. * */ #include "precompiled.hpp" #include "gc/shared/c1ModRefBSCodeGen.hpp" #include "utilities/macros.hpp" #ifdef ASSERT #define __ lir_generator->lir(__FILE__, __LINE__)-> #else #define __ lir_generator->lir()-> #endif void C1ModRefBSCodeGen::store_at_resolved(LIRGenerator *lir_generator, C1DecoratorSet decorators, BasicType type, LIR_Opr addr, LIRItem& base, LIR_Opr offset, LIR_Opr value, CodeEmitInfo* patch_info, CodeEmitInfo* store_emit_info) { bool is_oop = type == T_OBJECT || type == T_ARRAY; bool on_array = (decorators & C1_ACCESS_ON_ARRAY) != 0; bool on_anonymous = (decorators & C1_ACCESS_ON_ANONYMOUS) != 0; if (is_oop) { pre_barrier(lir_generator, decorators, addr, LIR_OprFact::illegalOpr /* pre_val */, patch_info); } C1BarrierSetCodeGen::store_at_resolved(lir_generator, decorators, type, addr, base, offset, value, patch_info, store_emit_info); if (is_oop) { bool precise = on_array || on_anonymous; LIR_Opr post_addr = precise ? addr : base.result(); post_barrier(lir_generator, decorators, post_addr, value); } } LIR_Opr C1ModRefBSCodeGen::cas_at_resolved(LIRGenerator *lir_generator, C1DecoratorSet decorators, BasicType type, LIR_Opr addr, LIRItem& base, LIRItem& offset, LIRItem& cmp_value, LIRItem& new_value) { bool is_oop = type == T_OBJECT || type == T_ARRAY; if (is_oop) { pre_barrier(lir_generator, decorators, addr, LIR_OprFact::illegalOpr /* pre_val */, NULL); } LIR_Opr result = C1BarrierSetCodeGen::cas_at_resolved(lir_generator, decorators, type, addr, base, offset, cmp_value, new_value); if (is_oop) { post_barrier(lir_generator, decorators, addr, new_value.result()); } return result; } LIR_Opr C1ModRefBSCodeGen::swap_at_resolved(LIRGenerator* lir_generator, C1DecoratorSet decorators, BasicType type, LIR_Opr addr, LIRItem& base, LIRItem& offset, LIRItem& value) { bool is_oop = type == T_OBJECT || type == T_ARRAY; if (is_oop) { pre_barrier(lir_generator, decorators, addr, LIR_OprFact::illegalOpr /* pre_val */, NULL); } LIR_Opr result = C1BarrierSetCodeGen::swap_at_resolved(lir_generator, decorators, type, addr, base, offset, value); if (is_oop) { post_barrier(lir_generator, decorators, addr, value.result()); } return result; }