Package org.allspice.bytecode

Examples of org.allspice.bytecode.MethodDef


  public ClassDef defadd21() {
    ClassDef cd = makeClassDef() ;
    {
      Var x = new Var(0,TypeName.LONG) ;
      Var y = new Var(2,TypeName.INT) ;
      MethodDef md = new MethodDef(TypeName.INT,"getFoo",x,y) ;
      md = md.setStatic(true) ;
      md = md.addInstructions(
          new Load(x),
          new Load(y),
          new Dup(TypeCode.LONG,TypeCode.INT),
          new Convert(TypeCode.INT,TypeName.LONG),
          new Add(TypeCode.LONG),
View Full Code Here


  public ClassDef defadd12() {
    ClassDef cd = makeClassDef() ;
    {
      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),
View Full Code Here

public class TestIFEQ extends MyTestCase {
  public ClassDef defadd(String type,int i1,int i2) {
    ClassDef cd = makeClassDef() ;
    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),
View Full Code Here

public class TestIFGE extends MyTestCase {
  public ClassDef defadd(String type,int i1,int i2) {
    ClassDef cd = makeClassDef() ;
    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),
View Full Code Here

public class TestOr extends MyTestCase {
  public ClassDef defadd(String ret,String type,int i1,int i2) {
    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))
        ) ;
View Full Code Here

    fd = fd.setStatic(true) ;
    cd = cd.addField(fd) ;
    {
      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))
          ) ;
View Full Code Here

public class TestAnd extends MyTestCase {
  public ClassDef defadd(String ret,String type,int i1,int i2) {
    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))
        ) ;
View Full Code Here

public class TestIFLT0 extends MyTestCase {
  public ClassDef defadd(String type,int i1) {
    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),
View Full Code Here

public class TestRem extends MyTestCase {
  public ClassDef defadd(String ret,String type,int i1,int i2) {
    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))
        ) ;
View Full Code Here

public class TestMul extends MyTestCase {
  public ClassDef defadd(String ret,String type,int i1,int i2) {
    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))
        ) ;
View Full Code Here

TOP

Related Classes of org.allspice.bytecode.MethodDef

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.