From 5f65868c2ca80b3ca5d0cebbbaf7241caa69c65f Mon Sep 17 00:00:00 2001 From: Marc Reisner Date: Mon, 5 Apr 2021 11:56:29 -0500 Subject: 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. --- universal.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'universal.c') 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; -- cgit v1.2.1