julia
26c109e6 - Move thunk and export evaluation out of `jl_toplevel_eval_flex` (#60528)

Commit
308 days ago
Move thunk and export evaluation out of `jl_toplevel_eval_flex` (#60528) Deconstructing `jl_toplevel_eval_flex` to help with JuliaLowering integration and to further disentangle top level evaluation from `Expr` and from the code in toplevel.c: ### `jl_eval_thunk`: C API for CodeInfo evaluation without Expr Separate CodeInfo evaluation out of `jl_toplevel_eval_flex` into `jl_eval_thunk` so that `CodeInfo` can become the basic unit of toplevel evaluation rather than `Expr`. The latest world age set and restore now moves entirely into `jl_eval_thunk` as `jl_toplevel_eval_flex` no longer modifies the task's world age. The world age set and restore inside `jl_eval_thunk` needs to moves outward so that it wraps around the calls to `jl_resolve_definition_effects_in_ir` which interprets some limited top level expressions for the argument types foreigncall, etc. (Previously the world age was updated to the latest in functions which call `jl_toplevel_eval_flex` so resolving definition effects happened to work.) `jl_filename` and `jl_lineno` are also set from `jl_eval_thunk` using the same debuginfo used within codegen so that deprecation binding errors and `jl_fprint_critical_error` can contain the approximate line number. ### `jl_module_public` API for declaring symbols public/exported Move public/export batching out of `jl_toplevel_eval_flex` and into a C runtime function `jl_module_public` which can be called without using eval and without constructing an Expr. ### Side quest: Fix GC rooting in `jl_declare_constant_val2` Various seemingly-unrelated changes in `jl_toplevel_eval_flex` mysteriously cause the static analyzer to see a rooting problem in `jl_declare_constant_val2`: The `val` argument is currently declared JL_MAYBE_UNROOTED, but we call JL_LOCK without rooting it. I've done the simplest fix here which is to root `val` inside `jl_declare_constant_val2`. An alternative would be to remove the `JL_MAYBE_UNROOTED` annotation which could be an artifact of the previous implementation which didn't require the lock prior to #57102.
Author
Parents
Loading