Geoff Leyland wrote: > On 14/06/2012, at 1:20 PM, Mike Pall wrote: > > Yes, more or less. Inside the loop everything will be computed in > > registers. There's still a 'point' allocation at the start of the > > loop. And another 'point' object will be materialized from the > > registers when the loop exits (it'll be eliminated if/when that > > side trace is compiled eventually). > > Cool! Are the two allocations because the trace starts most > likely starts on the "for i" rather than the line before and > ends at the end of the loop? The trace for a 'for' loop is initiated by a hot 'FORL' instruction. Trace recording starts at the _next_ instruction, which is the first instruction in the loop body. The trace ends after it hits the 'FORL' instruction again. The code before a 'for' loop, including the 'FORI' setup, is only compiled when a second trace ends up joining to the inner loop. But then it's too late to change the logic of the first trace, which expects a table (or a boxed object) and not separate values. --Mike