-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add is_reference_type()
#1119
Comments
In the near future, we won't really know if a type is going to be implemented in registers or not. It is very reasonable for the IR to decide to unwrap a local That being said, I may have to catch up on some Slack message to understand the context better. I imagine this has something to do with |
Correct. This isn't something we want to keep once we add intrinsics and remove the ASM blocks from the stdlib. But until then we need something to help out. |
To add some context here for permanence: Currently, sway/sway-lib-std/src/storage.sw Lines 3 to 7 in 4bbccc4
|
Similar to #818, add a
is_reference_type::<T>()
function that is replaced bytrue
orfalse
at compile time depending on if the type is a reference type or not. This is needed so that the stdlib can do different run time logic depending on whether a type is a pointer to data vs data in a register.Note that currently structs with a single single-word field are actually reference types, so the stdlib cannot use
size_of::<T>()
against the word size exclusively for such runtime checks.The text was updated successfully, but these errors were encountered: