-
Notifications
You must be signed in to change notification settings - Fork 598
eval_sv: add a G_USEHINTS flag #21421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12227,7 +12227,6 @@ Perl_ck_eval(pTHX_ OP *o) | |
/* Store a copy of %^H that pp_entereval can pick up. */ | ||
HV *hh = hv_copy_hints_hv(GvHV(PL_hintgv)); | ||
OP *hhop; | ||
STOREFEATUREBITSHH(hh); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, took me a little while to work out why this bit, until I saw that we're now reconstructing the feature bits from the entire hinthash. Is that OK? In general the hh might contain a lot more keys (e.g. other bits of enabled syntax and options), so iterating the whole thing might take a little while, as compared just storing/fetching the UV as we used to. |
||
hhop = newSVOP(OP_HINTSEVAL, 0, MUTABLE_SV(hh)); | ||
/* append hhop to only child */ | ||
op_sibling_splice(o, cUNOPo->op_first, 0, hhop); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -392,14 +392,7 @@ sub longest { | |
|
||
#define CLEARFEATUREBITS() (PL_compiling.cop_features = 0) | ||
|
||
#define STOREFEATUREBITSHH(hh) \\ | ||
(hv_stores((hh), "feature/bits", newSVuv(PL_compiling.cop_features))) | ||
|
||
#define FETCHFEATUREBITSHH(hh) \\ | ||
STMT_START { \\ | ||
SV **fbsv = hv_fetchs((hh), "feature/bits", FALSE); \\ | ||
PL_compiling.cop_features = fbsv ? SvUV(*fbsv) : 0; \\ | ||
} STMT_END | ||
#define FETCHFEATUREBITSHH(hh) S_fetch_feature_bits_hh(aTHX_ (hh)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This commit turned 1 |
||
|
||
#endif /* PERL_CORE or PERL_EXT */ | ||
|
||
|
@@ -434,7 +427,7 @@ sub longest { | |
} | ||
#endif /* PERL_IN_OP_C */ | ||
|
||
#ifdef PERL_IN_MG_C | ||
#if defined(PERL_IN_MG_C) || defined(PERL_IN_PP_CTL_C) | ||
|
||
#define magic_sethint_feature(keysv, keypv, keylen, valsv, valbool) \\ | ||
S_magic_sethint_feature(aTHX_ (keysv), (keypv), (keylen), (valsv), (valbool)) | ||
|
@@ -491,6 +484,49 @@ sub longest { | |
} | ||
#endif /* PERL_IN_MG_C */ | ||
|
||
/* subject to change */ | ||
struct perl_feature_bit { | ||
const char *name; | ||
STRLEN namelen; | ||
U32 mask; | ||
}; | ||
|
||
#ifdef PERL_IN_PP_CTL_C | ||
|
||
static const struct perl_feature_bit | ||
PL_feature_bits[] = { | ||
EOJ | ||
for my $key (sort keys %feature) { | ||
my $val = $feature{$key}; | ||
print $h <<EOJ; | ||
{ | ||
/* feature $key */ | ||
"feature_$val", | ||
STRLENs("feature_$val"), | ||
FEATURE_\U$val\E_BIT | ||
}, | ||
EOJ | ||
} | ||
|
||
print $h <<EOJ; | ||
{ NULL, 0, 0U } | ||
}; | ||
|
||
PERL_STATIC_INLINE void | ||
S_fetch_feature_bits_hh(pTHX_ HV *hh) { | ||
PL_compiling.cop_features = 0; | ||
|
||
const struct perl_feature_bit *fb = PL_feature_bits; | ||
while (fb->name) { | ||
SV **svp = hv_fetch(hh, fb->name, (I32)fb->namelen, 0); | ||
if (svp && SvTRUE(*svp)) | ||
PL_compiling.cop_features |= fb->mask; | ||
++fb; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This while loop has 26 hash key name entries to test/look for. All 26 hash keys, are never found in typical production perl code. The |
||
} | ||
} | ||
|
||
#endif | ||
|
||
#endif /* PERL_FEATURE_H_ */ | ||
EOJ | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.