Branch: Tag:

2014-08-31

2014-08-31 10:43:28 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Optimizer: Added some integer overflow paranoia.

80:   LOCAL_LVALUE CONST0 ADD_TO_AND_POP:      LOCAL_LVALUE LTOSVAL ADD_INT ASSIGN: ADD_LOCAL_INT($1a,$3a) - LOCAL_LVALUE LTOSVAL ADD_NEG_INT ASSIGN: ADD_LOCAL_INT($1a,-$3a) + LOCAL_LVALUE LTOSVAL ADD_NEG_INT [ !INT32_NEG_OVERFLOW($3a) ] ASSIGN: ADD_LOCAL_INT($1a,-$3a)      NUMBER ASSIGN_LOCAL_AND_POP : ASSIGN_LOCAL_NUMBER_AND_POP($2a,$1a)   CONST0 ASSIGN_LOCAL_AND_POP : CLEAR_LOCAL($2a)
300:   NUMBER MULTIPLY : MULTIPLY_INT($1a)   NUMBER DIVIDE : DIVIDE_INT($1a)    - NEG_NUMBER MOD : MOD_INT(-$1a) - NEG_NUMBER LSH : LSH_INT(-$1a) - NEG_NUMBER RSH : RSH_INT(-$1a) - NEG_NUMBER SUBTRACT : SUBTRACT_INT(-$1a) - NEG_NUMBER AND : DIVIDE_INT(-$1a) - NEG_NUMBER OR : OR_INT(-$1a) - NEG_NUMBER XOR : XOR_INT(-$1a) - NEG_NUMBER MULTIPLY : MULTIPLY_INT(-$1a) - NEG_NUMBER DIVIDE : DIVIDE_INT(-$1a) + NEG_NUMBER [ !INT32_NEG_OVERFLOW($1a) ] MOD : MOD_INT(-$1a) + NEG_NUMBER [ !INT32_NEG_OVERFLOW($1a) ] LSH : LSH_INT(-$1a) + NEG_NUMBER [ !INT32_NEG_OVERFLOW($1a) ] RSH : RSH_INT(-$1a) + NEG_NUMBER [ !INT32_NEG_OVERFLOW($1a) ] SUBTRACT : SUBTRACT_INT(-$1a) + NEG_NUMBER [ !INT32_NEG_OVERFLOW($1a) ] AND : DIVIDE_INT(-$1a) + NEG_NUMBER [ !INT32_NEG_OVERFLOW($1a) ] OR : OR_INT(-$1a) + NEG_NUMBER [ !INT32_NEG_OVERFLOW($1a) ] XOR : XOR_INT(-$1a) + NEG_NUMBER [ !INT32_NEG_OVERFLOW($1a) ] MULTIPLY : MULTIPLY_INT(-$1a) + NEG_NUMBER [ !INT32_NEG_OVERFLOW($1a) ] DIVIDE : DIVIDE_INT(-$1a)      // This set of optimizations is broken. Consider the case:   // STRING ADD_INT ADD_INT