View Javadoc

1   // CodeAddress.java, created Wed Sep 18  1:22:46 2002 by joewhaley
2   // Copyright (C) 2001-3 John Whaley <jwhaley@alum.mit.edu>
3   // Licensed under the terms of the GNU LGPL; see COPYING for details.
4   package joeq.Memory;
5   
6   import joeq.Class.PrimordialClassLoader;
7   import joeq.Class.jq_Class;
8   import joeq.Class.jq_StaticField;
9   
10  /***
11   * @author  John Whaley <jwhaley@alum.mit.edu>
12   * @version $Id: CodeAddress.java 1456 2004-03-09 22:01:46Z jwhaley $
13   */
14  public class CodeAddress extends Address {
15  
16      public static CodeAddressFactory FACTORY;
17      
18      public abstract static class CodeAddressFactory {
19          public abstract int size();
20          
21          public abstract CodeAddress getNull();
22      }
23      
24      public static final int size() {
25          return FACTORY.size();
26      }
27  
28      public static final CodeAddress getNull() {
29          return FACTORY.getNull();
30      }
31  
32      public native Address peek();
33      public native byte    peek1();
34      public native short   peek2();
35      public native int     peek4();
36      public native long    peek8();
37      
38      public native void poke(Address v);
39      public native void poke1(byte v);
40      public native void poke2(short v);
41      public native void poke4(int v);
42      public native void poke8(long v);
43      
44      public native Address offset(int offset);
45      public native Address align(int shift);
46      public native int difference(Address v);
47      public native boolean isNull();
48      
49      public native int to32BitValue();
50      public native String stringRep();
51      
52      public static final jq_Class _class;
53      public static final jq_StaticField _FACTORY;
54      static {
55          _class = (jq_Class) PrimordialClassLoader.loader.getOrCreateBSType("Ljoeq/Memory/CodeAddress;");
56          _FACTORY = _class.getOrCreateStaticField("FACTORY", "Ljoeq/Memory/CodeAddress$CodeAddressFactory;");
57      }
58  }