/* * 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. *
*/
struct NarrowPtrStruct { // Base address for oop-within-java-object materialization. // NULL if using wide oops or zero based narrow oops.
address _base; // Number of shift bits for encoding/decoding narrow ptrs. // 0 if using wide ptrs or zero based unscaled narrow ptrs, // LogMinObjAlignmentInBytes/LogKlassAlignmentInBytes otherwise. int _shift; // Generate code with implicit null checks for narrow ptrs. bool _use_implicit_null_checks;
};
class CompressedOops : public AllStatic { friendclass VMStructs;
// For UseCompressedOops. static NarrowPtrStruct _narrow_oop;
// The address range of the heap static MemRegion _heap_address_range;
public: // For UseCompressedOops // Narrow Oop encoding mode: // 0 - Use 32-bits oops without encoding when // NarrowOopHeapBaseMin + heap_size < 4Gb // 1 - Use zero based compressed oops with encoding when // NarrowOopHeapBaseMin + heap_size < 32Gb // 2 - Use compressed oops with disjoint heap base if // base is 32G-aligned and base > 0. This allows certain // optimizations in encoding/decoding. // Disjoint: Bits used in base are disjoint from bits used // for oops ==> oop = (cOop << 3) | base. One can disjoint // the bits of an oop into base and compressed oop. // 3 - Use compressed oops with heap base + encoding. enum Mode {
UnscaledNarrowOop = 0,
ZeroBasedNarrowOop = 1,
DisjointBaseNarrowOop = 2,
HeapBasedNarrowOop = 3,
AnyNarrowOopMode = 4
};
// The representation type for narrowOop is assumed to be uint32_t.
static_assert(std::is_same<uint32_t, std::underlying_type_t<narrowOop>>::value, "narrowOop has unexpected representation type");
// Test whether bits of addr and possible offsets into the heap overlap. staticbool is_disjoint_heap_base_address(address addr);
// Check for disjoint base compressed oops. staticbool base_disjoint();
// Check for real heapbased compressed oops. // We must subtract the base as the bits overlap. // If we negate above function, we also get unscaled and zerobased. staticbool base_overlaps();
staticvoid print_mode(outputStream* st);
staticbool is_null(oop v) { return v == NULL; } staticbool is_null(narrowOop v) { return v == narrowOop::null; }
// For UseCompressedClassPointers. class CompressedKlassPointers : public AllStatic { friendclass VMStructs;
static NarrowPtrStruct _narrow_klass;
// Together with base, this defines the address range within which Klass // structures will be located: [base, base+range). While the maximal // possible encoding range is 4|32G for shift 0|3, if we know beforehand // the expected range of Klass* pointers will be smaller, a platform // could use this info to optimize encoding. static size_t _range;
// Given an address p, return true if p can be used as an encoding base. // (Some platforms have restrictions of what constitutes a valid base // address). staticbool is_valid_base(address p);
// Given an address range [addr, addr+len) which the encoding is supposed to // cover, choose base, shift and range. // The address range is the expected range of uncompressed Klass pointers we // will encounter (and the implicit promise that there will be no Klass // structures outside this range). staticvoid initialize(address addr, size_t len);
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.