-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
An inline type is an immutable value type that's allocated inline/on the stack. Both regular and enum types can be defined as "inline". Inline types don't have object headers, and combined with them being stored inline means they don't incur extra indirection/overhead. For example, consider this type: class inline A { let @A: Int let @b: Int } If this were a regular type, its size would be 32 bytes: 16 bytes for the header, and 16 bytes for the two fields. Because it's an inline type though, it only needs 16 bytes. Inline types are restricted to types that can be trivially copied, such as Int, Float, and other inline types. String isn't allowed in inline types at this point as this could result in an unexpected copy cost due to String using atomic reference counting. Inline types are immutable because supporting mutations introduces significant compiler complexity, especially when dealing with closures that capture generic type parameters, as support for mutations would require rewriting part of the generated code as part of type specialization. This fixes #750. Changelog: added
- Loading branch information
1 parent
db72d59
commit 8ca46bf
Showing
66 changed files
with
4,243 additions
and
1,680 deletions.
There are no files selected for viewing
This file contains 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 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 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.