|
Hi all, There is a question about the code generation of OP_CLOSURE instruction. I've read the code about it(lparser.c ln 517). An expdesc was filled with "VRELOCABLE" and the "OP_CLOSURE" instruction, but the target register of the instruction was filled with "nextreg" immediatly. For the example code: =============== local a; a = function() end; =============== The code generated was: =============== 1 [1] LOADNIL 0 0 2 [2] CLOSURE 1 0 ; 0x80049078 3 [2] MOVE 0 1 4 [2] RETURN 0 1 =============== It seemed that we can not store the closure directly to local var "a". Why not keep the expdesc as "VRELOCABLE" and patch the target register later? |