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

Fine-Tune Type Prop Queries & Added Iterations CLI Opt #3230

Merged
merged 4 commits into from
Aug 1, 2023

Conversation

DavidBakerEffendi
Copy link
Collaborator

  • Optimized queries and data structures here and there, was able to reduce the memory consumption but it only defers a huge allocation later.
  • Added CLI opt for JS and Python --type-prop-iterations where one can set how many type propagation iterations run. 2 onwards typically involves interprocedural propagation. e.g. ./joern-parse .../../Workspace/test-repos/python/open-mmlab --frontend-args --type-prop-iterations 1 finishes for me but only performs intraprocedural type propagation.

@yzn12345 The type propagation is pretty rough around the edges and likely can be rewritten to be a bit more precise and performant but I hope this helps generate python CPGs with some type recovery!

Somewhat resolves #3211

* Optimized queries and data structures here and there, was able to reduce the memory consumption but it only defers a huge allocation later.
* Added CLI opt for JS and Python `--type-prop-iterations` where one can set how many type propagation iterations run. 2 onwards typically involves interprocedural propagation. e.g. `./joern-parse .../../Workspace/test-repos/python/open-mmlab --frontend-args --type-prop-iterations 1` finishes for me but only performs intraprocedural type propagation.

@yzn12345 The type propagation is pretty rough around the edges and likely can be rewritten to be a bit more precise and performant but I hope this helps generate python CPGs with some type recovery!

Somewhat resolves #3211
@max-leuthaeuser
Copy link
Contributor

Can we error out (or at least show a warning) if someone enters an invalid value for typePropagationIterations (<1 or something very large)? Maybe as OParser validation?

* Added `TypeRecoveryParserConfig` and `XTypeRecovery.parserOptions` to reduce code duplication across frontends that use type propagation
* Added logger info/warnings for type propagation iteration count, but no failures
@DavidBakerEffendi
Copy link
Collaborator Author

DavidBakerEffendi commented Jul 27, 2023

@max-leuthaeuser I've made a type propagation config trait and re-usable OParser configs now so there is less duplication and central parsing options. I've opted for x <= 0 to disable type propagation (with a warning) and warn for a x > 5.

@DavidBakerEffendi DavidBakerEffendi merged commit 6ed721d into master Aug 1, 2023
5 checks passed
@DavidBakerEffendi DavidBakerEffendi deleted the dave/py-mem-leak branch August 1, 2023 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working type recovery Concerns Joern's WIP type recovery
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Potential memory leak caused by PythonTypeRecovery
2 participants