diff options
author | Marc Reisner <reisner.marc@gmail.com> | 2021-04-05 11:56:29 -0500 |
---|---|---|
committer | Paul Evans <leonerd@leonerd.org.uk> | 2021-04-15 00:12:27 +0100 |
commit | 5f65868c2ca80b3ca5d0cebbbaf7241caa69c65f (patch) | |
tree | 01f993f9ae4c9c4d6d2c2c20977dab639a0c9693 /universal.c | |
parent | 5611ffc345393211770ee36bf0e3782dc7b0dcef (diff) | |
download | perl-5f65868c2ca80b3ca5d0cebbbaf7241caa69c65f.tar.gz |
Add GV_NOUNIVERSAL flag to skip UNIVERSAL lookup
For the `isa` infix operator, we can fall back to `sv_derived_from_sv`
instead of looking up UNIVERSAL::isa. Passing GV_NOUNIVERSAL will tell
gv_fetchmeth_internal not to look at UNIVERSAL for the method, and instead
return NULL. Then `Perl_sv_isa_sv` will skip the if block and check
`sv_derived_from_sv` which does the same thing UNIVERSAL::isa would have done.
Diffstat (limited to 'universal.c')
-rw-r--r-- | universal.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/universal.c b/universal.c index b839e5151d..5932767bdf 100644 --- a/universal.c +++ b/universal.c @@ -216,10 +216,7 @@ Perl_sv_isa_sv(pTHX_ SV *sv, SV *namesv) if(!SvROK(sv) || !SvOBJECT(SvRV(sv))) return FALSE; - /* TODO: Consider if we want a NOUNIVERSAL flag to skip the - * UNIVERSAL lookup - */ - isagv = gv_fetchmeth_pvn(SvSTASH(SvRV(sv)), "isa", 3, -1, 0); + isagv = gv_fetchmeth_pvn(SvSTASH(SvRV(sv)), "isa", 3, -1, GV_NOUNIVERSAL); if(isagv) { dSP; CV *isacv = isGV(isagv) ? GvCV(isagv) : (CV *)isagv; |