| Home >> All |
Source code: Memory/StackAddress.java
1 // StackAddress.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 Memory; 5 6 import Bootstrap.PrimordialClassLoader; 7 import Clazz.jq_Class; 8 import Clazz.jq_StaticField; 9 10 /** 11 * @author John Whaley <jwhaley@alum.mit.edu> 12 * @version $Id: StackAddress.java,v 1.2 2003/03/05 08:35:33 joewhaley Exp $ 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("LMemory/StackAddress;"); 62 _FACTORY = _class.getOrCreateStaticField("FACTORY", "LMemory/StackAddress$StackAddressFactory;"); 63 } 64 }