org.luaj.vm2.Upvaldesc Java Examples
The following examples show how to use
org.luaj.vm2.Upvaldesc.
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; } }
Example #3
Source File: FuncState.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
int searchupvalue (LuaString name) { int i; Upvaldesc[] up = f.upvalues; for (i = 0; i < nups; i++) if (up[i].name.eq_b(name)) return i; return -1; /* not found */ }
Example #4
Source File: FuncState.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
int newupvalue (LuaString name, expdesc v) { checklimit(nups + 1, LUAI_MAXUPVAL, "upvalues"); if (f.upvalues == null || nups + 1 > f.upvalues.length) f.upvalues = realloc( f.upvalues, nups > 0 ? nups*2 : 1 ); f.upvalues[nups] = new Upvaldesc(name, v.k == LexState.VLOCAL, v.u.info); return nups++; }
Example #5
Source File: FuncState.java From XPrivacyLua with GNU General Public License v3.0 | 5 votes |
int searchupvalue (LuaString name) { int i; Upvaldesc[] up = f.upvalues; for (i = 0; i < nups; i++) if (up[i].name.eq_b(name)) return i; return -1; /* not found */ }
Example #6
Source File: FuncState.java From XPrivacyLua with GNU General Public License v3.0 | 5 votes |
int newupvalue (LuaString name, expdesc v) { checklimit(nups + 1, LUAI_MAXUPVAL, "upvalues"); if (f.upvalues == null || nups + 1 > f.upvalues.length) f.upvalues = realloc( f.upvalues, nups > 0 ? nups*2 : 1 ); f.upvalues[nups] = new Upvaldesc(name, v.k == LexState.VLOCAL, v.u.info); return nups++; }
Example #7
Source File: FuncState.java From HtmlNative with Apache License 2.0 | 5 votes |
int searchupvalue (LuaString name) { int i; Upvaldesc[] up = f.upvalues; for (i = 0; i < nups; i++) if (up[i].name.eq_b(name)) return i; return -1; /* not found */ }
Example #8
Source File: FuncState.java From HtmlNative with Apache License 2.0 | 5 votes |
int newupvalue (LuaString name, expdesc v) { checklimit(nups + 1, LUAI_MAXUPVAL, "upvalues"); if (f.upvalues == null || nups + 1 > f.upvalues.length) f.upvalues = realloc( f.upvalues, nups > 0 ? nups*2 : 1 ); f.upvalues[nups] = new Upvaldesc(name, v.k == LexState.VLOCAL, v.u.info); return nups++; }
Example #9
Source File: FuncState.java From luaj with MIT License | 5 votes |
int searchupvalue (LuaString name) { int i; Upvaldesc[] up = f.upvalues; for (i = 0; i < nups; i++) if (up[i].name.eq_b(name)) return i; return -1; /* not found */ }
Example #10
Source File: FuncState.java From luaj with MIT License | 5 votes |
int newupvalue (LuaString name, expdesc v) { checklimit(nups + 1, LUAI_MAXUPVAL, "upvalues"); if (f.upvalues == null || nups + 1 > f.upvalues.length) f.upvalues = realloc( f.upvalues, nups > 0 ? nups*2 : 1 ); f.upvalues[nups] = new Upvaldesc(name, v.k == LexState.VLOCAL, v.u.info); return nups++; }
Example #11
Source File: LuaPrint.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
void buildUpvalue(StringBuffer ps, Upvaldesc u) { ps.append(u.idx + " "); buildValue(ps, u.name); }
Example #12
Source File: LuaC.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
static Upvaldesc[] realloc(Upvaldesc[] v, int n) { Upvaldesc[] a = new Upvaldesc[n]; if (v != null) System.arraycopy(v, 0, a, 0, Math.min(v.length, n)); return a; }
Example #13
Source File: Constants.java From XPrivacyLua with GNU General Public License v3.0 | 4 votes |
static Upvaldesc[] realloc(Upvaldesc[] v, int n) { Upvaldesc[] a = new Upvaldesc[n]; if ( v != null ) System.arraycopy(v, 0, a, 0, Math.min(v.length,n)); return a; }
Example #14
Source File: Constants.java From HtmlNative with Apache License 2.0 | 4 votes |
static Upvaldesc[] realloc(Upvaldesc[] v, int n) { Upvaldesc[] a = new Upvaldesc[n]; if ( v != null ) System.arraycopy(v, 0, a, 0, Math.min(v.length,n)); return a; }
Example #15
Source File: Constants.java From luaj with MIT License | 4 votes |
static Upvaldesc[] realloc(Upvaldesc[] v, int n) { Upvaldesc[] a = new Upvaldesc[n]; if ( v != null ) System.arraycopy(v, 0, a, 0, Math.min(v.length,n)); return a; }