From b595bb032b8345056cea55f27633c484823ee2e9 Mon Sep 17 00:00:00 2001 From: gahaas Date: Wed, 14 Dec 2016 18:39:49 +0100 Subject: Define the exception type for stack overflows in JS.md --- JS.md | 6 ++++++ Semantics.md | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/JS.md b/JS.md index 4fa5690..4b19a87 100644 --- a/JS.md +++ b/JS.md @@ -23,6 +23,12 @@ Because JavaScript exceptions can be handled, and JavaScript can continue to call WebAssembly exports after a trap has been handled, traps do not, in general, prevent future execution. +## Stack Overflow + +Whenever a [stack overflow](Semantics.md#stack-overflow) is happening in +WebAssembly code, the same exception is thrown as for a stack overflow in +JavaScript. + ## The `WebAssembly` object The `WebAssembly` object is the initial value of the `WebAssembly` property of diff --git a/Semantics.md b/Semantics.md index 050dcf2..8203d14 100644 --- a/Semantics.md +++ b/Semantics.md @@ -42,9 +42,13 @@ environment such as a browser, a trap results in throwing a JavaScript exception If developer tools are active, attaching a debugger before the termination would be sensible. +## Stack Overflow + Call stack space is limited by unspecified and dynamically varying constraints and is a source of [nondeterminism](Nondeterminism.md). If program call stack usage -exceeds the available call stack space at any time, a trap occurs. +exceeds the available call stack space at any time, the execution in the +WebAssembly instance is terminated and abnormal termination is reported to the +outside environment. Implementations must have an internal maximum call stack size, and every call must take up some resources toward exhausting that size (of course, dynamic -- cgit v1.2.3