< prev index next >

agent/src/share/classes/sun/jvm/hotspot/utilities/PointerLocation.java

Print this page
rev 8331 : 8077842: Remove the level parameter passed around in GenCollectedHeap
Reviewed-by:
   1 /*
   2  * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  67   boolean inBlobCode;
  68   boolean inBlobData;
  69   boolean inBlobOops;
  70   boolean inBlobUnknownLocation;
  71 
  72   boolean inStrongGlobalJNIHandleBlock;
  73   boolean inWeakGlobalJNIHandleBlock;
  74   boolean inLocalJNIHandleBlock;
  75   JNIHandleBlock handleBlock;
  76   sun.jvm.hotspot.runtime.Thread handleThread;
  77 
  78   public PointerLocation(Address addr) {
  79     this.addr = addr;
  80   }
  81 
  82   public boolean isInHeap() {
  83     return (heap != null || (gen != null));
  84   }
  85 
  86   public boolean isInNewGen() {
  87     return ((gen != null) && (gen.level() == 0));
  88   }
  89 
  90   public boolean isInOldGen() {
  91     return ((gen != null) && (gen.level() == 1));
  92   }
  93 
  94   public boolean inOtherGen() {
  95     return (!isInNewGen() && !isInOldGen());
  96   }
  97 
  98   /** Only valid if isInHeap() */
  99   public Generation getGeneration() {
 100       return gen;
 101   }
 102 
 103   /** This may be true if isInNewGen is also true */
 104   public boolean isInTLAB() {
 105     return inTLAB;
 106   }
 107 
 108   /** Only valid if isInTLAB() returns true */
 109   public JavaThread getTLABThread() {
 110     return tlabThread;
 111   }


 190   public void printOn(PrintStream tty) {
 191     tty.print("Address ");
 192     if (addr == null) {
 193       tty.print("0x0");
 194     } else {
 195       tty.print(addr.toString());
 196     }
 197     tty.print(": ");
 198     if (isInHeap()) {
 199       if (isInTLAB()) {
 200         tty.print("In thread-local allocation buffer for thread \"" +
 201                   getTLABThread().getThreadName() + "\" (");
 202         getTLABThread().printThreadIDOn(tty);
 203         tty.print(") ");
 204         getTLAB().printOn(tty);
 205       } else {
 206         if (isInNewGen()) {
 207           tty.print("In new generation ");
 208         } else if (isInOldGen()) {
 209           tty.print("In old generation ");
 210         } else if (gen != null) {
 211           tty.print("In Generation " + getGeneration().level());
 212         } else {
 213           tty.print("In unknown section of Java heap");
 214         }
 215         if (getGeneration() != null) {
 216           getGeneration().printOn(tty);
 217         }
 218       }
 219     } else if (isInInterpreter()) {
 220       tty.println("In interpreter codelet \"" + interpreterCodelet.getDescription() + "\"");
 221       interpreterCodelet.printOn(tty);
 222     } else if (isInCodeCache()) {
 223       CodeBlob b = getCodeBlob();
 224       tty.print("In ");
 225       if (isInBlobCode()) {
 226         tty.print("code");
 227       } else if (isInBlobData()) {
 228         tty.print("data");
 229       } else if (isInBlobOops()) {
 230         tty.print("oops");
 231       } else {


   1 /*
   2  * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  67   boolean inBlobCode;
  68   boolean inBlobData;
  69   boolean inBlobOops;
  70   boolean inBlobUnknownLocation;
  71 
  72   boolean inStrongGlobalJNIHandleBlock;
  73   boolean inWeakGlobalJNIHandleBlock;
  74   boolean inLocalJNIHandleBlock;
  75   JNIHandleBlock handleBlock;
  76   sun.jvm.hotspot.runtime.Thread handleThread;
  77 
  78   public PointerLocation(Address addr) {
  79     this.addr = addr;
  80   }
  81 
  82   public boolean isInHeap() {
  83     return (heap != null || (gen != null));
  84   }
  85 
  86   public boolean isInNewGen() {
  87     return ((gen != null) && (gen == heap.getGen(0)));
  88   }
  89 
  90   public boolean isInOldGen() {
  91     return ((gen != null) && (gen == heap.getGen(1)));
  92   }
  93 
  94   public boolean inOtherGen() {
  95     return (!isInNewGen() && !isInOldGen());
  96   }
  97 
  98   /** Only valid if isInHeap() */
  99   public Generation getGeneration() {
 100       return gen;
 101   }
 102 
 103   /** This may be true if isInNewGen is also true */
 104   public boolean isInTLAB() {
 105     return inTLAB;
 106   }
 107 
 108   /** Only valid if isInTLAB() returns true */
 109   public JavaThread getTLABThread() {
 110     return tlabThread;
 111   }


 190   public void printOn(PrintStream tty) {
 191     tty.print("Address ");
 192     if (addr == null) {
 193       tty.print("0x0");
 194     } else {
 195       tty.print(addr.toString());
 196     }
 197     tty.print(": ");
 198     if (isInHeap()) {
 199       if (isInTLAB()) {
 200         tty.print("In thread-local allocation buffer for thread \"" +
 201                   getTLABThread().getThreadName() + "\" (");
 202         getTLABThread().printThreadIDOn(tty);
 203         tty.print(") ");
 204         getTLAB().printOn(tty);
 205       } else {
 206         if (isInNewGen()) {
 207           tty.print("In new generation ");
 208         } else if (isInOldGen()) {
 209           tty.print("In old generation ");


 210         } else {
 211           tty.print("In unknown section of Java heap");
 212         }
 213         if (getGeneration() != null) {
 214           getGeneration().printOn(tty);
 215         }
 216       }
 217     } else if (isInInterpreter()) {
 218       tty.println("In interpreter codelet \"" + interpreterCodelet.getDescription() + "\"");
 219       interpreterCodelet.printOn(tty);
 220     } else if (isInCodeCache()) {
 221       CodeBlob b = getCodeBlob();
 222       tty.print("In ");
 223       if (isInBlobCode()) {
 224         tty.print("code");
 225       } else if (isInBlobData()) {
 226         tty.print("data");
 227       } else if (isInBlobOops()) {
 228         tty.print("oops");
 229       } else {


< prev index next >