/* * Copyright (c) 2019, 2022, 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. *
*/
class BootstrapInfo; class ReservedSpace; class VirtualSpace;
// ArchivePtrMarker is used to mark the location of pointers embedded in a CDS archive. E.g., when an // InstanceKlass k is dumped, we mark the location of the k->_name pointer by effectively calling // mark_pointer(/*ptr_loc=*/&k->_name). It's required that (_prt_base <= ptr_loc < _ptr_end). _ptr_base is // fixed, but _ptr_end can be expanded as more objects are dumped. class ArchivePtrMarker : AllStatic { static CHeapBitMap* _ptrmap; static VirtualSpace* _vs;
// Once _ptrmap is compacted, we don't allow bit marking anymore. This is to // avoid unintentional copy operations after the bitmap has been finalized and written. staticbool _compacted;
// SharedDataRelocator is used to shift pointers in the CDS archive. // // The CDS archive is basically a contiguous block of memory (divided into several regions) // that contains multiple objects. The objects may contain direct pointers that point to other objects // within the archive (e.g., InstanceKlass::_name points to a Symbol in the archive). During dumping, we // built a bitmap that marks the locations of all these pointers (using ArchivePtrMarker, see comments above). // // The contents of the archive assumes that it’s mapped at the default SharedBaseAddress (e.g. 0x800000000). // If the archive ends up being mapped at a different address (e.g. 0x810000000), SharedDataRelocator // is used to shift each marked pointer by a delta (0x10000000 in this example), so that it points to // the actually mapped location of the target object. class SharedDataRelocator: public BitMapClosure { // for all (address** p), where (is_marked(p) && _patch_base <= p && p < _patch_end) { *p += delta; }
// Patch all pointers within this region that are marked.
address* _patch_base;
address* _patch_end;
// Before patching, all pointers must point to this region.
address _valid_old_base;
address _valid_old_end;
// After patching, all pointers must point to this region.
address _valid_new_base;
address _valid_new_end;
// How much to relocate for each pointer.
intx _delta;
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.