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

JavaLangMathReflection.java

00001 package gov.nasa.arc.ase.jpf.jvm.reflection;
00002 
00003 import gov.nasa.arc.ase.jpf.jvm.*;
00004 import gov.nasa.arc.ase.jpf.jvm.bytecode.Instruction;
00005 
00006 public class JavaLangMathReflection extends Reflection {
00007   public Instruction executeStaticMethod(MethodInfo mi) {
00008     String name = mi.getFullName();
00009 
00010     if(name.equals("<clinit>()V")) {
00011       return exit();
00012     }
00013 
00014     if(name.equals("pow(DD)D")) {
00015       // doubles take 2 slots on the stack each, hence 0 and 2
00016       return exit(java.lang.Math.pow(getDoubleArgument(0),
00017                                      getDoubleArgument(2)));        
00018     }
00019 
00020     if(name.equals("max(DD)D")) {
00021       // doubles take 2 slots on the stack each, hence 0 and 2
00022       return exit(java.lang.Math.max(getDoubleArgument(0),
00023                                      getDoubleArgument(2)));        
00024     }
00025 
00026     if(name.equals("max(FF)F")) {
00027       return exit(java.lang.Math.max(getFloatArgument(0),
00028                                      getFloatArgument(1)));     
00029     }
00030 
00031     if(name.equals("max(II)I")) {
00032       return exit(java.lang.Math.max(getIntArgument(0),
00033                                      getIntArgument(1)));       
00034     }
00035 
00036     if(name.equals("max(JJ)J")) {
00037       // longs take 2 slots on the stack each, hence 0 and 2
00038       return exit(java.lang.Math.max(getLongArgument(0),
00039                                      getLongArgument(2)));      
00040     }
00041 
00042     if(name.equals("min(DD)D")) {
00043       // doubles take 2 slots on the stack each, hence 0 and 2
00044       return exit(java.lang.Math.min(getDoubleArgument(0),
00045                                      getDoubleArgument(2)));        
00046     }
00047 
00048     if(name.equals("min(FF)F")) {
00049       return exit(java.lang.Math.min(getFloatArgument(0),
00050                                      getFloatArgument(1)));     
00051     }
00052 
00053     if(name.equals("min(II)I")) {
00054       return exit(java.lang.Math.min(getIntArgument(0),
00055                                      getIntArgument(1)));       
00056     }
00057 
00058     if(name.equals("min(JJ)J")) {
00059       // longs take 2 slots on the stack each, hence 0 and 2
00060       return exit(java.lang.Math.min(getLongArgument(0),
00061                                      getLongArgument(2)));      
00062     }
00063 
00064     return super.executeStaticMethod(mi);
00065   }  
00066 }

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