On 12/18/2012 8:54 AM, Andrei Alexandrescu wrote:
On 12/18/12 10:01 AM, Walter Bright wrote:
On 12/18/2012 1:43 AM, Dmitry Olshansky wrote:
Compared to doing computations on AST tries (and looking up every name
in symbol
table?), creating fake nodes when the result is computed etc?

CTFE does not look up every (or any) name in the symbol table. I don't
see any advantage to interpreting bytecode over interpreting ASTs. In
fact, all the Java bytecode is is a serialized AST.

My understanding is that Java bytecode is somewhat lowered e.g. using a stack
machine for arithmetic, jumps etc. which makes it more amenable to
interpretation than what an AST walker would do.

The Java bytecode is indeed a stack machine, and a stack machine *is* a serialized AST.


Also bytecode is more directly
streamable because you don't need any pointer fixups.

A stack machine *is* a streamable representation of an AST. They are trivially convertible back and forth between each other, and I mean trivially.

Reply via email to