Merged
Conversation
added 4 commits
March 12, 2017 12:10
Previous commit broke this functionality by only allowing Fiddle::Pointer types.
This should be supported in future. Currently, attempting to convert IO to pointer causes a Segfault. Raising to avoid this for now.
This was referenced Mar 12, 2017
added 2 commits
March 12, 2017 13:59
Accidentally left them in in last commit
Previously, `Fiddle::Pointer`s passed to `Fiddle::Function#call` were actually being silently converted to `FFI::Pointer`s because `FFI::Function#call` calls `#to_ptr`, which coincidentally (or not) returns the underlying `FFI::Pointer`. I now convert these pointers explicitely and remove the `#to_ptr` method.
headius
pushed a commit
that referenced
this pull request
Nov 29, 2018
1. lexically contained closures will return since it knows it is safe to do so (e.g. nonlocal -> local return conversion) 2. other closures will copy to the return value of the method and jump to the end of the method I believe #2 is wrong and it is not currently possible to hit with the limitations in what we will inline. I still added it as it seemed like some code should be there to handle this scenario when/if we decide to support it. I think the premise of what #2 does is right; but I do not see how we can guarantee where we jump to could possibly have the same variable in a return instr (or copy to some other significant variable). For posterity, if I delete #1 and run the following script I feel this should still work but it doesn't: ```ruby def try_fdopen() 1.times do return :exit_closure end :exit_try_fdopen end def foo i = 0 while i < 1000 do p try_fdopen i += 1 end end foo ```
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes jruby#4518
Convert pointer-type arguments to actual pointers when calling a Fiddle::Function.
Also, I added a clause to raise when attempting to pass an IO object to a Fiddle::Function. This is because, currently, this action causes a Segfault. Raising merely avoids this scenario for now. We will have to rectify this issue in the future, but currently this isn't causing any loss in functionality as far as I can tell.
I also implemented
Fiddle::Pointer#-@andFiddle::Pointer#+@because I noticed they were missing.