Giter Site home page Giter Site logo

nqp's Introduction

NQP - Not Quite Perl

NQP is Copyright (C) 2009-2020 by The Perl Foundation. See LICENSE for licensing details.

This is "Not Quite Perl" -- a lightweight Raku-like environment for virtual machines. The key feature of NQP is that it's designed to be a very small environment (as compared with, say, raku or Rakudo) and is focused on being a high-level way to create compilers and libraries for virtual machines like MoarVM, the JVM, and others.

Unlike a full-fledged implementation of Raku, NQP strives to have as small a runtime footprint as it can, while still providing a Raku object model and regular expression engine for the virtual machine.

Building from source

To build NQP from source, you'll just need a make utility and Perl 5.8 or newer. To automatically obtain and build MoarVM you may also need a git client.

To obtain NQP directly from its repository:

$ git clone git://github.com/Raku/nqp.git

If you don't have git installed, you can get a tarball or zip of NQP from github by visiting http://github.com/Raku/nqp/tree/main and clicking "Download". Then unpack the tarball or zip.

NQP can run on three different backends: MoarVM, the JVM, and JavaScript. The JVM and JavaScript backends are currently experimental. The JVM backend requires JDK 1.9 (also known as JDK 9) or higher.

Once you have a copy of NQP, decide which backends you want to run, and configure and build it as follows:

$ cd nqp
$ perl Configure.pl --with-moar=/path/to/moar --backends=moar,jvm
$ make

If you don't have an installed MoarVM, you can have Configure.pl download and build one for you as well -- by passing the --gen-moar option to it (instead of --with-moar):

$ cd nqp
$ perl Configure.pl --gen-moar --backends=moar,jvm
$ make

The make step will create a nqp or nqp.exe executable in the current directory. Programs can then be run from the build directory using a command like:

$ ./nqp hello.nqp

By default, NQP searches for the MoarVM executable and installs to the directory ./install. You can change that with the --prefix option to Configure.pl; this will point to the directory prefix where `moar` is installed, such as `/usr`; it needs to be the same one used when configuring MoarVM unless you use the option `--with-moar`. This optional argument should point to the installed `moar` executable; for instance, `--with-moar=/usr/local/bin/moar`.

Once built, NQP's make install target will install NQP and its libraries into the same location as the MoarVM installation that was used to create it. Until this step is performed, the nqp executable created by make above can only be reliably run from the root of NQP's build directory. After make install is performed the executable can be run from any directory.

If the NQP compiler is invoked without an explicit script to run, it enters a small interactive mode that allows statements to be executed from the command line. Each line entered is treated as a separate compilation unit, however (which means that subroutines are preserved after they are defined, but variables are not).

Troubleshooting

OS X

On OS X, it appears that configuration fails in some configurations:

3rdparty/libuv/include/uv-darwin.h:26:11: fatal error: 'mach/mach.h' file not found

Should this happen to you, then a solution might be the following:

$ cd MoarVM/3rdparty/libuv/include
$ ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/mach
$ cd ../../../..
$ # run the Configure again

Note that the 10.9 in the above, represents the major version of OS X being used. On Mavericks use 10.9 (like above), on Yosemite use 10.10.

JVM

If attempting to run NQP on the JVM results in NQP claiming it couldn't reserve enough memory, you may need to increase the memory limit of your shell like so:

$ ulimit -d 6144000

Using NQP

NOTE: there's no end-user support for NQP and the behaviour can change without notice. It's a tool for writing Raku compilers, not a low-level module for Raku programmers.

The examples directory is a good place to start, with the loops and other files. Opcodes are listed in the docs directory. NQP also has built-in routines listed in the docs directory. You can use NQP from this release, it will be already installed if you have built Raku from scratch.

JavaScript backend

The best thing before playing with it/hacking on it is to contact pmurias via IRC at #raku on irc.libera.chat. We depend on node.js at least 10.10.0

Building the JavaScript backend currently requires building the moar backend:

$ perl Configure.pl --backends=moar,js
$ make

Currently it needs to be run like:

$ ./nqp-js file.nqp

If you are developing nqp-js, you may want to pass the --link option to configure to have the nqp-runtime linked instead of installed

$ cd src/vm/js/nqp-runtime; npm link .
$ perl Configure --backends=moar,js

nqp's People

Contributors

alexdaniel avatar altai-man avatar arnsholt avatar bacek avatar coke avatar donaldh avatar dwarring avatar froggs avatar hoelzro avatar jdv avatar jnthn avatar kaiepi avatar lizmat avatar masterduke17 avatar moritz avatar niner avatar patrickbkr avatar patzim avatar peschwa avatar pmichaud avatar pmurias avatar samcv avatar sorear avatar tbrowder avatar timo avatar timtoady avatar tisonkun avatar usev6 avatar vrurg avatar zoffixznet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nqp's Issues

No $*CALLER::FOO

I attempted to write the following:

    my $old := $*VAR;
    my $*VAR := 'new value';

To my surprise, $old ended up undefined due to $_VAR being declared at ENTER time. I am informed that $_CALLER::VAR would do what I wanted, so an implementation of that would be very useful.

`sub a:b['c']` generates `.sub "a:b<Capture[0x...]>"`

It seems that colonpair_str returns what I guess to be a PCT node instead of a string for the :b['c'] syntax. To expand the terse example in the title:

sub a:b['c']() { say("hi") }

generates the following PIR

.sub "a:b<Capture[0xeafa6588]>"  :subid("11_1313977936.07837") :outer("10_1313977936.07837")
    $P100 = "say"("hi")
    .return ($P100)
.end

This may seem somewhat cosmetic, but this also affects grammars, so the following from nom's setting:

    token special_variable:sym['$<'] {
        <sym> <!before \s* \w+ \s* '>' >

generates:

.sub "special_variable:sym<Capture[0xf4820400]>"  :subid("461_1313948700.73446") :method :outer("11_1313948700.73446")
    # cut for brevity
    ne $S10, "Capture[0xf4820400]", rx2590_fail

Which means that it doesn't match what it should.

Mac OS X: -Werror=strict-prototypes causes compilation of dyncall_thunk* to fail

The switch -Werror=strict-prototypes causes compilation of dyncall to fail. Here's the end of the compile log (a larger extract can be found at http://pastebin.com/NBnaQ24s):

In file included from dyncall_thunk.c:27:
dyncall_thunk.h:59: error: function declaration isn't a prototype
In file included from dyncall_thunk.h:64,
from dyncall_thunk.c:27:
dyncall_thunk_x64.h:32: error: function declaration isn't a prototype
In file included from dyncall_thunk.c:33:
dyncall_thunk_x64.c:28: error: function declaration isn't a prototype
make[2]: *** [dyncall_thunk.o] Error 1
make[1]: *** [dyncallback] Error 2
make: *** [3rdparty/dyncall/dyncall/libdyncall_s.a] Error 2

I'm compiling with the tools that come with Xcode 4.3.2 (4E2002):
i686-apple-darwin11-llvm-gcc-4.2
i686-apple-darwin11-llvm-g++-4.2

The flag itself is imported from parrot (or at least I could find it nowhere in the nqp source, but it does exist in the parrot source). To test I tried compiling the latest version of the dyncall library (0.7) on the same machine I I get the same behaviour. If I add the flag (which doesn't exist in their Makefile) then the compile fails with exactly the same error, otherwise it compiles with no problems.

nqp fails to compile with Segmentation fault message.

$ git clone git://github.com/perl6/nqp.git
$ cd nqp/
$ perl Configure.pl
$ make
...
/usr/bin/parrot -L. -X. --library=src/stage1 src/stage1/nqp.pbc
--target=pir --output=src/stage2/gen/NQPCORE.setting.pir
--module-path=src/stage2 --setting=NULL src/stage2/NQPCORE.setting
/usr/bin/parrot -L. -X. -o src/stage2/NQPCORE.setting.pbc src/stage2/gen/NQPCORE.setting.pir
/usr/bin/perl5.16.2 -MExtUtils::Command -e mkpath src/stage2/gen
/usr/bin/perl5.16.2 tools/build/gen-cat.pl src/QAST/CompileTimeValue.nqp src/QAST/SpecialArg.nqp src/QAST/Node.nqp src/QAST/Regex.nqp src/QAST/IVal.nqp src/QAST/NVal.nqp src/QAST/SVal.nqp src/QAST/BVal.nqp src/QAST/WVal.nqp src/QAST/Want.nqp src/QAST/Var.nqp src/QAST/VarWithFallback.nqp src/QAST/Op.nqp src/QAST/VM.nqp src/QAST/Stmts.nqp src/QAST/Stmt.nqp src/QAST/Block.nqp src/QAST/Unquote.nqp src/QAST/CompUnit.nqp src/QAST/InlinePlaceholder.nqp > src/stage2/QASTNode.nqp
/usr/bin/parrot -L. -X. --library=src/stage1 src/stage1/nqp.pbc
--target=pir --output=src/stage2/QASTNode.pir --no-regex-lib
--module-path=src/stage2 --setting-path=src/stage2 src/stage2/QASTNode.nqp
/usr/bin/parrot -L. -X. -o src/stage2/QASTNode.pbc src/stage2/QASTNode.pir
/usr/bin/perl5.16.2 -MExtUtils::Command -e mkpath src/stage2/gen
/usr/bin/perl5.16.2 tools/build/gen-cat.pl src/QRegex/NFA.nqp src/QRegex/Cursor.nqp > src/stage2/QRegex.nqp
/usr/bin/parrot -L. -X. --library=src/stage1 src/stage1/nqp.pbc
--target=pir --output=src/stage2/QRegex.pir --no-regex-lib
--module-path=src/stage2 --setting-path=src/stage2 src/stage2/QRegex.nqp
/usr/bin/parrot -L. -X. -o src/stage2/QRegex.pbc src/stage2/QRegex.pir
/usr/bin/perl5.16.2 -MExtUtils::Command -e mkpath src/stage2/gen
/usr/bin/perl5.16.2 tools/build/gen-cat.pl src/HLL/Grammar.pm src/HLL/Actions.pm src/HLL/Compiler.pm src/HLL/CommandLine.pm src/HLL/World.pm > src/stage2/gen/NQPHLL.pm
/usr/bin/parrot -L. -X. --library=src/stage1 src/stage1/nqp.pbc
--target=pir --output=src/stage2/gen/NQPHLL.pir --no-regex-lib
--module-path=src/stage2 --setting-path=src/stage2 src/stage2/gen/NQPHLL.pm
/usr/bin/parrot -L. -X. --include=src/stage2 -o src/stage2/NQPHLL.pbc
src/stage2/gen/NQPHLL.pir
/usr/bin/perl5.16.2 -MExtUtils::Command -e mkpath src/stage2/gen
/usr/bin/perl5.16.2 tools/build/gen-cat.pl src/QAST/PIRT.nqp src/QAST/Operations.nqp src/QAST/Compiler.nqp > src/stage2/QAST.nqp
/usr/bin/parrot -L. -X. --library=src/stage1 src/stage1/nqp.pbc
--target=pir --output=src/stage2/QAST.pir --no-regex-lib
--module-path=src/stage2 --setting-path=src/stage2 src/stage2/QAST.nqp
/usr/bin/parrot -L. -X. -o src/stage2/QAST.pbc src/stage2/QAST.pir
/usr/bin/perl5.16.2 -MExtUtils::Command -e mkpath src/stage2/gen
/usr/bin/perl5.16.2 tools/build/gen-cat.pl src/QRegex/P6Regex/Grammar.nqp src/QRegex/P6Regex/Actions.nqp src/QRegex/P6Regex/Compiler.nqp > src/stage2/gen/NQPP6QRegex.pm
/usr/bin/parrot -L. -X. --library=src/stage1 src/stage1/nqp.pbc
--target=pir --output=src/stage2/gen/NQPP6QRegex.pir --no-regex-lib
--module-path=src/stage2 --setting-path=src/stage2 src/stage2/gen/NQPP6QRegex.pm
/usr/bin/parrot -L. -X. --include=src/stage2 -o src/stage2/NQPP6QRegex.pbc
src/stage2/gen/NQPP6QRegex.pir
/usr/bin/perl5.16.2 -MExtUtils::Command -e mkpath src/stage2/gen
/usr/bin/perl5.16.2 tools/build/gen-version.pl >src/gen/nqp-config.pm
/usr/bin/perl5.16.2 tools/build/gen-cat.pl src/NQP/World.pm src/NQP/Grammar.pm src/NQP/Ops.pm src/NQP/Actions.pm src/NQP/Compiler.pm src/gen/nqp-config.pm > src/stage2/gen/NQP.pm
/usr/bin/parrot -L. -X. --library=src/stage1 src/stage1/nqp.pbc
--target=pir --output=src/stage2/gen/NQP.pir
--module-path=src/stage2 --setting-path=src/stage2 src/stage2/gen/NQP.pm
make: *** [src/stage2/nqp.pbc] Segmentation fault

MAC OS warning: initializing 'char *' with an expression of type 'const char *'

Xcode 4.3.2

nqp_bigint_ops.c:4169:13: warning: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Wincompatible-pointer-types]
    char  * buf = Parrot_str_cstring(interp, SREG(2));
            ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nqp_bigint_ops.c:4180:13: warning: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Wincompatible-pointer-types]
    char  * buf = Parrot_str_cstring(interp, SCONST(2));
            ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nqp_bigint_ops.c:4191:13: warning: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Wincompatible-pointer-types]
    char  * buf = Parrot_str_cstring(interp, SREG(2));
            ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nqp_bigint_ops.c:4202:13: warning: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Wincompatible-pointer-types]
    char  * buf = Parrot_str_cstring(interp, SCONST(2));
            ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Port Match to 6model

