Nicholas Clark wrote:
The summary reminded me I had a question stillOn Thu, Jan 30, 2003 at 08:42:34AM +0100, Leopold Toetsch wrote:
[ constant folding for eval ]
Create a hash table of values present at the time of the first eval, and use that from then on?
There are 2 possibilities:
- we are executing a source file, then the lexer in imcc has a symbol hash with constants anyway. Constant folding in eval is done automatically.
- we are executing a PBC. Then - as laid out by your analysis - we are out of luck.
So I think: all *known* (from lexers POV) constants get their number
from the main constant table. New constants go into a new constant_table[1]
per eval code block.
Argh: Decoffeinitis
[1] Would still mean to append to the main constant table, remember the const count of main, and clean up only new constants.
Sounds rather complicated. So probably to start with: the eval block has it's own constant_table. Optimization for later: when eval() runs in a loop, the usage count of constants is kept and when they are the same,
the constants are added to the main constant_table and kept.
Nicholas Clark
leo