@@ -3897,35 +3897,8 @@ jl_value_t *jl_gc_realloc_string(jl_value_t *s, size_t sz)
3897
3897
{
3898
3898
size_t len = jl_string_len (s );
3899
3899
if (sz <= len ) return s ;
3900
- jl_taggedvalue_t * v = jl_astaggedvalue (s );
3901
- size_t strsz = len + sizeof (size_t ) + 1 ;
3902
- if (strsz <= GC_MAX_SZCLASS ||
3903
- // TODO: because of issue #17971 we can't resize old objects
3904
- gc_marked (v -> bits .gc )) {
3905
- // pool allocated; can't be grown in place so allocate a new object.
3906
- jl_value_t * snew = jl_alloc_string (sz );
3907
- memcpy (jl_string_data (snew ), jl_string_data (s ), len );
3908
- return snew ;
3909
- }
3910
- size_t newsz = sz + sizeof (size_t ) + 1 ;
3911
- size_t offs = sizeof (bigval_t );
3912
- size_t oldsz = LLT_ALIGN (strsz + offs , JL_CACHE_BYTE_ALIGNMENT );
3913
- size_t allocsz = LLT_ALIGN (newsz + offs , JL_CACHE_BYTE_ALIGNMENT );
3914
- if (allocsz < sz ) // overflow in adding offs, size was "negative"
3915
- jl_throw (jl_memory_exception );
3916
- bigval_t * hdr = bigval_header (v );
3917
- jl_ptls_t ptls = jl_current_task -> ptls ;
3918
- maybe_collect (ptls ); // don't want this to happen during jl_gc_managed_realloc
3919
- gc_big_object_unlink (hdr );
3920
- // TODO: this is not safe since it frees the old pointer. ideally we'd like
3921
- // the old pointer to be left alone if we can't grow in place.
3922
- // for now it's up to the caller to make sure there are no references to the
3923
- // old pointer.
3924
- bigval_t * newbig = (bigval_t * )gc_managed_realloc_ (ptls , hdr , allocsz , oldsz , 1 , s , 0 );
3925
- newbig -> sz = allocsz ;
3926
- gc_big_object_link (newbig , & ptls -> heap .big_objects );
3927
- jl_value_t * snew = jl_valueof (& newbig -> header );
3928
- * (size_t * )snew = sz ;
3900
+ jl_value_t * snew = jl_alloc_string (sz );
3901
+ memcpy (jl_string_data (snew ), jl_string_data (s ), len );
3929
3902
return snew ;
3930
3903
}
3931
3904
0 commit comments