-
Notifications
You must be signed in to change notification settings - Fork 334
feat: (CM64) Allow component model resources to be represented by i64 as well as i32.
#2496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
alexcrichton
merged 9 commits into
bytecodealliance:main
from
michael-weigelt:mwe/comp64
Apr 21, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b90ef1f
allow resource rep i64
michael-weigelt 40894a7
fix
michael-weigelt 53c3953
allow CABI memory to be 64bit
michael-weigelt abf640c
fix
michael-weigelt aff4dc2
gate behind feature flag
michael-weigelt 5dd7592
fix tests
michael-weigelt 6358e4d
address comments
michael-weigelt dbd67c3
fix
michael-weigelt edbc21d
remove file
michael-weigelt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| ;; RUN: wast --assert default --snapshot tests/snapshots -f cm64 % | ||
|
|
||
| (component | ||
| (import "x" (func $x (param "x" string))) | ||
| (core module $A | ||
| (memory (export "m") i64 1)) | ||
| (core instance $A (instantiate $A)) | ||
| (alias core export $A "m" (core memory $m)) | ||
| (core func (canon lower (func $x) (memory $m))) | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| ;; RUN: wast --assert default --snapshot tests/snapshots -f cm64 % | ||
|
|
||
| (component | ||
| (type $x (resource (rep i64))) | ||
| ) | ||
|
|
||
| (component | ||
| (type $x (resource (rep i64))) | ||
|
|
||
| (core func (canon resource.new $x)) | ||
| (core func (canon resource.rep $x)) | ||
| (core func (canon resource.drop $x)) | ||
| ) | ||
|
|
||
| (component | ||
| (core module $m | ||
| (func (export "dtor") (param i64)) | ||
| ) | ||
| (core instance $m (instantiate $m)) | ||
| (type $x (resource (rep i64) (dtor (func $m "dtor")))) | ||
| (core func (canon resource.new $x)) | ||
| ) | ||
|
|
||
| (component | ||
| (type $x (resource (rep i64))) | ||
| (core func $f1 (canon resource.new $x)) | ||
| (core func $f2 (canon resource.rep $x)) | ||
| (core func $f3 (canon resource.drop $x)) | ||
|
|
||
| (core module $m | ||
| (import "" "f1" (func (param i64) (result i32))) | ||
| (import "" "f2" (func (param i32) (result i64))) | ||
| (import "" "f3" (func (param i32))) | ||
| ) | ||
|
|
||
| (core instance (instantiate $m | ||
| (with "" (instance | ||
| (export "f1" (func $f1)) | ||
| (export "f2" (func $f2)) | ||
| (export "f3" (func $f3)) | ||
| )) | ||
| )) | ||
| ) | ||
|
|
||
| (assert_invalid | ||
| (component | ||
| (core module $m | ||
| (func (export "dtor") (param i32)) | ||
| ) | ||
| (core instance $m (instantiate $m)) | ||
| (type $x (resource (rep i64) (dtor (func $m "dtor")))) | ||
| (core func (canon resource.new $x)) | ||
| ) | ||
| "wrong signature for a destructor") | ||
|
|
||
| (assert_invalid | ||
| (component | ||
| (core module $m | ||
| (func (export "dtor") (param i64)) | ||
| ) | ||
| (core instance $m (instantiate $m)) | ||
| (type $x (resource (rep i32) (dtor (func $m "dtor")))) | ||
| (core func (canon resource.new $x)) | ||
| ) | ||
| "wrong signature for a destructor") | ||
|
|
||
| (assert_invalid | ||
| (component | ||
| (type $x (resource (rep v128))) | ||
| ) | ||
| "resources can only be represented by `i32` or `i64`") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| error: invalid value 'unknown' for '--features <FEATURES>': unknown feature `unknown` | ||
| Valid features: mutable-global, saturating-float-to-int, sign-extension, reference-types, multi-value, bulk-memory, simd, relaxed-simd, threads, shared-everything-threads, tail-call, floats, multi-memory, exceptions, memory64, extended-const, component-model, function-references, memory-control, gc, custom-page-sizes, legacy-exceptions, gc-types, stack-switching, wide-arithmetic, cm-values, cm-nested-names, cm-async, cm-async-stackful, cm-async-builtins, cm-threading, cm-error-context, cm-fixed-length-lists, cm-gc, call-indirect-overlong, bulk-memory-opt, custom-descriptors, compact-imports, cm-map, mvp, wasm1, wasm2, wasm3, lime1, all | ||
| Valid features: mutable-global, saturating-float-to-int, sign-extension, reference-types, multi-value, bulk-memory, simd, relaxed-simd, threads, shared-everything-threads, tail-call, floats, multi-memory, exceptions, memory64, extended-const, component-model, function-references, memory-control, gc, custom-page-sizes, legacy-exceptions, gc-types, stack-switching, wide-arithmetic, cm-values, cm-nested-names, cm-async, cm-async-stackful, cm-async-builtins, cm-threading, cm-error-context, cm-fixed-length-lists, cm-gc, call-indirect-overlong, bulk-memory-opt, custom-descriptors, compact-imports, cm-map, cm64, mvp, wasm1, wasm2, wasm3, lime1, all | ||
|
|
||
| For more information, try '--help'. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
tests/snapshots/cli/component-model/memory64/memory64.wast.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "source_filename": "tests/cli/component-model/memory64/memory64.wast", | ||
| "commands": [ | ||
| { | ||
| "type": "module", | ||
| "line": 3, | ||
| "filename": "memory64.0.wasm", | ||
| "module_type": "binary" | ||
| } | ||
| ] | ||
| } |
11 changes: 11 additions & 0 deletions
11
tests/snapshots/cli/component-model/memory64/memory64.wast/0.print
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| (component | ||
| (type (;0;) (func (param "x" string))) | ||
| (import "x" (func $x (;0;) (type 0))) | ||
| (core module $A (;0;) | ||
| (memory (;0;) i64 1) | ||
| (export "m" (memory 0)) | ||
| ) | ||
| (core instance $A (;0;) (instantiate $A)) | ||
| (alias core export $A "m" (core memory $m (;0;))) | ||
| (core func (;0;) (canon lower (func $x) (memory $m))) | ||
| ) |
50 changes: 50 additions & 0 deletions
50
tests/snapshots/cli/component-model/memory64/resources.wast.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| { | ||
| "source_filename": "tests/cli/component-model/memory64/resources.wast", | ||
| "commands": [ | ||
| { | ||
| "type": "module", | ||
| "line": 3, | ||
| "filename": "resources.0.wasm", | ||
| "module_type": "binary" | ||
| }, | ||
| { | ||
| "type": "module", | ||
| "line": 7, | ||
| "filename": "resources.1.wasm", | ||
| "module_type": "binary" | ||
| }, | ||
| { | ||
| "type": "module", | ||
| "line": 15, | ||
| "filename": "resources.2.wasm", | ||
| "module_type": "binary" | ||
| }, | ||
| { | ||
| "type": "module", | ||
| "line": 24, | ||
| "filename": "resources.3.wasm", | ||
| "module_type": "binary" | ||
| }, | ||
| { | ||
| "type": "assert_invalid", | ||
| "line": 46, | ||
| "filename": "resources.4.wasm", | ||
| "module_type": "binary", | ||
| "text": "wrong signature for a destructor" | ||
| }, | ||
| { | ||
| "type": "assert_invalid", | ||
| "line": 57, | ||
| "filename": "resources.5.wasm", | ||
| "module_type": "binary", | ||
| "text": "wrong signature for a destructor" | ||
| }, | ||
| { | ||
| "type": "assert_invalid", | ||
| "line": 68, | ||
| "filename": "resources.6.wasm", | ||
| "module_type": "binary", | ||
| "text": "resources can only be represented by `i32` or `i64`" | ||
| } | ||
| ] | ||
| } |
3 changes: 3 additions & 0 deletions
3
tests/snapshots/cli/component-model/memory64/resources.wast/0.print
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| (component | ||
| (type $x (;0;) (resource (rep i64))) | ||
| ) |
6 changes: 6 additions & 0 deletions
6
tests/snapshots/cli/component-model/memory64/resources.wast/1.print
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| (component | ||
| (type $x (;0;) (resource (rep i64))) | ||
| (core func (;0;) (canon resource.new $x)) | ||
| (core func (;1;) (canon resource.rep $x)) | ||
| (core func (;2;) (canon resource.drop $x)) | ||
| ) |
11 changes: 11 additions & 0 deletions
11
tests/snapshots/cli/component-model/memory64/resources.wast/2.print
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| (component | ||
| (core module $m (;0;) | ||
| (type (;0;) (func (param i64))) | ||
| (export "dtor" (func 0)) | ||
| (func (;0;) (type 0) (param i64)) | ||
| ) | ||
| (core instance $m (;0;) (instantiate $m)) | ||
| (alias core export $m "dtor" (core func (;0;))) | ||
| (type $x (;0;) (resource (rep i64) (dtor (func 0)))) | ||
| (core func (;1;) (canon resource.new $x)) | ||
| ) |
23 changes: 23 additions & 0 deletions
23
tests/snapshots/cli/component-model/memory64/resources.wast/3.print
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| (component | ||
| (type $x (;0;) (resource (rep i64))) | ||
| (core func $f1 (;0;) (canon resource.new $x)) | ||
| (core func $f2 (;1;) (canon resource.rep $x)) | ||
| (core func $f3 (;2;) (canon resource.drop $x)) | ||
| (core module $m (;0;) | ||
| (type (;0;) (func (param i64) (result i32))) | ||
| (type (;1;) (func (param i32) (result i64))) | ||
| (type (;2;) (func (param i32))) | ||
| (import "" "f1" (func (;0;) (type 0))) | ||
| (import "" "f2" (func (;1;) (type 1))) | ||
| (import "" "f3" (func (;2;) (type 2))) | ||
| ) | ||
| (core instance (;0;) | ||
| (export "f1" (func $f1)) | ||
| (export "f2" (func $f2)) | ||
| (export "f3" (func $f3)) | ||
| ) | ||
| (core instance (;1;) (instantiate $m | ||
| (with "" (instance 0)) | ||
| ) | ||
| ) | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.