/* * Copyright (c) 2019, 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.
*/
typedefstruct _jmetadata HandleRecord; typedefstruct _jmetadata *jmetadata; class MetadataHandles;
class MetadataHandleBlock : public CHeapObj<mtJVMCI> { friendclass MetadataHandles; private: enum SomeConstants {
block_size_in_handles = 32 // Number of handles per handle block
};
// Free handles always have their low bit set so those pointers can // be distinguished from handles which are in use. The last handle // on the free list has a NULL pointer with the tag bit set, so it's // clear that the handle has been reclaimed. The _free_list is // always a real pointer to a handle.
HandleRecord _handles[block_size_in_handles]; // The handles int _top; // Index of next unused handle
MetadataHandleBlock* _next; // Link to next block
MetadataHandleBlock() {
_top = 0;
_next = NULL; #ifdef METADATA_TRACK_NAMES for (int i = 0; i < block_size_in_handles; i++) {
_handles[i].initialize();
} #endif
}
// JVMCI maintains direct references to metadata. To make these references safe in the face of // class redefinition, they are held in handles so they can be scanned during GC. They are // managed in a cooperative way between the Java code and HotSpot. A handle is filled in and // passed back to the Java code which is responsible for setting the handle to NULL when it // is no longer in use. This is done by jdk.vm.ci.hotspot.HandleCleaner. The // rebuild_free_list function notices when the handle is clear and reclaims it for re-use. class MetadataHandles : public CHeapObj<mtJVMCI> { private: enum SomeConstants {
ptr_tag = 1,
ptr_mask = ~((intptr_t)ptr_tag)
};
MetadataHandleBlock* _head; // First block
MetadataHandleBlock* _last; // Last block in use
intptr_t _free_list; // Handle free list int _allocate_before_rebuild; // Number of blocks to allocate before rebuilding free list int _num_blocks; // Number of blocks int _num_handles; int _num_free_handles;
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 ist noch experimentell.