-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
macrocall: Specialize macro invocations like normal function calls #57782
base: master
Are you sure you want to change the base?
Conversation
`jl_invoke` behaves like `Expr(:invoke, ...)` not `Core.invoke`, so we were (accidentally?) bypassing the default specialization for a `macro` and only ever invoked de-specialized MethodInstances. Change this to `jl_apply` so that we specialize as normal, which should dramatically improve inference and not lead to much extra code since our AST is very homogeneous (`Expr` + typeof.(literals), IIUC)
dfdd613
to
75c3101
Compare
That was sort of the point though, since inference is supposed to reject these also anyways, so attempted specialization here is expected to be just wasted effort |
Why the invalidations in #57781 then? |
This PR doesn't seem to prevent any invalidation - the invalidations are exactly the same before and after applying this change on top of current |
Furthermore, I can confirm the invalidation of macro |
I'm not sure why the code is written this way (seems to be from c79e34c) but I don't think this is true? This code path does end up doing specialization. But then there is a check for functions starting with |
Oh we also insert |
Ah yep - Looks like that was auto-qualifying any |
Inspired by #57781 (kudos to @nsajko for another good find)
jl_invoke
behaves likeExpr(:invoke, ...)
notCore.invoke
, so this was bypassing the default specialization for amacro
and only ever invoked de-specialized MethodInstances.Change this to
jl_apply
so that we specialize as normal, which should dramatically improve inference and not lead to much extra code since our AST is very homogeneous (Expr
+ typeof.(literals), IIUC).