View Javadoc
1   package sun.jvm.hotspot.utilities;
2   
3   import java.util.Observable;
4   import java.util.Observer;
5   
6   import sun.jvm.hotspot.debugger.Address;
7   import sun.jvm.hotspot.runtime.VM;
8   import sun.jvm.hotspot.types.Type;
9   import sun.jvm.hotspot.types.TypeDataBase;
10  import sun.jvm.hotspot.types.WrongTypeException;
11  
12  public class IntArray extends GenericArray {
13    static {
14      VM.registerVMInitializedObserver(new Observer() {
15        public void update(Observable o, Object data) {
16          initialize(VM.getVM().getTypeDataBase());
17        }
18      });
19    }
20  
21    private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
22      elemType = db.lookupType("int");
23  
24      Type type = db.lookupType("Array<int>");
25      dataFieldOffset = type.getAddressField("_data").getOffset();
26    }
27  
28    private static long dataFieldOffset;
29    protected static Type elemType;
30  
31    public IntArray(Address addr) {
32      super(addr, dataFieldOffset);
33    }
34  
35    public int at(int i) {
36      return (int)getIntegerAt(i);
37    }
38  
39    public Type getElemType() {
40      return elemType;
41    }
42  }