mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-08 15:34:09 +00:00
Implement UGET.
Allows simple closures, for example: function f(x) return function() return x end end y = f(1) print(y()) -- prints 1
This commit is contained in:
parent
354b5c748b
commit
aba9cfb2a8
@ -1970,8 +1970,16 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
|
||||
| stg r0, 0(r0)
|
||||
break;
|
||||
case BC_UGET:
|
||||
| stg r0, 0(r0)
|
||||
| stg r0, 0(r0)
|
||||
| ins_AD // RA = dst, RD = upvalue #
|
||||
| sllg RA, RA, 3(r0)
|
||||
| sllg RD, RD, 3(r0)
|
||||
| lg LFUNC:RB, -16(BASE)
|
||||
| cleartp LFUNC:RB
|
||||
| lg UPVAL:RB, (offsetof(GCfuncL, uvptr))(RD, LFUNC:RB)
|
||||
| lg RB, UPVAL:RB->v
|
||||
| lg RD, 0(RB)
|
||||
| stg RD, 0(RA, BASE)
|
||||
| ins_next
|
||||
break;
|
||||
case BC_USETV:
|
||||
| stg r0, 0(r0)
|
||||
|
Loading…
Reference in New Issue
Block a user