mirror of
https://github.com/golang/go
synced 2024-11-02 08:01:26 +00:00
misc/wasm: ensure correct stack pointer in catch clauses
The stack pointer may have changed after a call from JavaScript into Go code because of stack growth. The normal case already updated the sp variable accordingly, but the catch case did not yet. Fixes #45433 Change-Id: I3e0a33381929626f6b21902948935eb5ffb26c96 Reviewed-on: https://go-review.googlesource.com/c/go/+/321936 Trust: Richard Musiol <neelance@gmail.com> Run-TryBot: Richard Musiol <neelance@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
32b73ae180
commit
08a8fa9c47
1 changed files with 3 additions and 0 deletions
|
@ -401,6 +401,7 @@
|
|||
storeValue(sp + 56, result);
|
||||
this.mem.setUint8(sp + 64, 1);
|
||||
} catch (err) {
|
||||
sp = this._inst.exports.getsp() >>> 0; // see comment above
|
||||
storeValue(sp + 56, err);
|
||||
this.mem.setUint8(sp + 64, 0);
|
||||
}
|
||||
|
@ -417,6 +418,7 @@
|
|||
storeValue(sp + 40, result);
|
||||
this.mem.setUint8(sp + 48, 1);
|
||||
} catch (err) {
|
||||
sp = this._inst.exports.getsp() >>> 0; // see comment above
|
||||
storeValue(sp + 40, err);
|
||||
this.mem.setUint8(sp + 48, 0);
|
||||
}
|
||||
|
@ -433,6 +435,7 @@
|
|||
storeValue(sp + 40, result);
|
||||
this.mem.setUint8(sp + 48, 1);
|
||||
} catch (err) {
|
||||
sp = this._inst.exports.getsp() >>> 0; // see comment above
|
||||
storeValue(sp + 40, err);
|
||||
this.mem.setUint8(sp + 48, 0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue