src/hotspot/share/oops/compressedOops.cpp
author coleenp
Wed, 24 Jul 2019 10:22:11 -0400
changeset 57511 00ae3b739184
parent 54780 f8d182aedc92
child 58015 dd84de796f2c
child 58678 9cf78a70fa4f
permissions -rw-r--r--
8228485: JVM crashes when bootstrap method for condy triggers loading of class whose static initializer throws exception Summary: Add case for JVM_CONSTANT_Dynamic in error_message function. Reviewed-by: dholmes, shade
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
54780
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
     1
/*
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
     2
 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
     4
 *
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
     7
 * published by the Free Software Foundation.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
     8
 *
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    13
 * accompanied this code).
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    14
 *
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    18
 *
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    21
 * questions.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    22
 *
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    23
 */
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    24
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    25
#include "precompiled.hpp"
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    26
#include "aot/aotLoader.hpp"
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    27
#include "logging/log.hpp"
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    28
#include "logging/logStream.hpp"
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    29
#include "memory/memRegion.hpp"
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    30
#include "memory/universe.hpp"
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    31
#include "oops/compressedOops.hpp"
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    32
#include "gc/shared/collectedHeap.hpp"
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    33
#include "runtime/globals.hpp"
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    34
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    35
// For UseCompressedOops.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    36
NarrowPtrStruct CompressedOops::_narrow_oop = { NULL, 0, true };
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    37
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    38
address CompressedOops::_narrow_ptrs_base;
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    39
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    40
// Choose the heap base address and oop encoding mode
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    41
// when compressed oops are used:
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    42
// Unscaled  - Use 32-bits oops without encoding when
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    43
//     NarrowOopHeapBaseMin + heap_size < 4Gb
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    44
// ZeroBased - Use zero based compressed oops with encoding when
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    45
//     NarrowOopHeapBaseMin + heap_size < 32Gb
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    46
// HeapBased - Use compressed oops with heap base + encoding.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    47
void CompressedOops::initialize() {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    48
#ifdef _LP64
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    49
  if (UseCompressedOops) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    50
    // Subtract a page because something can get allocated at heap base.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    51
    // This also makes implicit null checking work, because the
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    52
    // memory+1 page below heap_base needs to cause a signal.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    53
    // See needs_explicit_null_check.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    54
    // Only set the heap base for compressed oops because it indicates
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    55
    // compressed oops for pstack code.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    56
    if ((uint64_t)Universe::heap()->reserved_region().end() > UnscaledOopHeapMax) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    57
      // Didn't reserve heap below 4Gb.  Must shift.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    58
      set_shift(LogMinObjAlignmentInBytes);
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    59
    }
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    60
    if ((uint64_t)Universe::heap()->reserved_region().end() <= OopEncodingHeapMax) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    61
      // Did reserve heap below 32Gb. Can use base == 0;
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    62
      set_base(0);
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    63
    }
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    64
    AOTLoader::set_narrow_oop_shift();
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    65
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    66
    set_ptrs_base(base());
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    67
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    68
    LogTarget(Info, gc, heap, coops) lt;
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    69
    if (lt.is_enabled()) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    70
      ResourceMark rm;
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    71
      LogStream ls(lt);
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    72
      print_mode(&ls);
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    73
    }
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    74
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    75
    // Tell tests in which mode we run.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    76
    Arguments::PropertyList_add(new SystemProperty("java.vm.compressedOopsMode",
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    77
                                                   mode_to_string(mode()),
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    78
                                                   false));
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    79
  }
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    80
  // base() is one page below the heap.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    81
  assert((intptr_t)base() <= (intptr_t)(Universe::heap()->base() - os::vm_page_size()) ||
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    82
         base() == NULL, "invalid value");
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    83
  assert(shift() == LogMinObjAlignmentInBytes ||
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    84
         shift() == 0, "invalid value");
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    85
#endif
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    86
}
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    87
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    88
void CompressedOops::set_base(address base) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    89
  assert(UseCompressedOops, "no compressed oops?");
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    90
  _narrow_oop._base    = base;
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    91
}
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    92
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    93
void CompressedOops::set_shift(int shift) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    94
  _narrow_oop._shift   = shift;
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    95
}
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    96
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    97
void CompressedOops::set_use_implicit_null_checks(bool use) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    98
  assert(UseCompressedOops, "no compressed ptrs?");
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
    99
  _narrow_oop._use_implicit_null_checks   = use;
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   100
}
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   101
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   102
void CompressedOops::set_ptrs_base(address addr) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   103
  _narrow_ptrs_base = addr;
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   104
}
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   105
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   106
CompressedOops::Mode CompressedOops::mode() {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   107
  if (base_disjoint()) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   108
    return DisjointBaseNarrowOop;
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   109
  }
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   110
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   111
  if (base() != 0) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   112
    return HeapBasedNarrowOop;
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   113
  }
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   114
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   115
  if (shift() != 0) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   116
    return ZeroBasedNarrowOop;
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   117
  }
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   118
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   119
  return UnscaledNarrowOop;
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   120
}
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   121
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   122
const char* CompressedOops::mode_to_string(Mode mode) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   123
  switch (mode) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   124
    case UnscaledNarrowOop:
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   125
      return "32-bit";
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   126
    case ZeroBasedNarrowOop:
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   127
      return "Zero based";
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   128
    case DisjointBaseNarrowOop:
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   129
      return "Non-zero disjoint base";
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   130
    case HeapBasedNarrowOop:
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   131
      return "Non-zero based";
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   132
    default:
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   133
      ShouldNotReachHere();
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   134
      return "";
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   135
  }
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   136
}
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   137
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   138
// Test whether bits of addr and possible offsets into the heap overlap.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   139
bool CompressedOops::is_disjoint_heap_base_address(address addr) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   140
  return (((uint64_t)(intptr_t)addr) &
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   141
          (((uint64_t)UCONST64(0xFFFFffffFFFFffff)) >> (32-LogMinObjAlignmentInBytes))) == 0;
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   142
}
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   143
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   144
// Check for disjoint base compressed oops.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   145
bool CompressedOops::base_disjoint() {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   146
  return _narrow_oop._base != NULL && is_disjoint_heap_base_address(_narrow_oop._base);
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   147
}
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   148
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   149
// Check for real heapbased compressed oops.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   150
// We must subtract the base as the bits overlap.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   151
// If we negate above function, we also get unscaled and zerobased.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   152
bool CompressedOops::base_overlaps() {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   153
  return _narrow_oop._base != NULL && !is_disjoint_heap_base_address(_narrow_oop._base);
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   154
}
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   155
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   156
void CompressedOops::print_mode(outputStream* st) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   157
  st->print("Heap address: " PTR_FORMAT ", size: " SIZE_FORMAT " MB",
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   158
            p2i(Universe::heap()->base()), Universe::heap()->reserved_region().byte_size()/M);
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   159
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   160
  st->print(", Compressed Oops mode: %s", mode_to_string(mode()));
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   161
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   162
  if (base() != 0) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   163
    st->print(": " PTR_FORMAT, p2i(base()));
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   164
  }
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   165
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   166
  if (shift() != 0) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   167
    st->print(", Oop shift amount: %d", shift());
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   168
  }
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   169
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   170
  if (!use_implicit_null_checks()) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   171
    st->print(", no protected page in front of the heap");
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   172
  }
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   173
  st->cr();
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   174
}
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   175
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   176
// For UseCompressedClassPointers.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   177
NarrowPtrStruct CompressedKlassPointers::_narrow_klass = { NULL, 0, true };
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   178
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   179
// CompressedClassSpaceSize set to 1GB, but appear 3GB away from _narrow_ptrs_base during CDS dump.
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   180
uint64_t CompressedKlassPointers::_narrow_klass_range = (uint64_t(max_juint)+1);;
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   181
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   182
void CompressedKlassPointers::set_base(address base) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   183
  assert(UseCompressedClassPointers, "no compressed klass ptrs?");
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   184
  _narrow_klass._base   = base;
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   185
}
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   186
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   187
void CompressedKlassPointers::set_shift(int shift)       {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   188
  assert(shift == 0 || shift == LogKlassAlignmentInBytes, "invalid shift for klass ptrs");
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   189
  _narrow_klass._shift   = shift;
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   190
}
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   191
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   192
void CompressedKlassPointers::set_range(uint64_t range) {
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   193
  assert(UseCompressedClassPointers, "no compressed klass ptrs?");
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   194
  _narrow_klass_range = range;
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
diff changeset
   195
}