diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-12-20 20:13:12 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-12-20 20:13:12 +0000 |
commit | 62d55b227f6b1e95d65e7faf12ed22fd467e4c0e (patch) | |
tree | 878ebaec9c22b6cea9c0ddb9e303b2ea782dc6f4 /gv.c | |
parent | b204bbd55f0b19ee3a808931bc9154c7a5183948 (diff) | |
download | perl-62d55b227f6b1e95d65e7faf12ed22fd467e4c0e.tar.gz |
Take care in toke.c not to convert constant subroutine reference
proxies into full blown PVGVs with PVCVs, and recognise them and inline
their values. Adds a new function gv_const_sv(gv) to return the value
of the constant subroutine from a GV, and adds a cv parameter to
S_intuit_method.
p4raw-id: //depot/perl@26427
Diffstat (limited to 'gv.c')
-rw-r--r-- | gv.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -122,6 +122,25 @@ Perl_gv_fetchfile(pTHX_ const char *name) return gv; } +/* +=for apidoc gv_const_sv + +If C<gv> is a typeglob whose subroutine entry is a constant sub eligible for +inlining, or C<gv> is a placeholder reference that would be promoted to such +a typeglob, then returns the value returned by the sub. Otherwise, returns +NULL. + +=cut +*/ + +SV * +Perl_gv_const_sv(pTHX_ GV *gv) +{ + if (SvTYPE(gv) == SVt_PVGV) + return cv_const_sv(GvCVu(gv)); + return SvROK(gv) ? SvRV(gv) : NULL; +} + void Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi) { |