@Override public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) throws IllegalArgumentException { if (uses != null && uses.length == 0) { throw new IllegalArgumentException("(uses != null) and (uses.length == 0)"); } return insts.ConversionInstruction(iindex, defs == null || defs.length == 0 ? getDef(0) : defs[0], uses == null ? getUse(0) : uses[0], getFromType(), getToType(), false); } };
@Override public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) throws IllegalArgumentException { if (uses != null && uses.length == 0) { throw new IllegalArgumentException("(uses != null) and (uses.length == 0)"); } return insts.ConversionInstruction(iindex, defs == null || defs.length == 0 ? getDef(0) : defs[0], uses == null ? getUse(0) : uses[0], getFromType(), getToType(), false); } };
/** * @see com.ibm.wala.shrikeBT.IInstruction.Visitor#visitConversion(IConversionInstruction) */ @Override public void visitConversion(IConversionInstruction instruction) { int val = workingState.pop(); int result = reuseOrCreateDef(); workingState.push(result); TypeReference fromType = ShrikeUtil.makeTypeReference(loader, instruction.getFromType()); TypeReference toType = ShrikeUtil.makeTypeReference(loader, instruction.getToType()); emitInstruction(insts.ConversionInstruction(getCurrentInstructionIndex(), result, val, fromType, toType, instruction.throwsExceptionOnOverflow())); }
/** * @see com.ibm.wala.shrikeBT.IInstruction.Visitor#visitConversion(IConversionInstruction) */ @Override public void visitConversion(IConversionInstruction instruction) { int val = workingState.pop(); int result = reuseOrCreateDef(); workingState.push(result); TypeReference fromType = ShrikeUtil.makeTypeReference(loader, instruction.getFromType()); TypeReference toType = ShrikeUtil.makeTypeReference(loader, instruction.getToType()); emitInstruction(insts.ConversionInstruction(getCurrentInstructionIndex(), result, val, fromType, toType, instruction.throwsExceptionOnOverflow())); }
@Override protected void leaveCast(CAstNode n, WalkContext context, CAstVisitor<WalkContext> visitor) { int result = context.getValue(n); CAstType toType = (CAstType) n.getChild(0).getValue(); TypeReference toRef = makeType(toType); CAstType fromType = (CAstType) n.getChild(2).getValue(); TypeReference fromRef = makeType(fromType); if (toRef.isPrimitiveType()) { context.cfg().addInstruction( insts.ConversionInstruction( context.cfg().getCurrentInstruction(), result, context.getValue(n.getChild(1)), fromRef, toRef, false)); } else { context.cfg().addInstruction( insts.CheckCastInstruction( context.cfg().getCurrentInstruction(), result, context.getValue(n.getChild(1)), toRef, true)); processExceptions(n, context); } }
@Override protected void leaveCast(CAstNode n, WalkContext context, CAstVisitor<WalkContext> visitor) { int result = context.getValue(n); CAstType toType = (CAstType) n.getChild(0).getValue(); TypeReference toRef = makeType(toType); CAstType fromType = (CAstType) n.getChild(2).getValue(); TypeReference fromRef = makeType(fromType); if (toRef.isPrimitiveType()) { context.cfg().addInstruction( insts.ConversionInstruction( context.cfg().getCurrentInstruction(), result, context.getValue(n.getChild(1)), fromRef, toRef, false)); } else { context.cfg().addInstruction( insts.CheckCastInstruction( context.cfg().getCurrentInstruction(), result, context.getValue(n.getChild(1)), toRef, true)); processExceptions(n, context); } }
int result = reuseOrCreateDef(); setLocal(dest, result); emitInstruction(insts.ConversionInstruction(getCurrentInstructionIndex(), result, val, fromType, toType, overflows));
int result = reuseOrCreateDef(); setLocal(dest, result); emitInstruction(insts.ConversionInstruction(getCurrentInstructionIndex(), result, val, fromType, toType, overflows));