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

Remove rb_clear_method_cache_all() from Module#using #4323

Closed
wants to merge 3 commits into from

Conversation

XrXr
Copy link
Member

@XrXr XrXr commented Mar 25, 2021

It seems it is no longer necessary with the call cache design from
Feature #16614. It should be okay
to cache refinement method entry because all it does is perform a
secondary uncached method lookup.

All the tests pass. Is it possible that some refinement tests are missing?

Update Feb 27th 2023:

I think this works because when enabling a refinement for a CREF, it's
still valid for callsites within the scope to cache lookups that terminate in a
VM_METHOD_TYPE_REFINED. The logic for resolving refined definition is
done in an uncached secondary lookup after finding a VM_METHOD_TYPE_REFINED, so
clearing all the ccs doesn't touch what the ultimate call target is
resolved to in any case.

@eregon
Copy link
Member

eregon commented Aug 25, 2021

This sounds worth adding to the dev meeting, and probably better to create a Redmine issue for it

It seems it is no longer necessary with the call cache design from
[Feature #16614].

I think this works because when enabling a refinement for a CREF, it's
still valid for callsites within the scope to cache lookups that terminate in a
`VM_METHOD_TYPE_REFINED`. The logic for resolving refined definition is
done in an uncached secondary lookup after finding a `VM_METHOD_TYPE_REFINED`, so
clearing all the ccs doesn't touch what the ultimate call target is
resolved to in any case.
@eregon
Copy link
Member

eregon commented Feb 27, 2023

Potential fix for https://bugs.ruby-lang.org/issues/18572

@XrXr
Copy link
Member Author

XrXr commented Feb 27, 2023

This won't fix https://bugs.ruby-lang.org/issues/18572 directly. Module#using would complete faster, but call sites still do uncached lookups even when there is no refinement active for their scope.

@XrXr
Copy link
Member Author

XrXr commented Nov 24, 2023

Some cache clearing now load-bearing due to #8129.

@XrXr XrXr closed this Nov 24, 2023
@XrXr XrXr deleted the why-invalidate-all-ccs branch November 24, 2023 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants