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 und die Messung sind noch experimentell.