Skip to content

Better use of ThreadContext constants#5071

Merged
headius merged 1 commit intomasterfrom
better_context_constants
Apr 12, 2018
Merged

Better use of ThreadContext constants#5071
headius merged 1 commit intomasterfrom
better_context_constants

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 force-pushed the better_context_constants branch from 75ac955 to 9b50958 Compare March 1, 2018 04:54
@headius headius requested review from enebo and kares 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 force-pushed the better_context_constants branch from 9b50958 to 6bb18b2 Compare April 12, 2018 15:28
@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.

3 participants