[Wasm] Rename wasm initialize function
This commit is contained in:
committed by
Zalim Bashorov
parent
a29fa428b3
commit
98329f30f8
@@ -350,7 +350,7 @@ For more information see $d{uri("https://kotl.in/wasm_help/")}.
|
|||||||
|
|
||||||
wasmExports = wasmInstance.exports;
|
wasmExports = wasmInstance.exports;
|
||||||
if (runInitializer) {
|
if (runInitializer) {
|
||||||
wasmExports.__init();
|
wasmExports._initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
return { instance: wasmInstance, exports: wasmExports };
|
return { instance: wasmInstance, exports: wasmExports };
|
||||||
|
|||||||
+3
-3
@@ -178,14 +178,14 @@ class WasmCompiledModuleFragment(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val masterInitFunctionType = WasmFunctionType(emptyList(), emptyList())
|
val masterInitFunctionType = WasmFunctionType(emptyList(), emptyList())
|
||||||
val masterInitFunction = WasmFunction.Defined("__init", WasmSymbol(masterInitFunctionType))
|
val masterInitFunction = WasmFunction.Defined("_initialize", WasmSymbol(masterInitFunctionType))
|
||||||
with(WasmIrExpressionBuilder(masterInitFunction.instructions)) {
|
with(WasmIrExpressionBuilder(masterInitFunction.instructions)) {
|
||||||
initFunctions.sortedBy { it.priority }.forEach {
|
initFunctions.sortedBy { it.priority }.forEach {
|
||||||
buildCall(WasmSymbol(it.function), SourceLocation.NoLocation("Generated service code"))
|
buildCall(WasmSymbol(it.function), SourceLocation.NoLocation("Generated service code"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports += WasmExport.Function("__init", masterInitFunction)
|
exports += WasmExport.Function("_initialize", masterInitFunction)
|
||||||
|
|
||||||
val typeInfoSize = currentDataSectionAddress
|
val typeInfoSize = currentDataSectionAddress
|
||||||
val memorySizeInPages = (typeInfoSize / 65_536) + 1
|
val memorySizeInPages = (typeInfoSize / 65_536) + 1
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ let { exports } = await instantiate(imports, /*runInitializer=*/false);
|
|||||||
if (exports.getInitialized() !== 0) {
|
if (exports.getInitialized() !== 0) {
|
||||||
throw "Fail1"
|
throw "Fail1"
|
||||||
}
|
}
|
||||||
exports.__init();
|
exports._initialize();
|
||||||
if (exports.getInitialized() !== 100) {
|
if (exports.getInitialized() !== 100) {
|
||||||
throw "Fail2"
|
throw "Fail2"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user