Skip to content
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

Allow specifying alignment to loads and stores #5

Open
RoyalIcing opened this issue Aug 21, 2023 · 2 comments
Open

Allow specifying alignment to loads and stores #5

RoyalIcing opened this issue Aug 21, 2023 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@RoyalIcing
Copy link
Owner

RoyalIcing commented Aug 21, 2023

e.g.

(i32.load align=1 (i32.const 0))
(i32.load align=4 (i32.const 0))

(i32.store align=4 (i32.const 0) (i32.const 1))
(i64.store align=8 (i32.const 0) (i64.const 1))
(f32.store align=4 (i32.const 0) (f32.const 1.0))

The default alignment when loading i32.load is 4, should we change this for I32.UnsafePointer?

I32.UnsafePointer.alignment() # 1
I32.UnsafeAlignedPointer.alignment() # 4

some_address: I32.UnsafePointer
Memory.load(I32, some_address) # (i32.load (i32.const 0))

some_address2: I32.UnsafeAlignedPointer
Memory.load(I32, some_address) # (i32.load align=4 (i32.const 0))
@RoyalIcing RoyalIcing added this to the Beta milestone Jan 28, 2024
@RoyalIcing
Copy link
Owner Author

RoyalIcing commented Jan 29, 2024

Aligns could be defined when defining a SilverOrb Arena, and so you know for example that loads/store to your particular arena is 32-bit aligned.

@RoyalIcing RoyalIcing added the enhancement New feature or request label Mar 8, 2024
@RoyalIcing
Copy link
Owner Author

Some progress has been made on this. I just need to decide whether I32.UnsafePointer should be aligned by default or not. If it should be aligned perhaps it should be renamed to I32.UnsafeAlignedPointer to reflect this. I think it partly depends on which pointer types should be built-in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant