Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 5d27f5c

Browse files
author
Reini Urban
committed
Enable NODEFAULT_SHAREKEYS
Dont store all hash keys in strtab also. WIP: sv_clear of a IsCOW/LEN=0 PV fails to get the he before the hek, which is shared with the pv. Fixed with subsequent commits. See GH #201
1 parent cdd37b6 commit 5d27f5c

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

sv.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -9367,7 +9367,7 @@ Perl_newSVhek(pTHX_ const HEK *const hek)
93679367
char *as_utf8 = (char *)bytes_to_utf8 ((U8*)HEK_KEY(hek), &utf8_len);
93689368
/* bytes_to_utf8() allocates a new string, which we can repurpose: */
93699369
sv_usepvn_flags(sv, as_utf8, utf8_len, SV_HAS_TRAILING_NUL);
9370-
SvUTF8_on (sv);
9370+
SvUTF8_on(sv);
93719371
if (HEK_TAINTED(hek))
93729372
SvTAINTED_on(sv);
93739373
return sv;
@@ -9376,14 +9376,14 @@ Perl_newSVhek(pTHX_ const HEK *const hek)
93769376
the flag in every key so that we know not to try to call
93779377
share_hek_hek on it. */
93789378

9379-
SV * const sv = newSVpvn (HEK_KEY(hek), HEK_LEN(hek));
9379+
SV * const sv = newSVpvn(HEK_KEY(hek), HEK_LEN(hek));
93809380
if (HEK_UTF8(hek))
9381-
SvUTF8_on (sv);
9381+
SvUTF8_on(sv);
93829382
if (HEK_TAINTED(hek))
93839383
SvTAINTED_on(sv);
93849384
return sv;
93859385
}
9386-
/* This will be overwhelminly the most common case. */
9386+
/* This will be overwhelmingly the most common case. */
93879387
{
93889388
/* Inline most of newSVpvn_share(), because share_hek_hek() is far
93899389
more efficient than sharepvn(). */

sv.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,10 @@ typedef enum {
170170
#endif
171171

172172
/* Adding each hash key to strtab also is massive overkill */
173-
/*
174173
#ifdef USE_CPERL
175-
#define NODEFAULT_SHAREKEYS
174+
# define NODEFAULT_SHAREKEYS
176175
#endif
177-
*/
176+
178177

179178
/* There is collusion here with sv_clear - sv_clear exits early for SVt_NULL
180179
so never reaches the clause at the end that uses sv_type_details->body_size

0 commit comments

Comments
 (0)