1
2
3
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: StackAddress.java 1456 2004-03-09 22:01:46Z jwhaley $
13 */
14 public class StackAddress extends Address {
15
16 public static StackAddressFactory FACTORY;
17
18 public abstract static class StackAddressFactory {
19 public abstract int size();
20 public abstract StackAddress getBasePointer();
21 public abstract StackAddress getStackPointer();
22 public abstract StackAddress alloca(int size);
23 }
24
25 public static final int size() {
26 return FACTORY.size();
27 }
28 public static final StackAddress getBasePointer() {
29 return FACTORY.getBasePointer();
30 }
31 public static final StackAddress getStackPointer() {
32 return FACTORY.getStackPointer();
33 }
34 public static final StackAddress alloca(int size) {
35 return FACTORY.alloca(size);
36 }
37
38 public native Address peek();
39 public native byte peek1();
40 public native short peek2();
41 public native int peek4();
42 public native long peek8();
43
44 public native void poke(Address v);
45 public native void poke1(byte v);
46 public native void poke2(short v);
47 public native void poke4(int v);
48 public native void poke8(long v);
49
50 public native Address offset(int offset);
51 public native Address align(int shift);
52 public native int difference(Address v);
53 public native boolean isNull();
54
55 public native int to32BitValue();
56 public native String stringRep();
57
58 public static final jq_Class _class;
59 public static final jq_StaticField _FACTORY;
60 static {
61 _class = (jq_Class) PrimordialClassLoader.loader.getOrCreateBSType("Ljoeq/Memory/StackAddress;");
62 _FACTORY = _class.getOrCreateStaticField("FACTORY", "Ljoeq/Memory/StackAddress$StackAddressFactory;");
63 }
64 }