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

improve heuristics for executing top-level code #24600

Merged
merged 1 commit into from
Dec 3, 2017

Conversation

JeffBezanson
Copy link
Member

@JeffBezanson JeffBezanson commented Nov 13, 2017

This refactors the code that decides how to execute top-level expressions, separating the identification of key features of the code from using it to make decisions.

It also skips inference for blocks containing load-time-ish forms like method and type definitions, since it's probably not profitable and helps avoid unsoundness issues like #24316. Of course it doesn't fully fix ~~ #24569, but will help in common cases. The reduction in compiler time also makes using DataFrames (with --compiled-modules=no) about 10% faster for me.

if (head == toplevel_sym || head == thunk_sym) {
return;
}
else if (head == global_sym || head == const_sym || head == copyast_sym) {
Copy link
Member

Choose a reason for hiding this comment

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

global_sym isn't a definition anymore, it's just a scope annotation

copyast also doesn't seem like it defines anything, it's just a local allocation (albeit one that commonly appears in contexts related to defining code)

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think that's true; global as a scope annotation gets removed by the front end, but when it serves to create an (initially undefined) global variable the global expression remains.

one that commonly appears in contexts related to defining code

Yes, that's what I was thinking.

also avoid inferring blocks with method definitions and other forms
used only at load time. helps #24316.
@JeffBezanson JeffBezanson force-pushed the jb/toplevel_heuristics branch from 2215e01 to e8073cc Compare December 2, 2017 18:59
@JeffBezanson JeffBezanson merged commit b02cf6e into master Dec 3, 2017
@JeffBezanson JeffBezanson deleted the jb/toplevel_heuristics branch December 3, 2017 17:44
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

Successfully merging this pull request may close these issues.

2 participants