Skip to content

Commit

Permalink
fix struct tail initialization for inline reference allocation (#35291)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Mar 31, 2020
1 parent 3048517 commit 105ed11
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/datatype.c
Original file line number Diff line number Diff line change
Expand Up @@ -887,19 +887,10 @@ JL_DLLEXPORT jl_value_t *jl_new_struct(jl_datatype_t *type, ...)

static void init_struct_tail(jl_datatype_t *type, jl_value_t *jv, size_t na)
{
size_t nf = jl_datatype_nfields(type);
char *data = (char*)jl_data_ptr(jv);
for (size_t i = na; i < nf; i++) {
if (jl_field_isptr(type, i)) {
*(jl_value_t**)(data + jl_field_offset(type, i)) = NULL;
}
else {
jl_value_t *ft = jl_field_type(type, i);
if (jl_is_uniontype(ft)) {
uint8_t *psel = &((uint8_t *)data)[jl_field_offset(type, i) + jl_field_size(type, i) - 1];
*psel = 0;
}
}
if (na < jl_datatype_nfields(type)) {
char *data = (char*)jl_data_ptr(jv);
size_t offs = jl_field_offset(type, na);
memset(data + offs, 0, jl_datatype_size(type) - offs);
}
}

Expand Down

2 comments on commit 105ed11

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan

Please sign in to comment.