-
Notifications
You must be signed in to change notification settings - Fork 36
Clarify the ID and location of the exception section #27
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -306,14 +306,31 @@ or defined: | |
|
||
### Exception section | ||
|
||
The `exception` section is the named section 'exception'. The exception section | ||
declares exception types using exception type signatures. | ||
The `exception` section is the named section 'exception' with id 13. The | ||
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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is that mentioned? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is what? The name section? I was going based on this line of code: https://cs.chromium.org/chromium/src/v8/src/wasm/module-decoder.h?type=cs&q=NameSection+f:v8&l=36 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I meant where is the name sections specified as section 12. I'd say that v8 is wrong here -- the spec says nothing about the name section being numbered. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Name section is a custom section, numbered zero, and using an explicit string as name. |
||
|
||
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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order of all known sections is fixed. We shouldn't lose that property. For maximum future-proofness I suggest inserting it between import section (2) and function section (3).