Re: [PHP4BETA] zend-parser.y shift/reduce conflicts and suggestions
| From: | Philippe Verdy | Date: | Wed, 18 Aug 1999 00:18:03 +0000 |
| Subject: | Re: [PHP4BETA] zend-parser.y shift/reduce conflicts and suggestions | ||
| References: | 1 2 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-3533@lists.php.net to get a copy of this message | ||
I also forgot to say how to implement BREAK more efficiently:
they generate an unconditional jump, but the destination address is still
unknown when they need to be generated. One way to do it is simply to store
the address of the ZEND_JMP opcode generated the previous BREAK statement
already generated in the current LOOP of SWITCH, and store the head of this
backward list in the zend parser stack which now stores information on the
current level of loops or switchs.
Then when the end of the loop or the end of the switch is detected, the code
generator simply knows the address of the current opcode. This can be used
to update all ZEND_JMP opcodes in the backward list with this now known
address.
Using such technics allows a good resolution of all forward jumps in the
code, so that you do not need to generate so many jumps in the opcode array.
And a smaller code means a better run-time performance...