Package org.allspice.bytecode.instructions

Examples of org.allspice.bytecode.instructions.Dup


      Var x = new Var(0,TypeName.INT) ;
      MethodDef md = new MethodDef(TypeName.INT,"getFoo",x) ;
      md = md.setStatic(true) ;
      md = md.addInstructions(
          new Load(x),
          new Dup(TypeCode.VOID,TypeCode.INT),
          new Add(TypeCode.INT),
          new Return(TypeCode.INT)
          ) ;
      cd = cd.addMethod(md) ;
    }
View Full Code Here


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

      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) ;
View Full Code Here

      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) ;
View Full Code Here

      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)
View Full Code Here

      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)
View Full Code Here

      Expr inc = t.rhs;
      final Expr var = t.lhs;
      final StubResolver type = context.getType(var);
      if (type.getTypeName().equals(TypeName.STRING)) {
        LValue v = context.compileLValue(var, l);
        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))) ;
View Full Code Here

      Expr inc = t.rhs;
      final Expr var = t.lhs;
      final StubResolver type = context.getType(var);
      if (type.getTypeName().equals(TypeName.STRING)) {
        LValue v = context.compileLValue(var, l);
        l.add(new Dup(TypeCode.VOID,v.getRefType())) ;
        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))) ;
View Full Code Here

      }
      TypeName baseType = vtype.getArrayBase() ;
      createNewArray(context,Arrays.asList(new ConstExpr(Integer.valueOf(arrinit.size()),null)),vtype,l) ;
      int i = 0 ;
      for(Expr arrval: arrinit) {
        l.add(new Dup(TypeCode.VOID,TypeCode.getType(vtype))) ;
        l.add(new Const(Integer.valueOf(i))) ;
        context.compile(baseType, arrval, l) ;
        l.add(new Store(new ArrLValue(baseType))) ;
        i++ ;
      }
View Full Code Here

    EvaluationContext newContext = context.addFinallyDest(finallyMark).setVars(vars) ;
    LValue v = newContext.getVar("$$mon$$") ;
    Var ex = (Var)newContext.getVar("$$ex$$") ;
    Var vret = (Var)newContext.getVar("$$ra$$") ;
    makeInit(newContext,varDecl.init,v.getType(),l) ;
    l.add(new Dup(TypeCode.VOID,TypeCode.OBJECT)) ;
    l.add(new Store(v)) ;
    l.add(new MonitorEnter()) ;
    Mark the_end = new Mark() ;
    Mark start_pc = new Mark() ;
    Mark end_pc = new Mark() ;
View Full Code Here

TOP

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

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.