···88local fileutil = require("fileutil")
99local strutil = require("strutil")
10101111+local function trace(...)
1212+ if wasmlib.TRACING then print(...) end
1313+end
1414+1115wasmlib.VM = {
1216 numImportedFuncs = 0,
1317 stack = {},
···332336 local length = constants.ilengths[opcode]
333337 if length == 0 then
334338 if constants.blockOpcodes[opcode] ~= nil then
335335- i = findMatchingEndOrElse(body, i + 1, depth + 1) + (depth > 0 and 1 or 0)
339339+ i = findMatchingEndOrElse(body, i + 2, depth + 1) + (depth > 0 and 1 or 0)
336340 elseif opcode == constants.opcodes.OP_ELSE then
337341 i = i + 1
338342 end
···422426 end
423427424428 local opcode = self:nextArg()
429429+ trace(self:curFrame().pc,opcode,"###",table.unpack(self.stack))
430430+ trace(#self.labelStack,"---",table.unpack(self.labelStack))
425431426432 local c = constants.opcodes
427433 local optable = {