Package org.allspice.bytecode.instructions

Examples of org.allspice.bytecode.instructions.Return


      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


    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

      MethodDef md = new MethodDef(TypeName.INT,"getFoo",x) ;
      md = md.setStatic(true) ;
      md = md.addInstructions(
          new Load(x),
          new ArrLen(),
          new Return(TypeCode.INT)
          ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
View Full Code Here

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

      // 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) ;
    }
    return cd ;
View Full Code Here

TOP

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

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.