Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

JavaLangSystemReflection.java

00001 package gov.nasa.arc.ase.jpf.jvm.reflection;
00002 
00003 import gov.nasa.arc.ase.jpf.jvm.*;
00004 import de.fub.bytecode.generic.InstructionHandle;
00005 
00006 public class JavaLangSystemReflection extends Reflection {
00007   public InstructionHandle executeStaticMethod(MethodInfo mi, boolean atomic) {
00008     String name = mi.getFullName();
00009 
00010     if(name.equals("java.lang.System.<clinit>()V")) {
00011       // this is the class initialization code for the System class
00012       // it should create the in, out, and err stream.
00013       return repeat();
00014     }
00015 
00016     if(name.equals("java.lang.System.arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V")) {
00017       int src = th.getLocalVariable(0);
00018       int src_position = th.getLocalVariable(1);
00019       int dst = th.getLocalVariable(2);
00020       int dst_position = th.getLocalVariable(3);
00021       int length = th.getLocalVariable(4);
00022 
00023       long[] src_array = da.convert2Array(src);
00024       long[] dst_array = da.convert2Array(dst);
00025 
00026       System.arraycopy(src_array, src_position, dst_array, dst_position, length);
00027 
00028       for(int i = 0; i < length; i++)
00029     da.setValue(dst, dst_position + i, dst_array[dst_position + i]);
00030 
00031       return exit();
00032     }
00033 
00034     if(name.equals("java.lang.System.currentTimeMillis()J")) {
00035       // throws a runtime exception for now
00036       throw new NativeMethodException("java.lang.System.currentTimeMillis()J");
00037     }
00038 
00039     if(name.equals("java.lang.System.getCallerClass()Ljava/lang/Class;")) {
00040       // throws a runtime exception for now
00041       throw new NativeMethodException("java.lang.System.getCallerClass()Ljava/lang/Class;");
00042     }
00043 
00044     if(name.equals("java.lang.System.identityHashCode(Ljava/lang/Object;)I")) {
00045       // throws a runtime exception for now
00046       throw new NativeMethodException("java.lang.System.identityHashCode(Ljava/lang/Object;)I");
00047     }
00048 
00049     if(name.equals("java.lang.System.initProperties(Ljava/util/Properties;)Ljava/util/Properties;")) {
00050       // throws a runtime exception for now
00051       throw new NativeMethodException("java.lang.System.initProperties(Ljava/util/Properties;)Ljava/util/Properties;");
00052     }
00053 
00054     if(name.equals("java.lang.System.mapLibraryName(Ljava/lang/String;)Ljava/lang/String;")) {
00055       // throws a runtime exception for now
00056       throw new NativeMethodException("java.lang.System.mapLibraryName(Ljava/lang/String;)Ljava/lang/String;");
00057     }
00058 
00059     if(name.equals("java.lang.System.registerNatives()V"))
00060       return exit();
00061 
00062     if(name.equals("java.lang.System.setErr0(Ljava/io/PrintStream;)V")) {
00063       // throws a runtime exception for now
00064       throw new NativeMethodException("java.lang.System.setErr0(Ljava/io/PrintStream;)V");
00065     }
00066 
00067     if(name.equals("java.lang.System.setIn0(Ljava/io/InputStream;)V")) {
00068       // throws a runtime exception for now
00069       throw new NativeMethodException("java.lang.System.setIn0(Ljava/io/InputStream;)V");
00070     }
00071 
00072     if(name.equals("java.lang.System.setOut0(Ljava/io/PrintStream;)V")) {
00073       // throws a runtime exception for now
00074       throw new NativeMethodException("java.lang.System.setOut0(Ljava/io/PrintStream;)V");
00075     }
00076 
00077     return super.executeStaticMethod(mi, atomic);
00078   }  
00079   public boolean isStaticMethodDeterministic(MethodInfo mi) {
00080     String name = mi.getFullName();
00081 
00082     if(name.equals("java.lang.System.currentTimeMillis()J")) {
00083       // throws a runtime exception for now
00084       throw new NativeMethodException("java.lang.System.currentTimeMillis()J");
00085     }
00086 
00087     if(name.equals("java.lang.System.getCallerClass()Ljava/lang/Class;")) {
00088       // throws a runtime exception for now
00089       throw new NativeMethodException("java.lang.System.getCallerClass()Ljava/lang/Class;");
00090     }
00091 
00092     if(name.equals("java.lang.System.identityHashCode(Ljava/lang/Object;)I")) {
00093       // throws a runtime exception for now
00094       throw new NativeMethodException("java.lang.System.identityHashCode(Ljava/lang/Object;)I");
00095     }
00096 
00097     if(name.equals("java.lang.System.initProperties(Ljava/util/Properties;)Ljava/util/Properties;")) {
00098       // throws a runtime exception for now
00099       throw new NativeMethodException("java.lang.System.initProperties(Ljava/util/Properties;)Ljava/util/Properties;");
00100     }
00101 
00102     if(name.equals("java.lang.System.mapLibraryName(Ljava/lang/String;)Ljava/lang/String;")) {
00103       // throws a runtime exception for now
00104       throw new NativeMethodException("java.lang.System.mapLibraryName(Ljava/lang/String;)Ljava/lang/String;");
00105     }
00106 
00107     if(name.equals("java.lang.System.registerNatives()V")) {
00108       return true;
00109     }
00110 
00111     if(name.equals("java.lang.System.setErr0(Ljava/io/PrintStream;)V")) {
00112       // throws a runtime exception for now
00113       throw new NativeMethodException("java.lang.System.setErr0(Ljava/io/PrintStream;)V");
00114     }
00115 
00116     if(name.equals("java.lang.System.setIn0(Ljava/io/InputStream;)V")) {
00117       // throws a runtime exception for now
00118       throw new NativeMethodException("java.lang.System.setIn0(Ljava/io/InputStream;)V");
00119     }
00120 
00121     if(name.equals("java.lang.System.setOut0(Ljava/io/PrintStream;)V")) {
00122       // throws a runtime exception for now
00123       throw new NativeMethodException("java.lang.System.setOut0(Ljava/io/PrintStream;)V");
00124     }
00125 
00126     return super.isStaticMethodDeterministic(mi);
00127   }  
00128   public boolean isStaticMethodExecutable(MethodInfo mi) {
00129     String name = mi.getFullName();
00130 
00131     if(name.equals("java.lang.System.currentTimeMillis()J")) {
00132       // throws a runtime exception for now
00133       throw new NativeMethodException("java.lang.System.currentTimeMillis()J");
00134     }
00135 
00136     if(name.equals("java.lang.System.getCallerClass()Ljava/lang/Class;")) {
00137       // throws a runtime exception for now
00138       throw new NativeMethodException("java.lang.System.getCallerClass()Ljava/lang/Class;");
00139     }
00140 
00141     if(name.equals("java.lang.System.identityHashCode(Ljava/lang/Object;)I")) {
00142       // throws a runtime exception for now
00143       throw new NativeMethodException("java.lang.System.identityHashCode(Ljava/lang/Object;)I");
00144     }
00145 
00146     if(name.equals("java.lang.System.initProperties(Ljava/util/Properties;)Ljava/util/Properties;")) {
00147       // throws a runtime exception for now
00148       throw new NativeMethodException("java.lang.System.initProperties(Ljava/util/Properties;)Ljava/util/Properties;");
00149     }
00150 
00151     if(name.equals("java.lang.System.mapLibraryName(Ljava/lang/String;)Ljava/lang/String;")) {
00152       // throws a runtime exception for now
00153       throw new NativeMethodException("java.lang.System.mapLibraryName(Ljava/lang/String;)Ljava/lang/String;");
00154     }
00155 
00156     if(name.equals("java.lang.System.registerNatives()V")) {
00157       return true;
00158     }
00159 
00160     if(name.equals("java.lang.System.setErr0(Ljava/io/PrintStream;)V")) {
00161       // throws a runtime exception for now
00162       throw new NativeMethodException("java.lang.System.setErr0(Ljava/io/PrintStream;)V");
00163     }
00164 
00165     if(name.equals("java.lang.System.setIn0(Ljava/io/InputStream;)V")) {
00166       // throws a runtime exception for now
00167       throw new NativeMethodException("java.lang.System.setIn0(Ljava/io/InputStream;)V");
00168     }
00169 
00170     if(name.equals("java.lang.System.setOut0(Ljava/io/PrintStream;)V")) {
00171       // throws a runtime exception for now
00172       throw new NativeMethodException("java.lang.System.setOut0(Ljava/io/PrintStream;)V");
00173     }
00174 
00175     return super.isStaticMethodExecutable(mi);
00176   }  
00177 }

Generated at Thu Feb 7 06:48:19 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001