develooper Front page | perl.perl5.porters | Postings from December 2000

PERLVAR + MULTIPLICITY

Thread Next
From:
Doug MacEachern
Date:
December 21, 2000 11:34
Subject:
PERLVAR + MULTIPLICITY
Message ID:
Pine.LNX.4.10.10012211038380.7347-100000@mojo.covalent.net
perlapi.c defines PERLVAR as this:

#define PERLVAR(v,t)	t* Perl_##v##_ptr(pTHX)				\
			{ return &(aTHX->v); }

which is then used along the lines of:
SV **sp = (*Perl_Tstack_sp_ptr(my_perl));

why the function call and not just:

#define PERLVAR(v,t)    (t *)&(aTHX->v)

?

looking at gcc -O -S output, these function calls are not inlined.

a typical xsub ends up calling:
Perl_Tstack_sp_ptr() : 2
Perl_Tstack_base_ptr() : 4 + (items * 4) (i.e. 8 for 1 arg, 12 for 2 args)
Perl_Tmarkstack_ptr_ptr() : 1
Perl_Top_ptr() : 2

Summary of my perl5 (revision 5.0 version 7 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.2.7, archname=i686-linux-thread-multi
    uname='linux mojo 2.2.16 #1 smp fri sep 15 14:51:18 pdt 2000 i686 unknown '
    config_args='-des -Dprefix=/usr/local/ithrperl -Dusethreads -Doptimize=-g -Dusedevel'
    hint=previous, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-g',
    cppflags='-D_REENTRANT -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    ccversion='', gccversion='egcs-2.91.66 19990314 (egcs-1.1.2 release)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lpthread -lc -lposix -lcrypt -lutil
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: DEBUGGING MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
  Locally applied patches:
  	DEVEL8210
  Built under linux
  Compiled at Dec 20 2000 18:59:42
  @INC:
    /usr/local/ithrperl/lib/5.7.0/i686-linux-thread-multi
    /usr/local/ithrperl/lib/5.7.0
    /usr/local/ithrperl/lib/site_perl/5.7.0/i686-linux-thread-multi
    /usr/local/ithrperl/lib/site_perl/5.7.0
    /usr/local/ithrperl/lib/site_perl
    .


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About