src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/Universe.java
author rkennke
Mon, 10 Dec 2018 15:47:44 +0100
changeset 52925 9c18c9d839d3
parent 51554 5b0d86499960
child 54780 f8d182aedc92
permissions -rw-r--r--
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental) Reviewed-by: kvn, roland, shade, coleenp, lmesnik, pliden, jgeorge, ihse, erikj Contributed-by: Christine Flood <chf@redhat.com>, Aleksey Shipilev <shade@redhat.com>, Roland Westrelin <rwestrel@redhat.com>, Zhenygu Gu <zgu@redhat.com>, Andrew Haley <aph@redhat.com>, Andrew Dinn <adinn@redhat.com>, Mario Torre <mtorre@redhat.com>, Roman Kennke <rkennke@redhat.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
51554
5b0d86499960 8209958: Clean up duplicate basic array type statics in Universe
coleenp
parents: 50525
diff changeset
     2
 * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3261
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3261
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3261
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
package sun.jvm.hotspot.memory;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    27
import java.io.PrintStream;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    28
import java.util.Observable;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    29
import java.util.Observer;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    30
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    31
import sun.jvm.hotspot.debugger.Address;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    32
import sun.jvm.hotspot.debugger.OopHandle;
47663
3e78d37acdde 8189373: jmap -heap exited with error code
rkennke
parents: 47216
diff changeset
    33
import sun.jvm.hotspot.gc.cms.CMSHeap;
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    34
import sun.jvm.hotspot.gc.epsilon.EpsilonHeap;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    35
import sun.jvm.hotspot.gc.g1.G1CollectedHeap;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    36
import sun.jvm.hotspot.gc.parallel.ParallelScavengeHeap;
47819
ee36a8e36561 8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass
rkennke
parents: 47663
diff changeset
    37
import sun.jvm.hotspot.gc.serial.SerialHeap;
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    38
import sun.jvm.hotspot.gc.shared.CollectedHeap;
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents: 51554
diff changeset
    39
import sun.jvm.hotspot.gc.shenandoah.ShenandoahHeap;
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    40
import sun.jvm.hotspot.gc.z.ZCollectedHeap;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    41
import sun.jvm.hotspot.oops.Oop;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    42
import sun.jvm.hotspot.runtime.BasicType;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    43
import sun.jvm.hotspot.runtime.VM;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    44
import sun.jvm.hotspot.runtime.VirtualConstructor;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    45
import sun.jvm.hotspot.types.AddressField;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    46
import sun.jvm.hotspot.types.CIntegerField;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    47
import sun.jvm.hotspot.types.Type;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    48
import sun.jvm.hotspot.types.TypeDataBase;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
public class Universe {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  private static AddressField collectedHeapField;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  private static VirtualConstructor heapConstructor;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  private static sun.jvm.hotspot.types.OopField mainThreadGroupField;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  private static sun.jvm.hotspot.types.OopField systemThreadGroupField;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
    57
  private static AddressField narrowOopBaseField;
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
    58
  private static CIntegerField narrowOopShiftField;
13969
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
    59
  private static AddressField narrowKlassBaseField;
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
    60
  private static CIntegerField narrowKlassShiftField;
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    61
25335
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
    62
  public enum NARROW_OOP_MODE {
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
    63
    UnscaledNarrowOop,
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
    64
    ZeroBasedNarrowOop,
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
    65
    HeapBasedNarrowOop
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
    66
  }
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
    67
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  static {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
    VM.registerVMInitializedObserver(new Observer() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
        public void update(Observable o, Object data) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
          initialize(VM.getVM().getTypeDataBase());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
      });
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    76
  private static boolean typeExists(TypeDataBase db, String type) {
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    77
      try {
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    78
          db.lookupType(type);
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    79
      } catch (RuntimeException e) {
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    80
          return false;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    81
      }
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    82
      return true;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    83
  }
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    84
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    85
  private static void addHeapTypeIfInDB(TypeDataBase db, Class heapClass) {
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    86
      String heapName = heapClass.getSimpleName();
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    87
      if (typeExists(db, heapName)) {
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    88
          heapConstructor.addMapping(heapName, heapClass);
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    89
      }
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    90
  }
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    91
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  private static synchronized void initialize(TypeDataBase db) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    Type type = db.lookupType("Universe");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
    collectedHeapField = type.getAddressField("_collectedHeap");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    heapConstructor = new VirtualConstructor(db);
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    98
    addHeapTypeIfInDB(db, CMSHeap.class);
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
    99
    addHeapTypeIfInDB(db, SerialHeap.class);
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
   100
    addHeapTypeIfInDB(db, ParallelScavengeHeap.class);
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
   101
    addHeapTypeIfInDB(db, G1CollectedHeap.class);
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
   102
    addHeapTypeIfInDB(db, EpsilonHeap.class);
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50523
diff changeset
   103
    addHeapTypeIfInDB(db, ZCollectedHeap.class);
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents: 51554
diff changeset
   104
    addHeapTypeIfInDB(db, ShenandoahHeap.class);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
    mainThreadGroupField   = type.getOopField("_main_thread_group");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
    systemThreadGroupField = type.getOopField("_system_thread_group");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
   109
    narrowOopBaseField = type.getAddressField("_narrow_oop._base");
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
   110
    narrowOopShiftField = type.getCIntegerField("_narrow_oop._shift");
13969
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   111
    narrowKlassBaseField = type.getAddressField("_narrow_klass._base");
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   112
    narrowKlassShiftField = type.getCIntegerField("_narrow_klass._shift");
39227
59ace61f7436 8157243: JMap heap test fail when used with external heap
sjohanss
parents: 35217
diff changeset
   113
59ace61f7436 8157243: JMap heap test fail when used with external heap
sjohanss
parents: 35217
diff changeset
   114
    UniverseExt.initialize(heapConstructor);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  public Universe() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  }
