-
Notifications
You must be signed in to change notification settings - Fork 45
Use JRuby implementation for TruffleRuby #149
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
Changes from all commits
418bd89
0631d46
fc3be9c
41c21f5
bf06273
3e11fad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,6 +64,10 @@ def test_strtod | |
| end | ||
|
|
||
| def test_qsort1 | ||
| if RUBY_ENGINE == "jruby" | ||
| omit("The untouched sanity check is broken on JRuby: https://github.com/jruby/jruby/issues/8365") | ||
| end | ||
|
|
||
| closure_class = Class.new(Closure) do | ||
| def call(x, y) | ||
| Pointer.new(x)[0] <=> Pointer.new(y)[0] | ||
|
|
@@ -74,27 +78,32 @@ def call(x, y) | |
| qsort = Function.new(@libc['qsort'], | ||
| [TYPE_VOIDP, TYPE_SIZE_T, TYPE_SIZE_T, TYPE_VOIDP], | ||
| TYPE_VOID) | ||
| buff = "9341" | ||
| untouched = "9341" | ||
| buff = +"9341" | ||
| qsort.call(buff, buff.size, 1, callback) | ||
| assert_equal("1349", buff) | ||
|
|
||
| bug4929 = '[ruby-core:37395]' | ||
| buff = "9341" | ||
| buff = +"9341" | ||
| under_gc_stress do | ||
| qsort.call(buff, buff.size, 1, callback) | ||
| end | ||
| assert_equal("1349", buff, bug4929) | ||
|
|
||
| # Ensure the test didn't mutate String literals | ||
| assert_equal("93" + "41", untouched) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without the added Interestingly this sanity check actually fails on JRuby, I'll file an issue there: jruby/jruby#8365 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The JRuby issue has been fixed on master and will be in JRuby 9.4.9.0. We won't be updating 9.4 to use the fiddle gem in any case, but the test could be un-omitted now. |
||
| end | ||
| ensure | ||
| # We can't use ObjectSpace with JRuby. | ||
| return if RUBY_ENGINE == "jruby" | ||
| # Ensure freeing all closures. | ||
| # See https://github.com/ruby/fiddle/issues/102#issuecomment-1241763091 . | ||
| not_freed_closures = [] | ||
| ObjectSpace.each_object(Fiddle::Closure) do |closure| | ||
| not_freed_closures << closure unless closure.freed? | ||
| unless RUBY_ENGINE == "jruby" | ||
| # Ensure freeing all closures. | ||
| # See https://github.com/ruby/fiddle/issues/102#issuecomment-1241763091 . | ||
| not_freed_closures = [] | ||
| ObjectSpace.each_object(Fiddle::Closure) do |closure| | ||
| not_freed_closures << closure unless closure.freed? | ||
| end | ||
| assert_equal([], not_freed_closures) | ||
| end | ||
| assert_equal([], not_freed_closures) | ||
| end | ||
|
|
||
| def test_snprintf | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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 think it would be good to rename this file to
ffi_backend.rbor so and avoid a JRuby namespace since it is effectively independent from JRuby but it doesn't like that currently due to file naming and things likeFiddle::JRuby.It's helpful to have a small diff at this point though, so I think that's best done later, maybe even in a separate PR.
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 think that we don't need to do it because this is a short-term workaround for TruffleRuby.
This file will be used by only JRuby eventually.
Uh oh!
There was an error while loading. Please reload this page.
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 the FFI backend seems to work well I think we should just use it long term, for both JRuby and TruffleRuby.
It's also nice to have 2 backends instead of 3.