[WIP] On demand analyze for allocation - #37
Draft
keremsahn wants to merge 2 commits into
Draft
Conversation
…p information and this information effects kIsCreator flag of overload group , currently analyzer is not called, just attribute checker is called
keremsahn
force-pushed
the
on-demand-analyze
branch
from
August 22, 2026 17:03
501fc03 to
7a6eddc
Compare
keremsahn
force-pushed
the
on-demand-analyze
branch
from
August 22, 2026 17:22
7a6eddc to
29f069b
Compare
Vipul-Cariappa
marked this pull request as draft
August 23, 2026 04:54
Vipul-Cariappa
left a comment
Collaborator
There was a problem hiding this comment.
Minor comments. LGTM!
| def test03_analyzer_new(self): | ||
| import cppjit | ||
|
|
||
| cppjit._backend.SetUseAllocAnalyzer(True) |
Collaborator
There was a problem hiding this comment.
Please add a wrapper in __init__.py, such that the user can directly do
cppjit.use_alloc_analyzer(...). Note that in Python, function names should be in snake case.
Comment on lines
+44
to
+47
| cppjit._backend.SetUseAllocAnalyzer(False) | ||
| obj = cppjit.gbl.allocNew2() | ||
| assert type(obj) == cppjit.gbl.memAnalysisKlass | ||
| assert not (obj.__python_owns__) |
Collaborator
There was a problem hiding this comment.
We need a test for reusing existing results... i.e. already analyzed, but use_alloc_analyzer(False).
Comment on lines
+13
to
+14
| inline memAnalysisKlass* allocNew() { return new memAnalysisKlass; } | ||
| inline memAnalysisKlass* allocNew2() { return new memAnalysisKlass; } |
Collaborator
There was a problem hiding this comment.
Can the function names be a bit more descriptive? In the context of the test. Example:
AnalysisOnAllocNew & AnalysisOffAllocNew?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Built upon #35
Added wrapping for GetAllocType, and it is called if user sets gUseAllocAnalyze variable, which is disabled by default. Analyzer has lower priority compared to attribute check.
A detail: Analyzer caches the result, so once the function is called with gUseAllocAnalyze, the result stays, even though the flag is set to False laterly.
@aaronj0 @vgvassilev @Vipul-Cariappa