Package org.allspice.bytecode

Examples of org.allspice.bytecode.TypeCode


    l.add(new Const(Boolean.TRUE)) ;
    l.add(new Nop(end)) ;
  }
 
  public static Object cast(ClassPool pool,StubResolver type,ConstObj o) throws CompilerException {
    TypeCode t = TypeCode.getType(type.getTypeName()) ;
    switch(t) {
    case DOUBLE: return getDoubleValue(o) ;
    case FLOAT: return getFloatValue(o) ;
    case LONG: return getLongValue(o) ;
    case INT: return getIntValue(o) ;
View Full Code Here


  public static void createConditional(EvaluationContext context,
      Expr cond, Expr thenst, Expr elsest,InstList l ) throws CompilerException {
    StubResolver td1 = context.getType(thenst) ;
    StubResolver td2 = context.getType(elsest) ;
    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)) ;
View Full Code Here

      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

  public static void createNegate(EvaluationContext context, Expr e, InstList l) throws CompilerException {
    context.compile(null,e, l) ;
    l.add(new Negate(context.getTypeCode(e))) ;
  }
  public static void createPositive(EvaluationContext context, Expr e, InstList l) throws CompilerException {
    final TypeCode t = context.getTypeCode(e);
    TypeCode type = getArithBinopType(t, t) ;
    createConvert(context,e,TypeName.valueOf(type),l) ;
  }
View Full Code Here

    pushArgs(context, args, types, l);
    l.add(i) ;
  }
 
  public static TypeCode getEqualityComparisonOperationType(EvaluationContext context,Expr lhs,Expr rhs) throws CompilerException {
    TypeCode td1 = context.getTypeCode(lhs) ;
    TypeCode td2 = context.getTypeCode(rhs) ;
    if (TypeCode.isReference(td1) && TypeCode.isReference(td2)) {
      return TypeCode.OBJECT ;
    }
    TypeCode t = arithTable.get(new TypePair(td1,td2)) ;
    if (t == null) {
      throw new NoEqualityOperator(td1,td2) ;
    }
    return t ;
  }
View Full Code Here

      throw new NoEqualityOperator(td1,td2) ;
    }
    return t ;
  }
  public static TypeCode getBinopComparisonOperationType(EvaluationContext context,Expr lhs,Expr rhs) throws CompilerException {
    TypeCode td1 = context.getTypeCode(lhs) ;
    TypeCode td2 = context.getTypeCode(rhs) ;
    TypeCode t = arithTable.get(new TypePair(td1,td2)) ;
    if (t == null) {
      throw new NoComparisonOperator(td1,td2) ;
    }
    return t ;
  }
View Full Code Here

    context.compile(null,e, l) ;
    l.add(new InstanceOf(context.fullyQualified(type))) ;
  }

  public static TypeCode getShiftBinopType(TypeCode td1,TypeCode td2) throws CompilerException {
    TypeCode t = shiftTable.get(new TypePair(td1,td2)) ;
    if (t == null) {
      throw new NoShiftOperator(td1,td2) ;
    }
    return t ;
  }
View Full Code Here

    }
    return t ;
  }

  public static TypeCode getBitBinopType(TypeCode td1,TypeCode td2) throws CompilerException {
    TypeCode t = bitTable.get(new TypePair(td1,td2)) ;
    if (t == null) {
      throw new NoBitOperator(td1,td2) ;
    }
    return t ;
  }
View Full Code Here

    }
    return t ;
  }

  public static TypeCode getArithBinopType(TypeCode td1,TypeCode td2) throws CompilerException {
    TypeCode t = arithTable.get(new TypePair(td1,td2)) ;
    if (t == null) {
      throw new NoArithmeticOperator(td1,td2) ;
    }
    return t ;
  }
View Full Code Here

  }
  private static final class BitNotConverter implements
      ExprCompiler<BitNotExpr> {
    public void compile(TypeName forwardType, BitNotExpr t, EvaluationContext context, InstList result) throws CompilerException {
      final Expr lhs = t.e;
      TypeCode type = getBitBinopType(context.getTypeCode(lhs),context.getTypeCode(lhs)) ;
      context.compile(null,lhs, result)
      result.add(new Not(type)) ;
      convertResult(context,t,forwardType,result) ;
    }
View Full Code Here

TOP

Related Classes of org.allspice.bytecode.TypeCode

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.