comparison agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java @ 6848:8e47bac5643a

7054512: Compress class pointers after perm gen removal Summary: support of compress class pointers in the compilers. Reviewed-by: kvn, twisti
author roland
date Tue, 09 Oct 2012 10:11:38 +0200
parents da91efe96a93
children 8552f0992748
comparison
equal deleted inserted replaced
6847:65d07d9ee446 6848:8e47bac5643a
45 45
46 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { 46 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
47 Type type = db.lookupType("oopDesc"); 47 Type type = db.lookupType("oopDesc");
48 mark = new CIntField(type.getCIntegerField("_mark"), 0); 48 mark = new CIntField(type.getCIntegerField("_mark"), 0);
49 klass = new MetadataField(type.getAddressField("_metadata._klass"), 0); 49 klass = new MetadataField(type.getAddressField("_metadata._klass"), 0);
50 if (VM.getVM().isCompressedHeadersEnabled()) { 50 compressedKlass = new NarrowKlassField(type.getAddressField("_metadata._compressed_klass"), 0);
51 // compressedKlass = new CIntField(type.getCIntegerField("_metadata._compressed_klass"), 0);
52 throw new InternalError("unimplemented");
53 }
54 headerSize = type.getSize(); 51 headerSize = type.getSize();
55 } 52 }
56 53
57 private OopHandle handle; 54 private OopHandle handle;
58 private ObjectHeap heap; 55 private ObjectHeap heap;
72 private static long headerSize; 69 private static long headerSize;
73 public static long getHeaderSize() { return headerSize; } // Header size in bytes. 70 public static long getHeaderSize() { return headerSize; } // Header size in bytes.
74 71
75 private static CIntField mark; 72 private static CIntField mark;
76 private static MetadataField klass; 73 private static MetadataField klass;
77 private static CIntField compressedKlass; 74 private static NarrowKlassField compressedKlass;
78 75
79 // Accessors for declared fields 76 // Accessors for declared fields
80 public Mark getMark() { return new Mark(getHandle()); } 77 public Mark getMark() { return new Mark(getHandle()); }
81 public Klass getKlass() { 78 public Klass getKlass() {
82 if (VM.getVM().isCompressedHeadersEnabled()) { 79 if (VM.getVM().isCompressedKlassPointersEnabled()) {
83 throw new InternalError("unimplemented"); 80 return (Klass)compressedKlass.getValue(getHandle());
84 } else { 81 } else {
85 return (Klass)klass.getValue(getHandle()); 82 return (Klass)klass.getValue(getHandle());
86 } 83 }
87 } 84 }
88 85
148 } 145 }
149 146
150 void iterateFields(OopVisitor visitor, boolean doVMFields) { 147 void iterateFields(OopVisitor visitor, boolean doVMFields) {
151 if (doVMFields) { 148 if (doVMFields) {
152 visitor.doCInt(mark, true); 149 visitor.doCInt(mark, true);
153 if (VM.getVM().isCompressedHeadersEnabled()) { 150 if (VM.getVM().isCompressedKlassPointersEnabled()) {
154 throw new InternalError("unimplemented"); 151 throw new InternalError("unimplemented");
155 } else { 152 } else {
156 visitor.doMetadata(klass, true); 153 visitor.doMetadata(klass, true);
157 } 154 }
158 } 155 }
208 // Package-private routine to speed up ObjectHeap.newOop 205 // Package-private routine to speed up ObjectHeap.newOop
209 static Klass getKlassForOopHandle(OopHandle handle) { 206 static Klass getKlassForOopHandle(OopHandle handle) {
210 if (handle == null) { 207 if (handle == null) {
211 return null; 208 return null;
212 } 209 }
213 if (VM.getVM().isCompressedHeadersEnabled()) { 210 if (VM.getVM().isCompressedKlassPointersEnabled()) {
214 throw new InternalError("Unimplemented"); 211 return (Klass)Metadata.instantiateWrapperFor(handle.getCompKlassAddressAt(compressedKlass.getOffset()));
215 } else { 212 } else {
216 return (Klass)Metadata.instantiateWrapperFor(handle.getAddressAt(klass.getOffset())); 213 return (Klass)Metadata.instantiateWrapperFor(handle.getAddressAt(klass.getOffset()));
217 } 214 }
218 } 215 }
219 }; 216 };