Skip to content

Commit

Permalink
debugs
Browse files Browse the repository at this point in the history
  • Loading branch information
oscardssmith committed Oct 14, 2024
1 parent 003613b commit a3f4d87
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/cgutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4554,11 +4554,24 @@ static jl_cgval_t emit_const_len_memorynew(jl_codectx_t &ctx, jl_datatype_t *typ
auto cg_tot = ConstantInt::get(T_size, tot);
auto call = prepare_call(jl_alloc_obj_func);
alloc = ctx.builder.CreateCall(call, { ct, cg_tot, track_pjlvalue(ctx, cg_typ)});
dbgs() << "alloc: ";
alloc->print(dbgs(), NULL);
// set data (jl_alloc_genericmemory_unchecked_func doesn't have it)
decay_alloc = maybe_decay_tracked(ctx, alloc);
decay_alloc = decay_derived(ctx, alloc);
//dbgs() << "\ndecay_alloc: ";
decay_alloc->print(dbgs(), NULL);
ptr_field = ctx.builder.CreateStructGEP(ctx.types().T_jlgenericmemory, decay_alloc, 1);
Value *data = emit_ptrgep(ctx, emit_pointer_from_objref(ctx, alloc), JL_SMALL_BYTE_ALIGNMENT);
ctx.builder.CreateStore(data, ptr_field);
//dbgs() << "\nptr_field: ";
//ptr_field->print(dbgs(), NULL);
auto objref = emit_pointer_from_objref(ctx, alloc);
//dbgs() << "\nobjref: ";
//objref->print(dbgs(), NULL);

Value *data = track_pjlvalue(ctx, emit_ptrgep(ctx, objref, JL_SMALL_BYTE_ALIGNMENT));
//dbgs() << "\ndata: ";
//data->print(dbgs(), NULL);
//dbgs() << "\n";
ctx.builder.CreateAlignedStore(data, ptr_field, Align(sizeof(void*)));
} else { // just use the dynamic length version since the malloc will be slow anyway
auto ptls = get_current_ptls(ctx);
auto call = prepare_call(jl_alloc_genericmemory_unchecked_func);
Expand Down

0 comments on commit a3f4d87

Please sign in to comment.