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

Framework for organizing passes #126

Open
tristanlatr opened this issue May 12, 2024 · 4 comments
Open

Framework for organizing passes #126

tristanlatr opened this issue May 12, 2024 · 4 comments
Assignees

Comments

@tristanlatr
Copy link
Contributor

Hello static analysis enthousiastes,

I believe this proposal could be interesting for the work you’re doing in this repository.

twisted/twisted#12176

Basically I’m trying to describe an infrastructure that would allow to hook any analysis or transformation into a system in charge of ensuring optimizations and consistency of analysis results when a transformation happen.

It’s currently unclear where this code will be hosted for the long term. I’m opening this issue to gather feedbacks and see if there are potential contributors here that could help me finish the implementation and maintain this over time.

thanks,

@tristanlatr
Copy link
Contributor Author

@pawamoy ça pourrait t’intéresser

@pawamoy
Copy link

pawamoy commented May 12, 2024

Hey @tristanlatr, thanks for mentioning me 🙂

It's cool to see that you're still working on static analysis. @tusharsadhwani has created a Discord channel on the static analysis topic, if you'd like to join and share this there: https://discord.gg/fZCBfm4r 🙂

I've read the mentioned issue. It looks very serious and promising 👍 However I do have to say I have trouble understanding why and how I would use this passmanager (by the way, I understand that "passmanager" is the name used in LLVM, GCC and Pythran, but I can't help but think of "password manager" when I read it 😅).

For ignorant devs like myself, I would expect to see the following things explained:

  • what is a "pass manager" (quick, high-level explanation, I think you got this one already)
  • what can it be used for (static analysis and AST transformations IIUC? this is a bit burried in too much text IMO)
  • what are some clear and simple use-cases? IIUC again, expanding wildcard imports? inferring values and types of variables? following variables indirections (through assignments/function calls)?
  • what's a concrete example? show some input, passmanager code, and output

Without this it's hard for me to see how I could use such package for my own static analysis needs. How would I plug it into existing AST visitors? Would I have to migrate all of my visitor's code, or could I just use the passmanager in specific places to infer the values of __all__ or expand wildcard imports?

I found the Pythran docs to be the most readable ones, if that helps 🙂

@tristanlatr
Copy link
Contributor Author

Thanks for your feedback, I'll try to improve these points.

In the meantime, there is this docstring full of doctest that could be more or less what your looking for: https://github.com/tristanlatr/libstatic/blob/passmanager/libstatic/_lib/passmanager/__init__.py

Would I have to migrate all of my visitor's code, or could I just use the passmanager in specific places to infer the values of all or expand wildcard imports?

It's aimed to be flexible, so you should be able to use it once at specific places, for instance to transform from x import * into from x importa,b,c,d,e,f,...

@pawamoy
Copy link

pawamoy commented May 12, 2024

The docstring is great, thanks!

@Jarvx Jarvx self-assigned this Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants