mirror of
https://github.com/irmen/prog8.git
synced 2025-02-18 05:30:34 +00:00
fix compiler crash on certain constant expressions
This commit is contained in:
parent
e7178ee496
commit
d9389afc66
@ -87,7 +87,8 @@ class ConstantFoldingOptimizer(private val program: Program) : AstWalker() {
|
|||||||
|
|
||||||
if(expr.operator=="==" && rightconst!=null) {
|
if(expr.operator=="==" && rightconst!=null) {
|
||||||
val leftExpr = expr.left as? BinaryExpression
|
val leftExpr = expr.left as? BinaryExpression
|
||||||
if(leftExpr!=null) {
|
// only do this shuffling when the LHS is not a constant itself (otherwise problematic nested replacements)
|
||||||
|
if(leftExpr?.constValue(program) != null) {
|
||||||
val leftRightConst = leftExpr.right.constValue(program)
|
val leftRightConst = leftExpr.right.constValue(program)
|
||||||
if(leftRightConst!=null) {
|
if(leftRightConst!=null) {
|
||||||
when (leftExpr.operator) {
|
when (leftExpr.operator) {
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
TODO
|
TODO
|
||||||
====
|
====
|
||||||
|
|
||||||
|
- is Jesko's circle algorithm faster than what we have now? https://en.wikipedia.org/wiki/Midpoint_circle_algorithm#Jesko's_Method
|
||||||
|
is it Correct??? Or better to use Casey's algorithm?
|
||||||
|
- revisit the seek example to see if write-seeking now works?
|
||||||
|
|
||||||
|
- remove unused interned strings in the resulting code (for example from removed if/else blocks)
|
||||||
- [on branch: shortcircuit] investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 ....
|
- [on branch: shortcircuit] investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 ....
|
||||||
- [on branch: ir-less-branch-opcodes] IR: reduce the number of branch instructions such as BEQ, BEQR, etc (gradually), replace with CMP(I) + status branch instruction
|
- [on branch: ir-less-branch-opcodes] IR: reduce the number of branch instructions such as BEQ, BEQR, etc (gradually), replace with CMP(I) + status branch instruction
|
||||||
- IR: reduce amount of CMP/CMPI after instructions that set the status bits correctly (LOADs? INC? Bitwise operations, etc), but only after setting the status bits is verified!
|
- IR: reduce amount of CMP/CMPI after instructions that set the status bits correctly (LOADs? INC? Bitwise operations, etc), but only after setting the status bits is verified!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user