< prev index next >

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

Print this page


   1 /*
   2  * Copyright (c) 2000, 2017, 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  *
  23  */
  24 
  25 package sun.jvm.hotspot.memory;
  26 
  27 import java.io.PrintStream;
  28 import java.util.Observable;
  29 import java.util.Observer;
  30 
  31 import sun.jvm.hotspot.debugger.Address;
  32 import sun.jvm.hotspot.debugger.OopHandle;
  33 import sun.jvm.hotspot.gc.cms.CMSHeap;
  34 import sun.jvm.hotspot.gc.epsilon.EpsilonHeap;
  35 import sun.jvm.hotspot.gc.g1.G1CollectedHeap;
  36 import sun.jvm.hotspot.gc.parallel.ParallelScavengeHeap;
  37 import sun.jvm.hotspot.gc.serial.SerialHeap;
  38 import sun.jvm.hotspot.gc.shared.CollectedHeap;

  39 import sun.jvm.hotspot.gc.z.ZCollectedHeap;
  40 import sun.jvm.hotspot.oops.Oop;
  41 import sun.jvm.hotspot.runtime.BasicType;
  42 import sun.jvm.hotspot.runtime.VM;
  43 import sun.jvm.hotspot.runtime.VirtualConstructor;
  44 import sun.jvm.hotspot.types.AddressField;
  45 import sun.jvm.hotspot.types.CIntegerField;
  46 import sun.jvm.hotspot.types.Type;
  47 import sun.jvm.hotspot.types.TypeDataBase;
  48 
  49 
  50 public class Universe {
  51   private static AddressField collectedHeapField;
  52   private static VirtualConstructor heapConstructor;
  53   private static sun.jvm.hotspot.types.OopField mainThreadGroupField;
  54   private static sun.jvm.hotspot.types.OopField systemThreadGroupField;
  55 
  56   // single dimensional primitive array klasses
  57   private static sun.jvm.hotspot.types.AddressField boolArrayKlassField;
  58   private static sun.jvm.hotspot.types.AddressField byteArrayKlassField;


  93 
  94   private static void addHeapTypeIfInDB(TypeDataBase db, Class heapClass) {
  95       String heapName = heapClass.getSimpleName();
  96       if (typeExists(db, heapName)) {
  97           heapConstructor.addMapping(heapName, heapClass);
  98       }
  99   }
 100 
 101   private static synchronized void initialize(TypeDataBase db) {
 102     Type type = db.lookupType("Universe");
 103 
 104     collectedHeapField = type.getAddressField("_collectedHeap");
 105 
 106     heapConstructor = new VirtualConstructor(db);
 107     addHeapTypeIfInDB(db, CMSHeap.class);
 108     addHeapTypeIfInDB(db, SerialHeap.class);
 109     addHeapTypeIfInDB(db, ParallelScavengeHeap.class);
 110     addHeapTypeIfInDB(db, G1CollectedHeap.class);
 111     addHeapTypeIfInDB(db, EpsilonHeap.class);
 112     addHeapTypeIfInDB(db, ZCollectedHeap.class);

 113 
 114     mainThreadGroupField   = type.getOopField("_main_thread_group");
 115     systemThreadGroupField = type.getOopField("_system_thread_group");
 116 
 117     boolArrayKlassField      = type.getAddressField("_boolArrayKlassObj");
 118     byteArrayKlassField      = type.getAddressField("_byteArrayKlassObj");
 119     charArrayKlassField      = type.getAddressField("_charArrayKlassObj");
 120     intArrayKlassField       = type.getAddressField("_intArrayKlassObj");
 121     shortArrayKlassField     = type.getAddressField("_shortArrayKlassObj");
 122     longArrayKlassField      = type.getAddressField("_longArrayKlassObj");
 123     singleArrayKlassField    = type.getAddressField("_singleArrayKlassObj");
 124     doubleArrayKlassField    = type.getAddressField("_doubleArrayKlassObj");
 125 
 126     narrowOopBaseField = type.getAddressField("_narrow_oop._base");
 127     narrowOopShiftField = type.getCIntegerField("_narrow_oop._shift");
 128     narrowKlassBaseField = type.getAddressField("_narrow_klass._base");
 129     narrowKlassShiftField = type.getCIntegerField("_narrow_klass._shift");
 130 
 131     UniverseExt.initialize(heapConstructor);
 132   }


   1 /*
   2  * Copyright (c) 2000, 2018, 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  *
  23  */
  24 
  25 package sun.jvm.hotspot.memory;
  26 
  27 import java.io.PrintStream;
  28 import java.util.Observable;
  29 import java.util.Observer;
  30 
  31 import sun.jvm.hotspot.debugger.Address;
  32 import sun.jvm.hotspot.debugger.OopHandle;
  33 import sun.jvm.hotspot.gc.cms.CMSHeap;
  34 import sun.jvm.hotspot.gc.epsilon.EpsilonHeap;
  35 import sun.jvm.hotspot.gc.g1.G1CollectedHeap;
  36 import sun.jvm.hotspot.gc.parallel.ParallelScavengeHeap;
  37 import sun.jvm.hotspot.gc.serial.SerialHeap;
  38 import sun.jvm.hotspot.gc.shared.CollectedHeap;
  39 import sun.jvm.hotspot.gc.shenandoah.ShenandoahHeap;
  40 import sun.jvm.hotspot.gc.z.ZCollectedHeap;
  41 import sun.jvm.hotspot.oops.Oop;
  42 import sun.jvm.hotspot.runtime.BasicType;
  43 import sun.jvm.hotspot.runtime.VM;
  44 import sun.jvm.hotspot.runtime.VirtualConstructor;
  45 import sun.jvm.hotspot.types.AddressField;
  46 import sun.jvm.hotspot.types.CIntegerField;
  47 import sun.jvm.hotspot.types.Type;
  48 import sun.jvm.hotspot.types.TypeDataBase;
  49 
  50 
  51 public class Universe {
  52   private static AddressField collectedHeapField;
  53   private static VirtualConstructor heapConstructor;
  54   private static sun.jvm.hotspot.types.OopField mainThreadGroupField;
  55   private static sun.jvm.hotspot.types.OopField systemThreadGroupField;
  56 
  57   // single dimensional primitive array klasses
  58   private static sun.jvm.hotspot.types.AddressField boolArrayKlassField;
  59   private static sun.jvm.hotspot.types.AddressField byteArrayKlassField;


  94 
  95   private static void addHeapTypeIfInDB(TypeDataBase db, Class heapClass) {
  96       String heapName = heapClass.getSimpleName();
  97       if (typeExists(db, heapName)) {
  98           heapConstructor.addMapping(heapName, heapClass);
  99       }
 100   }
 101 
 102   private static synchronized void initialize(TypeDataBase db) {
 103     Type type = db.lookupType("Universe");
 104 
 105     collectedHeapField = type.getAddressField("_collectedHeap");
 106 
 107     heapConstructor = new VirtualConstructor(db);
 108     addHeapTypeIfInDB(db, CMSHeap.class);
 109     addHeapTypeIfInDB(db, SerialHeap.class);
 110     addHeapTypeIfInDB(db, ParallelScavengeHeap.class);
 111     addHeapTypeIfInDB(db, G1CollectedHeap.class);
 112     addHeapTypeIfInDB(db, EpsilonHeap.class);
 113     addHeapTypeIfInDB(db, ZCollectedHeap.class);
 114     addHeapTypeIfInDB(db, ShenandoahHeap.class);
 115 
 116     mainThreadGroupField   = type.getOopField("_main_thread_group");
 117     systemThreadGroupField = type.getOopField("_system_thread_group");
 118 
 119     boolArrayKlassField      = type.getAddressField("_boolArrayKlassObj");
 120     byteArrayKlassField      = type.getAddressField("_byteArrayKlassObj");
 121     charArrayKlassField      = type.getAddressField("_charArrayKlassObj");
 122     intArrayKlassField       = type.getAddressField("_intArrayKlassObj");
 123     shortArrayKlassField     = type.getAddressField("_shortArrayKlassObj");
 124     longArrayKlassField      = type.getAddressField("_longArrayKlassObj");
 125     singleArrayKlassField    = type.getAddressField("_singleArrayKlassObj");
 126     doubleArrayKlassField    = type.getAddressField("_doubleArrayKlassObj");
 127 
 128     narrowOopBaseField = type.getAddressField("_narrow_oop._base");
 129     narrowOopShiftField = type.getCIntegerField("_narrow_oop._shift");
 130     narrowKlassBaseField = type.getAddressField("_narrow_klass._base");
 131     narrowKlassShiftField = type.getCIntegerField("_narrow_klass._shift");
 132 
 133     UniverseExt.initialize(heapConstructor);
 134   }


< prev index next >