[WIP] On demand analyze for allocation - #37
Conversation
7a6eddc to
29f069b
Compare
Vipul-Cariappa
left a comment
There was a problem hiding this comment.
Minor comments. LGTM!
| def test03_analyzer_new(self): | ||
| import cppjit | ||
|
|
||
| cppjit._backend.SetUseAllocAnalyzer(True) |
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.
There was a problem hiding this comment.
Added the wrapper, it is cppjit.use_alloc_analyzer()
| cppjit._backend.SetUseAllocAnalyzer(False) | ||
| obj = cppjit.gbl.allocNew2() | ||
| assert type(obj) == cppjit.gbl.memAnalysisKlass | ||
| assert not (obj.__python_owns__) |
There was a problem hiding this comment.
We need a test for reusing existing results... i.e. already analyzed, but use_alloc_analyzer(False).
| inline memAnalysisKlass* allocNew() { return new memAnalysisKlass; } | ||
| inline memAnalysisKlass* allocNew2() { return new memAnalysisKlass; } |
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?
4e3a996 to
1c5bac8
Compare
…p information and this information effects kIsCreator flag of overload group , currently analyzer is not called, just attribute checker is called
…mory-related attributes in the FunctionDecl, analyzer is disabled by default and set by cppjit.use_alloc_analyzer(True/False)
1c5bac8 to
38fdddb
Compare
|
Heads-up: main was force-pushed before the first release as a one-time fix for authorship on two commits ported from the cppyy forks, which credited claude instead of the original patch authors. Since this branch was based on the old history, I rebased it onto the current main and force-pushed, your commits are unchanged. If you have local work on this branch, fetch and put it on top with |
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