diff options
| author | Drahflow <drahflow@gmx.de> | 2015-06-15 16:52:23 +0200 |
|---|---|---|
| committer | Drahflow <drahflow@gmx.de> | 2015-06-15 16:52:23 +0200 |
| commit | a30775351c5fa08293e087fdf650237c6c5e182a (patch) | |
| tree | ffcfe26f611830a1a66ffa6888698a2713614f97 /elymas/lib/sys | |
| parent | 8f5c0b2db85a4cef9e21991fa20860b6e3659a2c (diff) | |
Optimized ] -- (used to discard stack effects)
Diffstat (limited to 'elymas/lib/sys')
| -rw-r--r-- | elymas/lib/sys/opt.ey | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/elymas/lib/sys/opt.ey b/elymas/lib/sys/opt.ey index 93b6e7e..c51f145 100644 --- a/elymas/lib/sys/opt.ey +++ b/elymas/lib/sys/opt.ey @@ -5,6 +5,7 @@ "../compiler/elymasAsmOps.ey" include > /ops sys .asm .defv + 1 ==ARRAYMARKER # FIXME unify with elymasGlobal.ey 4 ==INITIALSCOPESIZE # FIXME take this from the compiler directory sys .asm .ops ==:sysasmops @@ -158,6 +159,7 @@ /UNTYPEDUNSCOPEDSTAR ==:UNTYPEDUNSCOPEDSTAR /STRINGSTAR ==:STRINGSTAR /CONDITIONALTAIL ==:CONDITIONALTAIL + /ARRAYCLEAR ==:ARRAYCLEAR { =*f ==t t { f } { 0 } ? * @@ -1714,6 +1716,21 @@ } each } /rewriteConstantQuestionStar deffst + { _ ==logic + 1 logic len range { ==i i logic * ==entry 0 entry * ==action i 1 sub logic * ==last + [ + { action CALL eq + { 1 entry * "--" | ::rawCodeAddress eq }' andif + { 0 last * CALL eq }' andif + { 1 last * "]" | ::rawCodeAddress eq }' andif + }' { + [ NOP ] i 1 sub logic =[] + [ ARRAYCLEAR ] i logic =[] + } + ] conds + } each + } /rewriteArrayClear deffst + { ==logic [ NOP ] ==last [ logic { ==entry 0 entry * ==action @@ -1960,6 +1977,7 @@ rewriteTrivialStar rewriteConstantStar rewriteConstantQuestionStar + rewriteArrayClear rewriteIntegerTrace rewriteArithmetics # mostly SUPERSEDED BY rewriteIntegerTrace rewriteArithmeticsOptimistic @@ -2234,6 +2252,16 @@ } ? * } + { action ARRAYCLEAR eq }' { + [[ + ARRAYMARKER /rax :movqImmReg + @search + /rdi :popqReg + /rdi /rax :cmpqRegReg + /search :jneLbl8 + ]] emitOpcodes + } + { 1 }' { |entry dump "invalid intermediate code during optimize" die |
