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 1 commit into from Apr 12, 2018


None yet
3 participants
Copy link

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 milestone Mar 1, 2018


This comment has been minimized.

Copy link
Member Author

headius commented Mar 1, 2018

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

@headius headius force-pushed the better_context_constants branch from 75ac955 to 9b50958 Mar 1, 2018

@headius headius requested review from kares and enebo Mar 1, 2018


kares approved these changes Mar 1, 2018


enebo approved these changes Mar 1, 2018

Make better use of context-cached "immediates".
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 force-pushed the better_context_constants branch from 9b50958 to 6bb18b2 Apr 12, 2018

@headius headius merged commit d4d4e31 into master Apr 12, 2018

0 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
continuous-integration/travis-ci/push The Travis CI build is in progress

@headius headius deleted the better_context_constants branch Apr 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.