fix compiler crash on certain constant expressions

This commit is contained in:
Irmen de Jong 2023-11-05 13:59:08 +01:00
parent e7178ee496
commit d9389afc66
2 changed files with 7 additions and 1 deletions

View File

@ -87,7 +87,8 @@ class ConstantFoldingOptimizer(private val program: Program) : AstWalker() {
if(expr.operator=="==" && rightconst!=null) {
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)
if(leftRightConst!=null) {
when (leftExpr.operator) {

View File

@ -1,6 +1,11 @@
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: 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!