Package org.allspice.bytecode.instructions

Examples of org.allspice.bytecode.instructions.IfEquals0


    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 IfEquals0(TypeCode.getType(type),one),
        new Const(false),
        new Return(TypeCode.BOOLEAN),
        new Nop(one),
        new Const(true),
        new Return(TypeCode.BOOLEAN)
View Full Code Here


  public static void createAnd(EvaluationContext context,
      final Expr lhs, final Expr rhs, InstList l) throws CompilerException {
    Mark isZero = new Mark() ;
    Mark end = new Mark() ;
    context.compile(null,lhs, l) ;
    l.add(new IfEquals0(context.getTypeCode(lhs),isZero)) ;
    context.compile(null,rhs, l) ;
    l.add(new IfEquals0(context.getTypeCode(rhs),isZero)) ;
    l.add(new Const(Boolean.TRUE)) ;
    l.add(new Goto(end)) ;
    l.add(new Nop(isZero)) ;
    l.add(new Const(Boolean.FALSE)) ;
    l.add(new Nop(end)) ;
View Full Code Here

    TypeCode t1 = condTable.get(new TypePair(td1.getTypeCode(),td2.getTypeCode())) ;
    TypeName type = (t1 != null) ? TypeName.valueOf(t1) : null ;
    context.compile(null,cond, l) ;
    Mark endmark = new Mark() ;
    Mark elsemark = new Mark() ;
    l.add(new IfEquals0(context.getTypeCode(cond),elsemark)) ;
    createConvert(context, thenst, type,l) ;
    l.add(new Goto(endmark)) ;
    l.add(new Nop(elsemark)) ;
    createConvert(context, elsest, type,l) ;
    l.add(new Nop(endmark)) ;
View Full Code Here

    Mark beginmark = new Mark() ;
    Mark endmark = new Mark() ;
    EvaluationContext newContext = context.setBreak(endmark).setContinue(beginmark) ;
    l.add(new Nop(beginmark)) ;
    context.compile(null,cond, l) ;
    l.add(new IfEquals0(context.getTypeCode(cond),endmark)) ;
    for(Statement s: thenst) {
      newContext.compile(s,l) ;
    }
    l.add(new Goto(beginmark)) ;
    l.add(new Nop(endmark)) ;
View Full Code Here

  public static void createIfThenElse(EvaluationContext context,Expr cond,
      Collection<Statement> thenst,Collection<Statement> elsest, InstList l) throws CompilerException {
    context.compile(null,cond, l) ;
    Mark endmark = new Mark() ;
    Mark elsemark = new Mark() ;
    l.add(new IfEquals0(context.getTypeCode(cond),elsemark)) ;
    for(Statement st: thenst) {
      context.compile(st,l) ;
    }
    l.add(new Goto(endmark)) ;
    l.add(new Nop(elsemark)) ;
View Full Code Here

  public static void createNot(EvaluationContext context, Expr e, InstList l) throws CompilerException {
    context.compile(null,e, l) ;
    Mark isZero = new Mark() ;
    Mark end = new Mark() ;
    l.add(new IfEquals0(context.getTypeCode(e),isZero)) ;
    l.add(new Const(Boolean.FALSE)) ;
    l.add(new Goto(end)) ;
    l.add(new Nop(isZero)) ;
    l.add(new Const(Boolean.TRUE)) ;
    l.add(new Nop(end)) ;
View Full Code Here

TOP

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

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.