Skip to content

Commit

Permalink
Follow suggestion from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
gbaraldi committed Jun 7, 2024
1 parent 488ba8f commit fe72b8e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8471,11 +8471,11 @@ static jl_llvm_functions_t
allocate_gc_frame(ctx, b0);
Value *last_age = NULL;
auto world_age_field = get_last_age_field(ctx);
if (toplevel || ctx.is_opaque_closure) {
jl_aliasinfo_t ai = jl_aliasinfo_t::fromTBAA(ctx, ctx.tbaa().tbaa_gcframe);
last_age = ai.decorateInst(ctx.builder.CreateAlignedLoad(
ctx.types().T_size, world_age_field, ctx.types().alignof_ptr));
}
jl_aliasinfo_t ai = jl_aliasinfo_t::fromTBAA(ctx, ctx.tbaa().tbaa_gcframe);
last_age = ai.decorateInst(ctx.builder.CreateAlignedLoad(
ctx.types().T_size, world_age_field, ctx.types().alignof_ptr));
ctx.world_age_at_entry = last_age // Load world age for use in get_tls_world_age

// step 7. allocate local variables slots
// must be in the first basic block for the llvm mem2reg pass to work
auto allocate_local = [&ctx, &dbuilder, &debugcache, topdebugloc, va, debug_enabled, M](jl_varinfo_t &varinfo, jl_sym_t *s, int i) {
Expand Down Expand Up @@ -8721,6 +8721,7 @@ static jl_llvm_functions_t

jl_cgval_t closure_world = typed_load(ctx, worldaddr, NULL, (jl_value_t*)jl_long_type,
nullptr, nullptr, false, AtomicOrdering::NotAtomic, false, ctx.types().alignof_ptr.value());
ctx.world_age_at_entry = closure_world; // The tls world in a OC is the world of the closure
emit_unbox_store(ctx, closure_world, world_age_field, ctx.tbaa().tbaa_gcframe, ctx.types().alignof_ptr.value());

// Load closure env
Expand Down Expand Up @@ -8992,9 +8993,6 @@ static jl_llvm_functions_t
ctx.builder.CreateAlignedStore(world, world_age_field, ctx.types().alignof_ptr);
}

jl_aliasinfo_t ai = jl_aliasinfo_t::fromTBAA(ctx, ctx.tbaa().tbaa_gcframe);
ctx.world_age_at_entry = ai.decorateInst(
ctx.builder.CreateAlignedLoad(ctx.types().T_size, world_age_field, ctx.types().alignof_ptr)); // Load age after OC/toplevel world age store
// step 11b. Emit the entry safepoint
if (JL_FEAT_TEST(ctx, safepoint_on_entry))
emit_gc_safepoint(ctx.builder, ctx.types().T_size, get_current_ptls(ctx), ctx.tbaa().tbaa_const);
Expand Down

0 comments on commit fe72b8e

Please sign in to comment.