hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjArray.java

Print this page
rev 611 : Merge

*** 1,7 **** /* ! * Copyright 2000-2004 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 41,64 **** }); } private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { Type type = db.lookupType("objArrayOopDesc"); ! elementSize = db.getOopSize(); } ObjArray(OopHandle handle, ObjectHeap heap) { super(handle, heap); } public boolean isObjArray() { return true; } private static long elementSize; ! public Oop getObjAt(long index) { long offset = baseOffsetInBytes(BasicType.T_OBJECT) + (index * elementSize); ! return getHeap().newOop(getHandle().getOopHandleAt(offset)); } public void printValueOn(PrintStream tty) { tty.print("ObjArray"); } --- 41,72 ---- }); } private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { Type type = db.lookupType("objArrayOopDesc"); ! elementSize = VM.getVM().getHeapOopSize(); } ObjArray(OopHandle handle, ObjectHeap heap) { super(handle, heap); } public boolean isObjArray() { return true; } private static long elementSize; ! public OopHandle getOopHandleAt(long index) { long offset = baseOffsetInBytes(BasicType.T_OBJECT) + (index * elementSize); ! if (VM.getVM().isCompressedOopsEnabled()) { ! return getHandle().getCompOopHandleAt(offset); ! } else { ! return getHandle().getOopHandleAt(offset); ! } ! } ! ! public Oop getObjAt(long index) { ! return getHeap().newOop(getOopHandleAt(index)); } public void printValueOn(PrintStream tty) { tty.print("ObjArray"); }
*** 67,75 **** super.iterateFields(visitor, doVMFields); int length = (int) getLength(); long baseOffset = baseOffsetInBytes(BasicType.T_OBJECT); for (int index = 0; index < length; index++) { long offset = baseOffset + (index * elementSize); ! visitor.doOop(new OopField(new IndexableFieldIdentifier(index), offset, false), false); } } } --- 75,89 ---- super.iterateFields(visitor, doVMFields); int length = (int) getLength(); long baseOffset = baseOffsetInBytes(BasicType.T_OBJECT); for (int index = 0; index < length; index++) { long offset = baseOffset + (index * elementSize); ! OopField field; ! if (VM.getVM().isCompressedOopsEnabled()) { ! field = new NarrowOopField(new IndexableFieldIdentifier(index), offset, false); ! } else { ! field = new OopField(new IndexableFieldIdentifier(index), offset, false); ! } ! visitor.doOop(field, false); } } }