-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Clean up lowering API #58147
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
Clean up lowering API #58147
Conversation
vtjnash
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the stmt arg form was mainly a hack to change the meaning of an expression for a deprecation, which isn't necessarily applicable anymore
5dc7870 to
e994dba
Compare
topolarity
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Seems like a pretty straightforward (small) re-factor
unless @JeffBezanson has any feedback, I'll merge this today
and redirect all calls to lowering through it. `jl_fl_lower` is essentially a
renamed `jl_expand_with_loc_warn`, but change the structure of the return
value of its callee `jl-expand-to-thunk-warn` so we can ignore the warnings
if they aren't relevant.
`jl_expand_stmt`, `jl_expand_stmt_with_loc`, `jl_expand_with_loc`
This function has always been a convenience wrapper providing default arguments
to another lowering function. We can give it a more accurate name now that
there aren't five other wrappers we would also need to rename in a
consistent way.
This seems to be more accurate.
|
Thanks @mlechu ! |
Broken by JuliaLang/julia#58147 . However, this has always been an error outside of a module block so the error is probably consistent
Broken by JuliaLang/julia#58147 . However, this has always been an error outside of a module block so the error is probably consistent
This is preparatory work for experimental integration with JuliaLowering, which
happened to be separable into its own PR.
We currently have three lowering entry points doing slightly different things:
jl-expand-to-thunk,jl-expand-to-thunk-warn(for complaining about ambiguoussoft scope assignments during non-interactive use), and
jl-expand-to-thunk-stmt(which wraps the expression in a block returningnothing before lowering it) and a bunch of C wrappers on top of those (see red
nodes in the call graphs below).
In this PR:
jl_lower, which just calls out to lispfor now, but will probably function like
jl_parsedoes in a future PR.warnwith an extra parameterthree entry points
"expand"-prefixed functions to "lower"-prefixed ones (excluding macro
expansion functions, which are called as the first part of lowering).
Here's a call graph before this change, made by looking for callers
of each lowering entry point and tracing back one or more steps (expect
mistakes...). Macro expansion functions are mostly omitted for clarity.
Blue is scheme, red is ast.c, and green is toplevel.c.
After this change:

todo?
I'd like to see if we can eliminate thestmtboolean option fromjl_lowerand handle that another way; I'm just not sure it's worth the effort at the
moment. We only use it in one place in
jl_eval_module_expr. The originalcode path was added in lower top-level statements so that the front-end knows their values are unused #26304.