quick and dirty pure lua webassembly interpreter
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bugfixes

+15 -7
+8 -6
constants.lua
··· 66 66 OP_I32_NE = 0x47, 67 67 OP_I32_LT_S = 0x48, 68 68 OP_I32_LT_U = 0x49, 69 - OP_I32_GT_S = 0x50, 70 - OP_I32_GT_U = 0x51, 71 - OP_I32_LE_S = 0x52, 72 - OP_I32_LE_U = 0x53, 73 - OP_I32_GE_S = 0x54, 74 - OP_I32_GE_U = 0x55, 69 + OP_I32_GT_S = 0x4A, 70 + OP_I32_GT_U = 0x4B, 71 + OP_I32_LE_S = 0x4C, 72 + OP_I32_LE_U = 0x4D, 73 + OP_I32_GE_S = 0x4E, 74 + OP_I32_GE_U = 0x4F, 75 75 -- i64 comparisons 76 76 OP_I64_EQZ = 0x50, 77 77 OP_I64_EQ = 0x51, ··· 321 321 [c.OP_I32_GT_U] = 1, 322 322 [c.OP_I32_LE_S] = 1, 323 323 [c.OP_I32_LE_U] = 1, 324 + [c.OP_I32_GE_S] = 1, 325 + [c.OP_I32_GE_U] = 1, 324 326 -- i64 comparisons 325 327 [c.OP_I64_EQZ] = 1, 326 328 [c.OP_I64_EQ] = 1,
+7 -1
wasmlib.lua
··· 8 8 local fileutil = require("fileutil") 9 9 local strutil = require("strutil") 10 10 11 + local function trace(...) 12 + if wasmlib.TRACING then print(...) end 13 + end 14 + 11 15 wasmlib.VM = { 12 16 numImportedFuncs = 0, 13 17 stack = {}, ··· 332 336 local length = constants.ilengths[opcode] 333 337 if length == 0 then 334 338 if constants.blockOpcodes[opcode] ~= nil then 335 - i = findMatchingEndOrElse(body, i + 1, depth + 1) + (depth > 0 and 1 or 0) 339 + i = findMatchingEndOrElse(body, i + 2, depth + 1) + (depth > 0 and 1 or 0) 336 340 elseif opcode == constants.opcodes.OP_ELSE then 337 341 i = i + 1 338 342 end ··· 422 426 end 423 427 424 428 local opcode = self:nextArg() 429 + trace(self:curFrame().pc,opcode,"###",table.unpack(self.stack)) 430 + trace(#self.labelStack,"---",table.unpack(self.labelStack)) 425 431 426 432 local c = constants.opcodes 427 433 local optable = {