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

Fix failures in ruby/spec running with immediate jit mode #6757

merged 8 commits into from Jul 23, 2021


Copy link

@headius headius commented Jul 21, 2021

See #6753 for the PR that initiated this work, by @ahorek. That PR has been superseded by this one, which includes the added jit job and will eventually contain all fixes to get that job green.

ahorek and others added 3 commits July 13, 2021 01:54
Because blocks are more sensitive to the surrounding scope, our
JIT will always interpret a block that has not yet been jit
compiled so that it can exit and be re-activated properly. This
caused an issue when using a //o regexp and jit threshold of zero,
because the jit happens before that first interpret, causing both
interpreted and jitted code to produce their own regexp object.

The fix here moves the jit request after the interpret, better
matching the expected behavior and guaranteeing the block will
finish interpreting at least once before the jit fires. As a
result, the jit sees the already-encountered //o regexp and can
compile it as a static regexp.

See discussion under jruby#6753.
@headius headius added this to the JRuby milestone Jul 21, 2021
@headius headius mentioned this pull request Jul 21, 2021
Copy link
Member Author

headius commented Jul 21, 2021

Fix for the first failure from #6753 is already in this PR. The failure looked like this:

Regexps with modifiers supports /o (once) FAILED
Expected /1/ == /0/
to be truthy but was false
/home/travis/build/jruby/jruby/spec/ruby/language/regexp/modifiers_spec.rb:20:in `block in <main>'

The second failure looks like this:

Literal Regexps caches the Regexp object FAILED
Expected /foo/ to be identical to /foo/
/home/travis/build/jruby/jruby/spec/ruby/language/regexp_spec.rb:32:in `block in <main>'

This one may not be fixable currently due to the interpreted code and jitted code not sharing a cache of objects.

This only worked in interpreter accidentally. This behavior is
difficult to support and only works reliably in JRuby for the
literal code ``. It is also deprecated in 2.7 so we don't
care anymore.
@headius headius merged commit 4648cc4 into jruby:master Jul 23, 2021
@headius headius deleted the fix_jit_mode_specs branch July 23, 2021 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants