@@ -457,43 +457,13 @@ JL_DLLEXPORT jl_array_t *jl_pchar_to_array(const char *str, size_t len)
457457 return a ;
458458}
459459
460- uv_mutex_t array_to_string_print_lock ;
461-
462- void jl_set_in_flight_bit_for_array_to_string (jl_array_t * a )
463- {
464- uintptr_t msk = (1 << ARRAY_TO_STRING_IN_FLIGHT_BIT_OFFSET );
465- uintptr_t header = jl_atomic_fetch_or ((_Atomic (uintptr_t ) * )jl_astaggedvalue (a ), msk );
466- if (header & msk ) {
467- uv_mutex_lock (& array_to_string_print_lock );
468- // Race detected... Someone already set the in-flight bit.
469- jl_safe_printf ("Race detected... Someone already set the in-flight bit.\n" );
470- jlbacktracet (jl_current_task );
471- uv_mutex_unlock (& array_to_string_print_lock );
472- }
473- }
474-
475- void jl_reset_in_flight_bit_for_array_to_string (jl_array_t * a )
476- {
477- uintptr_t msk = (1 << ARRAY_TO_STRING_IN_FLIGHT_BIT_OFFSET );
478- uintptr_t header = jl_atomic_fetch_and ((_Atomic (uintptr_t ) * )jl_astaggedvalue (a ), ~msk );
479- if (!(header & msk )) {
480- uv_mutex_lock (& array_to_string_print_lock );
481- // Race detected... Someone reset the in-flight bit before we could.
482- jl_safe_printf ("Race detected... Someone reset the in-flight bit before we could.\n" );
483- jlbacktracet (jl_current_task );
484- uv_mutex_unlock (& array_to_string_print_lock );
485- }
486- }
487-
488460JL_DLLEXPORT jl_value_t * jl_array_to_string (jl_array_t * a )
489461{
490- jl_set_in_flight_bit_for_array_to_string (a );
491462 size_t len = jl_array_len (a );
492463 if (len == 0 ) {
493464 // this may seem like purely an optimization (which it also is), but it
494465 // also ensures that calling `String(a)` doesn't corrupt a previous
495466 // string also created the same way, where `a = StringVector(_)`.
496- jl_reset_in_flight_bit_for_array_to_string (a );
497467 return jl_an_empty_string ;
498468 }
499469 if (a -> flags .how == 3 && a -> offset == 0 && a -> elsize == 1 &&
@@ -506,13 +476,11 @@ JL_DLLEXPORT jl_value_t *jl_array_to_string(jl_array_t *a)
506476 a -> nrows = 0 ;
507477 a -> length = 0 ;
508478 a -> maxsize = 0 ;
509- jl_reset_in_flight_bit_for_array_to_string (a );
510479 return o ;
511480 }
512481 }
513482 a -> nrows = 0 ;
514483 a -> length = 0 ;
515- jl_reset_in_flight_bit_for_array_to_string (a );
516484 return jl_pchar_to_string ((const char * )jl_array_data (a ), len );
517485}
518486
0 commit comments