Skip to content

Commit

Permalink
Add missing GC_POP() in emit_cfunction (#53809)
Browse files Browse the repository at this point in the history
~~Apparently somewhere in codegen inside `emit_codeinst`some piece of
code is relying on the implicit try catch gcstack restoring. I haven't
got the analyzer working on that file yet (it has hundreds of issues and
it doesn't like C++ code that much + the file is tens of thousands of
lines after includes so it struggles).~~

This fixes the compileall segfault in apple-aarch64 ci.
#53811

(cherry picked from commit 52fc796)
  • Loading branch information
gbaraldi authored and KristofferC committed Mar 27, 2024
1 parent a579dab commit 0a7a95c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7373,6 +7373,7 @@ static jl_cgval_t emit_cfunction(jl_codectx_t &ctx, jl_value_t *output_type, con
if (ctx.emission_context.TargetTriple.isAArch64() || ctx.emission_context.TargetTriple.isARM() || ctx.emission_context.TargetTriple.isPPC64()) {
if (nest) {
emit_error(ctx, "cfunction: closures are not supported on this platform");
JL_GC_POP();
return jl_cgval_t();
}
}
Expand Down
1 change: 1 addition & 0 deletions src/rtutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ JL_DLLEXPORT void jl_eh_restore_state(jl_task_t *ct, jl_handler_t *eh)

JL_DLLEXPORT void jl_eh_restore_state_noexcept(jl_task_t *ct, jl_handler_t *eh)
{
assert(ct->gcstack == eh->gcstack && "Incorrect GC usage under try catch");
ct->eh = eh->prev;
ct->ptls->defer_signal = eh->defer_signal; // optional, but certain try-finally (in stream.jl) may be slightly harder to write without this
}
Expand Down

0 comments on commit 0a7a95c

Please sign in to comment.