|
|
@ -572,7 +572,7 @@ M3Result ParseModuleSection (M3Module * o_module, u8 i_sectionType, bytes_t i_
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
M3Result m3_ParseModule (IM3Environment i_environment, IM3Module * o_module, cbytes_t i_bytes, u32 i_numBytes)
|
|
|
|
M3Result m3_ParseModule (IM3Environment i_environment, IM3Module * o_module, cbytes_t i_bytes, u32 i_numBytes, bool i_copyBytes)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
M3Result result;
|
|
|
|
M3Result result;
|
|
|
|
|
|
|
|
|
|
|
@ -582,10 +582,17 @@ _try {
|
|
|
|
_throwifnull(module);
|
|
|
|
_throwifnull(module);
|
|
|
|
module->name = ".unnamed"; m3log (parse, "load module: %d bytes", i_numBytes);
|
|
|
|
module->name = ".unnamed"; m3log (parse, "load module: %d bytes", i_numBytes);
|
|
|
|
module->startFunction = -1;
|
|
|
|
module->startFunction = -1;
|
|
|
|
//module->hasWasmCodeCopy = false;
|
|
|
|
|
|
|
|
module->environment = i_environment;
|
|
|
|
module->environment = i_environment;
|
|
|
|
|
|
|
|
module->hasWasmCodeCopy = i_copyBytes;
|
|
|
|
|
|
|
|
|
|
|
|
const u8 * pos = i_bytes;
|
|
|
|
const u8 * pos = i_bytes;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (i_copyBytes)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
pos = m3_CopyMem (i_bytes, i_numBytes);
|
|
|
|
|
|
|
|
_throwifnull (pos);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const u8 * end = pos + i_numBytes;
|
|
|
|
const u8 * end = pos + i_numBytes;
|
|
|
|
|
|
|
|
|
|
|
|
module->wasmStart = pos;
|
|
|
|
module->wasmStart = pos;
|
|
|
|