-
Notifications
You must be signed in to change notification settings - Fork 409
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
return Result<T, E> from IO functions #407
Conversation
because of the original form of this if-statement, threads that were in WORK mode and that had a high-priority redex but no low priority redexes would not do any work. this led to a bug where `save_redexes` was called while high-priority redexes were still present.
returns Result<T,E> for appropriate io functions, matches up with C implementation
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.
Remember to also update hvm.h
Since some IO errors are shared across IO functions (invalid argument type, unexpected IO function name), we add a custom IOError ADT. Now, every IO function (even those that cannot fail) will return a Result<T, IOError<E>>. When attempting to invoke an IO function with an invalid name, an IOError/Name is returned.
Add io programs that test basic functionality, including failures. This also updates the "smoke test" file, that does a sequence of open, read, write, close io calls on a file.
basic.bend couldn't be run in CUDA as the main definition was too large
otherwise the rust impl will run on these
they were stale, and didn't represent the shortest bend code that can invoke io functions
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.
Remember to update the lib headers hvm.h
and hvm.cuh
the README is more likely to change and break tests than the LICENSE file.
the Str struct was stale in the header files
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.
looks alright
Going to hold off on merging as there is some issue with the C runtime hanging on this code (on an M1 mac only, not on my intel machine)
|
amazingly this bug hadn't been caught before. we were not checking the number of arguments in `ctr` before accessing them, therefore accessing meaningless memory regions, which could lead to infinite loops as nothing would be reduced and the same "interaction" would be attempted endlessly.
No description provided.