Path: blob/master/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp
40976 views
/*1* Copyright (c) 2015, 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*/2223#ifndef SHARE_GC_Z_C2_ZBARRIERSETC2_HPP24#define SHARE_GC_Z_C2_ZBARRIERSETC2_HPP2526#include "gc/shared/c2/barrierSetC2.hpp"27#include "memory/allocation.hpp"28#include "opto/node.hpp"29#include "utilities/growableArray.hpp"3031const uint8_t ZLoadBarrierElided = 0;32const uint8_t ZLoadBarrierStrong = 1;33const uint8_t ZLoadBarrierWeak = 2;34const uint8_t ZLoadBarrierPhantom = 4;35const uint8_t ZLoadBarrierNoKeepalive = 8;3637class ZLoadBarrierStubC2 : public ResourceObj {38private:39const MachNode* _node;40const Address _ref_addr;41const Register _ref;42const Register _tmp;43const uint8_t _barrier_data;44Label _entry;45Label _continuation;4647ZLoadBarrierStubC2(const MachNode* node, Address ref_addr, Register ref, Register tmp, uint8_t barrier_data);4849public:50static ZLoadBarrierStubC2* create(const MachNode* node, Address ref_addr, Register ref, Register tmp, uint8_t barrier_data);5152Address ref_addr() const;53Register ref() const;54Register tmp() const;55address slow_path() const;56RegMask& live() const;57Label* entry();58Label* continuation();59};6061class ZBarrierSetC2 : public BarrierSetC2 {62private:63void compute_liveness_at_stubs() const;64void analyze_dominating_barriers() const;6566protected:67virtual Node* load_at_resolved(C2Access& access, const Type* val_type) const;68virtual Node* atomic_cmpxchg_val_at_resolved(C2AtomicParseAccess& access,69Node* expected_val,70Node* new_val,71const Type* val_type) const;72virtual Node* atomic_cmpxchg_bool_at_resolved(C2AtomicParseAccess& access,73Node* expected_val,74Node* new_val,75const Type* value_type) const;76virtual Node* atomic_xchg_at_resolved(C2AtomicParseAccess& access,77Node* new_val,78const Type* val_type) const;7980public:81virtual void* create_barrier_state(Arena* comp_arena) const;82virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc,83BasicType type,84bool is_clone,85bool is_clone_instance,86ArrayCopyPhase phase) const;87virtual void clone_at_expansion(PhaseMacroExpand* phase,88ArrayCopyNode* ac) const;8990virtual void late_barrier_analysis() const;91virtual int estimate_stub_size() const;92virtual void emit_stubs(CodeBuffer& cb) const;93};9495#endif // SHARE_GC_Z_C2_ZBARRIERSETC2_HPP969798