/* * Copyright (c) 2018, 2021, 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. *
*/
// Array of all active blocks. Refcounted for lock-free reclaim of // old array when a new array is allocated for expansion. class OopStorage::ActiveArray { friendclass OopStorage::TestAccess;
// Support for OopStorage::allocate. // Add block to the end of the array. Updates block count at the // end of the operation, with a release_store. Returns true if the // block was added, false if there was no room available. // precondition: owner's _allocation_mutex is locked, or at safepoint. bool push(Block* block);
// Support OopStorage::delete_empty_blocks_xxx operations. // Remove block from the array. // precondition: block must be present at its active_index element. void remove(Block* block);
// A Block has an embedded AllocationListEntry to provide the links between // Blocks in an AllocationList. class OopStorage::AllocationListEntry { friendclass OopStorage::AllocationList;
// Members are mutable, and we deal exclusively with pointers to // const, to make const blocks easier to use; a block being const // doesn't prevent modifying its list state. mutableconst Block* _prev; mutableconst Block* _next;
// Fixed-sized array of oops, plus bookkeeping data. // All blocks are in the storage's _active_array, at the block's _active_index. // Non-full blocks are in the storage's _allocation_list, linked through the // block's _allocation_list_entry. Empty blocks are at the end of that list. class OopStorage::Block /* No base class, to avoid messing up alignment. */ { // _data must be the first non-static data member, for alignment.
oop _data[BitsPerWord]; staticconstunsigned _data_pos = 0; // Position of _data.
volatile uintx _allocated_bitmask; // One bit per _data element.
intptr_t _owner_address; void* _memory; // Unaligned storage containing block.
size_t _active_index;
AllocationListEntry _allocation_list_entry;
Block* volatile _deferred_updates_next; volatile uintx _release_refcount;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.