Package org.allspice.bytecode

Examples of org.allspice.bytecode.ClassDef


      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
  public ClassDef defadd02() {
    ClassDef cd = makeClassDef() ;
    {
      Var x = new Var(0,TypeName.LONG) ;
      MethodDef md = new MethodDef(TypeName.LONG,"getFoo",x) ;
      md = md.setStatic(true) ;
      md = md.addInstructions(
          new Load(x),
          new Dup(TypeCode.VOID,TypeCode.LONG),
          new Add(TypeCode.LONG),
          new Return(TypeCode.LONG)
          ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
View Full Code Here


      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
  public ClassDef defadd11() {
    ClassDef cd = makeClassDef() ;
    {
      Var x = new Var(0,TypeName.INT) ;
      Var y = new Var(1,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.INT,TypeCode.INT),
          new Add(TypeCode.INT),
          new Add(TypeCode.INT),
          new Return(TypeCode.INT)
          ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
View Full Code Here

      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
  public ClassDef defadd22() {
    ClassDef cd = makeClassDef() ;
    {
      Var x = new Var(0,TypeName.LONG) ;
      Var y = new Var(2,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.LONG,TypeCode.LONG),
          new Add(TypeCode.LONG),
          new Add(TypeCode.LONG),
          new Return(TypeCode.LONG)
          ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
View Full Code Here

      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
  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),
          new Convert(TypeCode.LONG,TypeName.INT),
          new Add(TypeCode.INT),
          new Return(TypeCode.INT)
          ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
View Full Code Here

      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
  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),
          new Convert(TypeCode.INT,TypeName.LONG),
          new Add(TypeCode.LONG),
          new Return(TypeCode.LONG)
          ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
  }
View Full Code Here

    }
    return cd ;
  }
  public void test1() throws Exception {
   
    ClassDef cd = defadd01() ;
    Class<?> obj = makeClass(cd) ;
    Method m = obj.getMethod("getFoo",int.class) ;
    assertEquals(m.invoke(null,5),10) ;
  }
View Full Code Here

    Method m = obj.getMethod("getFoo",int.class) ;
    assertEquals(m.invoke(null,5),10) ;
  }
  public void test2() throws Exception {
   
    ClassDef cd = defadd02() ;
    Class<?> obj = makeClass(cd) ;
    Method m = obj.getMethod("getFoo",long.class) ;
    assertEquals(m.invoke(null,5L),10L) ;
  }
View Full Code Here

    Method m = obj.getMethod("getFoo",long.class) ;
    assertEquals(m.invoke(null,5L),10L) ;
  }
  public void test3() throws Exception {
   
    ClassDef cd = defadd11() ;
    Class<?> obj = makeClass(cd) ;
    Method m = obj.getMethod("getFoo",int.class,int.class) ;
    assertEquals(m.invoke(null,5,7),19) ;
  }
View Full Code Here

    Method m = obj.getMethod("getFoo",int.class,int.class) ;
    assertEquals(m.invoke(null,5,7),19) ;
  }
  public void test4() throws Exception {
   
    ClassDef cd = defadd22() ;
    Class<?> obj = makeClass(cd) ;
    Method m = obj.getMethod("getFoo",long.class,long.class) ;
    assertEquals(m.invoke(null,5L,7L),19L) ;
  }
View Full Code Here

    Method m = obj.getMethod("getFoo",long.class,long.class) ;
    assertEquals(m.invoke(null,5L,7L),19L) ;
  }
  public void test5() throws Exception {
   
    ClassDef cd = defadd21() ;
    Class<?> obj = makeClass(cd) ;
    Method m = obj.getMethod("getFoo",long.class,int.class) ;
    assertEquals(m.invoke(null,5L,7),19) ;
  }
View Full Code Here

TOP

Related Classes of org.allspice.bytecode.ClassDef

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.