Skip to content
Merged
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
17 changes: 11 additions & 6 deletions src/mono/browser/runtime/jiterpreter-support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1246,12 +1246,14 @@ class Cfg {
this.overheadBytes += 11;
}

// Account for the size of the safepoint
if (
(branchType === CfgBranchType.SafepointConditional) ||
(branchType === CfgBranchType.SafepointUnconditional)
) {
this.overheadBytes += 17;
if (WasmEnableThreads) {
// Account for the size of the safepoint
if (
(branchType === CfgBranchType.SafepointConditional) ||
(branchType === CfgBranchType.SafepointUnconditional)
) {
this.overheadBytes += 17;
}
}
}

Expand Down Expand Up @@ -1505,6 +1507,9 @@ export const _now = (globalThis.performance && globalThis.performance.now)
let scratchBuffer: NativePointer = <any>0;

export function append_safepoint(builder: WasmBuilder, ip: MintOpcodePtr) {
// safepoints are never triggered in a single-threaded build
if (!WasmEnableThreads)
return;
// Check whether a safepoint is required
builder.ptr_const(cwraps.mono_jiterp_get_polling_required_address());
builder.appendU8(WasmOpcode.i32_load);
Expand Down