hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PointerLocation.java
author jwilhelm
Wed, 17 Jun 2015 14:44:54 +0200
changeset 31358 693058672cc6
parent 30764 fec48bf5a827
permissions -rw-r--r--
8077842: Remove the level parameter passed around in GenCollectedHeap Reviewed-by: kbarrett, mgerdin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 13728
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: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
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: 1
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.utilities;
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 sun.jvm.hotspot.code.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
import sun.jvm.hotspot.debugger.*;
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 13728
diff changeset
    30
import sun.jvm.hotspot.gc.shared.*;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
import sun.jvm.hotspot.interpreter.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
import sun.jvm.hotspot.runtime.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
import sun.jvm.hotspot.memory.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
/** This class attempts to describe possible locations of pointers in
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
    the VM. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
public class PointerLocation {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  //////////////////////////////////////////////////////////////////
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  //                                                              //
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  // These are package private to simplify the implementation and //
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  // interaction with PointerFinder                               //
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  //                                                              //
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  //////////////////////////////////////////////////////////////////
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  Address addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  CollectedHeap heap;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  Generation gen;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  // If UseTLAB was enabled and the pointer was found in a
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  // currently-active TLAB, these will be set
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  boolean inTLAB;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  JavaThread tlabThread;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  ThreadLocalAllocBuffer tlab;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  // Generated code locations
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  boolean inInterpreter;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  boolean inCodeCache;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  // FIXME: add other locations like VTableStubs, StubRoutines, maybe
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  // even "on thread x's stack"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  InterpreterCodelet interpreterCodelet;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  CodeBlob blob;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  // FIXME: add more detail about CodeBlob
6418
6671edbd230e 6978355: renaming for 6961697
twisti
parents: 5547
diff changeset
    67
  boolean inBlobCode;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  boolean inBlobData;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  boolean inBlobOops;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  boolean inBlobUnknownLocation;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  boolean inStrongGlobalJNIHandleBlock;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  boolean inWeakGlobalJNIHandleBlock;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  boolean inLocalJNIHandleBlock;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  JNIHandleBlock handleBlock;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  sun.jvm.hotspot.runtime.Thread handleThread;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  public PointerLocation(Address addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    this.addr = addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  public boolean isInHeap() {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6418
diff changeset
    83
    return (heap != null || (gen != null));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  public boolean isInNewGen() {
31358
693058672cc6 8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents: 30764
diff changeset
    87
    return ((gen != null) && (gen == ((GenCollectedHeap)heap).getGen(0)));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  public boolean isInOldGen() {
31358
693058672cc6 8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents: 30764
diff changeset
    91
    return ((gen != null) && (gen == ((GenCollectedHeap)heap).getGen(1)));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  public boolean inOtherGen() {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6418
diff changeset
    95
    return (!isInNewGen() && !isInOldGen());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  /** Only valid if isInHeap() */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  public Generation getGeneration() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
      return gen;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  /** This may be true if isInNewGen is also true */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  public boolean isInTLAB() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    return inTLAB;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  /** Only valid if isInTLAB() returns true */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  public JavaThread getTLABThread() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
    return tlabThread;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  /** Only valid if isInTLAB() returns true */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  public ThreadLocalAllocBuffer getTLAB() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
    return tlab;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  public boolean isInInterpreter() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
    return inInterpreter;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  /** For now, only valid if isInInterpreter is true */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  public InterpreterCodelet getInterpreterCodelet() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
    return interpreterCodelet;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  public boolean isInCodeCache() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    return inCodeCache;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  /** For now, only valid if isInCodeCache is true */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  public CodeBlob getCodeBlob() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
    return blob;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
6418
6671edbd230e 6978355: renaming for 6961697
twisti
parents: 5547
diff changeset
   136
  public boolean isInBlobCode() {
6671edbd230e 6978355: renaming for 6961697
twisti
parents: 5547
diff changeset
   137
    return inBlobCode;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  public boolean isInBlobData() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
    return inBlobData;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  public boolean isInBlobOops() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
    return inBlobOops;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  public boolean isInBlobUnknownLocation() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
    return inBlobUnknownLocation;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  public boolean isInStrongGlobalJNIHandleBlock() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
    return inStrongGlobalJNIHandleBlock;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  public boolean isInWeakGlobalJNIHandleBlock() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
    return inWeakGlobalJNIHandleBlock;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  public boolean isInLocalJNIHandleBlock() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
    return inLocalJNIHandleBlock;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  /** Only valid if isInStrongGlobalJNIHandleBlock,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
      isInWeakGlobalJNIHandleBlock, or isInLocalJNIHandleBlock is true */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  public JNIHandleBlock getJNIHandleBlock() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
    return handleBlock;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  /** Only valid if isInLocalJNIHandleBlock is true */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  public sun.jvm.hotspot.runtime.Thread getJNIHandleThread() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
    return handleThread;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  public boolean isUnknown() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
    return (!(isInHeap() || isInInterpreter() || isInCodeCache() ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
              isInStrongGlobalJNIHandleBlock() || isInWeakGlobalJNIHandleBlock() || isInLocalJNIHandleBlock()));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  public String toString() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
    printOn(new PrintStream(bos));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
    return bos.toString();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  public void print() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
    printOn(System.out);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  public void printOn(PrintStream tty) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
    tty.print("Address ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
    if (addr == null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
      tty.print("0x0");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
      tty.print(addr.toString());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
    tty.print(": ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
    if (isInHeap()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
      if (isInTLAB()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
        tty.print("In thread-local allocation buffer for thread \"" +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
                  getTLABThread().getThreadName() + "\" (");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
        getTLABThread().printThreadIDOn(tty);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
        tty.print(") ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
        getTLAB().printOn(tty);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
      } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
        if (isInNewGen()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
          tty.print("In new generation ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
        } else if (isInOldGen()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
          tty.print("In old generation ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
          tty.print("In unknown section of Java heap");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
        if (getGeneration() != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
          getGeneration().printOn(tty);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
    } else if (isInInterpreter()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
      tty.println("In interpreter codelet \"" + interpreterCodelet.getDescription() + "\"");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
      interpreterCodelet.printOn(tty);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
    } else if (isInCodeCache()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
      CodeBlob b = getCodeBlob();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
      tty.print("In ");
6418
6671edbd230e 6978355: renaming for 6961697
twisti
parents: 5547
diff changeset
   223
      if (isInBlobCode()) {
6671edbd230e 6978355: renaming for 6961697
twisti
parents: 5547
diff changeset
   224
        tty.print("code");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
      } else if (isInBlobData()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
        tty.print("data");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
      } else if (isInBlobOops()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
        tty.print("oops");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
      } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
        if (Assert.ASSERTS_ENABLED) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
          Assert.that(isInBlobUnknownLocation(), "Should have known location in CodeBlob");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
        tty.print("unknown location");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
      tty.print(" in ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
      b.printOn(tty);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
      // FIXME: add more detail
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
    } else if (isInStrongGlobalJNIHandleBlock() ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
               isInWeakGlobalJNIHandleBlock() ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
               isInLocalJNIHandleBlock()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
      tty.print("In ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
      if (isInStrongGlobalJNIHandleBlock()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
        tty.print("strong global");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
      } else if (isInWeakGlobalJNIHandleBlock()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
        tty.print("weak global");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
      } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
        tty.print("thread-local");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
      tty.print(" JNI handle block (" + handleBlock.top() + " handle slots present)");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
      if (isInLocalJNIHandleBlock()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
        if (handleThread.isJavaThread()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
          tty.print(" for JavaThread ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
          ((JavaThread) handleThread).printThreadIDOn(tty);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
          tty.print("for a non-Java Thread");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
      // This must be last
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
      if (Assert.ASSERTS_ENABLED) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
        Assert.that(isUnknown(), "Should have unknown location");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
      tty.print("In unknown location");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
}