Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9334,6 +9334,7 @@ static jl_llvm_functions_t
Value *scope_ptr = get_scope_field(ctx);
LoadInst *current_scope = ctx.builder.CreateAlignedLoad(ctx.types().T_prjlvalue, scope_ptr, ctx.types().alignof_ptr);
StoreInst *scope_store = ctx.builder.CreateAlignedStore(scope_boxed, scope_ptr, ctx.types().alignof_ptr);
emit_write_barrier(ctx, get_current_task(ctx), scope_boxed);
jl_aliasinfo_t::fromTBAA(ctx, ctx.tbaa().tbaa_gcframe).decorateInst(current_scope);
jl_aliasinfo_t::fromTBAA(ctx, ctx.tbaa().tbaa_gcframe).decorateInst(scope_store);
// GC preserve the scope, since it is not rooted in the `jl_handler_t *`
Expand Down
1 change: 1 addition & 0 deletions src/interpreter.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ static jl_value_t *eval_body(jl_array_t *stmts, interpreter_state *s, size_t ip,
// replaced later
JL_GC_PUSH1(&scope);
ct->scope = scope;
jl_gc_wb(ct, ct->scope);
if (!jl_setjmp(__eh.eh_ctx, 0)) {
ct->eh = &__eh;
eval_body(stmts, s, next_ip, toplevel);
Expand Down
2 changes: 2 additions & 0 deletions src/rtutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ JL_DLLEXPORT void jl_eh_restore_state(jl_task_t *ct, jl_handler_t *eh)
ct->eh = eh->prev;
ct->gcstack = eh->gcstack;
ct->scope = eh->scope;
jl_gc_wb(ct, ct->scope);
small_arraylist_t *locks = &ptls->locks;
int unlocks = locks->len > eh->locks_len;
if (unlocks) {
Expand Down Expand Up @@ -335,6 +336,7 @@ 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->scope = eh->scope;
jl_gc_wb(ct, ct->scope);
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
1 change: 1 addition & 0 deletions src/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,7 @@ JL_DLLEXPORT jl_task_t *jl_new_task(jl_function_t *start, jl_value_t *completion
jl_atomic_store_relaxed(&t->_isexception, 0);
// Inherit scope from parent task
t->scope = ct->scope;
jl_gc_wb(t, ct->scope);
// Fork task-local random state from parent
jl_rng_split(t->rngState, ct->rngState);
// there is no active exception handler available on this stack yet
Expand Down