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

CHECKCAST.java

00001 package gov.nasa.arc.ase.jpf.jvm.bytecode;
00002 
00003 import gov.nasa.arc.ase.jpf.*;
00004 import gov.nasa.arc.ase.jpf.jvm.*;
00005 import de.fub.bytecode.classfile.Constant;
00006 import de.fub.bytecode.classfile.ConstantPool;
00007 import de.fub.bytecode.generic.ConstantPoolGen;
00008 import de.fub.bytecode.generic.InstructionHandle;
00009 import gov.nasa.arc.ase.util.Debug;
00010 
00011 public class CHECKCAST extends AbstractInstruction {
00012   private de.fub.bytecode.generic.CHECKCAST peer;
00013 
00014   public InstructionHandle execute(SystemState ss, KernelState ks, ThreadInfo th) {
00015     ConstantPoolGen cpg = th.getCPG();
00016     ConstantPool cp = cpg.getConstantPool();
00017     Constant constant = cp.getConstant(peer.getIndex());
00018     String classname =  cp.constantToString(constant);
00019 
00020 // ifdef MARK_N_SWEEP
00021     int objref = th.peek();
00022 
00023     if (objref != -1 && !ks.dynamic_area.instanceOfClass(objref, classname)) {
00024       th.pop();
00025       return th.createAndThrowException("java.lang.ClassCastException", ss, ks, th);
00026     }
00027 //#else MARK_N_SWEEP
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 //#endif MARK_N_SWEEP
00037 
00038     return th.getPC().getNext();
00039   }  
00040   public void setPeer(de.fub.bytecode.generic.Instruction i) {
00041     peer = (de.fub.bytecode.generic.CHECKCAST)i;
00042   }  
00043 }

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