Package org.allspice.bytecode.instructions

Examples of org.allspice.bytecode.instructions.Load


    {
      Var x = new Var(0,TypeName.OBJECT) ;
      MethodDef md = new MethodDef(TypeName.BOOLEAN,"getFoo",x) ;
      md = md.setStatic(true) ;
      md = md.addInstructions(
          new Load(x),
          new InstanceOf(new TypeName(type)),
          new Return(TypeCode.BOOLEAN)
          ) ;
      cd = cd.addMethod(md) ;
    }
View Full Code Here


    Mark one = new Mark() ;
    Mark two = new Mark() ;
    Mark three = new Mark() ;
    Mark others = new Mark() ;
    md = md.addInstructions(
        new Load(x),
        new LookupSwitch(new FIFO<CaseLabel>(new CaseLabel(3,three),new CaseLabel(1,one),new CaseLabel(2,two),new CaseLabel(null,others))),
        new Nop(one),new Const(1.0),new Return(TypeCode.DOUBLE),
        new Nop(two),new Const(2.0),new Return(TypeCode.DOUBLE),
        new Nop(three),new Const(3.0),new Return(TypeCode.DOUBLE),
        new Nop(others),new Const(0.0),new Return(TypeCode.DOUBLE)
View Full Code Here

  public ClassDef defadd(String ret,String type) {
    ClassDef cd = makeClassDef() ;
    Var x = new Var(1,new TypeName(type)) ;
    MethodDef md = new MethodDef(new TypeName(ret),"meth",x) ;
    md = md.addInstructions(
        new Load(x),
        new Negate(TypeCode.getType(type)),
        new Return(TypeCode.getType(ret))
        ) ;
    return cd.addMethod(md)
  }
View Full Code Here

    {
      MethodDef md = new MethodDef(TypeName.VOID,"<init>") ;
      MethodRef mref = new MethodRef(
          cd.superClass,TypeName.VOID,"<init>") ;
      md = md.addInstructions(
          new Load(new Var(0,new TypeName("TestClass"))),
          new InvokeSpecial(mref),
          new Return(TypeCode.VOID)
      ) ;
      cd = cd.addMethod(md) ;
    }
View Full Code Here

    Var x = new Var(i1,new TypeName(type)) ;
    Var y = new Var(i2,new TypeName(type)) ;
    MethodDef md = new MethodDef(TypeName.BOOLEAN,"meth",x,y) ;
    Mark one = new Mark() ;
    md = md.addInstructions(
        new Load(x),
        new Load(y),
        new IfLessThanEq(TypeCode.getType(type),one),
        new Const(false),
        new Return(TypeCode.BOOLEAN),
        new Nop(one),
        new Const(true),
View Full Code Here

    ClassDef cd = makeClassDef() ;
    Var x = new Var(i1,new TypeName(type)) ;
    Var y = new Var(i2,TypeName.INT) ;
    MethodDef md = new MethodDef(new TypeName(ret),"meth",x,y) ;
    md = md.addInstructions(
        new Load(x),
        new Load(y),
        new UnsignedShiftRight(TypeCode.getType(type)),
        new Return(TypeCode.getType(ret))
        ) ;
    return cd.addMethod(md)
  }
View Full Code Here

      Var y = new Var(1,TypeName.INT) ;
      Var z = new Var(2,new TypeName(type)) ;
      MethodDef md = new MethodDef(TypeName.VOID,"setFoo",x,y,z) ;
      md = md.setStatic(true) ;
      md = md.addInstructions(
          new Load(x),
          new Load(y),
          new Load(z),
          new Store(new ArrLValue(new TypeName(type))),
          new Return(TypeCode.VOID)
          ) ;
      cd = cd.addMethod(md) ;
    }
View Full Code Here

    Mark end_pc = new Mark() ;
    Mark the_end = new Mark() ;
    Mark handler = new Mark() ;
    md = md.addInstructions(
        new Nop(start_pc),
        new Load(x),
        new Throw(),
        new Nop(end_pc),
        new Goto(the_end),
        new ExceptionHandler(start_pc,end_pc,handler,new TypeName("java.lang.Exception")),
        new Nop(handler),
View Full Code Here

      Var x = new Var(0,new TypeName(type)) ;
      Var y = new Var(i1,new TypeName(type)) ;
      MethodDef md = new MethodDef(new TypeName(type),"getFoo",x) ;
      md = md.setStatic(true) ;
      md = md.addInstructions(
          new Load(x),
          new Store(y),
          new Load(y),
          new Return(TypeCode.getType(type))
          ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
View Full Code Here

  public ClassDef defadd(String ret,String type) {
    ClassDef cd = makeClassDef() ;
    Var x = new Var(1,new TypeName(type)) ;
    MethodDef md = new MethodDef(new TypeName(ret),"meth",x) ;
    md = md.addInstructions(
        new Load(x),
        new Convert(TypeCode.getType(type),new TypeName(ret)),
        new Return(TypeCode.getType(ret))
        ) ;
    cd = cd.addMethod(md) ;
    return cd ;
View Full Code Here

TOP

Related Classes of org.allspice.bytecode.instructions.Load

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.