Skip to content

Commit

Permalink
Do less work in zeroing out VMArray
Browse files Browse the repository at this point in the history
We don't need to go up all the way to ssize, just until the old end
of the stuff with data. The rest is already cleared from back when
we resized ssize.

(O = Old cell; N = new cell; G = garbage left over data)
|--|OO|OO|--|
|OO|OO|GG|--| <- conditional moves the old stuff and zeros the trash
|NN|NN|--|--|
  • Loading branch information
zoffixznet committed Dec 24, 2017
1 parent 43c926f commit 09482f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/6model/reprs/VMArray.c
Expand Up @@ -317,7 +317,7 @@ static void set_size_internal(MVMThreadContext *tc, MVMArrayBody *body, MVMuint6
elems * repr_data->elem_size);
body->start = 0;
/* fill out any unused slots with NULL pointers or zero values */
elems = zero_slots(tc, body, elems, ssize, repr_data->slot_type);
elems = zero_slots(tc, body, elems, start+elems, repr_data->slot_type);
}
else if (n < elems) {
/* we're downsizing; clear off extra slots */
Expand Down

0 comments on commit 09482f9

Please sign in to comment.