< prev index next >

agent/src/share/classes/sun/jvm/hotspot/memory/Universe.java

Print this page
rev 8065 : 8076534: CollectedHeapName in SA agent incorrect
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  *


  95     narrowOopBaseField = type.getAddressField("_narrow_oop._base");
  96     narrowOopShiftField = type.getCIntegerField("_narrow_oop._shift");
  97     narrowKlassBaseField = type.getAddressField("_narrow_klass._base");
  98     narrowKlassShiftField = type.getCIntegerField("_narrow_klass._shift");
  99   }
 100 
 101   public Universe() {
 102   }
 103   public static String narrowOopModeToString(NARROW_OOP_MODE mode) {
 104     switch (mode) {
 105     case UnscaledNarrowOop:
 106       return "32-bits Oops";
 107     case ZeroBasedNarrowOop:
 108       return "zero based Compressed Oops";
 109     case HeapBasedNarrowOop:
 110       return "Compressed Oops with base";
 111     }
 112     return "";
 113   }
 114   public CollectedHeap heap() {
 115     try {
 116       return (CollectedHeap) heapConstructor.instantiateWrapperFor(collectedHeapField.getValue());
 117     } catch (WrongTypeException e) {
 118       return new CollectedHeap(collectedHeapField.getValue());
 119     }
 120   }
 121 
 122   public static long getNarrowOopBase() {
 123     if (narrowOopBaseField.getValue() == null) {
 124       return 0;
 125     } else {
 126       return narrowOopBaseField.getValue().minus(null);
 127     }
 128   }
 129 
 130   public static int getNarrowOopShift() {
 131     return (int)narrowOopShiftField.getValue();
 132   }
 133 
 134   public static long getNarrowKlassBase() {
 135     if (narrowKlassBaseField.getValue() == null) {
 136       return 0;
 137     } else {
 138       return narrowKlassBaseField.getValue().minus(null);
 139     }


   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  *


  95     narrowOopBaseField = type.getAddressField("_narrow_oop._base");
  96     narrowOopShiftField = type.getCIntegerField("_narrow_oop._shift");
  97     narrowKlassBaseField = type.getAddressField("_narrow_klass._base");
  98     narrowKlassShiftField = type.getCIntegerField("_narrow_klass._shift");
  99   }
 100 
 101   public Universe() {
 102   }
 103   public static String narrowOopModeToString(NARROW_OOP_MODE mode) {
 104     switch (mode) {
 105     case UnscaledNarrowOop:
 106       return "32-bits Oops";
 107     case ZeroBasedNarrowOop:
 108       return "zero based Compressed Oops";
 109     case HeapBasedNarrowOop:
 110       return "Compressed Oops with base";
 111     }
 112     return "";
 113   }
 114   public CollectedHeap heap() {

 115     return (CollectedHeap) heapConstructor.instantiateWrapperFor(collectedHeapField.getValue());



 116   }
 117 
 118   public static long getNarrowOopBase() {
 119     if (narrowOopBaseField.getValue() == null) {
 120       return 0;
 121     } else {
 122       return narrowOopBaseField.getValue().minus(null);
 123     }
 124   }
 125 
 126   public static int getNarrowOopShift() {
 127     return (int)narrowOopShiftField.getValue();
 128   }
 129 
 130   public static long getNarrowKlassBase() {
 131     if (narrowKlassBaseField.getValue() == null) {
 132       return 0;
 133     } else {
 134       return narrowKlassBaseField.getValue().minus(null);
 135     }


< prev index next >