Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/shenandoah/c2/shenandoahBarrierSetC2.cpp
38922 views
/*1* Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation.6*7* This code is distributed in the hope that it will be useful, but WITHOUT8* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or9* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License10* version 2 for more details (a copy is included in the LICENSE file that11* accompanied this code).12*13* You should have received a copy of the GNU General Public License version14* 2 along with this work; if not, write to the Free Software Foundation,15* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.16*17* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA18* or visit www.oracle.com if you need additional information or have any19* questions.20*21*/2223#include "precompiled.hpp"24#include "gc_implementation/shenandoah/shenandoahBarrierSet.hpp"25#include "gc_implementation/shenandoah/shenandoahRuntime.hpp"26#include "gc_implementation/shenandoah/c2/shenandoahBarrierSetC2.hpp"27#include "gc_implementation/shenandoah/c2/shenandoahSupport.hpp"28#include "opto/type.hpp"29#include "runtime/thread.hpp"3031ShenandoahBarrierSetC2* ShenandoahBarrierSetC2::bsc2() {32return ShenandoahBarrierSet::barrier_set()->bsc2();33}3435bool ShenandoahBarrierSetC2::is_shenandoah_lrb_call(Node* call) {36if (!call->is_CallLeaf()) {37return false;38}3940address entry_point = call->as_CallLeaf()->entry_point();41return (entry_point == CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier)) ||42(entry_point == CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_narrow));43}4445bool ShenandoahBarrierSetC2::is_shenandoah_state_load(Node* n) {46if (!n->is_Load()) return false;47const int state_offset = in_bytes(JavaThread::gc_state_offset());48return n->in(2)->is_AddP() && n->in(2)->in(2)->Opcode() == Op_ThreadLocal49&& n->in(2)->in(3)->is_Con()50&& n->in(2)->in(3)->bottom_type()->is_intptr_t()->get_con() == state_offset;51}5253const TypeFunc* ShenandoahBarrierSetC2::shenandoah_load_reference_barrier_Type() {54const Type **fields = TypeTuple::fields(2);55fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // original field value56fields[TypeFunc::Parms+1] = TypeRawPtr::BOTTOM; // original load address5758const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields);5960// create result type (range)61fields = TypeTuple::fields(1);62fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL;63const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields);6465return TypeFunc::make(domain, range);66}6768Node* ShenandoahBarrierSetC2::step_over_gc_barrier(Node* c) {69if (c->Opcode() == Op_ShenandoahLoadReferenceBarrier) {70return c->in(ShenandoahLoadReferenceBarrierNode::ValueIn);71}72return c;73}7475Node* ShenandoahBarrierSetC2::load_reference_barrier(GraphKit* kit, Node* n) const {76if (ShenandoahLoadRefBarrier) {77return kit->gvn().transform(new (kit->C) ShenandoahLoadReferenceBarrierNode(NULL, n));78} else {79return n;80}81}828384