comparison agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java @ 2177:3582bf76420e

6990754: Use native memory and reference counting to implement SymbolTable Summary: move symbols from permgen into C heap and reference count them Reviewed-by: never, acorn, jmasa, stefank
author coleenp
date Thu, 27 Jan 2011 16:11:27 -0800
parents c18cbe5936b8
children 63997f575155
comparison
equal deleted inserted replaced
2176:27e4ea99855d 2177:3582bf76420e
45 45
46 static { 46 static {
47 DEBUG = System.getProperty("sun.jvm.hotspot.oops.ObjectHeap.DEBUG") != null; 47 DEBUG = System.getProperty("sun.jvm.hotspot.oops.ObjectHeap.DEBUG") != null;
48 } 48 }
49 49
50 private OopHandle symbolKlassHandle;
51 private OopHandle methodKlassHandle; 50 private OopHandle methodKlassHandle;
52 private OopHandle constMethodKlassHandle; 51 private OopHandle constMethodKlassHandle;
53 private OopHandle methodDataKlassHandle; 52 private OopHandle methodDataKlassHandle;
54 private OopHandle constantPoolKlassHandle; 53 private OopHandle constantPoolKlassHandle;
55 private OopHandle constantPoolCacheKlassHandle; 54 private OopHandle constantPoolCacheKlassHandle;
66 private OopHandle singleArrayKlassHandle; 65 private OopHandle singleArrayKlassHandle;
67 private OopHandle doubleArrayKlassHandle; 66 private OopHandle doubleArrayKlassHandle;
68 private OopHandle arrayKlassKlassHandle; 67 private OopHandle arrayKlassKlassHandle;
69 private OopHandle compiledICHolderKlassHandle; 68 private OopHandle compiledICHolderKlassHandle;
70 69
71 private SymbolKlass symbolKlassObj;
72 private MethodKlass methodKlassObj; 70 private MethodKlass methodKlassObj;
73 private ConstMethodKlass constMethodKlassObj; 71 private ConstMethodKlass constMethodKlassObj;
74 private MethodDataKlass methodDataKlassObj; 72 private MethodDataKlass methodDataKlassObj;
75 private ConstantPoolKlass constantPoolKlassObj; 73 private ConstantPoolKlass constantPoolKlassObj;
76 private ConstantPoolCacheKlass constantPoolCacheKlassObj; 74 private ConstantPoolCacheKlass constantPoolCacheKlassObj;
91 89
92 public void initialize(TypeDataBase db) throws WrongTypeException { 90 public void initialize(TypeDataBase db) throws WrongTypeException {
93 // Lookup the roots in the object hierarchy. 91 // Lookup the roots in the object hierarchy.
94 Type universeType = db.lookupType("Universe"); 92 Type universeType = db.lookupType("Universe");
95 93
96 symbolKlassHandle = universeType.getOopField("_symbolKlassObj").getValue();
97 symbolKlassObj = new SymbolKlass(symbolKlassHandle, this);
98
99 methodKlassHandle = universeType.getOopField("_methodKlassObj").getValue(); 94 methodKlassHandle = universeType.getOopField("_methodKlassObj").getValue();
100 methodKlassObj = new MethodKlass(methodKlassHandle, this); 95 methodKlassObj = new MethodKlass(methodKlassHandle, this);
101 96
102 constMethodKlassHandle = universeType.getOopField("_constMethodKlassObj").getValue(); 97 constMethodKlassHandle = universeType.getOopField("_constMethodKlassObj").getValue();
103 constMethodKlassObj = new ConstMethodKlass(constMethodKlassHandle, this); 98 constMethodKlassObj = new ConstMethodKlass(constMethodKlassHandle, this);
197 public long getLongSize() { return longSize; } 192 public long getLongSize() { return longSize; }
198 public long getFloatSize() { return floatSize; } 193 public long getFloatSize() { return floatSize; }
199 public long getDoubleSize() { return doubleSize; } 194 public long getDoubleSize() { return doubleSize; }
200 195
201 // Accessors for well-known system classes (from Universe) 196 // Accessors for well-known system classes (from Universe)
202 public SymbolKlass getSymbolKlassObj() { return symbolKlassObj; }
203 public MethodKlass getMethodKlassObj() { return methodKlassObj; } 197 public MethodKlass getMethodKlassObj() { return methodKlassObj; }
204 public ConstMethodKlass getConstMethodKlassObj() { return constMethodKlassObj; } 198 public ConstMethodKlass getConstMethodKlassObj() { return constMethodKlassObj; }
205 public MethodDataKlass getMethodDataKlassObj() { return methodDataKlassObj; } 199 public MethodDataKlass getMethodDataKlassObj() { return methodDataKlassObj; }
206 public ConstantPoolKlass getConstantPoolKlassObj() { return constantPoolKlassObj; } 200 public ConstantPoolKlass getConstantPoolKlassObj() { return constantPoolKlassObj; }
207 public ConstantPoolCacheKlass getConstantPoolCacheKlassObj() { return constantPoolCacheKlassObj; } 201 public ConstantPoolCacheKlass getConstantPoolCacheKlassObj() { return constantPoolCacheKlassObj; }
335 if (handle == null) return null; 329 if (handle == null) return null;
336 330
337 // First check if handle is one of the root objects 331 // First check if handle is one of the root objects
338 if (handle.equals(methodKlassHandle)) return getMethodKlassObj(); 332 if (handle.equals(methodKlassHandle)) return getMethodKlassObj();
339 if (handle.equals(constMethodKlassHandle)) return getConstMethodKlassObj(); 333 if (handle.equals(constMethodKlassHandle)) return getConstMethodKlassObj();
340 if (handle.equals(symbolKlassHandle)) return getSymbolKlassObj();
341 if (handle.equals(constantPoolKlassHandle)) return getConstantPoolKlassObj(); 334 if (handle.equals(constantPoolKlassHandle)) return getConstantPoolKlassObj();
342 if (handle.equals(constantPoolCacheKlassHandle)) return getConstantPoolCacheKlassObj(); 335 if (handle.equals(constantPoolCacheKlassHandle)) return getConstantPoolCacheKlassObj();
343 if (handle.equals(instanceKlassKlassHandle)) return getInstanceKlassKlassObj(); 336 if (handle.equals(instanceKlassKlassHandle)) return getInstanceKlassKlassObj();
344 if (handle.equals(objArrayKlassKlassHandle)) return getObjArrayKlassKlassObj(); 337 if (handle.equals(objArrayKlassKlassHandle)) return getObjArrayKlassKlassObj();
345 if (handle.equals(klassKlassHandle)) return getKlassKlassObj(); 338 if (handle.equals(klassKlassHandle)) return getKlassKlassObj();
361 // Then check if obj.klass() is one of the root objects 354 // Then check if obj.klass() is one of the root objects
362 OopHandle klass = Oop.getKlassForOopHandle(handle); 355 OopHandle klass = Oop.getKlassForOopHandle(handle);
363 if (klass != null) { 356 if (klass != null) {
364 if (klass.equals(methodKlassHandle)) return new Method(handle, this); 357 if (klass.equals(methodKlassHandle)) return new Method(handle, this);
365 if (klass.equals(constMethodKlassHandle)) return new ConstMethod(handle, this); 358 if (klass.equals(constMethodKlassHandle)) return new ConstMethod(handle, this);
366 if (klass.equals(symbolKlassHandle)) return new Symbol(handle, this);
367 if (klass.equals(constantPoolKlassHandle)) return new ConstantPool(handle, this); 359 if (klass.equals(constantPoolKlassHandle)) return new ConstantPool(handle, this);
368 if (klass.equals(constantPoolCacheKlassHandle)) return new ConstantPoolCache(handle, this); 360 if (klass.equals(constantPoolCacheKlassHandle)) return new ConstantPoolCache(handle, this);
369 if (!VM.getVM().isCore()) { 361 if (!VM.getVM().isCore()) {
370 if (klass.equals(compiledICHolderKlassHandle)) return new CompiledICHolder(handle, this); 362 if (klass.equals(compiledICHolderKlassHandle)) return new CompiledICHolder(handle, this);
371 if (klass.equals(methodDataKlassHandle)) return new MethodData(handle, this); 363 if (klass.equals(methodDataKlassHandle)) return new MethodData(handle, this);