-
-
Notifications
You must be signed in to change notification settings - Fork 116
Add @gcsafe ccall
#835
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 @gcsafe ccall
#835
Conversation
e6f268f
to
d055c52
Compare
@martinholters: looks like an upstream change has broken a test you added? Can you take a look please? |
Huh? AFAICT, the problem originates in Lines 158 to 174 in 8819abe
__not_a_binding__ has changed by the binding partitioning work? Maybe explicitly throwing an exception would be less brittle?
|
So sorry for the mistaken tag @martinholters! I didn't look too closely... maybe @Sacha0 can take a look at it? |
No worries. And it's just the "Suggestion: check for spelling errors or missing imports." that has been added to the exception printing at some point that causes the test failure. Fix at #836. |
Any chance to make this work on v1.6 and v1.7? |
@vchuravy would know... when he gets back and reviews this. |
From `GPUToolbox.jl`.
And discard the test Project.toml added in an earlier commit.
d055c52
to
7a9e37d
Compare
src/Compat.jl
Outdated
# when callbacks occur, the code should ensure the GC is not running by wrapping the code | ||
# in the `@gcunsafe` macro | ||
|
||
if VERSION >= v"1.8" |
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.
I don't see why this code should be lower bounded to 1.8?
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.
On Julia 1.6:
gcsafe_ccall: Error During Test at /Users/kpamnany/Work/Compat.jl/test/runtests.jl:1086
Test threw exception
Expression: gc_safe_ccall() isa UInt64
could not load symbol "jl_rand":
dlsym(RTLD_DEFAULT, jl_rand): symbol not found
<snip>
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.
Calling any Julia C function marked JL_NOTSAFEPOINT
will serve, yeah?
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.
Switched to calling jl_errno
.
I got asked to review here so I give my personal opinion. I don't think Compat with a bunch of internals that tries to backport features from later Julia versions is a good idea in general. I don't think adding a Compat dependency (which transitively gives you dependencies on very large stdlibs) is very nice, especially when it is done on small packages that themselves have many other packages depending on them. I personally rather see some copy-pasting if something like this is really needed. |
@KristofferC's points make sense to me. I can copy-paste this macro instead; that was also an alternative @vchuravy had suggested. |
From GPUToolbox.jl.