-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
[compiler] Remove ConstAPI struct #48598
Conversation
9deff5e
to
16c51ae
Compare
I've added a change to try and fix the |
19a1239
to
8ffa25e
Compare
If `y` has no free typevar. Then `x <: y` wont cause any env change. Thus there's no need to split `y`.
`ConstAPI` predates the effect analysis framework, and was relying on an ad-hoc implementation of effect analysis that only worked for functions of less than 15 statements. As a result, it wasn't used much anymore, but it could cause trouble with external `AbstractInterpreters` that may want to cache additional code metadata within `CodeInstance`s. This commit simply removes this, expecting that the existing effect analysis will pick up the slack.
This ensures that `Base.require_one_based_indexing()` is always fully eliminated, since previously `has_offset_axes(::Array)` is effect-tainted as non-consistent due to calculating `size(::Array)`. This dodges the effect taint by adding this short-circuit, fixing broken tests due to using effects analysis more extensively.
Code coverage is implemented as an optimization pass that inserts an SSA IR node during optimization, however effects analysis is perfomed during inference, and so the desired effects tainting that should occur from insertion of the code coverage IR node is ignored. This teaches `InferenceState` to taint itself with the effects flag `effects_free = ALWAYS_FALSE` when coverage is applicable to this inference state's method.
We just assume that you don't want code coverage if you're using this constructor. This may not always be true.
8ffa25e
to
5e94b86
Compare
I believe I have fixed the last bit of tests related to code coverage. Code coverage is implemented by inserting a special code coverage IR node into the IR, however it is inserted at optimization time, which is after inference is finished assigning effects to return types. To fix this, we moved the code coverage check (including scoped coverage selection) into inference time, mark each |
One remaining question is the second constructor to X-ref: 5e94b86 |
- added missing `is_inlineable_constant` check in the inlining code of `InferenceResult` - rename `is_total` to `is_foldable_nothrow` (since `:total` subsumes the other program properties too now) - updated docstring of `Core.Compiler.finish`
- added missing `is_inlineable_constant` check in the inlining code of `InferenceResult` - rename `is_total` to `is_foldable_nothrow` (since `:total` subsumes the other program properties too now) - updated docstring of `Core.Compiler.finish`
- added missing `is_inlineable_constant` check in the inlining code of `InferenceResult` - rename `is_total` to `is_foldable_nothrow` (since `:total` subsumes the other program properties too now) - updated docstring of `Core.Compiler.finish`
- added missing `is_inlineable_constant` check in the inlining code of `InferenceResult` - rename `is_total` to `is_foldable_nothrow` (since `:total` subsumes the other program properties too now) - updated docstring of `Core.Compiler.finish`
…ache After #48598, the `CodeInstance` constructor discards `inferred_result` when the cache can use the constant calling convention. This is generally fine, but external `AbstractInterpreter` may still want to keep the discarded source, that may be arbitrary custom data structure. This commit makes use of the `may_discard_trees` interface to configure that behavior.
…ache (#48626) After #48598, the `CodeInstance` constructor discards `inferred_result` when the cache can use the constant calling convention. This is generally fine, but external `AbstractInterpreter` may still want to keep the discarded source, that may be arbitrary custom data structure. This commit makes use of the `may_discard_trees` interface to configure that behavior.
ConstAPI
predates the effect analysis framework, and was relying on anad-hoc implementation of effect analysis that only worked for functions
of less than 15 statements. As a result, it wasn't used much anymore,
but it could cause trouble with external
AbstractInterpreters
that maywant to cache additional code metadata within
CodeInstance
s.This commit simply removes this, expecting that the existing effect
analysis will pick up the slack.