Skip to content

Commit 75c3101

Browse files
committed
macrocall: Specialize macro invocations like normal function calls
`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)
1 parent 744e03d commit 75c3101

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ast.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ static jl_value_t *jl_invoke_julia_macro(jl_array_t *args, jl_module_t *inmodule
11351135
}
11361136
jl_timing_show_macro(mfunc, margs[1], inmodule, JL_TIMING_DEFAULT_BLOCK);
11371137
*ctx = mfunc->def.method->module;
1138-
result = jl_invoke(margs[0], &margs[1], nargs - 1, mfunc);
1138+
result = jl_apply(margs, nargs);
11391139
}
11401140
JL_CATCH {
11411141
if ((jl_loaderror_type == NULL) || !throw_load_error) {

0 commit comments

Comments
 (0)