You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A few special forms have a kind of "deferred static evaluation"
semantics for some of their children:
* `@cfunction` - the function name and types
* `ccall` / `foreigncall` / `@ccall` - the type arguments and sometimes
the function name
* `cglobal` - the function name
* `@generated` - the expression defining the generated function stub
For example, in `@ccall f()::Int`, the `Int` means "the symbol `Int` as
looked up in global scope in the module, or as a static parameter of the
method", and should fail if `Int` refers to a local variable. Currently
all three of these cases are handled through different mechanisms with
varying levels of hygiene inconsistency and ability to warn about access
to local variables.
To fix this problem, introduce the new `K"static_eval"` form which wraps
an expression and preserves it as a piece of AST in the output (rather
than producing IR), but still resolves scope and hygiene.
Use this new form to remove all the special case child-index-dependent
handling of these disparate forms from the IR.
Also fixes bugs in `Base.@cfunction` hygiene where the function name
might be resolved to a global symbol in the wrong module.
Also move demo `@ccall` implementation into JuliaLowering, clean up and
fix a few things which were broken and implement the gc_safe option from
`Base.@ccall`. Makes use of static_eval kind for more precise
diagnostics.
0 commit comments