Regex::Match needs to get 6model-ized. Main challenge: 6model doesn't do PMC inheritance and won't (unless/until PMCs change to become 6model objects). Also a couple of the attributes can become native int ones. No need to turn this into NQP - a PIR port is a good enough start and will be enough to close this ticket.

nqp segv

00:02 < [Coke]> anyone know how I can invoke a sub in nqp when I have the 
                /name/ of the sub in a var? "command"(@args) works, but my $a 
                := 'command'; "$a"(@args) # fails.
00:12 < sorear> [Coke]: how is the sub defined?
00:13 < sorear> maybe some variation on pir::find_lex__PS($a)(@args)
00:14 < [Coke]> in a .pm that is precompiled to pir and then use'd
00:14 < [Coke]> (and the sub is exported, so it's visible)
00:16 < [Coke]> nqp: sub v($a) {say($a)}; pir::find_lex__PS("v")(4);
00:16 <+p6eval> nqp: OUTPUT«(signal SEGV)»
00:17 < sorear> nqp: sub v($a) {say($a)}; pir::find_lex__PS("foo")(4);
00:17 <+p6eval> nqp: OUTPUT«(signal SEGV)»
00:17 < sorear> nqp: sub v($a) {say($a)}; pir::find_lex__PS("&v")(4);
00:17 <+p6eval> nqp: OUTPUT«4␤»
00:17  * [Coke] opens issue#58 for that.
00:17 < sorear> nqp: pir::find_lex__PS("v")(4);
00:17 <+p6eval> nqp: OUTPUT«(signal SEGV)»
00:18 < sorear> found a working version and golfed the crash \o/
00:18 < [Coke]> me updates.

MAC OS X warning: equality comparison with extraneous parentheses

Xcode 4.3.2

Compiler is overreacting here, looks like it expects if(comaprison) or if((assignment)).

nqp_bigint_ops.c:3192:17: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
    if ((result == MP_VAL)) {
         ~~~~~~~^~~~~~~~~
nqp_bigint_ops.c:3192:17: note: remove extraneous parentheses around the comparison to silence this warning
    if ((result == MP_VAL)) {
        ~       ^        ~
nqp_bigint_ops.c:3192:17: note: use '=' to turn this equality comparison into an assignment
    if ((result == MP_VAL)) {
                ^~
                =
nqp_bigint_ops.c:3209:17: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
    if ((result == MP_VAL)) {
         ~~~~~~~^~~~~~~~~
nqp_bigint_ops.c:3209:17: note: remove extraneous parentheses around the comparison to silence this warning
    if ((result == MP_VAL)) {
        ~       ^        ~
nqp_bigint_ops.c:3209:17: note: use '=' to turn this equality comparison into an assignment
    if ((result == MP_VAL)) {
                ^~
                =
nqp_bigint_ops.c:3226:17: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
    if ((result == MP_VAL)) {
         ~~~~~~~^~~~~~~~~
nqp_bigint_ops.c:3226:17: note: remove extraneous parentheses around the comparison to silence this warning
    if ((result == MP_VAL)) {
        ~       ^        ~
nqp_bigint_ops.c:3226:17: note: use '=' to turn this equality comparison into an assignment
    if ((result == MP_VAL)) {
                ^~
                =
nqp_bigint_ops.c:3243:17: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
    if ((result == MP_VAL)) {
         ~~~~~~~^~~~~~~~~
nqp_bigint_ops.c:3243:17: note: remove extraneous parentheses around the comparison to silence this warning
    if ((result == MP_VAL)) {
        ~       ^        ~
nqp_bigint_ops.c:3243:17: note: use '=' to turn this equality comparison into an assignment
    if ((result == MP_VAL)) {
                ^~
                =
nqp_bigint_ops.c:3260:17: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
    if ((result == MP_VAL)) {
         ~~~~~~~^~~~~~~~~
nqp_bigint_ops.c:3260:17: note: remove extraneous parentheses around the comparison to silence this warning
    if ((result == MP_VAL)) {
        ~       ^        ~
nqp_bigint_ops.c:3260:17: note: use '=' to turn this equality comparison into an assignment
    if ((result == MP_VAL)) {
                ^~
                =
nqp_bigint_ops.c:3277:17: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
    if ((result == MP_VAL)) {
         ~~~~~~~^~~~~~~~~
nqp_bigint_ops.c:3277:17: note: remove extraneous parentheses around the comparison to silence this warning
    if ((result == MP_VAL)) {
        ~       ^        ~
nqp_bigint_ops.c:3277:17: note: use '=' to turn this equality comparison into an assignment
    if ((result == MP_VAL)) {
                ^~
                =
nqp_bigint_ops.c:3294:17: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
    if ((result == MP_VAL)) {
         ~~~~~~~^~~~~~~~~
nqp_bigint_ops.c:3294:17: note: remove extraneous parentheses around the comparison to silence this warning
    if ((result == MP_VAL)) {
        ~       ^        ~
nqp_bigint_ops.c:3294:17: note: use '=' to turn this equality comparison into an assignment
    if ((result == MP_VAL)) {
                ^~
                =
nqp_bigint_ops.c:3311:17: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
    if ((result == MP_VAL)) {
         ~~~~~~~^~~~~~~~~
nqp_bigint_ops.c:3311:17: note: remove extraneous parentheses around the comparison to silence this warning
    if ((result == MP_VAL)) {
        ~       ^        ~
nqp_bigint_ops.c:3311:17: note: use '=' to turn this equality comparison into an assignment
    if ((result == MP_VAL)) {
                ^~

nqp_bigint_ops.c:8522:18: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
        if ((cmp == MP_GT)) {
             ~~~~^~~~~~~~
nqp_bigint_ops.c:8522:18: note: remove extraneous parentheses around the comparison to silence this warning
        if ((cmp == MP_GT)) {
            ~    ^       ~
nqp_bigint_ops.c:8522:18: note: use '=' to turn this equality comparison into an assignment
        if ((cmp == MP_GT)) {
                 ^~
                 =
nqp_bigint_ops.c:8581:18: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
        if ((cmp == MP_GT)) {
             ~~~~^~~~~~~~
nqp_bigint_ops.c:8581:18: note: remove extraneous parentheses around the comparison to silence this warning
        if ((cmp == MP_GT)) {
            ~    ^       ~
nqp_bigint_ops.c:8581:18: note: use '=' to turn this equality comparison into an assignment
        if ((cmp == MP_GT)) {
                 ^~
                 =
nqp_bigint_ops.c:8640:18: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
        if ((cmp == MP_GT)) {
             ~~~~^~~~~~~~
nqp_bigint_ops.c:8640:18: note: remove extraneous parentheses around the comparison to silence this warning
        if ((cmp == MP_GT)) {
            ~    ^       ~
nqp_bigint_ops.c:8640:18: note: use '=' to turn this equality comparison into an assignment
        if ((cmp == MP_GT)) {
                 ^~
                 =
nqp_bigint_ops.c:8699:18: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
        if ((cmp == MP_GT)) {
             ~~~~^~~~~~~~
nqp_bigint_ops.c:8699:18: note: remove extraneous parentheses around the comparison to silence this warning
        if ((cmp == MP_GT)) {
            ~    ^       ~
nqp_bigint_ops.c:8699:18: note: use '=' to turn this equality comparison into an assignment
        if ((cmp == MP_GT)) {
                 ^~
                 =
nqp_bigint_ops.c:8758:18: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
        if ((cmp == MP_GT)) {
             ~~~~^~~~~~~~
nqp_bigint_ops.c:8758:18: note: remove extraneous parentheses around the comparison to silence this warning
        if ((cmp == MP_GT)) {
            ~    ^       ~
nqp_bigint_ops.c:8758:18: note: use '=' to turn this equality comparison into an assignment
        if ((cmp == MP_GT)) {
                 ^~
                 =
nqp_bigint_ops.c:8817:18: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
        if ((cmp == MP_GT)) {
             ~~~~^~~~~~~~
nqp_bigint_ops.c:8817:18: note: remove extraneous parentheses around the comparison to silence this warning
        if ((cmp == MP_GT)) {
            ~    ^       ~
nqp_bigint_ops.c:8817:18: note: use '=' to turn this equality comparison into an assignment
        if ((cmp == MP_GT)) {
                 ^~
                 =
nqp_bigint_ops.c:8876:18: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
        if ((cmp == MP_GT)) {
             ~~~~^~~~~~~~
nqp_bigint_ops.c:8876:18: note: remove extraneous parentheses around the comparison to silence this warning
        if ((cmp == MP_GT)) {
            ~    ^       ~
nqp_bigint_ops.c:8876:18: note: use '=' to turn this equality comparison into an assignment
        if ((cmp == MP_GT)) {
                 ^~
                 =
nqp_bigint_ops.c:8935:18: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
        if ((cmp == MP_GT)) {
             ~~~~^~~~~~~~
nqp_bigint_ops.c:8935:18: note: remove extraneous parentheses around the comparison to silence this warning
        if ((cmp == MP_GT)) {
            ~    ^       ~
nqp_bigint_ops.c:8935:18: note: use '=' to turn this equality comparison into an assignment
        if ((cmp == MP_GT)) {
                 ^~
                 =
nqp_bigint_ops.c:8994:18: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
        if ((cmp == MP_GT)) {
             ~~~~^~~~~~~~
nqp_bigint_ops.c:8994:18: note: remove extraneous parentheses around the comparison to silence this warning
        if ((cmp == MP_GT)) {
            ~    ^       ~
nqp_bigint_ops.c:8994:18: note: use '=' to turn this equality comparison into an assignment
        if ((cmp == MP_GT)) {
                 ^~
                 =
nqp_bigint_ops.c:9053:18: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
        if ((cmp == MP_GT)) {
             ~~~~^~~~~~~~
nqp_bigint_ops.c:9053:18: note: remove extraneous parentheses around the comparison to silence this warning
        if ((cmp == MP_GT)) {
            ~    ^       ~
nqp_bigint_ops.c:9053:18: note: use '=' to turn this equality comparison into an assignment
        if ((cmp == MP_GT)) {
                 ^~
                 =
nqp_bigint_ops.c:9112:18: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
        if ((cmp == MP_GT)) {
             ~~~~^~~~~~~~
nqp_bigint_ops.c:9112:18: note: remove extraneous parentheses around the comparison to silence this warning
        if ((cmp == MP_GT)) {
            ~    ^       ~
nqp_bigint_ops.c:9112:18: note: use '=' to turn this equality comparison into an assignment
        if ((cmp == MP_GT)) {
                 ^~
                 =
nqp_bigint_ops.c:9171:18: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
        if ((cmp == MP_GT)) {
             ~~~~^~~~~~~~
nqp_bigint_ops.c:9171:18: note: remove extraneous parentheses around the comparison to silence this warning
        if ((cmp == MP_GT)) {
            ~    ^       ~
nqp_bigint_ops.c:9171:18: note: use '=' to turn this equality comparison into an assignment
        if ((cmp == MP_GT)) {
                 ^~
                 =
nqp_bigint_ops.c:9230:18: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
        if ((cmp == MP_GT)) {
             ~~~~^~~~~~~~
nqp_bigint_ops.c:9230:18: note: remove extraneous parentheses around the comparison to silence this warning
        if ((cmp == MP_GT)) {
            ~    ^       ~
nqp_bigint_ops.c:9230:18: note: use '=' to turn this equality comparison into an assignment
        if ((cmp == MP_GT)) {
                 ^~
                 =
nqp_bigint_ops.c:9289:18: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
        if ((cmp == MP_GT)) {
             ~~~~^~~~~~~~
nqp_bigint_ops.c:9289:18: note: remove extraneous parentheses around the comparison to silence this warning
        if ((cmp == MP_GT)) {
            ~    ^       ~
nqp_bigint_ops.c:9289:18: note: use '=' to turn this equality comparison into an assignment
        if ((cmp == MP_GT)) {
                 ^~
                 =
nqp_bigint_ops.c:9348:18: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
        if ((cmp == MP_GT)) {
             ~~~~^~~~~~~~
nqp_bigint_ops.c:9348:18: note: remove extraneous parentheses around the comparison to silence this warning
        if ((cmp == MP_GT)) {
            ~    ^       ~
nqp_bigint_ops.c:9348:18: note: use '=' to turn this equality comparison into an assignment
        if ((cmp == MP_GT)) {
                 ^~
                 =
nqp_bigint_ops.c:9407:18: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
        if ((cmp == MP_GT)) {
             ~~~~^~~~~~~~
nqp_bigint_ops.c:9407:18: note: remove extraneous parentheses around the comparison to silence this warning
        if ((cmp == MP_GT)) {
            ~    ^       ~
nqp_bigint_ops.c:9407:18: note: use '=' to turn this equality comparison into an assignment
        if ((cmp == MP_GT)) {
                 ^~
nqp_dyncall_ops.c:3558:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == cs_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:3558:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == cs_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:3558:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == cs_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:3572:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == cp_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:3572:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == cp_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:3572:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == cp_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:3586:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == ca_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:3586:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == ca_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:3586:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == ca_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:3728:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == cs_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:3728:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == cs_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:3728:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == cs_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:3742:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == cp_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:3742:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == cp_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:3742:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == cp_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:3756:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == ca_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:3756:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == ca_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:3756:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == ca_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:3898:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == cs_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:3898:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == cs_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:3898:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == cs_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:3912:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == cp_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:3912:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == cp_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:3912:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == cp_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:3926:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == ca_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:3926:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == ca_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:3926:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == ca_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:4068:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == cs_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:4068:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == cs_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:4068:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == cs_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:4082:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == cp_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:4082:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == cp_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:4082:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == cp_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:4096:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == ca_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:4096:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == ca_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:4096:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == ca_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:4238:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == cs_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:4238:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == cs_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:4238:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == cs_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:4252:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == cp_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:4252:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == cp_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:4252:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == cp_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:4266:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == ca_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:4266:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == ca_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:4266:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == ca_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:4408:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == cs_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:4408:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == cs_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:4408:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == cs_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:4422:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == cp_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:4422:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == cp_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:4422:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == cp_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:4436:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == ca_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:4436:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == ca_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:4436:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == ca_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:4578:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == cs_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:4578:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == cs_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:4578:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == cs_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:4592:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == cp_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:4592:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == cp_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:4592:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == cp_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:4606:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == ca_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:4606:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == ca_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:4606:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == ca_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:4748:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == cs_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:4748:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == cs_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:4748:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == cs_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:4762:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == cp_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:4762:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == cp_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:4762:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == cp_repr_id)) {
                                     ^~
                                     =
nqp_dyncall_ops.c:4776:38: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((REPR(value)->ID == ca_repr_id)) {
                     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
nqp_dyncall_ops.c:4776:38: note: remove extraneous parentheses around the comparison to silence this warning
                if ((REPR(value)->ID == ca_repr_id)) {
                    ~                ^            ~
nqp_dyncall_ops.c:4776:38: note: use '=' to turn this equality comparison into an assignment
                if ((REPR(value)->ID == ca_repr_id)) {
                                     ^~
                                     =

strict c++: cast function ptrs

clang++:

nqp_ops.c:3102:52: error: cannot initialize a parameter of type 'void *' with an lvalue of type 'void (Parrot_Interp, PMC *)'
        VTABLE_set_pointer(interp, obj_sc_barrier, SC_write_barrier_obj);
                                                   ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/parrot/4.11.0-devel/parrot/vtable.h:694:45: note: expanded from macro 'VTABLE_set_pointer'
    (pmc)->vtable->set_pointer(interp, pmc, value)
                                            ^
nqp_ops.c:3105:51: error: cannot initialize a parameter of type 'void *' with an lvalue of type 'void (Parrot_Interp, STable *)'
        VTABLE_set_pointer(interp, st_sc_barrier, SC_write_barrier_st);

Need to cast function ptrs to (void*)

encoding problem - Invalid character in ASCII string

"breaks" means outputs: "Invalid character in ASCII string"

13:41 < diakopter> say('¢'"\n"); # breaks
13:41 < diakopter> say('¢'); # works
13:42 < diakopter> say("\n"); # works
13:42 < diakopter> say("¢\n"); # works
13:46 < diakopter> say("¢"
"\n"); # breaks
13:47 < diakopter> say("¢"'a'); # breaks
13:50 < diakopter> say('a'
"¢"); # breaks
13:51 < diakopter> I have parrot nqp
13:51 < diakopter> nqp's parrot
13:52 < diakopter> 'a'~"¢" # breaks

Fail to compile with installed devel parrot

parrot master installed:

/usr/local/bin/parrot --library=src/stage0 src/stage0/nqp.pbc \
        --target=pir --output=src/stage1/gen/nqp-mo.pir \
        --setting=NULL --no-regex-lib src/stage1/gen/nqp-mo.pm
Missing or wrong version of dependency 'src/stage2/QRegex.nqp'
current instr.: '' pc 129152 (src/stage0/NQP-s0.pir:43951) (src/stage2/gen/NQP.pm:3231)

Same master generated via --gen-parrot=master or via echo RELEASE_4_11_0-98-g5d697e5 > tools/build/PARROT_REVISION, installed into install/bin/parrot compiles and tests fine.

Testing with an globally installed non-devel 4.11.0 parrot (version 0) also worked fine. Using /usr/local/bin/parrot (version 0).

So it's a problem with a globally installed parrot devel version only.

can't use a file with INIT more than once.

One of the changes between parrot-nqp and nqp is 'our' variables; to compensate for the changed behavior, I tried a workaround to INIT() a lexical variable and then create a sub that returns this lexical. Then export the sub from that file so I can get a similar effect as the original our.

However, the INIT is causing problems, as seen below. Getting this fixed (or providing a way to share variables between use'd files) will help unblock partcl-nqp

$ cat a.nqp
INIT {
say("INIT");
}
$ cat b.nqp
use a;
$ cat c.nqp
use a;
use b;

say("alive");
$ nqp --target=pir a.nqp > a.pir
$ nqp --target=pir b.nqp > b.pir
$ nqp c.nqp
INIT
error:imcc:syntax error, unexpected IDENTIFIER ('INIT')
in file './b.pir' line 1

`$x ; my $x` should cause an error

Because all variables are declared at ENTER time, nothing prevents the following code from working:

   say $x;
   my $x := 5

This will 'say' undefined. NQP should likely show an error for this.

Failures in t/nqp/60-bigint.t

t/nqp/60-bigint.t (Wstat: 0 Tests: 31 Failed: 2)
Failed tests: 27-28

not ok 27 - to_num and from_num round-trip
not ok 28 - to_num and from_num round-trip (negative number)

This on feather.perl6.nl

Segfault when no multi matches

<pmurias> is it normal for nqp code to segfault when it's unable to match a multi?
<moritz> I hope not :-)
<moritz> nqp: class A { }; proto f(*@args) {*}; multi f(A $x) { say('A') }; f('str')
<p6eval> nqp: OUTPUT«(signal SEGV)»
<masak> o.O
* masak submits nqpbug
<moritz> pmurias: I'm sure that's not intended behavior :-)

segfault during build

b6c88ff introduced a segfault into the build process on my mac.

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.7.3
BuildVersion:   11D50d
~/sandbox/nqp
$ make
...
/Users/willcoleda/bird/bin/parrot --library=src/stage1 src/stage1/nqp.pbc \
        --target=pir --output=src/stage2/QASTNode.pir --no-regex-lib \
        --module-path=src/stage2 --setting-path=src/stage2 src/stage2/QASTNode.nqp
make: *** [src/stage2/QASTNode.pbc] Segmentation fault: 11

Can't install NQP and nqp-rx

Seems they try to install some libraries to the same place. Make NQP install to different locations where there is conflict.

segfault when chasing callers outwards to the stars

<phenny> masak: 10:54Z <diakopter> tell masak masakbot :) nqp: my $_ := nqp::ctx(); $_ := nqp::ctxcaller($_) while 1;
<masak> nqp: my $_ := nqp::ctx(); $_ := nqp::ctxcaller($_) while 1;
<p6eval> nqp: OUTPUT«(signal SEGV)»
<masak> woo
<masak> but I don't know enough about nqp failure modes to know if this is fine or not.
<masak> maybe we are OK with SEGVs in NQP-land?
<jnthn> masak: The segfault isn't good
<jnthn> masak: I think it's reproducable with pure PIR, though...
<jnthn> Need to be sure of that.
* masak submits it to the perl6/nqp issue queue

Can't override class's Numeric

20:23 < [Coke]> nqp: class EEK {method Numeric() {return 3}}; my $a:=
EEK.new(); say(+$a);
20:23 <+p6eval> nqp: OUTPUT«No applicable candidates found to dispatch to for
'Numeric'. Available candidates are:␤␤current instr.: 'Numeric'
pc 3450 (src/stage2/gen/NQPCORE.setting.pir:1608)
(src/stage2/NQPCORE.setting:171)␤»

20:29 < [Coke]> r: class EEK {method Numeric() {return 3}}; my $a:= EEK.new();
say(+$a);
20:29 <+p6eval> rakudo fb11f1: OUTPUT«3␤»

This is a (minor) blocker for partcl-nqp work.

MAC OS X warning: control reaches end of non-void function

Xcode 4.3.2

P6bigint.c:100:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
P6bigint.c:114:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
P6bigint.c:122:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
nqp_dyncall_ops.c:187:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
nqp_dyncall_ops.c:211:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
CStruct.c:386:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
CStruct.c:400:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
CStruct.c:434:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
CArray.c:181:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
CArray.c:207:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
CArray.c:251:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^

regex goals fail at error reporting

11:31 < moritz> nqp: my $re := "'(' ~ ')' \\d+"; '(123' ~~ /<$re>/
11:31 <+p6eval> nqp: OUTPUT«Can only use get_who on a SixModelObject␤current 
            instr.: 'nqp;Regex;Cursor;FAILGOAL' pc 3792 
            (src/Regex/Cursor.pir:216)␤»

12:19 < jnthn> moritz: Argh. It's broken because it tries to use 
           HLL::Compiler.lineof during error reporting, which of course may 
           well not have been loaded.
12:20 < jnthn> nqp: use NQPHLL; my $re := "'(' ~ ')' \\d+"; '(123' ~~ /<$re>/
12:20 <+p6eval> nqp: OUTPUT«Unable to parse _block77, couldn't find final ')' 
            at line 1␤current instr.: 'nqp;Regex;Cursor;FAILGOAL' pc 3863 
            (src/Regex/Cursor.pir:239)␤»
12:35 < moritz> the test file even usees NQPHLL 
12:40 < jnthn> Oh.
12:40 < jnthn> moritz: Please file an nqp ticket for it.

If you enable rx_goal in t/p6regex/01-regex.t you can easily reproduce the error.

NQP dyncall library doesn't build under Strawberry Perl

I tried on several machines to build/install Rakudo under WIndows, and NQP consistently fails for me when attempting to create the dyncall ops.

Under Windows XP 32-bit and Strawberry Perl 5.16.0, I get this error:

cd src\ops && g++ -o nqp_dyncall_ops.dll nqp_dyncall_ops.o ..\6model\reprs\NativeCall.o 
..\6model\reprs\CStruct.o ..\6model\reprs\CPointer.o ..\6model\reprs\CArray.o ..\6model\reprs\CStr.o
..\..\3rdparty\dyncall\dyncall\libdyncall_s.a ..\.. \3rdparty\dyncall\dyncallback\libdyncallback_s.a 
..\..\3rdparty\dyncall\dynload\libdynload_s.a  -shared  "C:\rakudo\install\bin\libparrot.dll" -lmoldname -lkernel32 
 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 
 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 -lgmp
 ..\..\3rdparty\dyncall\dyncall\libdyncall_s.a(dyncall_callvm.o):dyncall_callvm.c
 :(.text+0x2bd): undefined reference to `dcCall_x86_win32_fast'
 ..\..\3rdparty\dyncall\dyncall\libdyncall_s.a(dyncall_callvm.o):dyncall_callvm.c
 :(.text+0x2fd): undefined reference to `dcCall_x86_sys_int80h_bsd'
 ..\..\3rdparty\dyncall\dyncall\libdyncall_s.a(dyncall_callvm.o):dyncall_callvm.c
 :(.text+0x32d): undefined reference to `dcCall_x86_sys_int80h_linux'
 ..\..\3rdparty\dyncall\dyncall\libdyncall_s.a(dyncall_callvm.o):dyncall_callvm.c
 :(.text+0x35d): undefined reference to `dcCall_x86_win32_msthis'
 ..\..\3rdparty\dyncall\dyncall\libdyncall_s.a(dyncall_callvm.o):dyncall_callvm.c
 :(.text+0x38d): undefined reference to `dcCall_x86_win32_std'
 ..\..\3rdparty\dyncall\dyncall\libdyncall_s.a(dyncall_callvm.o):dyncall_callvm.c
 :(.text+0x3bd): undefined reference to `dcCall_x86_cdecl'
 c:/strawberry/c/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw
 32/bin/ld.exe: ..\..\3rdparty\dyncall\dyncall\libdyncall_s.a(dyncall_callvm.o):
 bad reloc address 0x0 in section `.data'
 collect2: ld returned 1 exit status
 gmake: *** [src\ops\nqp_dyncall_ops.dll] Error 1

I downgraded to Strawberry Perl 5.12.3 (since diakopter++ reported being able to build with it), and I get:

 cd src\ops && g++ -o nqp_dyncall_ops.dll nqp_dyncall_ops.o ..\6model\reprs\Nativ
 eCall.o ..\6model\reprs\CStruct.o ..\6model\reprs\CPointer.o ..\6model\reprs\CAr
 ray.o ..\6model\reprs\CStr.o ..\..\3rdparty\dyncall\dyncall\libdyncall_s.a ..\..
 \3rdparty\dyncall\dyncallback\libdyncallback_s.a ..\..\3rdparty\dyncall\dynload\
 libdynload_s.a  -shared  "C:\rakudo\install\bin\libparrot.dll" -lmoldname -lkern
 el32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleau
 t32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcom
 ctl32 -lgmp
 ..\..\3rdparty\dyncall\dyncall\libdyncall_s.a(dyncall_callvm.o):dyncall_callvm.c
 :(.text+0x2bd): undefined reference to `dcCall_x86_win32_fast'
 ..\..\3rdparty\dyncall\dyncall\libdyncall_s.a(dyncall_callvm.o):dyncall_callvm.c
 :(.text+0x2fd): undefined reference to `dcCall_x86_sys_int80h_bsd'
 ..\..\3rdparty\dyncall\dyncall\libdyncall_s.a(dyncall_callvm.o):dyncall_callvm.c
 :(.text+0x32d): undefined reference to `dcCall_x86_sys_int80h_linux'
 ..\..\3rdparty\dyncall\dyncall\libdyncall_s.a(dyncall_callvm.o):dyncall_callvm.c
 :(.text+0x35d): undefined reference to `dcCall_x86_win32_msthis'
 ..\..\3rdparty\dyncall\dyncall\libdyncall_s.a(dyncall_callvm.o):dyncall_callvm.c
 :(.text+0x38d): undefined reference to `dcCall_x86_win32_std'
 ..\..\3rdparty\dyncall\dyncall\libdyncall_s.a(dyncall_callvm.o):dyncall_callvm.c
 :(.text+0x3bd): undefined reference to `dcCall_x86_cdecl'
 collect2: ld returned 1 exit status
 gmake: *** [src\ops\nqp_dyncall_ops.dll] Error 1
 Command failed (status 512): gmake
 Command failed (status 512): C:\strawberry\perl\bin\perl.exe Configure.pl --with
 -parrot=C:/rakudo/install/bin/parrot.exe --make-install

Thinking the problem might be 32-bit windows versus 64-bit windows, I then tried
on a 64-bit WIndows 7 machine (Strawberry 5.12.3) and I get a somewhat different error:

cd src\ops && g++ -o nqp_dyncall_ops.dll nqp_dyncall_ops.o ..\6model\reprs\Nativ
eCall.o ..\6model\reprs\CStruct.o ..\6model\reprs\CPointer.o ..\6model\reprs\CAr
ray.o ..\6model\reprs\CStr.o ..\..\3rdparty\dyncall\dyncall\libdyncall_s.a ..\..
\3rdparty\dyncall\dyncallback\libdyncallback_s.a ..\..\3rdparty\dyncall\dynload\
libdynload_s.a  -shared  "C:\rakudo\install\bin\libparrot.dll" -lmoldname -lkern
el32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleau
t32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcom
ctl32 -lgmp
..\..\3rdparty\dyncall\dyncall\libdyncall_s.a(dyncall_callvm.o):dyncall_callvm.c
:(.text+0x28b): undefined reference to `dcCall_x64_win64'
collect2: ld returned 1 exit status
gmake: *** [src\ops\nqp_dyncall_ops.dll] Error 1
Command failed (status 512): gmake
Command failed (status 512): C:\strawberry\perl\bin\perl.exe Configure.pl --with
-parrot=C:/rakudo/install/bin/parrot.exe --make-install

I'm not sure what to look at next, but will be glad to give various commands a try.

Thanks!

Serialization error with INIT'd pointy block.

$ cat pointy.pm
INIT {

GLOBAL::foo := -> { say(3) };

}
$ cat main.pm
use pointy;

$ nqp --target=pir pointy.pm > pointy.pir
$ nqp --target=pir main.pm > main.pir
Serialization Error: could not locate static code ref for closure ''
current instr.: 'deserialization_code' pc 40940 (src/stage2/QAST.pir:14242) (src/stage2/QAST.nqp:2183)
called from Sub '' pc 40481 (src/stage2/QAST.pir:14079) (src/stage2/QAST.nqp:2151)
called from Sub 'as_post' pc 40259 (src/stage2/QAST.pir:14003) (src/stage2/QAST.nqp:2139)
called from Sub 'as_post' pc 39956 (src/stage2/QAST.pir:13890) (src/stage2/QAST.nqp:2109)
called from Sub 'post' pc 39564 (src/stage2/QAST.pir:13710) (src/stage2/QAST.nqp:2072)
called from Sub 'post' pc 33144 (src/stage2/gen/NQPHLL.pir:12640) (src/stage2/gen/NQPHLL.pm:1487)
called from Sub '' pc 32411 (src/stage2/gen/NQPHLL.pir:12348) (src/stage2/gen/NQPHLL.pm:1437)
called from Sub 'compile' pc 32320 (src/stage2/gen/NQPHLL.pir:12308) (src/stage2/gen/NQPHLL.pm:1435)
called from Sub 'eval' pc 29254 (src/stage2/gen/NQPHLL.pir:11063) (src/stage2/gen/NQPHLL.pm:1206)
called from Sub 'evalfiles' pc 31784 (src/stage2/gen/NQPHLL.pir:12094) (src/stage2/gen/NQPHLL.pm:1419)
called from Sub 'command_eval' pc 30738 (src/stage2/gen/NQPHLL.pir:11686) (src/stage2/gen/NQPHLL.pm:1354)
called from Sub 'command_line' pc 30040 (src/stage2/gen/NQPHLL.pir:11425) (src/stage2/gen/NQPHLL.pm:1304)
called from Sub 'MAIN' pc 699 (src/stage2/gen/NQP.pir:227) (src/stage2/gen/NQP.pm:3090)
called from Sub '' pc 444 (src/stage2/gen/NQP.pir:155) (src/stage2/gen/NQP.pm:1479)

Can't do a second evaluation in the REPL

$ ./nqp
> say(42);
42
> say(42);
Null PMC access in find_method('new')
>

Same with any other commands, not just 'say(42);'.

<jnthn> ooh...I think I know what might be up with the REPL...
<jnthn> Looks like it create a new view of GLOBAL for each inner scope and thus loses the outer one.
<jnthn> Meaning symbols get lost 
<masak> aha.

strange loop

my int $i := 200_000_000;
while --$i {
nqp::iscclass(pir::const::CCLASS_ALPHABETIC, "«", 0);

if ($i % 1_000_000) == 0 { say($i); }

}
say("alive");

running this takes 12s and uses 45MB ram.
commenting the iscclass call makes it take 46s and use 300MB ram. Why in the world would this be case? commenting a line makes it take 10x longer and use 6x more ram?
uncommenting both lines makes it take 55s and use 300MB ram.

2012.10 fails to build on powerpc because of dyncall

I currently get this when building nqp 2012.10 on powerpc:

make -C dyncallback 
make[4]: Entering directory `/build/buildd-nqp_2012.10-1-powerpc-u2Xzm4/nqp-2012.10/3rdparty/dyncall/dyncallback'
gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -DHASATTRIBUTE_CONST  -DHASATTRIBUTE_DEPRECATED  -DHASATTRIBUTE_MALLOC  -DHASATTRIBUTE_NONNULL  -DHASATTRIBUTE_NORETURN  -DHASATTRIBUTE_PURE  -DHASATTRIBUTE_UNUSED  -DHASATTRIBUTE_WARN_UNUSED_RESULT  -DHASATTRIBUTE_HOT  -DHASATTRIBUTE_COLD  -DHAS_GETTEXT -fPIC -g -falign-functions=16 -funit-at-a-time -fexcess-precision=standard -W -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment -Wdisabled-optimization -Wdiv-by-zero -Wenum-compare -Wendif-labels -Wextra -Wformat -Wformat-extra-args -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimplicit -Wimport -Winit-self -Winline -Winvalid-pch -Wjump-misses-init -Wlogical-op -Werror=missing-braces -Wmissing-declarations -Wmissing-field-initializers -Wno-missing-format-attribute -Wmissing-include-dirs -Wmultichar -Wpacked -Wparentheses -Wpointer-arith -Wpointer-sign -Wreturn-type -Wsequence-point -Wsign-compare -Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch -Wswitch-default -Wtrigraphs -Werror=undef -Wno-unused -Wunknown-pragmas -Wvariadic-macros -Wwrite-strings -Wc++-compat -Werror=declaration-after-statement -Werror=implicit-function-declaration -Wmissing-prototypes -Werror=nested-externs -Werror=old-style-definition -Werror=strict-prototypes -fvisibility=hidden   -Wno-strict-prototypes -O3 -O3 -D_FORTIFY_SOURCE=2 -I../dyncall  -c dyncall_thunk.c -o dyncall_thunk.o
In file included from dyncall_thunk.c:35:0:
dyncall_thunk_ppc32.c:28:16: warning: no previous prototype for 'hi16' [-Wmissing-prototypes]
dyncall_thunk_ppc32.c: In function 'hi16':
dyncall_thunk_ppc32.c:28:16: error: old-style function definition [-Werror=old-style-definition]
dyncall_thunk_ppc32.c:28:16: warning: type of 'x' defaults to 'int' [-Wmissing-parameter-type]
dyncall_thunk_ppc32.c: At top level:
dyncall_thunk_ppc32.c:29:16: warning: no previous prototype for 'lo16' [-Wmissing-prototypes]
dyncall_thunk_ppc32.c: In function 'lo16':
dyncall_thunk_ppc32.c:29:16: error: old-style function definition [-Werror=old-style-definition]
dyncall_thunk_ppc32.c:29:16: warning: type of 'x' defaults to 'int' [-Wmissing-parameter-type]
cc1: some warnings being treated as errors
make[4]: *** [dyncall_thunk.o] Error 1
make[4]: Leaving directory `/build/buildd-nqp_2012.10-1-powerpc-u2Xzm4/nqp-2012.10/3rdparty/dyncall/dyncallback'
make[3]: *** [dyncallback] Error 2
make[3]: Leaving directory `/build/buildd-nqp_2012.10-1-powerpc-u2Xzm4/nqp-2012.10/3rdparty/dyncall'
make[2]: *** [3rdparty/dyncall/dyncall/libdyncall_s.a] Error 2
make[2]: Leaving directory `/build/buildd-nqp_2012.10-1-powerpc-u2Xzm4/nqp-2012.10'

I'm not sure where the -Werror=old-style-definition comes from, but removing it should fix the build.

pointy blocks not blocky enough (errors with "missing block")


$ cat err.pm 
my $foo := -> { say(3) };
$foo();
$ nqp err.pm 
Missing block at line 2, near "-> { say(3"
current instr.: 'panic' pc 19998 (src/stage2/gen/NQPHLL.pir:7314) (src/stage2/gen/NQPHLL.pm:325)
called from Sub 'pblock' pc 25679 (src/stage2/gen/NQP.pir:9058) (src/stage2/gen/NQP.pm:741)
called from Sub 'term:sym<lambda>' pc 45428 (src/stage2/gen/NQP.pir:15995) (src/stage2/gen/NQP.pm:874)
called from Sub '!protoregex' pc 10078 (src/stage2/QRegex.pir:3917) (src/stage2/QRegex.nqp:605)
called from Sub 'term' pc 1464 (src/stage2/gen/NQPHLL.pir:563) (src/stage2/gen/NQPHLL.pm:17)
called from Sub 'termish' pc 1070 (src/stage2/gen/NQPHLL.pir:431) (src/stage2/gen/NQPHLL.pm:11)
called from Sub 'EXPR' pc 21375 (src/stage2/gen/NQPHLL.pir:7929) (src/stage2/gen/NQPHLL.pm:541)
called from Sub 'statement' pc 23722 (src/stage2/gen/NQP.pir:8401) (src/stage2/gen/NQP.pm:717)
called from Sub 'statementlist' pc 23175 (src/stage2/gen/NQP.pir:8223) (src/stage2/gen/NQP.pm:712)
called from Sub 'comp_unit' pc 22540 (src/stage2/gen/NQP.pir:8003) (src/stage2/gen/NQP.pm:698)
called from Sub 'TOP' pc 12106 (src/stage2/gen/NQP.pir:4424) (src/stage2/gen/NQP.pm:622)
called from Sub 'parse' pc 16590 (src/stage2/QRegex.pir:6359) (src/stage2/QRegex.nqp:939)
called from Sub 'parse' pc 32847 (src/stage2/gen/NQPHLL.pir:12533) (src/stage2/gen/NQPHLL.pm:1478)
called from Sub '' pc 32381 (src/stage2/gen/NQPHLL.pir:12356) (src/stage2/gen/NQPHLL.pm:1442)
called from Sub 'compile' pc 32290 (src/stage2/gen/NQPHLL.pir:12316) (src/stage2/gen/NQPHLL.pm:1440)
called from Sub 'eval' pc 29227 (src/stage2/gen/NQPHLL.pir:11071) (src/stage2/gen/NQPHLL.pm:1211)
called from Sub 'evalfiles' pc 31756 (src/stage2/gen/NQPHLL.pir:12102) (src/stage2/gen/NQPHLL.pm:1424)
called from Sub 'command_eval' pc 30711 (src/stage2/gen/NQPHLL.pir:11694) (src/stage2/gen/NQPHLL.pm:1359)
called from Sub 'command_line' pc 30013 (src/stage2/gen/NQPHLL.pir:11433) (src/stage2/gen/NQPHLL.pm:1309)
called from Sub 'MAIN' pc 760 (src/stage2/gen/NQP.pir:250) (src/stage2/gen/NQP.pm:3085)
called from Sub '' pc 443 (src/stage2/gen/NQP.pir:155) (src/stage2/gen/NQP.pm:1475)

Internal error when running script from file

Running from command line works.

$ ./nqp -e 'say("OH HAI")'
OH HAI

Putting things in a script works but triggers an error message in the module loader.

$ cat q
say("OH HAI");
$ ./nqp q
OH HAI
Cannot take substr outside string
current instr.: 'nqp;ModuleLoader;set_mainline_module' pc 2814 (src/stage2/gen/module_loader.pir:1052)
called from Sub '_block11' pc 63 ((file unknown):36284014)
called from Sub 'nqp;HLL;Compiler;_block1706' pc 36838 (src/stage2/gen/NQPHLL.pir:0)
called from Sub 'nqp;HLL;Compiler;eval' pc 36699 (src/stage2/gen/NQPHLL.pir:11432)
called from Sub 'nqp;HLL;Compiler;_block1955' pc 38739 (src/stage2/gen/NQPHLL.pir:12251)
called from Sub 'nqp;HLL;Compiler;evalfiles' pc 38574 (src/stage2/gen/NQPHLL.pir:12182)
called from Sub 'nqp;HLL;Compiler;command_line' pc 37820 (src/stage2/gen/NQPHLL.pir:11862)
called from Sub 'MAIN' pc 20012 (src/stage2/gen/NQP.pir:4541)
called from Sub '_block11' pc 176 (src/stage2/gen/NQP.pir:78)

Using '--' before the filename makes things work again. o.O

masak@ubuntu:~/ours/nqp$ ./nqp -- q
OH HAI

Build failure on latest Parrot after invocation spec refactor

NQP aaf85c3 builds successfully on parrot/parrot@5fc1831, whereas 6005a68 (or later) does not.

Any invocation of the nqp executable will fail:

$ ./nqp
too few positional arguments: 0 passed, 1 (or more) expected
current instr.: '' pc 2390 (src/stage2/gen/module_loader.pir:1050) (src/ModuleLoader.pm:157)
called from Sub '' pc 127500 (src/stage2/gen/NQP.pir:43427) (src/stage2/gen/NQP.pm:3219)
called from Sub '' pc 127526 (src/stage2/gen/NQP.pir:43437) (src/stage2/gen/NQP.pm:3219)

The listed line numbers might not be accurate.

Note: build environment is Cygwin, ie 32-bit

invalid variable declaration segfaults

20:15 < [Coke]> nqp: INIT {my %foo := Hash.new()} ; %foo{3} :=4; say %foo.perl;
20:15 <+p6eval> nqp: OUTPUT«(signal SEGV)»
20:15 < [Coke]> BOOYAH
20:16 < [Coke]> (the my should be outside of the INIT block)

... but it still shouldn't segfault

Check for undeclared attributes

Check for any attributes that are undeclared and report on them. Must be done in co-operation with the meta-model. Important note - needs to stash the things to check away until the closing brace of the class decl, where the class is composed. Only then do we have all the roles composed and the attributes they bring. Then we can give a safe answer.

Support parrot threads

See parrot/parrot#870

NQPLexPad needs to support the new Proxy pmc,
and needs to check for the NQPLexPadInfo class more reliably.

In the parrot branch rurban/gh870-pmc_class we export now the dynpmc type information in the pmc and group header file, so nqplexpad.pmc can check for the dynpmc_class_NQPLexPadInfo type.

I haven't checked other failure cases yet, all tests pass, just new tests which use parrot threads do not.

MAC OS X warning: incompatible pointer types passing

Xcode 4.3.2

nqp_bigint_ops.c:2889:101: warning: incompatible pointer types passing 'REPROps *(Parrot_Interp, PMC *(*)(Parrot_Interp, void *), PMC *(*)(Parrot_Interp, REPROps *, PMC *))' to parameter of type
      'REPROps *(*)(Parrot_Interp, void *, void *)' [-Wincompatible-pointer-types]
        bigint_repr_id = REGISTER_DYNAMIC_REPR(interp, Parrot_str_new_constant(interp, "P6bigint"), P6bigint_initialize);
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
nqp_dyncall_ops.c:1236:99: warning: incompatible pointer types passing 'REPROps *(Parrot_Interp, PMC *(*)(Parrot_Interp, void *), PMC *(*)(Parrot_Interp, REPROps *, PMC *))' to parameter of type
      'REPROps *(*)(Parrot_Interp, void *, void *)' [-Wincompatible-pointer-types]
        nc_repr_id = REGISTER_DYNAMIC_REPR(interp, Parrot_str_new_constant(interp, "NativeCall"), NativeCall_initialize);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
./../6model/sixmodelobject.h:386:84: note: expanded from macro 'REGISTER_DYNAMIC_REPR'
                Parrot_str_new_constant(interp, "_REGISTER_REPR"))))(interp, name, reg_func)
                                                                                   ^
nqp_dyncall_ops.c:1240:96: warning: incompatible pointer types passing 'REPROps *(Parrot_Interp, PMC *(*)(Parrot_Interp, void *), PMC *(*)(Parrot_Interp, REPROps *, PMC *))' to parameter of type
      'REPROps *(*)(Parrot_Interp, void *, void *)' [-Wincompatible-pointer-types]
        cs_repr_id = REGISTER_DYNAMIC_REPR(interp, Parrot_str_new_constant(interp, "CStruct"), CStruct_initialize);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
./../6model/sixmodelobject.h:386:84: note: expanded from macro 'REGISTER_DYNAMIC_REPR'
                Parrot_str_new_constant(interp, "_REGISTER_REPR"))))(interp, name, reg_func)
                                                                                   ^
nqp_dyncall_ops.c:1244:97: warning: incompatible pointer types passing 'REPROps *(Parrot_Interp, PMC *(*)(Parrot_Interp, void *), PMC *(*)(Parrot_Interp, REPROps *, PMC *))' to parameter of type
      'REPROps *(*)(Parrot_Interp, void *, void *)' [-Wincompatible-pointer-types]
        cp_repr_id = REGISTER_DYNAMIC_REPR(interp, Parrot_str_new_constant(interp, "CPointer"), CPointer_initialize);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
./../6model/sixmodelobject.h:386:84: note: expanded from macro 'REGISTER_DYNAMIC_REPR'
                Parrot_str_new_constant(interp, "_REGISTER_REPR"))))(interp, name, reg_func)
                                                                                   ^
nqp_dyncall_ops.c:1248:95: warning: incompatible pointer types passing 'REPROps *(Parrot_Interp, PMC *(*)(Parrot_Interp, void *), PMC *(*)(Parrot_Interp, REPROps *, PMC *))' to parameter of type
      'REPROps *(*)(Parrot_Interp, void *, void *)' [-Wincompatible-pointer-types]
        ca_repr_id = REGISTER_DYNAMIC_REPR(interp, Parrot_str_new_constant(interp, "CArray"), CArray_initialize);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
./../6model/sixmodelobject.h:386:84: note: expanded from macro 'REGISTER_DYNAMIC_REPR'
                Parrot_str_new_constant(interp, "_REGISTER_REPR"))))(interp, name, reg_func)
                                                                                   ^

sub-hashes don't autovivify.

$ cat err.pm 
my %hash;
%hash<a><b> := 1;
$ nqp err.pm 
SixModelObject does not implement set_pmc_keyed_str
current instr.: '' pc 72 ((file unknown):48) (err.pm:1)
called from Sub '' pc 29439 (src/stage2/gen/NQPHLL.pir:11153) (src/stage2/gen/NQPHLL.pm:1224)
called from Sub 'eval' pc 29291 (src/stage2/gen/NQPHLL.pir:11092) (src/stage2/gen/NQPHLL.pm:1211)
called from Sub 'evalfiles' pc 31756 (src/stage2/gen/NQPHLL.pir:12102) (src/stage2/gen/NQPHLL.pm:1424)
called from Sub 'command_eval' pc 30711 (src/stage2/gen/NQPHLL.pir:11694) (src/stage2/gen/NQPHLL.pm:1359)
called from Sub 'command_line' pc 30013 (src/stage2/gen/NQPHLL.pir:11433) (src/stage2/gen/NQPHLL.pm:1309)
called from Sub 'MAIN' pc 760 (src/stage2/gen/NQP.pir:250) (src/stage2/gen/NQP.pm:3085)
called from Sub '' pc 443 (src/stage2/gen/NQP.pir:155) (src/stage2/gen/NQP.pm:1475)

Can't inherit from NQP::Grammar

This works fine:

$ ./nqp
> use HLL; class MyGrammar is HLL::Grammar {}

>

But this doesn't:

$ ./nqp
> use nqp; class MyGrammar is NQP::Grammar {} 
This class already has a method named TOP
>

Which is a shame, because some of us are really eager to start toying with language extensions. :-)

Flattening into named arguments does not happen from within rules

When feeding this code to rakudo, niecza, nqp:

my grammar G {
method s_m(*%n) { say(%n<a>, %n<b>, %n<c>) }
token TOP { <s_m(|hash(:a<1>, :c<3>), :b<2>)> }
}
G.s_m(|hash(:a<1>, :c<3>), :b<2>);
G.parse('');

The following happens:

rakudo e75a0a: OUTPUT«123␤Too many positional parameters passed; got 2 but
expected 1␤ in method s_m at /tmp/WoccMCN4lv:1␤ in regex TOP at
/tmp/WoccMCN4lv:1␤ in method parse at src/gen/CORE.setting:9647␤ in block
at /tmp/WoccMCN4lv:1␤␤»

niecza v18-5-g556574c: OUTPUT«123␤123␤Unhandled exception: Submatch to be
bound to s_m returned a Bool instead of a Cursor, violating the submatch
protocol.␤ at /tmp/UohDQXuKbo line 1 (G.TOP @ 6) ␤ at
/home/p6eval/niecza/lib/CORE.setting line 2884 (Grammar.parse @ 5) ␤ at
/tmp/UohDQX

nqp: OUTPUT«123␤too many positional arguments: 2 passed, 1 expected␤current
instr.: 's_m' pc 375 ((file unknown):151102171) (/tmp/A02sifbAgA:1)␤»

Niecza has the correct answer here, I believe.

src/cheats/hll-grammar.pir useless?

I think everything in here was moved to src/HLL/Grammar.pm. If this is confirmed, and deleting the file has no ill effects, it should be done.

Do we need both cclass 'n' and 'nl'?

I've removed the ability to have a cclass 'nl' here:
8fba6d4

jnthn pointed out that there might be a reason to a a CCLASS_NEWLINE that is treated as "\n" only, and one that matches "\r\n".

Do we need two newline cclasses? When yes, wouldn't an enumcharlist "\n" do that as well in addition to the cclass that matches "\r\n"?

a9b908a "Switch NQP to use a SHA-1 hash" broke bootstrap-files

Since a9b908a the *-so.pir produced by make bootstrap-files can no longer be used for bootstrapping.

The build dies with:

/usr/src/GIT/p6/local/bin/parrot --library=src/stage0 src/stage0/nqp.pbc \
            --target=pir --output=src/stage1/gen/NQPCORE.setting.pir \
            --module-path=src/stage1 --setting=NULL src/stage1/NQPCORE.setting
Null PMC access in find_method('new')
current instr.: 'nqp;NQPConcreteRoleHOW;_block1149' pc 8546 (src/stage1/gen/nqp-mo.pir:2528) (src/stage1/gen/nqp-mo.pm:190)
called from Sub '_block1000' pc 105 (src/stage1/gen/nqp-mo.pir:79) (src/stage1/gen/nqp-mo.pm:164)
called from Sub '_block2113' pc 23981 (src/stage1/gen/nqp-mo.pir:10623) (src/stage1/gen/nqp-mo.pm:1)
called from Sub 'nqp;ModuleLoader;_block1104' pc 2248 (src/stage0/ModuleLoader-s0.pir:1039) (src/ModuleLoader.pm:50)
called from Sub 'nqp;ModuleLoader;_block1104' pc 2314 (src/stage0/ModuleLoader-s0.pir:1073) (src/ModuleLoader.pm:63)
called from Sub 'nqp;ModuleLoader;load_module' pc 2059 (src/stage0/ModuleLoader-s0.pir:936) (src/ModuleLoader.pm:59)
called from Sub 'nqp;NQP;World;load_module' pc 15203 (src/stage0/NQP-s0.pir:3336) (src/stage2/gen/NQP.pm:64)
called from Sub 'nqp;NQP;Actions;statement_control:sym<use>' pc 115497 (src/stage0/NQP-s0.pir:34594) (src/stage2/gen/NQP.pm:1487)
called from Sub 'nqp;Regex;Cursor;!reduce' pc 2703 (src/stage0/Regex-s0.pir:1092)
called from Sub 'nqp;Regex;Cursor;!cursor_pass' pc 2116 (src/stage0/Regex-s0.pir:729)
called from Sub 'nqp;NQP;Grammar;statement_control:sym<use>' pc 35669 (src/stage0/NQP-s0.pir:10501) (src/stage2/gen/NQP.pm:654)

Cannot call a subroutine with a prefix "next"

<masak> nqp: sub next_() {}; next_()
<p6eval> nqp: OUTPUT«Confused at line 2, near "next_()" [...]
<masak> jnthn: this just bit me in NQP. is it a bug or a feature?
<masak> nqp: sub newt_() {}; newt_()
<p6eval> nqp:  ( no output )
<masak> anything starting with 'next' causes confusion.
<jnthn> masak: Probably overly-simplistic parsing of "next".
<masak> I know.
<masak> my question was if it's a bug or if the oversimplicity is intentional.
<jnthn> It's worth fixing. File an issue.
<jnthn> Or a patch ;)
* masak submits nqpbug

Null PMC access in --target=PAST output

Running nqp commit a555ce,

$ ./nqp --target=PAST
> say(42)

"past" => PMC 'PAST;Block'  {
    <hll> => "nqp"
    <loadinit> => PMC 'PAST;Stmts'  {
        [0] => PMC 'PAST;Op'  {
            <pasttype> => "if"
            [0] => PMC 'PAST;Op'  {
                <pirop> => "isnull IP"
                [0] => PMC 'PAST;Op'  {
                    <pirop> => "nqp_get_sc Ps"
                    [0] => "1305448589.01501"
                }
            }
            [1] => PMC 'PAST;Stmts'  {
                [0] => PMC 'PAST;Op'  {
                    <pirop> => "nqp_dynop_setup v"
                }
                [1] => PMC 'PAST;Op'  {
                    <name> => "hll_map"
                    <pasttype> => "callmethod"
                    [0] => PMC 'PAST;Op'  {
                        <pirop> => "getinterp P"
                    }
                    [1] => PMC 'PAST;Op'  {
                        <pirop> => "get_class Ps"
                        [0] => "LexPad"
                    }
                    [2] => PMC 'PAST;Op'  {
                        <pirop> => "get_class Ps"
                        [0] => "NQPLexPad"
                    }
                }
                [2] => PMC 'PAST;Op'  {
                    <pasttype> => "bind"
                    [0] => PMC 'PAST;Var'  {
                        <isdecl> => 1
                        <name> => "cur_sc"
                        <scope> => "register"
                    }
                    [1] => PMC 'PAST;Op'  {
                        <pirop> => "nqp_create_sc Ps"
                        [0] => \past
                    }
                }
                [3] => PMC 'PAST;Stmts'  {
                    [0] => PMC 'PAST;Op'  {
                        <pirop> => "nqp_set_sc_object vsiP"
                        [0] => \past
                        [1] => 0
                        [2] => PMC 'PAST;Op'  {
                            <pirop> => "nqp_set_sc_for_object__0PP"
                            [0] => PMC 'PAST;Op'  {
                                <name> => "new_type"
                                <pasttype> => "callmethod"
                                [0] => PMC 'PAST;Op'  {
                                    <pirop> => "nqp_get_sc_object Psi"
                                    [0] => "__6MODEL_CORE__"
                                    [1] => 0
                                }
                                [1] => PMC 'PAST;Val'  {
                                    <named> => "name"
                                    <value> => "GLOBALish"
                                }
                            }
                            [1] => PMC 'PAST;Var'  {
                                <name> => "cur_sc"
                                <scope> => "register"
                            }
                        }
                    }
                    [1] => PMC 'PAST;Stmts'  {
                        [0] => PMC 'PAST;Op'  {
                            <name> => "set_static_lexpad_value"
                            <pasttype> => "callmethod"
                            [0] => PMC 'PAST;Op'  {
                                <name> => "get_lexinfo"
                                <pasttype> => "callmethod"
                                [0] => PMC 'PAST;Val'  {
                                    <value> => \past
                                }
                            }
                            [1] => "GLOBALish"
                            [2] => PMC 'PAST;Op'  {
                                <pirop> => "nqp_get_sc_object Psi"
                                [0] => \past
                                [1] => \past
                            }
                        }
                        [1] => PMC 'PAST;Op'  {
                            <name> => "finish_static_lexpad"
                            <pasttype> => "callmethod"
                            [0] => PMC 'PAST;Op'  {
                                <name> => "get_lexinfo"
                                <pasttype> => "callmethod"
                                [0] => PMC 'PAST;Val'  {
                                    <value> => \past
                                }
                            }
                        }
                    }
                    [2] => PMC 'PAST;Stmts'  {
                        [0] => PMC 'PAST;Op'  {
                            <name> => "set_static_lexpad_value"
                            <pasttype> => "callmethod"
                            [0] => PMC 'PAST;Op'  {
                                <name> => "get_lexinfo"
                                <pasttype> => "callmethod"
                                [0] => PMC 'PAST;Val'  {
                                    <value> => \past
                                }
                            }
                            [1] => "$?PACKAGE"
                            [2] => PMC 'PAST;Op'  {
                                <pirop> => "nqp_get_sc_object Psi"
                                [0] => \past
                                [1] => \past
                            }
                        }
                        [1] => PMC 'PAST;Op'  {
                            <name> => "finish_static_lexpad"
                            <pasttype> => "callmethod"
                            [0] => PMC 'PAST;Op'  {
                                <name> => "get_lexinfo"
                                <pasttype> => "callmethod"
                                [0] => PMC 'PAST;Val'  {
                                    <value> => \past
                                }
                            }
                        }
                    }
                    [3] => PMC 'PAST;Stmts'  {
                        [0] => PMC 'PAST;Op'  {
                            <pirop> => "load_bytecode vs"
                            [0] => "ModuleLoader.pbc"
                        }
                        [1] => PMC 'PAST;Op'  {
                            <name> => "set_outer_ctx"
                            <pasttype> => "callmethod"
                            [0] => PMC 'PAST;Var'  {
                                <name> => "block"
                                <scope> => "register"
                            }
                            [1] => PMC 'PAST;Op'  {
                                <name> => "load_setting"
                                <pasttype> => "callmethod"
                                [0] => PMC 'PAST;Var'  {
                                    <name> => "ModuleLoader"
                                    <namespace> => ResizablePMCArray (size:0) [
                                    ]
                                    <scope> => "package"
                                }
                                [1] => "NQPCORE"
                            }
                        }
                    }
                    [4] => PMC 'PAST;Stmts'  {
                        [0] => PMC 'PAST;Op'  {
                            <pirop> => "load_bytecode vs"
                            [0] => "ModuleLoader.pbc"
                        }
                        [1] => PMC 'PAST;Op'  {
                            <name> => "load_module"
                            <pasttype> => "callmethod"
                            [0] => PMC 'PAST;Var'  {
                                <name> => "ModuleLoader"
                                <namespace> => ResizablePMCArray (size:0) [
                                ]
                                <scope> => "package"
                            }
                            [1] => "NQPRegex"
                            [2] => PMC 'PAST;Op'  {
                                <pirop> => "nqp_get_sc_object Psi"
                                [0] => \past
                                [1] => \past
                            }
                        }
                    }
                }
            }
            [2] => PMC 'PAST;Stmts'  {
                [0] => \past
                [1] => \past
            }
        }
        [1] => PMC 'PAST;Op'  {
            <pasttype> => "bind"
            [0] => PMC 'PAST;Var'  {
                <name> => "GLOBAL"
                <namespace> => ResizablePMCArray (size:0) [
                ]
                <scope> => "package"
            }
            [1] => PMC 'PAST;Op'  {
                <pirop> => "nqp_get_sc_object Psi"
                [0] => \past
                [1] => \past
            }
        }
    }
    <loadlibs> => ResizablePMCArray (size:2) [
        "nqp_group",
        "nqp_ops"
    ]
    <namespace> => ResizableStringArray (size:0) [
    ]
    <pos> => 0
    <source> => "say(42)\n"
    <symtable> => Hash {
        "$?PACKAGE" => Hash {
            "scope" => "lexical",
            "value" => PMC 'SixModelObject' { ... }
        },
        "$test_counter" => Hash {
            "scope" => "lexical",
            "value" => 0
        },
        "$todo_reason" => Hash {
            "scope" => "lexical",
            "value" => ""
        },
        "$todo_upto_test_num" => Hash {
            "scope" => "lexical",
            "value" => 0
        },
        "@ARGS" => Hash {
            "scope" => "lexical",
            "value" => ResizablePMCArray (size:0) [
            ]
        },
        "EXPORTHOW" => Hash {
            "scope" => "lexical",
            "value" => PMC 'SixModelObject' Null PMC access in invoke()
current instr.: 'parrot;Data;Dumper;Default;pmcDefault' pc 228 (runtime/parrot/library/Data/Dumper/Default.pir:190)
... call repeated 1 times
called from Sub 'parrot;Data;Dumper;Base;dump' pc 383 (runtime/parrot/library/Data/Dumper/Base.pir:251)
called from Sub 'parrot;Data;Dumper;Default;dumpWithName' pc 40 (runtime/parrot/library/Data/Dumper/Default.pir:56)
called from Sub 'parrot;Data;Dumper;Default;genericHash' pc 184 (runtime/parrot/library/Data/Dumper/Default.pir:153)
called from Sub 'parrot;Data;Dumper;Base;dump' pc 383 (runtime/parrot/library/Data/Dumper/Base.pir:251)
called from Sub 'parrot;Data;Dumper;Default;dumpWithName' pc 40 (runtime/parrot/library/Data/Dumper/Default.pir:56)
called from Sub 'parrot;Data;Dumper;Default;genericHash' pc 184 (runtime/parrot/library/Data/Dumper/Default.pir:153)
called from Sub 'parrot;Data;Dumper;Base;dump' pc 383 (runtime/parrot/library/Data/Dumper/Base.pir:251)
called from Sub 'parrot;Capture;__dump' pc 600 (runtime/parrot/library/Data/Dumper/Default.pir:454)
called from Sub 'parrot;Data;Dumper;Default;pmcDefault' pc 261 (runtime/parrot/library/Data/Dumper/Default.pir:208)
called from Sub 'parrot;Data;Dumper;Base;dump' pc 383 (runtime/parrot/library/Data/Dumper/Base.pir:251)
called from Sub 'parrot;Data;Dumper;Default;dumpWithName' pc 40 (runtime/parrot/library/Data/Dumper/Default.pir:56)
called from Sub 'parrot;Data;Dumper;dumper' pc 70 (runtime/parrot/library/Data/Dumper.pir:43)
called from Sub '_dumper' pc 56 (runtime/parrot/library/dumper.pir:89)
called from Sub 'nqp;HLL;Compiler;dumper' pc 40305 (src/stage2/gen/NQPHLL.pir:12963)
called from Sub 'nqp;HLL;Compiler;_block1592' pc 36119 (src/stage2/gen/NQPHLL.pir:11187)
called from Sub 'nqp;HLL;Compiler;_block1558' pc 35928 (src/stage2/gen/NQPHLL.pir:11094)
called from Sub 'nqp;HLL;Compiler;interactive' pc 35702 (src/stage2/gen/NQPHLL.pir:10994)
called from Sub 'nqp;HLL;Compiler;command_line' pc 37837 (src/stage2/gen/NQPHLL.pir:11870)
called from Sub 'MAIN' pc 20117 (src/stage2/gen/NQP.pir:4565)
called from Sub '_block11' pc 176 (src/stage2/gen/NQP.pir:78)

fails to build on big endian (mips, powerpc and sparc)

I currently get this when building nqp 2012.10 on mips:

/usr/bin/parrot --library=src/stage1 src/stage1/nqp.pbc \
        --target=pir --output=src/stage2/gen/NQP.pir \
        --module-path=src/stage2 --setting-path=src/stage2 src/stage2/gen/NQP.pm
make[2]: *** [src/stage2/nqp.pbc] Bus error
make[2]: Leaving directory `/build/buildd-nqp_2012.10-1-mips-P0hDD9/nqp-2012.10'

This may very well be a problem in Parrot, but I'm not sure.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.