Package org.allspice.bytecode.instructions

Examples of org.allspice.bytecode.instructions.InvokeSpecial


      MethodDef md = new MethodDef(new TypeName("TestClass"),"getFoo") ;
      md = md.setStatic(true) ;
      md = md.addInstructions(
          new New(new TypeName("TestClass")),
          new org.allspice.bytecode.instructions.Dup(TypeCode.VOID,TypeCode.OBJECT),
          new InvokeSpecial(mref),
          new Return(TypeCode.OBJECT)
          ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
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) ;
    }
View Full Code Here

        l.add(new Dup(TypeCode.VOID,v.getRefType())) ;
        l.add(new Load(v)) ;
        convert(context,type, TypeName.OBJECT, l) ;
        l.add(new New(TypeName.STRINGBUILDER)) ;
        l.add(new Dup(TypeCode.VOID,TypeCode.OBJECT)) ;
        l.add(new InvokeSpecial(new MethodRef(TypeName.STRINGBUILDER,TypeName.VOID,"<init>"))) ;
        l.add(new Swap()) ;
        l.add(new InvokeVirtual(new MethodRef(TypeName.STRINGBUILDER,TypeName.STRINGBUILDER,"append",TypeName.OBJECT))) ;
        StdJavaExpressions.createConvert(context, inc, TypeName.OBJECT,l) ;
        l.add(new InvokeVirtual(new MethodRef(TypeName.STRINGBUILDER,TypeName.STRINGBUILDER,"append",TypeName.OBJECT))) ;
        l.add(new InvokeVirtual(new MethodRef(TypeName.STRINGBUILDER,TypeName.STRING,"toString"))) ;
View Full Code Here

        l.add(new Dup(TypeCode.VOID,v.getRefType())) ;
        l.add(new Load(v)) ;
        convert(context,type, TypeName.OBJECT, l) ;
        l.add(new New(TypeName.STRINGBUILDER)) ;
        l.add(new Dup(TypeCode.VOID,TypeCode.OBJECT)) ;
        l.add(new InvokeSpecial(new MethodRef(TypeName.STRINGBUILDER,TypeName.VOID,"<init>"))) ;
        l.add(new Swap()) ;
        l.add(new InvokeVirtual(new MethodRef(TypeName.STRINGBUILDER,TypeName.STRINGBUILDER,"append",TypeName.OBJECT))) ;
        StdJavaExpressions.createConvert(context, inc, TypeName.OBJECT,l) ;
        l.add(new InvokeVirtual(new MethodRef(TypeName.STRINGBUILDER,TypeName.STRINGBUILDER,"append",TypeName.OBJECT))) ;
        l.add(new InvokeVirtual(new MethodRef(TypeName.STRINGBUILDER,TypeName.STRING,"toString"))) ;
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) ;
    }
    return cd ;
View Full Code Here

      MethodDef md = new MethodDef(TypeName.VOID,"getFoo") ;
      md = md.setStatic(true) ;
      md = md.addInstructions(
          new New(new TypeName("java.lang.RuntimeException")),
          new org.allspice.bytecode.instructions.Dup(TypeCode.VOID,TypeCode.OBJECT),
          new InvokeSpecial(mref),
          new Throw()
          ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
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) ;
    }
View Full Code Here

      final Expr rhs = t.rhs;
      StubResolver type = getType(t,context) ;
      if (type.getTypeName().equals(TypeName.STRING)) {
        l.add(new New(TypeName.STRINGBUILDER)) ;
        l.add(new Dup(TypeCode.VOID,TypeCode.OBJECT)) ;
        l.add(new InvokeSpecial(new MethodRef(TypeName.STRINGBUILDER,TypeName.VOID,"<init>"))) ;
        context.compile(TypeName.OBJECT, lhs, l) ;
        l.add(new InvokeVirtual(new MethodRef(TypeName.STRINGBUILDER,TypeName.STRINGBUILDER,"append",TypeName.OBJECT))) ;
        context.compile(TypeName.OBJECT, rhs, l) ;
        l.add(new InvokeVirtual(new MethodRef(TypeName.STRINGBUILDER,TypeName.STRINGBUILDER,"append",TypeName.OBJECT))) ;
        l.add(new InvokeVirtual(new MethodRef(TypeName.STRINGBUILDER,TypeName.STRING,"toString"))) ;
View Full Code Here

    }
    MethodRef mref = createMethodRef(fd) ;
    for(Expr e: args) {
      context.compile(null,e, l) ;
    }
    l.add(new InvokeSpecial(mref)) ;
  }
View Full Code Here

    if (fd.stub.isStatic) {
      createStaticCall(context,args,mref.parameters,new InvokeStatic(mref),l) ;
    }
    else {
      if (fd.stub.isPrivate || fd.isSuper || mref.name.equals("<init>")) {
        createInstanceCall(context,decl,mref.name,args,mref.parameters,new InvokeSpecial(mref),l) ;
      }
      else if (fd.stub.cl.getStub().isInterface) {
        createInstanceCall(context,decl,mref.name,args,mref.parameters,new InvokeInterface(mref),l) ;
      }
      else {
View Full Code Here

TOP

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

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.