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

Better use of ThreadContext constants #5071

Merged
merged 1 commit into from Apr 12, 2018
Merged

Conversation

headius
Copy link
Member

@headius headius commented Mar 1, 2018

There are two changes here:

  • A global search and replace for the context.runtime.getTrue() for true, false, and nil and replacing them with the context.tru pattern.
  • Retyping the tru, fals, and nil fields on ThreadContext to be the most specific type.

The latter change is binary incompatible if any third-party libraries have started to use these fields directly. However these fields were introduced fairly recently.

The second change has been removed because of additional internal compatibility problems. There are many places in code generation, and likely in any AOT code in the wild, that try to access the nil field using IRubyObject.

@headius headius added this to the JRuby 9.2.0.0 milestone Mar 1, 2018
@headius
Copy link
Member Author

headius commented Mar 1, 2018

Correction: the tru and fals fields have existed for about a year, so roughly 9.1.7.0ish. The nil field has been around substantially longer, since 1.6 times.

@headius headius requested review from kares and enebo March 1, 2018 04:58
This commit is a global search and replace of all code that
traverses through context.runtime to get at nil, true, and false
objects rather than using the cached versions on context itself.
The context is thread-local and probably very likely to be in the
CPU cache, which means these references should be in cache also.
@headius headius merged commit d4d4e31 into master Apr 12, 2018
@headius headius deleted the better_context_constants branch April 12, 2018 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants