Path: blob/master/src/hotspot/share/gc/z/zForwarding.hpp
40957 views
/*1* Copyright (c) 2015, 2020, 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_ZFORWARDING_HPP24#define SHARE_GC_Z_ZFORWARDING_HPP2526#include "gc/z/zAttachedArray.hpp"27#include "gc/z/zForwardingEntry.hpp"28#include "gc/z/zLock.hpp"29#include "gc/z/zVirtualMemory.hpp"3031class ObjectClosure;32class ZForwardingAllocator;33class ZPage;3435typedef size_t ZForwardingCursor;3637class ZForwarding {38friend class VMStructs;39friend class ZForwardingTest;4041private:42typedef ZAttachedArray<ZForwarding, ZForwardingEntry> AttachedArray;4344const ZVirtualMemory _virtual;45const size_t _object_alignment_shift;46const AttachedArray _entries;47ZPage* _page;48mutable ZConditionLock _ref_lock;49volatile int32_t _ref_count;50bool _ref_abort;51bool _in_place;5253ZForwardingEntry* entries() const;54ZForwardingEntry at(ZForwardingCursor* cursor) const;55ZForwardingEntry first(uintptr_t from_index, ZForwardingCursor* cursor) const;56ZForwardingEntry next(ZForwardingCursor* cursor) const;5758ZForwarding(ZPage* page, size_t nentries);5960public:61static uint32_t nentries(const ZPage* page);62static ZForwarding* alloc(ZForwardingAllocator* allocator, ZPage* page);6364uint8_t type() const;65uintptr_t start() const;66size_t size() const;67size_t object_alignment_shift() const;68void object_iterate(ObjectClosure *cl);6970bool retain_page();71ZPage* claim_page();72void release_page();73bool wait_page_released() const;74ZPage* detach_page();75void abort_page();7677void set_in_place();78bool in_place() const;7980ZForwardingEntry find(uintptr_t from_index, ZForwardingCursor* cursor) const;81uintptr_t insert(uintptr_t from_index, uintptr_t to_offset, ZForwardingCursor* cursor);8283void verify() const;84};8586#endif // SHARE_GC_Z_ZFORWARDING_HPP878889