@@ -239,9 +239,11 @@ JL_DLLEXPORT jl_array_t *jl_reshape_array(jl_value_t *atype, jl_array_t *data,
239239 jl_array_t * owner = (jl_array_t * )jl_array_owner (data );
240240 jl_array_data_owner (a ) = (jl_value_t * )owner ;
241241
242- if (mmtk_object_is_managed_by_mmtk (owner )) {
243- mmtk_pin_object (owner );
244- }
242+ // For array objects with an owner point (a->flags.how == 3), we would need to
243+ // introspect the object to update the a->data field. To avoid doing that and
244+ // making scan_object much more complex we simply enforce that both owner and
245+ // buffers are always pinned
246+ mmtk_pin_object (owner );
245247 a -> flags .how = 3 ;
246248 a -> data = data -> data ;
247249 a -> flags .isshared = 1 ;
@@ -290,9 +292,11 @@ JL_DLLEXPORT jl_array_t *jl_string_to_array(jl_value_t *str)
290292 a -> flags .ptrarray = 0 ;
291293 a -> flags .hasptr = 0 ;
292294 jl_array_data_owner (a ) = str ;
293- if (mmtk_object_is_managed_by_mmtk (str )) {
294- mmtk_pin_object (str );
295- }
295+ // For array objects with an owner point (a->flags.how == 3), we would need to
296+ // introspect the object to update the a->data field. To avoid doing that and
297+ // making scan_object much more complex we simply enforce that both owner and
298+ // buffers are always pinned
299+ mmtk_pin_object (str );
296300 a -> flags .how = 3 ;
297301 a -> flags .isshared = 1 ;
298302 size_t l = jl_string_len (str );
@@ -689,9 +693,11 @@ static int NOINLINE array_resize_buffer(jl_array_t *a, size_t newlen)
689693 else {
690694 s = jl_gc_realloc_string (jl_array_data_owner (a ), nbytes - (elsz == 1 ));
691695 }
692- if (mmtk_object_is_managed_by_mmtk (s )) {
693- mmtk_pin_object (s );
694- }
696+ // For array objects with an owner point (a->flags.how == 3), we would need to
697+ // introspect the object to update the a->data field. To avoid doing that and
698+ // making scan_object much more complex we simply enforce that both owner and
699+ // buffers are always pinned
700+ mmtk_pin_object (s );
695701 jl_array_data_owner (a ) = s ;
696702 jl_gc_wb (a , s );
697703 a -> data = jl_string_data (s );
0 commit comments