Mercurial > hg > graal-compiler
comparison agent/src/share/classes/sun/jvm/hotspot/oops/ObjArray.java @ 113:ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
author | coleenp |
---|---|
date | Sun, 13 Apr 2008 17:43:42 -0400 |
parents | a61af66fc99e |
children | d1605aabd0a1 |
comparison
equal
deleted
inserted
replaced
110:a49a647afe9a | 113:ba764ed4b6f2 |
---|---|
41 }); | 41 }); |
42 } | 42 } |
43 | 43 |
44 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { | 44 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { |
45 Type type = db.lookupType("objArrayOopDesc"); | 45 Type type = db.lookupType("objArrayOopDesc"); |
46 elementSize = db.getOopSize(); | 46 elementSize = VM.getVM().getHeapOopSize(); |
47 } | 47 } |
48 | 48 |
49 ObjArray(OopHandle handle, ObjectHeap heap) { | 49 ObjArray(OopHandle handle, ObjectHeap heap) { |
50 super(handle, heap); | 50 super(handle, heap); |
51 } | 51 } |
52 | 52 |
53 public boolean isObjArray() { return true; } | 53 public boolean isObjArray() { return true; } |
54 | 54 |
55 private static long elementSize; | 55 private static long elementSize; |
56 | 56 |
57 public OopHandle getOopHandleAt(long index) { | |
58 long offset = baseOffsetInBytes(BasicType.T_OBJECT) + (index * elementSize); | |
59 if (VM.getVM().isCompressedOopsEnabled()) { | |
60 return getHandle().getCompOopHandleAt(offset); | |
61 } else { | |
62 return getHandle().getOopHandleAt(offset); | |
63 } | |
64 } | |
65 | |
57 public Oop getObjAt(long index) { | 66 public Oop getObjAt(long index) { |
58 long offset = baseOffsetInBytes(BasicType.T_OBJECT) + (index * elementSize); | 67 return getHeap().newOop(getOopHandleAt(index)); |
59 return getHeap().newOop(getHandle().getOopHandleAt(offset)); | |
60 } | 68 } |
61 | 69 |
62 public void printValueOn(PrintStream tty) { | 70 public void printValueOn(PrintStream tty) { |
63 tty.print("ObjArray"); | 71 tty.print("ObjArray"); |
64 } | 72 } |
67 super.iterateFields(visitor, doVMFields); | 75 super.iterateFields(visitor, doVMFields); |
68 int length = (int) getLength(); | 76 int length = (int) getLength(); |
69 long baseOffset = baseOffsetInBytes(BasicType.T_OBJECT); | 77 long baseOffset = baseOffsetInBytes(BasicType.T_OBJECT); |
70 for (int index = 0; index < length; index++) { | 78 for (int index = 0; index < length; index++) { |
71 long offset = baseOffset + (index * elementSize); | 79 long offset = baseOffset + (index * elementSize); |
72 visitor.doOop(new OopField(new IndexableFieldIdentifier(index), offset, false), false); | 80 OopField field; |
81 if (VM.getVM().isCompressedOopsEnabled()) { | |
82 field = new NarrowOopField(new IndexableFieldIdentifier(index), offset, false); | |
83 } else { | |
84 field = new OopField(new IndexableFieldIdentifier(index), offset, false); | |
85 } | |
86 visitor.doOop(field, false); | |
73 } | 87 } |
74 } | 88 } |
75 } | 89 } |