25335
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   119
  public static String narrowOopModeToString(NARROW_OOP_MODE mode) {
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   120
    switch (mode) {
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   121
    case UnscaledNarrowOop:
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   122
      return "32-bits Oops";
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   123
    case ZeroBasedNarrowOop:
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   124
      return "zero based Compressed Oops";
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   125
    case HeapBasedNarrowOop:
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   126
      return "Compressed Oops with base";
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   127
    }
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   128
    return "";
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   129
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  public CollectedHeap heap() {
30159
5d1c43b3b9b3 8076534: CollectedHeapName in SA agent incorrect
pliden
parents: 25335
diff changeset
   131
    return (CollectedHeap) heapConstructor.instantiateWrapperFor(collectedHeapField.getValue());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
   134
  public static long getNarrowOopBase() {
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
   135
    if (narrowOopBaseField.getValue() == null) {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   136
      return 0;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   137
    } else {
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
   138
      return narrowOopBaseField.getValue().minus(null);
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   139
    }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   140
  }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   141
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
   142
  public static int getNarrowOopShift() {
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
   143
    return (int)narrowOopShiftField.getValue();
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
   144
  }
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
   145
13969
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   146
  public static long getNarrowKlassBase() {
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   147
    if (narrowKlassBaseField.getValue() == null) {
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   148
      return 0;
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   149
    } else {
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   150
      return narrowKlassBaseField.getValue().minus(null);
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   151
    }
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   152
  }
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   153
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   154
  public static int getNarrowKlassShift() {
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   155
    return (int)narrowKlassShiftField.getValue();
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   156
  }
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   157
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   158
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  /** Returns "TRUE" iff "p" points into the allocated area of the heap. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  public boolean isIn(Address p) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
    return heap().isIn(p);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  /** Returns "TRUE" iff "p" points into the reserved area of the heap. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  public boolean isInReserved(Address p) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
    return heap().isInReserved(p);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  private Oop newOop(OopHandle handle) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
    return VM.getVM().getObjectHeap().newOop(handle);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  public Oop mainThreadGroup() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
    return newOop(mainThreadGroupField.getValue());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  public Oop systemThreadGroup() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
    return newOop(systemThreadGroupField.getValue());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  public void print() { printOn(System.out); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  public void printOn(PrintStream tty) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
    heap().printOn(tty);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  // Check whether an element of a typeArrayOop with the given type must be
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  // aligned 0 mod 8.  The typeArrayOop itself must be aligned at least this
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  // strongly.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  public static boolean elementTypeShouldBeAligned(BasicType type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
    return type == BasicType.T_DOUBLE || type == BasicType.T_LONG;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  // Check whether an object field (static/non-static) of the given type must be
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  // aligned 0 mod 8.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  public static boolean fieldTypeShouldBeAligned(BasicType type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
    return type == BasicType.T_DOUBLE || type == BasicType.T_LONG;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
}