WASM: NFC. Rename string import/export functions
This commit is contained in:
committed by
TeamCityServer
parent
ebde1e5491
commit
2538caa84f
@@ -142,7 +142,7 @@ class WasmSymbols(
|
||||
|
||||
val wasmThrow = getInternalFunction("wasmThrow")
|
||||
|
||||
val exportStringRet = getInternalFunction("exportStringRet")
|
||||
val exportString = getInternalFunction("exportString")
|
||||
val unsafeGetScratchRawMemory = getInternalFunction("unsafeGetScratchRawMemory")
|
||||
|
||||
private val functionNInterfaces = (0..22).map { arity ->
|
||||
|
||||
@@ -133,11 +133,11 @@ fun WasmCompiledModuleFragment.generateJs(): String {
|
||||
},
|
||||
|
||||
println(valueAddr) {
|
||||
console.log(">>> " + importStringToJs(valueAddr));
|
||||
console.log(">>> " + importStringFromWasm(valueAddr));
|
||||
}
|
||||
};
|
||||
|
||||
function importStringToJs(addr) {
|
||||
function importStringFromWasm(addr) {
|
||||
const mem16 = new Uint16Array(wasmInstance.exports.memory.buffer);
|
||||
const mem32 = new Int32Array(wasmInstance.exports.memory.buffer);
|
||||
const len = mem32[addr / 4];
|
||||
|
||||
+1
-1
@@ -371,7 +371,7 @@ class BodyGenerator(val context: WasmFunctionCodegenContext) : IrElementVisitorV
|
||||
if (context.irFunction.isExported(context.backendContext) &&
|
||||
expression.value.type == irBuiltIns.stringType) {
|
||||
|
||||
body.buildCall(context.referenceFunction(wasmSymbols.exportStringRet))
|
||||
body.buildCall(context.referenceFunction(wasmSymbols.exportString))
|
||||
}
|
||||
|
||||
body.buildInstr(WasmOp.RETURN)
|
||||
|
||||
Reference in New Issue
Block a user