From a3f4d87e2b4b8092306815ca50eb091c811d19ff Mon Sep 17 00:00:00 2001 From: Oscar Smith Date: Mon, 14 Oct 2024 01:37:38 -0400 Subject: [PATCH] debugs --- src/cgutils.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/cgutils.cpp b/src/cgutils.cpp index 330f28eb33d79..b9923f00ed90a 100644 --- a/src/cgutils.cpp +++ b/src/cgutils.cpp @@ -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);