Skip to content
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

Two DB::lsub oddities #13264

Open
p5pRT opened this issue Sep 15, 2013 · 5 comments
Open

Two DB::lsub oddities #13264

p5pRT opened this issue Sep 15, 2013 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Sep 15, 2013

Migrated from rt.perl.org#119811 (status was 'open')

Searchable as RT119811$

@p5pRT
Copy link
Author

p5pRT commented Sep 15, 2013

From @cpansprout

DB​::sub has to exist for DB​::lsub to be called.

#!perl -d​:Peek
sub DB​::DB{}
sub DB​::lsub { warn "called" }
sub foo :lvalue {}
foo(); # utter silence

#!perl -d​:Peek
sub DB​::DB{}
sub DB​::lsub { warn "called" }
sub DB​::sub{} # dummy sub
sub foo :lvalue {}
foo(); # utter silence
__END__
called at - line 3.

Why this limitation?

Also, if DB​::sub is defined, then DB​::lsub lookup autovivifies %DB​::lsub (the hash), even if &DB​::lsub is not defined. It has been this way since 1ad62f6 added support for lsub.

#!perl -d​:Peek

sub DB​::DB {}
sub DB​::sub {}

sub foo​:lvalue{}
foo();
Dump $DB​::{lsub};
__END__
SV = PVGV(0x7ff003066790) at 0x7ff003029808
  REFCNT = 1
  FLAGS = (MULTI)
  NAME = "lsub"
  NAMELEN = 4
  GvSTASH = 0x7ff0030052e8 "DB"
  GP = 0x7ff002c0bcc0
  SV = 0x0
  REFCNT = 1
  IO = 0x0
  FORM = 0x0
  AV = 0x0
  HV = 0x7ff003029820 <----- look
  CV = 0x0
  CVGEN = 0x0
  LINE = 7
  FILE = "-"
  FLAGS = 0x2
  EGV = 0x7ff003029808 "lsub"

Why on earth is that hash being vivified? What is it for?


Flags​:
  category=core
  severity=low


Site configuration information for perl 5.19.4​:

Configured by sprout at Mon Sep 9 00​:16​:24 PDT 2013.

Summary of my perl5 (revision 5 version 19 subversion 4) configuration​:
  Commit id​: d47819ff6f55bfaa4b7eddc66c6db7d7dfdec11c
  Platform​:
  osname=darwin, osvers=12.2.0, archname=darwin-2level
  uname='darwin pint.local 12.2.0 darwin kernel version 12.2.0​: sat aug 25 00​:48​:52 pdt 2012; root​:xnu-2050.18.24~1release_x86_64 x86_64 '
  config_args='-de -Dcc=gcc -Dusedevel -Doptimize=-ggdb3 -Aoptimize=-O0 -DDEBUGGING'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=undef, usemultiplicity=undef
  useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
  use64bitint=define, use64bitall=define, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='gcc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include',
  optimize='-ggdb3 -O0',
  cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
  ccversion='', gccversion='4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)', gccosandvers=''
  intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -L/usr/local/lib'
  libpth=/usr/local/lib /usr/lib
  libs=-ldbm -ldl -lm -lutil -lc
  perllibs=-ldl -lm -lutil -lc
  libc=, so=dylib, useshrplib=false, libperl=libperl.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
  cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector'


@​INC for perl 5.19.4​:
  lib
  /usr/local/lib/perl5/site_perl/5.19.4/darwin-2level
  /usr/local/lib/perl5/site_perl/5.19.4
  /usr/local/lib/perl5/5.19.4/darwin-2level
  /usr/local/lib/perl5/5.19.4
  /usr/local/lib/perl5/site_perl
  .


Environment for perl 5.19.4​:
  DYLD_LIBRARY_PATH (unset)
  HOME=/Users/sprout
  LANG=en_US.UTF-8
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/usr/bin​:/bin​:/usr/sbin​:/sbin​:/usr/local/bin​:/usr/local/bin
  PERL_BADLANG (unset)
  SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Oct 29, 2013

From @cpansprout

On Sun Sep 15 13​:27​:04 2013, sprout wrote​:

Also, if DB​::sub is defined, then DB​::lsub lookup autovivifies
%DB​::lsub (the hash), even if &DB​::lsub is not defined. It has been
this way since 1ad62f6 added support for lsub.

That part of this ticket is fixed in 07b605e.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Oct 29, 2013

From [Unknown Contact. See original ticket]

On Sun Sep 15 13​:27​:04 2013, sprout wrote​:

Also, if DB​::sub is defined, then DB​::lsub lookup autovivifies
%DB​::lsub (the hash), even if &DB​::lsub is not defined. It has been
this way since 1ad62f6 added support for lsub.

That part of this ticket is fixed in 07b605e.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Nov 23, 2017

From zefram@fysh.org

Father Chrysostomos wrote​:

DB​::sub has to exist for DB​::lsub to be called.
...
Why this limitation?

It might perhaps be in order to avoid making sub calls any more expensive
than they already are. Some logic other than the actual DB​::{,l}sub()
call is controlled by the existence of DB​::sub(), and non-debugging calls
would get more expensive if DB​::lsub() had to be checked for as well.
However, the extra expense would in the usual case be only a check of
the CvLVALUE flag. Any opinion on whether that cost is worth incurring?

In the case of an lvalue sub there'd also be the extra cost of looking
up the *DB​::lsub glob, which is currently done by name. We'd probably
want to add a PL_DBlsub variable to provide direct access to the glob.

-zefram

@p5pRT
Copy link
Author

p5pRT commented Nov 23, 2017

The RT System itself - Status changed from 'new' to 'open'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants