-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
feat(compiler): Convert runtime/dataStructures.gr
to primitives
#1145
Conversation
a897a16
to
f8a56a9
Compare
a48dd60
to
ff0478f
Compare
f8a56a9
to
02a1afe
Compare
ff0478f
to
7c4aa62
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my limited understanding looks good. I see you've updated the formatter, the new LSP may need updating when merged too, maybe not if oprint is doing the work here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you are doing a lot of work in dataStructures, can you please make sure the graindoc is correct throughout?
Types.StackAllocated(WasmI32), | ||
Types.StackAllocated(WasmI32), | ||
], | ||
[Types.HeapAllocated, Types.HeapAllocated, Types.HeapAllocated], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this changed to heap allocated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was just wrong before. This is a little bit of a subtle bug to catch too, since it'd only be a problem if you were pattern matching on heap-allocated constants. I only noticed it because of the refactor.
stdlib/runtime/dataStructures.gr
Outdated
* | ||
* @returns {WasmI32} | ||
* @returns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gave up on writing these?
stdlib/runtime/dataStructures.gr
Outdated
* | ||
* @returns {WasmI32} | ||
* @returns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gave up on writing these?
stdlib/runtime/dataStructures.gr
Outdated
ptr | ||
} | ||
@unsafe | ||
export primitive allocateRational: () -> WasmI32 = "@allocate.rational" | ||
|
||
/** | ||
* Allocates a new Rational with a prepopulated value | ||
* @param value The value to store |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong docs? Can you please update
stdlib/runtime/dataStructures.gr
Outdated
* @param wrappedRational The boxed rational to return | ||
* Load the (tagged) variant of an ADT. | ||
* | ||
* @export |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wat
stdlib/runtime/dataStructures.gr
Outdated
* @param wrappedRational The boxed rational to return | ||
* Load an untagged string's size. | ||
* | ||
* @export |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wat?
stdlib/runtime/dataStructures.gr
Outdated
|
||
/** | ||
* Load a value from an ADT. | ||
* Load an untagged Bytes' size. | ||
* | ||
* @export |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wat?
stdlib/runtime/dataStructures.gr
Outdated
|
||
/** | ||
* Load an untagged string's size. | ||
* Untag a simple number. | ||
* | ||
* @export |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wat?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slight mistake on the graindocs. Can you generate the markdown file for this file so we can know that everything is doc'd correctly?
@phated Let me know if that looks good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good enough! I had some stylistic nits but not worth it for this internal documentation.
bad2609
to
6c2d1d9
Compare
3f278be
to
66c0bab
Compare
Co-authored-by: Blaine Bublitz <blaine.bublitz@gmail.com>
66c0bab
to
03f8232
Compare
This means that all of the data structures functions get inlined, so there's no performance cost to using something like
untagNumber
.