Package org.allspice.bytecode.instructions

Examples of org.allspice.bytecode.instructions.Increment


    Var x = new Var(1,new TypeName("int[]")) ;
    MethodDef md = new MethodDef(TypeName.VOID,"meth",x) ;
    md = md.addInstructions(
        new Load(x),
        new Const(0),
        new Increment(new ArrLValue(TypeName.INT),inc),
        new Return(TypeCode.VOID)
        ) ;
    return cd.addMethod(md)
  }
View Full Code Here


  public ClassDef defadd(String type,Number inc) {
    ClassDef cd = makeClassDef() ;
    Var x = new Var(1,new TypeName(type)) ;
    MethodDef md = new MethodDef(new TypeName(type),"meth",x) ;
    md = md.addInstructions(
        new Increment(x,inc),
        new Load(x),
        new Return(TypeCode.getType(type))
        ) ;
    return cd.addMethod(md)
  }
View Full Code Here

    l.add(new Nop(endmark)) ;
  }

  public static void createIncNoReturn(EvaluationContext context,Expr e,Number inc,InstList l) throws CompilerException {
    LValue v = context.compileLValue(e, l) ;
    l.add(new Increment(v,inc)) ;
  }
View Full Code Here

  }

  public static LValue createInc(EvaluationContext context,Expr e,Number inc,InstList l) throws CompilerException {
    LValue v = context.compileLValue(e, l) ;
    l.add(new Dup(TypeCode.VOID,v.getRefType())) ;
    l.add(new Increment(v,inc)) ;
    return v ;
  }
View Full Code Here

  }

  public static void createPostInc(EvaluationContext context,TypeName forwardType, Expr e,Number inc, InstList l) throws CompilerException {
    LValue v = context.compileLValue(e, l) ;
    if (TypeCode.getType(forwardType) == TypeCode.VOID) {
      l.add(new Increment(v,inc)) ;
    }
    else {
      l.add(new Dup(TypeCode.VOID,v.getRefType())) ;
      l.add(new Load(v)) ;
      final TypeCode tc = TypeCode.getType(v.getType());
      l.add(new Dup(v.getRefType(),tc)) ;
      l.add(new Pop(tc)) ;
      l.add(new Increment(v,inc)) ;
      convert(context,context.getType(e),forwardType,l) ;
    }
  }
View Full Code Here

TOP

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

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.