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

Add basic compiler plugins #2566

Merged
merged 1 commit into from
Feb 28, 2018
Merged

Conversation

Praetonus
Copy link
Member

This change adds a framework for compiler plugins. Plugins are specified through the new --plugin command line option and can observe the compiler data structures at various stages of the compilation process. Only read-only plugins are supported.

An example of this functionality is a plugin that reports detailed metrics about the compilation process.

@Praetonus Praetonus force-pushed the compiler-plugins branch 2 times, most recently from be986e1 to a16c285 Compare February 25, 2018 22:13
This change adds a framework for compiler plugins. Plugins are
specified through the new `--plugin` command line option and can
observe the compiler data structures at various stages of the
compilation process. Only read-only plugins are supported.

An example of this functionality is a plugin that reports detailed
metrics about the compilation process.
Copy link
Member

@jemc jemc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, and is a cool feature.

Out of curiosity, what utility do you have in mind for a read-only plugin?

Is it planned to support plugins that mutate in the future?

@Praetonus
Copy link
Member Author

@jemc The initial motivation for this feature was that I wanted to add more compilation information to the -V4 compiler flag. But this flag results in a lot of information being reported and no way to filter it, which is problematic when you're looking for some information in particular. I intend to move the stuff from -V4 to a compiler plugin with command line options to choose what is reported.

I personally haven't thought about use cases for mutating plugins, but if somebody comes up with use cases in the future it should be possible to support this kind of plugins.

@mfelsche
Copy link
Contributor

That is super nice work.

I think the docgen pass could be implemented as a read only plugin and thus benefit from all stages of the compilation process for gathering information.

@jemc jemc added the changelog - added Automatically add "Added" CHANGELOG entry on merge label Feb 28, 2018
@jemc jemc merged commit 9f9256e into ponylang:master Feb 28, 2018
ponylang-main added a commit that referenced this pull request Feb 28, 2018
@Praetonus Praetonus deleted the compiler-plugins branch February 28, 2018 21:01
dipinhora pushed a commit to dipinhora/ponyc that referenced this pull request Jun 5, 2018
This change adds a framework for compiler plugins. Plugins are
specified through the new `--plugin` command line option and can
observe the compiler data structures at various stages of the
compilation process. Only read-only plugins are supported.

An example of this functionality is a plugin that reports detailed
metrics about the compilation process.
dipinhora pushed a commit to dipinhora/ponyc that referenced this pull request Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - added Automatically add "Added" CHANGELOG entry on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants