summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorMarc Reisner <reisner.marc@gmail.com>2021-04-05 11:56:29 -0500
committerPaul Evans <leonerd@leonerd.org.uk>2021-04-15 00:12:27 +0100
commit5f65868c2ca80b3ca5d0cebbbaf7241caa69c65f (patch)
tree01f993f9ae4c9c4d6d2c2c20977dab639a0c9693 /gv.c
parent5611ffc345393211770ee36bf0e3782dc7b0dcef (diff)
downloadperl-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 'gv.c')
-rw-r--r--gv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gv.c b/gv.c
index 861f65c237..4660003a53 100644
--- a/gv.c
+++ b/gv.c
@@ -890,7 +890,7 @@ S_gv_fetchmeth_internal(pTHX_ HV* stash, SV* meth, const char* name, STRLEN len,
}
/* Check UNIVERSAL without caching */
- if(level == 0 || level == -1) {
+ if((level == 0 || level == -1) && !(flags & GV_NOUNIVERSAL)) {
candidate = gv_fetchmeth_internal(NULL, meth, name, len, 1,
flags &~GV_SUPER);
if(candidate) {