|
Mike Pall wrote:
Metatables and other dynamisms pose no problem either. A direct or indirect metatable access is just a special load or store to the underlying object. If the alias analysis doesn't find a conflicting store inside the loop (setmetatable to the same object), it can safely hoist all metatable loads out of the loop. Even if it finds a store, it can often just forward it to the load and sink the store. Ditto for function environments.
I think I'm beginning to understand how trace compilation works now... I believe the above can only work if the trace includes every single instruction executed inside the loop. I had always assumed that the trace only included code not already compiled, but I'm guessing I was mistaken. Either way, I'm looking forward to being able to test out jit 2.x, looks like it should produce some very impressive code.
- Alex