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

Support deleting methods during precompilation for stdlib excision #51641

Merged

Conversation

vchuravy
Copy link
Member

@vchuravy vchuravy commented Oct 8, 2023

Still fairly hacky and messy, but that's due to me not knowing this part of the code super well.

I originally was thinking I could scan all method tables and find deleted methods,
but I didn't find a way of expressing "these deletions are new".

I limited myself thusly to the part of the problem I need for #51432 and JuliaLang/LinearAlgebra.jl#1027,
in particular making my proposed delayed method trick compatible with caching,
by limiting the invalidation effect.

The problem with the delete_method in __init__ approach is that we invalidate the method-table,
after we have performed all of the caching work. A package dependent on Random, will still see
the stub method in Base and thus when we delete the stub, we may invalidate useful work.

Instead we delete the methods when Random is being loaded, thus a dependent package only ever sees
the method table with all the methods in Random, and non of the stubs methods.

The only invalidation that thus may happen are calls to rand and randn without first doing an import Random.

@vchuravy vchuravy requested review from timholy and vtjnash October 8, 2023 20:39
@brenhinkeller brenhinkeller added the stdlib Julia's standard library label Oct 13, 2023
@vchuravy vchuravy force-pushed the vc/support_deleting_methods_during_precompile branch from 5e54126 to 0aa42f8 Compare October 17, 2023 19:17
@vchuravy vchuravy marked this pull request as ready for review October 17, 2023 19:17
@vchuravy
Copy link
Member Author

@nanosoldier runtests()

@nanosoldier
Copy link
Collaborator

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

@vchuravy vchuravy merged commit 31ccfb6 into vc/excise_random Oct 18, 2023
@vchuravy vchuravy deleted the vc/support_deleting_methods_during_precompile branch October 18, 2023 18:39
vchuravy added a commit that referenced this pull request Oct 20, 2023
…51641)

The problem with the `delete_method` in `__init__` approach is that we
invalidate the method-table,
after we have performed all of the caching work. A package dependent on
`Random`, will still see
the stub method in Base and thus when we delete the stub, we may
invalidate useful work.

Instead we delete the methods when Random is being loaded, thus a
dependent package only ever sees
the method table with all the methods in Random, and non of the stubs
methods.

The only invalidation that thus may happen are calls to `rand` and
`randn` without first doing an `import Random`.
vchuravy added a commit that referenced this pull request Dec 4, 2023
…51641)

The problem with the `delete_method` in `__init__` approach is that we
invalidate the method-table,
after we have performed all of the caching work. A package dependent on
`Random`, will still see
the stub method in Base and thus when we delete the stub, we may
invalidate useful work.

Instead we delete the methods when Random is being loaded, thus a
dependent package only ever sees
the method table with all the methods in Random, and non of the stubs
methods.

The only invalidation that thus may happen are calls to `rand` and
`randn` without first doing an `import Random`.
vchuravy added a commit that referenced this pull request Jan 22, 2024
…51641)

The problem with the `delete_method` in `__init__` approach is that we
invalidate the method-table,
after we have performed all of the caching work. A package dependent on
`Random`, will still see
the stub method in Base and thus when we delete the stub, we may
invalidate useful work.

Instead we delete the methods when Random is being loaded, thus a
dependent package only ever sees
the method table with all the methods in Random, and non of the stubs
methods.

The only invalidation that thus may happen are calls to `rand` and
`randn` without first doing an `import Random`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Julia's standard library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants