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

Why does this module need multiplicity? #2

Closed
avar opened this issue Aug 1, 2016 · 3 comments
Closed

Why does this module need multiplicity? #2

avar opened this issue Aug 1, 2016 · 3 comments

Comments

@avar
Copy link

avar commented Aug 1, 2016

Is multiplicity a true hard requirement for this module? I've written XS modules for perl 5 that do:

1. I call my xs_function()
2. My xs_function() does some stuff()
3. The xs_function() calls some perl function via call_sv() or call_pv()

Thus I don't see why it wouldn't work to:

A. Start up a perl5 program
B. That perl5 program uses Inline::Perl6
C. A bunch of Perl 6 code gets executed, and returns

Or:

D. Instead of returning in C we use Inline::Perl5
E. When Inline::Perl5 calls something that resolves to call_sv() or call_pv()
F. Eventually we return to the top-level Inline::Perl6 routine in B

Is it possible that use-case A..C doesn't require multiplicity? That would already be quite nice because you could use this to bootstrap Perl 6 code for things that have an existing P5 API. Like mod_perl, or uWSGI's perl module, irssi plugins etc. You wouldn't be able to call any p5 code from Inline::Perl6, but that would be OK.

Or maybe A..F is possible. I can't see why, ignoring perl6 I've written C XS modules for Perl 5 that do exactly these sort of calls. Since there's no concurrency it works just fine.

Or is the multiplicity just because this is going to clone another interpreter for any hyperthreading ops? Maybe those could be disabled using some facility or forced to be serialized?

Aside from the "I need to recompile my perl" inconvenience having it need to spawn multiple perl interpreters could have a very bad (and silent?) impact on load times & memory use.

@niner
Copy link
Owner

niner commented Aug 5, 2016

What exactly makes you think that Inline::Perl6 needs multiplicity?
I'm asking because commit 8305f7b is explicitly there for supporting perls without multiplicity.

@avar
Copy link
Author

avar commented Aug 5, 2016

Because when I build it works, but running any of the tests I get:

# perl -Mblib t/01load.t 
ok 1
Unhandled exception: You need to compile perl with -DMULTIPLICITY for running multiple interpreters.
   at <unknown>:1  (/path/to/my/perl/site/lib/auto/Six/Rakudo/share/perl6/runtime/CORE.setting.moarvm:throw)
 from site#sources/3B0B691884D053BE76F42DB8F36C3421FCE9FB4C (Inline::Perl5):941  (/path/to/my/perl/site/lib/auto/Six/Rakudo/share/perl6/site/precomp/03419F43BFFCE0AEDE2CD622AE91E8513382EF49.1470046951.38947/3B/3B0B691884D053BE76F42DB8F36C3421FCE9FB4C:BUILD)
 from gen/moar/m-CORE.setting:978  (/path/to/my/perl/site/lib/auto/Six/Rakudo/share/perl6/runtime/CORE.setting.moarvm:BUILDALL)
 from gen/moar/m-CORE.setting:954  (/path/to/my/perl/site/lib/auto/Six/Rakudo/share/perl6/runtime/CORE.setting.moarvm:BUILDALL)
 from gen/moar/m-CORE.setting:950  (/path/to/my/perl/site/lib/auto/Six/Rakudo/share/perl6/runtime/CORE.setting.moarvm:bless)
 from gen/moar/m-CORE.setting:937  (/path/to/my/perl/site/lib/auto/Six/Rakudo/share/perl6/runtime/CORE.setting.moarvm:new)
 from gen/moar/m-CORE.setting:935  (/path/to/my/perl/site/lib/auto/Six/Rakudo/share/perl6/runtime/CORE.setting.moarvm:new)
 from site#sources/3B0B691884D053BE76F42DB8F36C3421FCE9FB4C (Inline::Perl5):1054  (/path/to/my/perl/site/lib/auto/Six/Rakudo/share/perl6/site/precomp/03419F43BFFCE0AEDE2CD622AE91E8513382EF49.1470046951.38947/3B/3B0B691884D053BE76F42DB8F36C3421FCE9FB4C:)
 from <unknown>:1  (/path/to/my/perl/site/lib/auto/Six/Rakudo/share/perl6/runtime/perl6.moarvm:<entry>)
Aborted

The build parameters for the perl are:

  Platform:
    osname=linux, osvers=2.6.32-642.3.1.el6.x86_64, archname=x86_64-linux
    uname='linux package-201.lhr4.prod.booking.com 2.6.32-642.3.1.el6.x86_64 #1 smp tue jul 12 18:30:56 utc 2016 x86_64 x86_64 x86_64 gnulinux '
    config_args='-des -DSILENT_NO_TAINT_SUPPORT -Dprefix=/path/to/my/perl -Uusevendorprefix -Dsiteprefix=/path/to/my/perl -Dinstallprefix=/path/to/my/perl -Dinstallstyle=lib -Darchlib=/path/to/my/perl/lib -Dman1dir=/path/to/my/perl/man/man1 -Dman3dir=/path/to/my/perl/man/man3 -Dprivlib=/path/to/my/perl/lib -Dsitearch=/path/to/my/perl/site/lib -Dsitebin=/path/to/my/perl/site/bin -Dsitelib=/path/to/my/perl/site/lib -Dsiteman1dir=/path/to/my/perl/site/man/man1 -Dsiteman3dir=/path/to/my/perl/site/man/man3 -Dcc=gcc -Dlibpth=/path/to/my/perl/lib /usr/lib64  -Dglibpth=/path/to/my/perl/lib /usr/lib64  -Dscriptdir=/path/to/my/perl/bin -Uinstallusrbinperl -Duseshrplib -Dusesitecustomize -Aoptimize=-g -Di_db -A prepend:libswanted=pthread '
    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-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2 -g',
    cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.4.7 20120313 (Red Hat 4.4.7-4)', 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 =' -fstack-protector'
    libpth=/usr/lib64
    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.12'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/path/to/my/perl/lib/CORE'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -g -fstack-protector'


Characteristics of this binary (from libperl): 
  Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
                        PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_64_BIT_ALL
                        USE_64_BIT_INT USE_LARGE_FILES USE_LOCALE
                        USE_LOCALE_COLLATE USE_LOCALE_CTYPE
                        USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
                        USE_SITECUSTOMIZE

@niner
Copy link
Owner

niner commented Aug 5, 2016

Turns out this was a regression caused by a change in Inline::Perl5 which is now fixed in niner/Inline-Perl5@de59782

Please upgrade your Inline::Perl5 to 0.9. Then you can use your normal perl installation.
Thanks for pointing out what should have been quite obvious!

@niner niner closed this as completed Aug 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants