Re: preserving the relationship between upvalues of serialized functions in LuaJIT 2

  • From: Mike Pall <mike-1206@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 14 Jun 2012 12:20:53 +0200

Zach Devito wrote:
> Can anyone comment on whether this code should work in general, and on
> any issues I might be missing?

Well, it doesn't error out on non-positive upvalue indices. And,
yes, it's really absolutely necessary that those functions haven't
been run (esp. not JIT-compiled) -- which is hard to verify. Umm,
and it might break on future changes that improve static upvalue
analysis.

[BTW: Why didn't you use the API names from Lua 5.2?]

But ... why is all of that necessary? Why serialize two functions
that obviously had to have a common parent? Why not serialize the
parent instead? That would avoid all of the logic.

--Mike

Other related posts: