src/share/classes/sun/tools/tree/IncDecExpression.java

Print this page
rev 10195 : 8048267: Replace uses of 'new Long()' with appropriate alternative across core classes
Reviewed-by: chegar, psandoz
Contributed-by: otaviojava@java.net


 114           case TC_BYTE:
 115             asm.add(where, opc_ldc, new Integer(1));
 116             asm.add(where, inc ? opc_iadd : opc_isub);
 117             asm.add(where, opc_i2b);
 118             break;
 119           case TC_SHORT:
 120             asm.add(where, opc_ldc, new Integer(1));
 121             asm.add(where, inc ? opc_iadd : opc_isub);
 122             asm.add(where, opc_i2s);
 123             break;
 124           case TC_CHAR:
 125             asm.add(where, opc_ldc, new Integer(1));
 126             asm.add(where, inc ? opc_iadd : opc_isub);
 127             asm.add(where, opc_i2c);
 128             break;
 129           case TC_INT:
 130             asm.add(where, opc_ldc, new Integer(1));
 131             asm.add(where, inc ? opc_iadd : opc_isub);
 132             break;
 133           case TC_LONG:
 134             asm.add(where, opc_ldc2_w, new Long(1));
 135             asm.add(where, inc ? opc_ladd : opc_lsub);
 136             break;
 137           case TC_FLOAT:
 138             asm.add(where, opc_ldc, new Float(1));
 139             asm.add(where, inc ? opc_fadd : opc_fsub);
 140             break;
 141           case TC_DOUBLE:
 142             asm.add(where, opc_ldc2_w, new Double(1));
 143             asm.add(where, inc ? opc_dadd : opc_dsub);
 144             break;
 145           default:
 146             throw new CompilerError("invalid type");
 147         }
 148     }
 149 
 150     void codeIncDec(Environment env, Context ctx, Assembler asm, boolean inc, boolean prefix, boolean valNeeded) {
 151 
 152         // The 'iinc' instruction cannot be used if an access method call is required.
 153         if ((right.op == IDENT) && type.isType(TC_INT) &&
 154             (((IdentifierExpression)right).field.isLocal()) && updater == null) {




 114           case TC_BYTE:
 115             asm.add(where, opc_ldc, new Integer(1));
 116             asm.add(where, inc ? opc_iadd : opc_isub);
 117             asm.add(where, opc_i2b);
 118             break;
 119           case TC_SHORT:
 120             asm.add(where, opc_ldc, new Integer(1));
 121             asm.add(where, inc ? opc_iadd : opc_isub);
 122             asm.add(where, opc_i2s);
 123             break;
 124           case TC_CHAR:
 125             asm.add(where, opc_ldc, new Integer(1));
 126             asm.add(where, inc ? opc_iadd : opc_isub);
 127             asm.add(where, opc_i2c);
 128             break;
 129           case TC_INT:
 130             asm.add(where, opc_ldc, new Integer(1));
 131             asm.add(where, inc ? opc_iadd : opc_isub);
 132             break;
 133           case TC_LONG:
 134             asm.add(where, opc_ldc2_w, 1L);
 135             asm.add(where, inc ? opc_ladd : opc_lsub);
 136             break;
 137           case TC_FLOAT:
 138             asm.add(where, opc_ldc, new Float(1));
 139             asm.add(where, inc ? opc_fadd : opc_fsub);
 140             break;
 141           case TC_DOUBLE:
 142             asm.add(where, opc_ldc2_w, new Double(1));
 143             asm.add(where, inc ? opc_dadd : opc_dsub);
 144             break;
 145           default:
 146             throw new CompilerError("invalid type");
 147         }
 148     }
 149 
 150     void codeIncDec(Environment env, Context ctx, Assembler asm, boolean inc, boolean prefix, boolean valNeeded) {
 151 
 152         // The 'iinc' instruction cannot be used if an access method call is required.
 153         if ((right.op == IDENT) && type.isType(TC_INT) &&
 154             (((IdentifierExpression)right).field.isLocal()) && updater == null) {