Java Code Examples for org.luaj.vm2.Lua#GETARG_Bx
The following examples show how to use
org.luaj.vm2.Lua#GETARG_Bx .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProtoInfo.java From HtmlNative with Apache License 2.0 | 6 votes |
private void findUpvalues() { int[] code = prototype.code; int n = code.length; // propogate to inner prototypes String[] names = findInnerprotoNames(); for ( int pc=0; pc<n; pc++ ) { if ( Lua.GET_OPCODE(code[pc]) == Lua.OP_CLOSURE ) { int bx = Lua.GETARG_Bx(code[pc]); Prototype newp = prototype.p[bx]; UpvalInfo[] newu = new UpvalInfo[newp.upvalues.length]; String newname = name + "$" + names[bx]; for ( int j=0; j<newp.upvalues.length; ++j ) { Upvaldesc u = newp.upvalues[j]; newu[j] = u.instack? findOpenUp(pc,u.idx) : upvals[u.idx]; } subprotos[bx] = new ProtoInfo(newp, newname, newu); } } // mark all upvalues that are written locally as read/write for ( int pc=0; pc<n; pc++ ) { if ( Lua.GET_OPCODE(code[pc]) == Lua.OP_SETUPVAL ) upvals[Lua.GETARG_B(code[pc])].rw = true; } }
Example 2
Source File: ProtoInfo.java From luaj with MIT License | 6 votes |
private void findUpvalues() { int[] code = prototype.code; int n = code.length; // propogate to inner prototypes String[] names = findInnerprotoNames(); for ( int pc=0; pc<n; pc++ ) { if ( Lua.GET_OPCODE(code[pc]) == Lua.OP_CLOSURE ) { int bx = Lua.GETARG_Bx(code[pc]); Prototype newp = prototype.p[bx]; UpvalInfo[] newu = new UpvalInfo[newp.upvalues.length]; String newname = name + "$" + names[bx]; for ( int j=0; j<newp.upvalues.length; ++j ) { Upvaldesc u = newp.upvalues[j]; newu[j] = u.instack? findOpenUp(pc,u.idx) : upvals[u.idx]; } subprotos[bx] = new ProtoInfo(newp, newname, newu); } } // mark all upvalues that are written locally as read/write for ( int pc=0; pc<n; pc++ ) { if ( Lua.GET_OPCODE(code[pc]) == Lua.OP_SETUPVAL ) upvals[Lua.GETARG_B(code[pc])].rw = true; } }