more aggressive code elimination for NODE_DOT{2,3}

parent a1804606
...@@ -1264,20 +1264,20 @@ codegen(codegen_scope *s, node *tree, int val) ...@@ -1264,20 +1264,20 @@ codegen(codegen_scope *s, node *tree, int val)
break; break;
case NODE_DOT2: case NODE_DOT2:
codegen(s, tree->car, VAL); codegen(s, tree->car, val);
codegen(s, tree->cdr, VAL); codegen(s, tree->cdr, val);
pop(); pop();
if (val) { if (val) {
pop(); pop();
genop(s, MKOP_ABC(OP_RANGE, cursp(), cursp(), 0)); genop(s, MKOP_ABC(OP_RANGE, cursp(), cursp(), 0));
push(); push();
} }
break; break;
case NODE_DOT3: case NODE_DOT3:
codegen(s, tree->car, VAL); codegen(s, tree->car, val);
codegen(s, tree->cdr, VAL); codegen(s, tree->cdr, val);
pop(); pop();
if (val) { if (val) {
pop(); pop();
genop(s, MKOP_ABC(OP_RANGE, cursp(), cursp(), 1)); genop(s, MKOP_ABC(OP_RANGE, cursp(), cursp(), 1));
push(); push();
} }
...@@ -1290,7 +1290,7 @@ codegen(codegen_scope *s, node *tree, int val) ...@@ -1290,7 +1290,7 @@ codegen(codegen_scope *s, node *tree, int val)
codegen(s, tree->car, VAL); codegen(s, tree->car, VAL);
pop(); pop();
genop(s, MKOP_ABx(OP_GETMCNST, cursp(), sym)); genop(s, MKOP_ABx(OP_GETMCNST, cursp(), sym));
push(); if (val) push();
} }
break; break;
...@@ -1300,7 +1300,7 @@ codegen(codegen_scope *s, node *tree, int val) ...@@ -1300,7 +1300,7 @@ codegen(codegen_scope *s, node *tree, int val)
genop(s, MKOP_A(OP_OCLASS, cursp())); genop(s, MKOP_A(OP_OCLASS, cursp()));
genop(s, MKOP_ABx(OP_GETMCNST, cursp(), sym)); genop(s, MKOP_ABx(OP_GETMCNST, cursp(), sym));
push(); if (val) push();
} }
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment