Repository: dotnet/runtime
File: src/native/corehost/browserhost/host/host.ts (TypeScript)

Code before:
        if (Module._posix_memalign(ptrPtr as any, 16, bytes.length)) {
            throw new Error("posix_memalign failed");
        }

        const ptr = Module.HEAPU32[ptrPtr as any >>> 2];
        Module.HEAPU8.set(bytes, ptr >>> 0);
        loadedAssemblies.set(asset.name, { ptr, length: bytes.length });
        loadedAssemblies.set(asset.virtualPath, { ptr, length: bytes.length });
    } finally {
        Module.stackRestore(sp);
    }
}

export function loadIcuData(bytes: Uint8Array) {
    const sp = Module.stackSave();
    try {
        const sizeOfPtr = 4;
        const ptrPtr = Module.stackAlloc(sizeOfPtr);
        if (Module._posix_memalign(ptrPtr as any, 16, bytes.length)) {
            throw new Error("posix_memalign failed for ICU data");
        }

        const ptr = Module.HEAPU32[ptrPtr as any >>> 2];
        Module.HEAPU8.set(bytes, ptr >>> 0);

        const result = Module.ccall("wasm_load_icu_data", "number", ["number"], [ptr]) as number;
        if (!result) {
            throw new Error("Failed to initialize ICU data");
        }
    } finally {
        Module.stackRestore(sp);
    }
}

export function installVfsFile(bytes: Uint8Array, asset: VfsAsset) {
    const virtualName: string = typeof (asset.virtualPath) === "string"
        ? asset.virtualPath
        : asset.name;
    const lastSlash = virtualName.lastIndexOf("/");
    let parentDirectory = (lastSlash > 0)
        ? virtualName.substring(0, lastSlash)
        : null;
    let fileName = (lastSlash > 0)
        ? virtualName.substring(lastSlash + 1)
        : virtualName;
    if (fileName.startsWith("/"))
        fileName = fileName.substring(1);
    if (parentDirectory) {
        if (!parentDirectory.startsWith("/"))
            parentDirectory = "/" + parentDirectory;


Review comment (suggestion):
we can replace ccall with direct reference. 
Add `wasm_load_icu_data` into `commonDeps` of `libBrowserHost.footer.js`
and then you can call it here with underscore `const result =_wasm_load_icu_data(ptr);`

You will need to add the signature into `src\native\corehost\browserhost\host\cross-linked.ts`

Code after:
        if (Module._posix_memalign(ptrPtr as any, 16, bytes.length)) {
            throw new Error("posix_memalign failed");
        }

        const ptr = Module.HEAPU32[ptrPtr as any >>> 2];
        Module.HEAPU8.set(bytes, ptr >>> 0);
        loadedAssemblies.set(asset.name, { ptr, length: bytes.length });
        loadedAssemblies.set(asset.virtualPath, { ptr, length: bytes.length });
    } finally {
        Module.stackRestore(sp);
    }
}

export function loadIcuData(bytes: Uint8Array) {
    const sp = Module.stackSave();
    try {
        const sizeOfPtr = 4;
        const ptrPtr = Module.stackAlloc(sizeOfPtr);
        if (Module._posix_memalign(ptrPtr as any, 16, bytes.length)) {
            throw new Error("posix_memalign failed for ICU data");
        }

        const ptr = Module.HEAPU32[ptrPtr as any >>> 2];
        Module.HEAPU8.set(bytes, ptr >>> 0);

        const result = _wasm_load_icu_data(ptr as unknown as VoidPtr);
        if (!result) {
            throw new Error("Failed to initialize ICU data");
        }
    } finally {
        Module.stackRestore(sp);
    }
}

export function installVfsFile(bytes: Uint8Array, asset: VfsAsset) {
    const virtualName: string = typeof (asset.virtualPath) === "string"
        ? asset.virtualPath
        : asset.name;
    const lastSlash = virtualName.lastIndexOf("/");
    let parentDirectory = (lastSlash > 0)
        ? virtualName.substring(0, lastSlash)
        : null;
    let fileName = (lastSlash > 0)
        ? virtualName.substring(lastSlash + 1)
        : virtualName;
    if (fileName.startsWith("/"))
        fileName = fileName.substring(1);
    if (parentDirectory) {
        if (!parentDirectory.startsWith("/"))
            parentDirectory = "/" + parentDirectory;