remove unnecessary? local parsing

extensions
Steven Massey 3 years ago
parent ded4cfafc4
commit 5615ff0d84

@ -2601,6 +2601,8 @@ M3Result CompileLocals (IM3Compilation o)
u32 numLocalBlocks; u32 numLocalBlocks;
_ (ReadLEB_u32 (& numLocalBlocks, & o->wasm, o->wasmEnd)); _ (ReadLEB_u32 (& numLocalBlocks, & o->wasm, o->wasmEnd));
u32 numLocals = 0;
for (u32 l = 0; l < numLocalBlocks; ++l) for (u32 l = 0; l < numLocalBlocks; ++l)
{ {
u32 varCount; u32 varCount;
@ -2610,10 +2612,13 @@ _ (ReadLEB_u32 (& numLocalBlocks, & o->wasm, o->wasmEnd));
_ (ReadLEB_u32 (& varCount, & o->wasm, o->wasmEnd)); _ (ReadLEB_u32 (& varCount, & o->wasm, o->wasmEnd));
_ (ReadLEB_i7 (& waType, & o->wasm, o->wasmEnd)); _ (ReadLEB_i7 (& waType, & o->wasm, o->wasmEnd));
_ (NormalizeType (& localType, waType)); _ (NormalizeType (& localType, waType));
m3log (compile, "pushing locals. count: %d; type: %s", varCount, c_waTypes [localType]); numLocals += varCount; m3log (compile, "pushing locals. count: %d; type: %s", varCount, c_waTypes [localType]);
while (varCount--) while (varCount--)
_ (PushAllocatedSlot (o, localType)); _ (PushAllocatedSlot (o, localType));
} }
if (o->function)
o->function->numLocals = numLocals;
_catch: return result; _catch: return result;
} }

@ -346,6 +346,7 @@ _ (ReadLEB_u32 (& size, & i_bytes, i_end));
if (i_bytes <= i_end) if (i_bytes <= i_end)
{ {
/*
u32 numLocalBlocks; u32 numLocalBlocks;
_ (ReadLEB_u32 (& numLocalBlocks, & ptr, i_end)); m3log (parse, " code size: %-4d", size); _ (ReadLEB_u32 (& numLocalBlocks, & ptr, i_end)); m3log (parse, " code size: %-4d", size);
@ -363,14 +364,15 @@ _ (NormalizeType (& normalType, wasmType));
numLocals += varCount; m3log (parse, " %2d locals; type: '%s'", varCount, c_waTypes [normalType]); numLocals += varCount; m3log (parse, " %2d locals; type: '%s'", varCount, c_waTypes [normalType]);
} }
*/
IM3Function func = Module_GetFunction (io_module, f + io_module->numFuncImports); IM3Function func = Module_GetFunction (io_module, f + io_module->numFuncImports);
func->module = io_module; func->module = io_module;
func->wasm = start; func->wasm = start;
func->wasmEnd = i_bytes; func->wasmEnd = i_bytes;
//func->ownsWasmCode = io_module->hasWasmCodeCopy; //func->ownsWasmCode = io_module->hasWasmCodeCopy;
func->numLocals = numLocals; // func->numLocals = numLocals;
} }
else _throw (m3Err_wasmSectionOverrun); else _throw (m3Err_wasmSectionOverrun);
} }

Loading…
Cancel
Save