Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/mono/browser/runtime/exports-binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
mono_wasm_pthread_on_pthread_registered, mono_wasm_pthread_set_name, mono_wasm_install_js_worker_interop, mono_wasm_uninstall_js_worker_interop, mono_wasm_start_io_thread_async
} from "./pthreads";
import { mono_wasm_dump_threads } from "./pthreads/ui-thread";
import { loaderHelpers } from "./globals";
import { mono_wasm_schedule_synchronization_context } from "./pthreads/shared";


Expand Down Expand Up @@ -147,7 +148,23 @@ export function replace_linker_placeholders (imports: WebAssembly.Imports) {
}
}

for (const [idx, realFn] of wasmImports.entries()) {
for (const [idx, rfn] of wasmImports.entries()) {
let realFn = rfn;
if (WasmEnableThreads) {
realFn = function catch_and_log_exceptions (...args: any[]) {
try {
return rfn(...args);
} catch (ex: any) {
if (ex == "unwind") {
throw ex;
}
if (ex && !ex.silent) {
loaderHelpers.mono_exit(1, ex);
}
}
};
}

const shortName = indexToNameMap[idx];
// if it's not found it means the emcc linker didn't include it, which is fine
if (shortName !== undefined) {
Expand Down
4 changes: 2 additions & 2 deletions src/mono/browser/runtime/managed-exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { assert_c_interop, assert_js_interop } from "./invoke-js";
import { monoThreadInfo, mono_wasm_main_thread_ptr } from "./pthreads";
import { _zero_region, copyBytes } from "./memory";
import { stringToUTF8Ptr } from "./strings";
import { mono_log_debug } from "./logging";
import { mono_log_error } from "./logging";

const managedExports: ManagedExports = {} as any;

Expand Down Expand Up @@ -254,7 +254,7 @@ export function install_main_synchronization_context (jsThreadBlockingMode: numb
}
return get_arg_gc_handle(res) as any;
} catch (e) {
mono_log_debug("install_main_synchronization_context failed", e);
mono_log_error("install_main_synchronization_context failed", e);
throw e;
}
}
Expand Down