-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
esm: WebAssembly.Global unwrapping for Wasm Namespaces #57525
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
Closed
Closed
Changes from all commits
Commits
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
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
Binary file not shown.
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,32 @@ | ||
(module | ||
(type (;0;) (func (result i32))) | ||
(type (;1;) (func (result i64))) | ||
(type (;2;) (func (result f32))) | ||
(type (;3;) (func (result f64))) | ||
(type (;4;) (func (result externref))) | ||
(type (;5;) (func (result v128))) | ||
(global $i32_value (;0;) i32 i32.const 1001) | ||
(global $i32_mut_value (;1;) (mut i32) i32.const 2001) | ||
(global $i64_value (;2;) i64 i64.const 10000000001) | ||
(global $i64_mut_value (;3;) (mut i64) i64.const 20000000001) | ||
(global $f32_value (;4;) f32 f32.const 0x1.4051ecp+3 (;=10.01;)) | ||
(global $f32_mut_value (;5;) (mut f32) f32.const 0x1.4028f6p+4 (;=20.01;)) | ||
(global $f64_value (;6;) f64 f64.const 0x1.90001a36e2eb2p+6 (;=100.0001;)) | ||
(global $f64_mut_value (;7;) (mut f64) f64.const 0x1.90000d1b71759p+7 (;=200.0001;)) | ||
(global $externref_value (;8;) externref ref.null extern) | ||
(global $externref_mut_value (;9;) (mut externref) ref.null extern) | ||
(global $v128_value (;10;) v128 v128.const i32x4 0x0000000a 0x00000014 0x0000001e 0x00000028) | ||
(global $v128_mut_value (;11;) (mut v128) v128.const i32x4 0x00000032 0x0000003c 0x00000046 0x00000050) | ||
(export "i32_value" (global $i32_value)) | ||
(export "i32_mut_value" (global $i32_mut_value)) | ||
(export "i64_value" (global $i64_value)) | ||
(export "i64_mut_value" (global $i64_mut_value)) | ||
(export "f32_value" (global $f32_value)) | ||
(export "f32_mut_value" (global $f32_mut_value)) | ||
(export "f64_value" (global $f64_value)) | ||
(export "f64_mut_value" (global $f64_mut_value)) | ||
(export "externref_value" (global $externref_value)) | ||
(export "externref_mut_value" (global $externref_mut_value)) | ||
(export "v128_value" (global $v128_value)) | ||
(export "v128_mut_value" (global $v128_mut_value)) | ||
) |
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,18 @@ | ||
// globals.js - Direct global exports for WebAssembly imports | ||
|
||
// Immutable globals (simple values) | ||
const i32_value = 42; | ||
export { i32_value as '🚀i32_value' } | ||
export const i64_value = 9223372036854775807n; // Max i64 value | ||
export const f32_value = 3.14159; | ||
export const f64_value = 3.141592653589793; | ||
|
||
// Mutable globals with WebAssembly.Global wrapper | ||
export const i32_mut_value = new WebAssembly.Global({ value: 'i32', mutable: true }, 100); | ||
export const i64_mut_value = new WebAssembly.Global({ value: 'i64', mutable: true }, 200n); | ||
export const f32_mut_value = new WebAssembly.Global({ value: 'f32', mutable: true }, 2.71828); | ||
export const f64_mut_value = new WebAssembly.Global({ value: 'f64', mutable: true }, 2.718281828459045); | ||
|
||
export const externref_value = { hello: 'world' }; | ||
export const externref_mut_value = new WebAssembly.Global({ value: 'externref', mutable: true }, { mutable: 'global' }); | ||
export const null_externref_value = null; |
Binary file not shown.
Oops, something went wrong.
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.