On Dec 30, 2005, at 20:54, Will Coleda (via RT) wrote:
[expr] currently generates quite a bit of code for something like: expr 1*2*3*4*5 Since all of those operators are constant, it should be possible to have that expr call be distilled to: .sub foo :anon $P0 = new TclInt $P0 = 120 .return($P0) .end Should probably convert [expr] to be inlined before implementing this.
Yep. I think it should compile to (pseudocode): expr = find_name 'expr' # or whatever if expr == builtin_expr # dummy sub constant PMC t0 = 5*6 t1 = t0 * 4 t2 = t1 * 3 ... result = tn else result = expr(expr_string) That is: - let Parrot do the work of constant propagation - don't call a function for compilable code, when not needed - inline it my 2 c leo