1 24 25 package org.aspectj.compiler.base.ast; 26 27 import org.aspectj.compiler.base.*; 28 import java.io.IOException ; 29 30 31 import org.aspectj.compiler.base.bcg.CodeBuilder; 32 import org.aspectj.compiler.base.bcg.Label; 33 34 35 public final class IntType extends IntishType { 36 37 protected boolean isAssignableFromOtherType(Type other) { 38 return (other instanceof IntishType); 39 } 40 41 public String getName() { return "int"; } 42 public int getTypeIndex() { return Type.INT; } 43 public Type getRefType() { return getTypeManager().getType("java.lang", "Integer"); } 44 45 public IntType(JavaCompiler compiler) { 46 super(compiler); 47 } 48 49 public String getDescriptor() { return "I"; } 51 52 LiteralExpr foldCast(LiteralExpr rand) { 54 return getAST().makeLiteral(rand.getIntValue()); 55 } 56 57 void emitCastFromInt(CodeBuilder cb) { } 59 void emitCastFromFloat(CodeBuilder cb) { cb.emitF2I(); } 60 void emitCastFromLong(CodeBuilder cb) { cb.emitL2I(); } 61 void emitCastFromDouble(CodeBuilder cb) { cb.emitD2I(); } 62 63 void emitAload(CodeBuilder cb) { cb.emitIALOAD(); } 64 void emitAstore(CodeBuilder cb) { cb.emitIASTORE(); } 65 66 69 boolean hasFastIncOp(Expr lhs, int rhs) { 70 return (lhs instanceof VarExpr) 71 && (Short.MIN_VALUE <= rhs) 72 && (rhs <= Short.MAX_VALUE); 73 } 74 void emitFastIncOp(CodeBuilder cb, Expr lhs, int rhs) { 75 cb.emitIINC(((VarExpr) lhs).getVarDec().getFrameLoc(), rhs); 76 } 77 } 78 79 80 | Popular Tags |