Skip to content

Invalidate method caches from generated populators#9203

Merged
headius merged 2 commits intojruby:masterfrom
headius:populators_invalidate_noncore
Jan 30, 2026
Merged

Invalidate method caches from generated populators#9203
headius merged 2 commits intojruby:masterfrom
headius:populators_invalidate_noncore

Conversation

@headius
Copy link
Member

@headius headius commented Jan 30, 2026

This includes a fix and test for invalidating method caches on classes modified by our generated populators (from AnnotationBinder). If we are booting core, no invalidation happens, but for extensions loaded after that point we should be invalidating to avoid leaving shadow cache entries as described in #9196.

Generated method populators use `putMethod` directly to avoid the
overhead of invalidating method caches before any user code runs,
but this breaks when a generated populator is used after boot time.
As described in jruby#9196, this can cause methods added by
generated populators to be shadowed by previously-cached results,
such as the undefined marker cached for missing methods.

The logic here modifies the generated populators to invalidate any
classes they've modified, but only once per populator and only if
we are no longer booting the JRuby core classes.
@headius headius added this to the JRuby 10.0.3.0 milestone Jan 30, 2026
@headius headius enabled auto-merge January 30, 2026 03:51
@headius headius disabled auto-merge January 30, 2026 03:51
@headius headius merged commit f9b1d3c into jruby:master Jan 30, 2026
76 checks passed
@headius headius deleted the populators_invalidate_noncore branch January 30, 2026 03:52
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.

1 participant