@@ -136,7 +136,7 @@ static DIType *_julia_type_to_di(jl_codegen_params_t *ctx, jl_value_t *jt, DIBui
136
136
size_t ntypes = jl_datatype_nfields (jdt);
137
137
std::vector<llvm::Metadata*> Elements (ntypes);
138
138
for (unsigned i = 0 ; i < ntypes; i++) {
139
- jl_value_t *el = jl_svecref (jdt-> types , i);
139
+ jl_value_t *el = jl_field_type_concrete (jdt, i);
140
140
DIType *di;
141
141
if (jl_field_isptr (jdt, i))
142
142
di = jl_pvalue_dillvmt;
@@ -2035,9 +2035,10 @@ static bool emit_getfield_unknownidx(jl_codectx_t &ctx,
2035
2035
if (!strct.ispointer ()) { // unboxed
2036
2036
assert (jl_is_concrete_immutable ((jl_value_t *)stt));
2037
2037
bool isboxed = is_datatype_all_pointers (stt);
2038
- bool issame = is_tupletype_homogeneous (stt->types );
2038
+ jl_svec_t *types = stt->types ;
2039
+ bool issame = is_tupletype_homogeneous (types);
2039
2040
if (issame) {
2040
- jl_value_t *jft = jl_svecref (stt-> types , 0 );
2041
+ jl_value_t *jft = jl_svecref (types, 0 );
2041
2042
if (strct.isghost ) {
2042
2043
(void )idx0 ();
2043
2044
*ret = ghostValue (jft);
@@ -2077,7 +2078,7 @@ static bool emit_getfield_unknownidx(jl_codectx_t &ctx,
2077
2078
ctx.builder .CreateExtractValue (strct.V , makeArrayRef (i)),
2078
2079
fld);
2079
2080
}
2080
- jl_value_t *jft = issame ? jl_svecref (stt-> types , 0 ) : (jl_value_t *)jl_any_type;
2081
+ jl_value_t *jft = issame ? jl_svecref (types, 0 ) : (jl_value_t *)jl_any_type;
2081
2082
if (isboxed && maybe_null)
2082
2083
null_pointer_check (ctx, fld);
2083
2084
*ret = mark_julia_type (ctx, fld, isboxed, jft);
@@ -2119,9 +2120,9 @@ static bool emit_getfield_unknownidx(jl_codectx_t &ctx,
2119
2120
*ret = mark_julia_type (ctx, fld, true , jl_any_type);
2120
2121
return true ;
2121
2122
}
2122
- else if (is_tupletype_homogeneous (stt-> types )) {
2123
+ else if (is_tupletype_homogeneous (jl_get_fieldtypes ( stt) )) {
2123
2124
assert (nfields > 0 ); // nf == 0 trapped by all_pointers case
2124
- jl_value_t *jft = jl_svecref (stt->types , 0 );
2125
+ jl_value_t *jft = jl_svecref (stt->types , 0 ); // n.b. jl_get_fieldtypes assigned stt->types for here
2125
2126
assert (jl_is_concrete_type (jft));
2126
2127
idx = idx0 ();
2127
2128
Value *ptr = maybe_decay_tracked (ctx, data_pointer (ctx, strct));
@@ -3242,9 +3243,10 @@ static void find_perm_offsets(jl_datatype_t *typ, SmallVector<unsigned,4> &res,
3242
3243
// This is a inlined field at `offset`.
3243
3244
if (!typ->layout || typ->layout ->npointers == 0 )
3244
3245
return ;
3245
- size_t nf = jl_svec_len (typ->types );
3246
+ jl_svec_t *types = jl_get_fieldtypes (typ);
3247
+ size_t nf = jl_svec_len (types);
3246
3248
for (size_t i = 0 ; i < nf; i++) {
3247
- jl_value_t *_fld = jl_svecref (typ-> types , i);
3249
+ jl_value_t *_fld = jl_svecref (types, i);
3248
3250
if (!jl_is_datatype (_fld))
3249
3251
continue ;
3250
3252
jl_datatype_t *fld = (jl_datatype_t *)_fld;
@@ -3293,7 +3295,7 @@ static jl_cgval_t emit_setfield(jl_codectx_t &ctx,
3293
3295
emit_bitcast (ctx, maybe_decay_tracked (ctx, addr), T_pint8),
3294
3296
ConstantInt::get (T_size, byte_offset)); // TODO: use emit_struct_gep
3295
3297
}
3296
- jl_value_t *jfty = jl_svecref (sty-> types , idx0);
3298
+ jl_value_t *jfty = jl_field_type (sty, idx0);
3297
3299
if (!jl_field_isptr (sty, idx0) && jl_is_uniontype (jfty)) {
3298
3300
size_t fsz = 0 , al = 0 ;
3299
3301
bool isptr = !jl_islayout_inline (jfty, &fsz, &al);
@@ -3418,7 +3420,7 @@ static jl_cgval_t emit_new_struct(jl_codectx_t &ctx, jl_value_t *ty, size_t narg
3418
3420
}
3419
3421
3420
3422
for (unsigned i = 0 ; i < na; i++) {
3421
- jl_value_t *jtype = jl_svecref (sty->types , i);
3423
+ jl_value_t *jtype = jl_svecref (sty->types , i); // n.b. ty argument must be concrete
3422
3424
jl_cgval_t fval_info = argv[i];
3423
3425
emit_typecheck (ctx, fval_info, jtype, " new" );
3424
3426
fval_info = update_julia_type (ctx, fval_info, jtype);
@@ -3553,7 +3555,7 @@ static jl_cgval_t emit_new_struct(jl_codectx_t &ctx, jl_value_t *ty, size_t narg
3553
3555
need_wb = !rhs.isboxed ;
3554
3556
else
3555
3557
need_wb = false ;
3556
- emit_typecheck (ctx, rhs, jl_svecref (sty->types , i), " new" );
3558
+ emit_typecheck (ctx, rhs, jl_svecref (sty->types , i), " new" ); // n.b. ty argument must be concrete
3557
3559
emit_setfield (ctx, sty, strctinfo, i, rhs, jl_cgval_t (), false , need_wb, AtomicOrdering::NotAtomic, AtomicOrdering::NotAtomic, false , true , false , false , false , nullptr , " " );
3558
3560
}
3559
3561
return strctinfo;
0 commit comments