From 0dcdc928121f7c59ef63018aef89b34b19383556 Mon Sep 17 00:00:00 2001 From: Eric Holk Date: Tue, 15 Aug 2017 13:21:42 -0700 Subject: [PATCH 1/2] Clarify the ID and location of the exception section Issue #25 --- proposals/Exceptions.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proposals/Exceptions.md b/proposals/Exceptions.md index 60dcf3f9..2b8623af 100644 --- a/proposals/Exceptions.md +++ b/proposals/Exceptions.md @@ -306,7 +306,8 @@ or defined: ### Exception section -The `exception` section is the named section 'exception'. The exception section +The `exception` section is the named section 'exception' with id 13. The +exception section must occur before the code section. The exception section declares exception types using exception type signatures. | Field | Type | Description | From 710acf88cabc6926543dbb3944fa914065f152b9 Mon Sep 17 00:00:00 2001 From: Eric Holk Date: Tue, 15 Aug 2017 16:53:50 -0700 Subject: [PATCH 2/2] Refine section position and give rationale --- proposals/Exceptions.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/proposals/Exceptions.md b/proposals/Exceptions.md index 2b8623af..9fda84a0 100644 --- a/proposals/Exceptions.md +++ b/proposals/Exceptions.md @@ -307,14 +307,30 @@ or defined: ### Exception section The `exception` section is the named section 'exception' with id 13. The -exception section must occur before the code section. The exception section -declares exception types using exception type signatures. +exception section may occur anywhere after the import section and before the +export section. There may be at most one exception section. The exception +section declares exception types using exception type signatures. | Field | Type | Description | |-------|------|-------------| | count | `varuint32` | count of the number of exceptions to follow | | sig | `except_type*` | The type signature of the data fields for each exception | +#### Rationale + +The exception is assigned the number 13 because this is the next available +identifier. +The [spec](https://webassembly.github.io/spec/binary/modules.html#sections) +currently shows numbers 0 through 11 are assigned. Section 12 appears to be +reserved for the name section. + +The position of the exception section is driven by the requirement that items be +defined before they are used. Having the exception section after the import +section allows imported exceptions to be assigned the lower number +tags. Similarly, defining the exceptions before the export section allows +exceptions to be exported. Beyond these constraints, no additional requirements +are imposed. + ### Import section The import section is extended to include exception types by extending an