hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Universe.java
author pliden
Wed, 08 Apr 2015 15:19:49 +0200
changeset 30159 5d1c43b3b9b3
parent 25335 2557b9b45520
child 30764 fec48bf5a827
permissions -rw-r--r--
8076534: CollectedHeapName in SA agent incorrect Reviewed-by: dsamersoff, sla, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
30159
5d1c43b3b9b3 8076534: CollectedHeapName in SA agent incorrect
pliden
parents: 25335
diff changeset
     2
 * Copyright (c) 2000, 2015, 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
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
import java.io.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
import java.util.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
import sun.jvm.hotspot.debugger.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
import sun.jvm.hotspot.gc_interface.*;
10663
3ef855a3329b 7059019: G1: add G1 support to the SA
tonyp
parents: 5547
diff changeset
    31
import sun.jvm.hotspot.gc_implementation.g1.G1CollectedHeap;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
import sun.jvm.hotspot.gc_implementation.parallelScavenge.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
import sun.jvm.hotspot.oops.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
import sun.jvm.hotspot.types.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
import sun.jvm.hotspot.runtime.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
public class Universe {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  private static AddressField collectedHeapField;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  private static VirtualConstructor heapConstructor;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  private static sun.jvm.hotspot.types.OopField mainThreadGroupField;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  private static sun.jvm.hotspot.types.OopField systemThreadGroupField;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  // single dimensional primitive array klasses
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
    45
  private static sun.jvm.hotspot.types.AddressField boolArrayKlassField;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
    46
  private static sun.jvm.hotspot.types.AddressField byteArrayKlassField;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
    47
  private static sun.jvm.hotspot.types.AddressField charArrayKlassField;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
    48
  private static sun.jvm.hotspot.types.AddressField intArrayKlassField;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
    49
  private static sun.jvm.hotspot.types.AddressField shortArrayKlassField;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
    50
  private static sun.jvm.hotspot.types.AddressField longArrayKlassField;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
    51
  private static sun.jvm.hotspot.types.AddressField singleArrayKlassField;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
    52
  private static sun.jvm.hotspot.types.AddressField doubleArrayKlassField;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
    54
  private static AddressField narrowOopBaseField;
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
    55
  private static CIntegerField narrowOopShiftField;
13969
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
    56
  private static AddressField narrowKlassBaseField;
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
    57
  private static CIntegerField narrowKlassShiftField;
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    58
25335
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
    59
  public enum NARROW_OOP_MODE {
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
    60
    UnscaledNarrowOop,
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
    61
    ZeroBasedNarrowOop,
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
    62
    HeapBasedNarrowOop
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
    63
  }
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
    64
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  static {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
    VM.registerVMInitializedObserver(new Observer() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
        public void update(Observable o, Object data) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
          initialize(VM.getVM().getTypeDataBase());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
      });
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  private static synchronized void initialize(TypeDataBase db) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
    Type type = db.lookupType("Universe");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    collectedHeapField = type.getAddressField("_collectedHeap");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
    heapConstructor = new VirtualConstructor(db);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    heapConstructor.addMapping("GenCollectedHeap", GenCollectedHeap.class);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
    heapConstructor.addMapping("ParallelScavengeHeap", ParallelScavengeHeap.class);
10663
3ef855a3329b 7059019: G1: add G1 support to the SA
tonyp
parents: 5547
diff changeset
    81
    heapConstructor.addMapping("G1CollectedHeap", G1CollectedHeap.class);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
    mainThreadGroupField   = type.getOopField("_main_thread_group");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
    systemThreadGroupField = type.getOopField("_system_thread_group");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
    86
    boolArrayKlassField      = type.getAddressField("_boolArrayKlassObj");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
    87
    byteArrayKlassField      = type.getAddressField("_byteArrayKlassObj");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
    88
    charArrayKlassField      = type.getAddressField("_charArrayKlassObj");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
    89
    intArrayKlassField       = type.getAddressField("_intArrayKlassObj");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
    90
    shortArrayKlassField     = type.getAddressField("_shortArrayKlassObj");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
    91
    longArrayKlassField      = type.getAddressField("_longArrayKlassObj");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
    92
    singleArrayKlassField    = type.getAddressField("_singleArrayKlassObj");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
    93
    doubleArrayKlassField    = type.getAddressField("_doubleArrayKlassObj");
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
    94
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
    95
    narrowOopBaseField = type.getAddressField("_narrow_oop._base");
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
    96
    narrowOopShiftField = type.getCIntegerField("_narrow_oop._shift");
13969
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
    97
    narrowKlassBaseField = type.getAddressField("_narrow_klass._base");
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
    98
    narrowKlassShiftField = type.getCIntegerField("_narrow_klass._shift");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  public Universe() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  }
25335
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   103
  public static String narrowOopModeToString(NARROW_OOP_MODE mode) {
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   104
    switch (mode) {
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   105
    case UnscaledNarrowOop:
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   106
      return "32-bits Oops";
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   107
    case ZeroBasedNarrowOop:
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   108
      return "zero based Compressed Oops";
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   109
    case HeapBasedNarrowOop:
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   110
      return "Compressed Oops with base";
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   111
    }
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   112
    return "";
2557b9b45520 8046282: SA update
poonam
parents: 13969
diff changeset
   113
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  public CollectedHeap heap() {
30159
5d1c43b3b9b3 8076534: CollectedHeapName in SA agent incorrect
pliden
parents: 25335
diff changeset
   115
    return (CollectedHeap) heapConstructor.instantiateWrapperFor(collectedHeapField.getValue());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
   118
  public static long getNarrowOopBase() {
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
   119
    if (narrowOopBaseField.getValue() == null) {
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   120
      return 0;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   121
    } else {
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
   122
      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
   123
    }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   124
  }
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   125
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
   126
  public static int getNarrowOopShift() {
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
   127
    return (int)narrowOopShiftField.getValue();
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
   128
  }
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 670
diff changeset
   129
13969
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   130
  public static long getNarrowKlassBase() {
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   131
    if (narrowKlassBaseField.getValue() == null) {
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   132
      return 0;
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   133
    } else {
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   134
      return narrowKlassBaseField.getValue().minus(null);
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   135
    }
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   136
  }
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   137
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   138
  public static int getNarrowKlassShift() {
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   139
    return (int)narrowKlassShiftField.getValue();
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   140
  }
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   141
d2a189b83b87 7054512: Compress class pointers after perm gen removal
roland
parents: 13728
diff changeset
   142
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  /** Returns "TRUE" iff "p" points into the allocated area of the heap. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  public boolean isIn(Address p) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
    return heap().isIn(p);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  /** Returns "TRUE" iff "p" points into the reserved area of the heap. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  public boolean isInReserved(Address p) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
    return heap().isInReserved(p);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  private Oop newOop(OopHandle handle) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
    return VM.getVM().getObjectHeap().newOop(handle);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  public Oop mainThreadGroup() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
    return newOop(mainThreadGroupField.getValue());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  public Oop systemThreadGroup() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
    return newOop(systemThreadGroupField.getValue());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  // iterate through the single dimensional primitive array klasses
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
   166
  // refer to basic_type_classes_do(void f(Klass*)) in universe.cpp
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  public void basicTypeClassesDo(SystemDictionary.ClassVisitor visitor) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
   168
    visitor.visit(new TypeArrayKlass(boolArrayKlassField.getValue()));
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
   169
    visitor.visit(new TypeArrayKlass(byteArrayKlassField.getValue()));
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
   170
    visitor.visit(new TypeArrayKlass(charArrayKlassField.getValue()));
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
   171
    visitor.visit(new TypeArrayKlass(intArrayKlassField.getValue()));
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
   172
    visitor.visit(new TypeArrayKlass(shortArrayKlassField.getValue()));
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
   173
    visitor.visit(new TypeArrayKlass(longArrayKlassField.getValue()));
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
   174
    visitor.visit(new TypeArrayKlass(singleArrayKlassField.getValue()));
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10663
diff changeset
   175
    visitor.visit(new TypeArrayKlass(doubleArrayKlassField.getValue()));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  public void print() { printOn(System.out); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  public void printOn(PrintStream tty) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
    heap().printOn(tty);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  // Check whether an element of a typeArrayOop with the given type must be
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  // aligned 0 mod 8.  The typeArrayOop itself must be aligned at least this
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  // strongly.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  public static boolean elementTypeShouldBeAligned(BasicType type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
    return type == BasicType.T_DOUBLE || type == BasicType.T_LONG;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  // Check whether an object field (static/non-static) of the given type must be
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  // aligned 0 mod 8.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  public static boolean fieldTypeShouldBeAligned(BasicType type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
    return type == BasicType.T_DOUBLE || type == BasicType.T_LONG;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
}