Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Last active December 24, 2017 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoffixznet/cd550a43907c0d4083656fa2172c606b to your computer and use it in GitHub Desktop.
Save zoffixznet/cd550a43907c0d4083656fa2172c606b to your computer and use it in GitHub Desktop.
diff --git a/src/6model/reprs/VMArray.c b/src/6model/reprs/VMArray.c
index feeeed7..f71e325 100644
--- a/src/6model/reprs/VMArray.c
+++ b/src/6model/reprs/VMArray.c
@@ -323,6 +323,8 @@ static void set_size_internal(MVMThreadContext *tc, MVMArrayBody *body, MVMuint6
body->elems = n;
if (n <= ssize) {
/* we already have n slots available, we can just return */
+ if (repr_data->slot_type != MVM_ARRAY_OBJ)
+ zero_slots(tc, body, elems, ssize, repr_data->slot_type);
return;
}
@@ -456,13 +458,6 @@ static void set_elems(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void
MVMArrayREPRData *repr_data = (MVMArrayREPRData *)st->REPR_data;
MVMArrayBody *body = (MVMArrayBody *)data;
enter_single_user(tc, body);
-
- // if we're downsizing, zero out the elements we're cutting off, to
- // avoid rogue left over data showing up when we, say, index into those
- // elements later on https://rt.perl.org/Ticket/Display.html?id=127756
- if (count < body->elems)
- zero_slots(tc, body, count, body->elems, repr_data->slot_type);
-
set_size_internal(tc, body, count, repr_data);
exit_single_user(tc, body);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment