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

Add the pony_try function to receive Pony errors in C code #2457

Merged
merged 1 commit into from
Jan 4, 2018

Conversation

Praetonus
Copy link
Member

This function is implemented in LLVM IR since it cannot be implemented in C.

This change also exposes the pony_error function (renamed from pony_throw) in the public runtime interface in order to allow C programs to both raise and receive Pony errors.


@sylvanc @SeanTAllen @jemc This PR adds the first instance of handwritten LLVM IR to the project. It'll almost certainly not become a trend since there aren't a lot of things that cannot be done in C, but it will nonetheless add some maintenance burden given that LLVM IR sometimes has breakages, so I'd like you to sign off on this.

@kulibali I'm not sure how to update the Windows build system for that one. We'd basically need to add a custom rule when compiling .ll files for libponyrt, but keep the existing rule for .c and .cc files. That existing rule seems to be internal to waf so I'm not sure how to proceed. The build command for .ll files would be llc.exe -filetype=obj -o file.o file.ll. Could you take a look when you have time?

@Praetonus Praetonus added the changelog - added Automatically add "Added" CHANGELOG entry on merge label Dec 28, 2017

#include <pony.h>

TEST(ExceptTest, PonyTry)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not ErrorTest?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No particular reason. I'll update.

@Praetonus
Copy link
Member Author

The Linux and OSX builds seem to be passing. I tried to update the wscript file with a custom build rule for .ll files but it is resulting in "broken revdeps" errors. I haven't been able to find any information on these errors. @kulibali Do you see what could be wrong in my changes?

This function is implemented in LLVM IR since it cannot be implemented
in C.

This change also exposes the `pony_error` function (renamed from
`pony_throw`) in the public runtime interface in order to allow C
programs to both raise and receive Pony errors.
@chalcolith
Copy link
Member

I'll take a look tonight.

@Praetonus
Copy link
Member Author

It looks like my last change fixed the problem. It was a naming error (I used LLC in one place and LLVM_LLC in another place). So this should be ready to merge once all CI builds have finished.

@Praetonus Praetonus merged commit 24982d5 into ponylang:master Jan 4, 2018
@Praetonus Praetonus deleted the pony-try branch January 4, 2018 23:59
ponylang-main added a commit that referenced this pull request Jan 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - added Automatically add "Added" CHANGELOG entry on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants