From 08d9c148d0d4c3f12f547b04786a6738c02731dc Mon Sep 17 00:00:00 2001 From: James Roseborough Date: Fri, 30 Jul 2010 23:50:03 +0000 Subject: [PATCH] Improve bytecode generation. --- src/jse/org/luaj/vm2/luajc/Slots.java | 30 ++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/jse/org/luaj/vm2/luajc/Slots.java b/src/jse/org/luaj/vm2/luajc/Slots.java index 15edaa10..2933e7a8 100644 --- a/src/jse/org/luaj/vm2/luajc/Slots.java +++ b/src/jse/org/luaj/vm2/luajc/Slots.java @@ -333,13 +333,15 @@ public class Slots { } private void markuninitialized() { - for ( int j=p.numparams; j= p.code.length ) + return false; + int ins = p.code[index]; + switch ( Lua.GET_OPCODE(ins) ) { + case Lua.OP_LOADBOOL: + if ( Lua.GETARG_C(ins) == 0 ) + return true; + case Lua.OP_EQ: + case Lua.OP_LT: + case Lua.OP_LE: + case Lua.OP_TEST: + case Lua.OP_TESTSET: + case Lua.OP_TFORLOOP: + case Lua.OP_JMP: + case Lua.OP_FORPREP: + case Lua.OP_FORLOOP: + return true; + } + return false; + } + private void markupvalues( ) { for ( int pc=0; pc