develooper Front page | perl.perl5.porters | Postings from April 2011

[perl #89188] PVBM pad constants aren't BM

nick @ eris . etla . org
April 27, 2011 00:31
[perl #89188] PVBM pad constants aren't BM
Message ID:
# New Ticket Created by 
# Please include the string:  [perl #89188]
# in the subject line of all future correspondence about this issue. 
# <URL: >

This is a bug report for perl from,
generated with the help of perlbug 1.36 running under perl 5.10.0.

[Please enter your report here]

Under ithreads:

$ ./perl -Ilib -MDevel::Peek -e 'use constant PVBM => "Foo"; my $dummy = index "Foo", PVBM; Dump(PVBM)' 
SV = PVGV(0x88cd78) at 0x84a9d0
  REFCNT = 1
  IV = 0
  NV = 0
  PV = 0x8590d8 "Foo"\0
  CUR = 3
  LEN = 8

That's very interesting, but why is it a PVGV *without* Boyer Moore data.
[That rather convoluted piece of code by Ben Morrow produces a PVBM accessible
to Perl space, something I didn't think was possible.]

At least, it does without ithreads. With ithreads, something drops the useful
part. It's an old problem:

[nicholas@dromedary perl]$ ~/Reference/5.8.0-default/bin/perl5.8.0  -MDevel::Peek -e 'use constant PVBM => "galumphing"; my $dummy = index "galumphing", PVBM; Dump(PVBM)'
SV = PVBM(0x3899800) at 0x38b9100
  REFCNT = 3
  UV = 0
  NV = 0
  PV = 0x3897620 "galumphing"\0
  CUR = 10
  LEN = 268
  MAGIC = 0x3861f30
    MG_VIRTUAL = &PL_vtbl_bm
[nicholas@dromedary perl]$ ~/Reference/5.8.0-thread/bin/perl5.8.0  -MDevel::Peek -e 'use constant PVBM => "galumphing"; my $dummy = index "galumphing", PVBM; Dump(PVBM)'
SV = PVBM(0x11431430) at 0x113b4790
  REFCNT = 1
  IV = 0
  NV = 0
  PV = 0x113acb10 "galumphing"\0
  CUR = 10
  LEN = 11

Really the pad constant should either be a PV, or a PV"BM" with all the
trimmings. Using a PV"BM" that acts as plain PV is a small waste of memory.
Not using a PV"BM" is a performance loss.

Nicholas Clark

[Please do not change anything below this line]
Site configuration information for perl 5.10.0:

Configured by nick at Sun Apr 24 21:18:40 BST 2011.

Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
    osname=linux, osvers=, archname=x86_64-linux-thread-multi
    uname='linux eris #4 smp tue sep 21 09:54:22 bst 2010 x86_64 gnulinux '
    config_args='-des -Dusedevel -Dusethreads -Doptimize=-g -Dcc=ccache gcc -Dld=gcc -Dnoextensions=IPC/SysV Encode DB_File'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
    cc='ccache gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include'
    ccversion='', gccversion='4.3.2', 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='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64
    libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -g -L/usr/local/lib'

Locally applied patches:

@INC for perl 5.10.0:

Environment for perl 5.10.0:
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)
    SHELL=/bin/bash Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About