Package org.allspice.bytecode.instructions

Examples of org.allspice.bytecode.instructions.Load


      Var x = new Var(0,TypeName.INT) ;
      Var y = new Var(1,TypeName.LONG) ;
      MethodDef md = new MethodDef(TypeName.LONG,"getFoo",x,y) ;
      md = md.setStatic(true) ;
      md = md.addInstructions(
          new Load(x),
          new Load(y),
          new Dup(TypeCode.INT,TypeCode.LONG),
          new Convert(TypeCode.LONG,TypeName.INT),
          new Add(TypeCode.INT),
          new Convert(TypeCode.INT,TypeName.LONG),
          new Add(TypeCode.LONG),
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 IfEquals(TypeCode.getType(type),one),
        new Const(false),
        new Return(TypeCode.BOOLEAN),
        new Nop(one),
        new Const(true),
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 IfGreaterThanEq(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,new TypeName(type)) ;
    MethodDef md = new MethodDef(new TypeName(ret),"meth",x,y) ;
    md = md.addInstructions(
        new Load(x),
        new Load(y),
        new Or(TypeCode.getType(type)),
        new Return(TypeCode.getType(ret))
        ) ;
    return cd.addMethod(md)
  }
View Full Code Here

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

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

    ClassDef cd = makeClassDef() ;
    Var x = new Var(i1,new TypeName(type)) ;
    MethodDef md = new MethodDef(TypeName.BOOLEAN,"meth",x) ;
    Mark one = new Mark() ;
    md = md.addInstructions(
        new Load(x),
        new IfLessThan0(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,new TypeName(type)) ;
    MethodDef md = new MethodDef(new TypeName(ret),"meth",x,y) ;
    md = md.addInstructions(
        new Load(x),
        new Load(y),
        new Remainder(TypeCode.getType(type)),
        new Return(TypeCode.getType(ret))
        ) ;
    return cd.addMethod(md)
  }
View Full Code Here

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

    {
      // constructor called <init>
      // must call superclass's <init>
      // Returns nothing
      MethodDef md = new MethodDef(TypeName.VOID,"<init>").addInstructions(
          new Load(new Var(0,new TypeName("TestClass"))),
          new InvokeSpecial(new MethodRef(cd.superClass,TypeName.VOID,"<init>")),
          new Return(TypeCode.VOID)
      ) ;
      // Watch it!  ClassDef is immutable
      cd = cd.addMethod(md) ;
    }
    {
      // Two variables, x & y
      // Index 0 is "this"
      Var x = new Var(1,TypeName.INT) ; // index 1
      Var y = new Var(2,TypeName.INT) ; // index 2
      MethodDef md = new MethodDef(TypeName.INT,"add",x,y).addInstructions(
          new Load(x),
          new Load(y),
          new Add(TypeCode.INT),
          new Return(TypeCode.INT)
      ) ;
      // Watch it!  ClassDef is immutable
      cd = cd.addMethod(md) ;
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.