bytecodealliance / jco

JavaScript tooling for working with WebAssembly Components
https://bytecodealliance.github.io/jco/
Apache License 2.0
571 stars 53 forks source link

Don't need to check for non-zero resource rep #427

Closed kateinoigakukun closed 2 months ago

kateinoigakukun commented 2 months ago

Handle 0 is reserved for the sentinel value, but resource rep can be 0 IIUC

Upon initialization, table element 0 is allocated and set to None, effectively reserving index 0 which is both useful for catching null/uninitialized accesses and allowing 0 to serve as a sentinel value. https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md#runtime-state