Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Failure on current rakudo moar #1

Open
raydiak opened this issue Apr 30, 2015 · 10 comments
Open

Failure on current rakudo moar #1

raydiak opened this issue Apr 30, 2015 · 10 comments

Comments

@raydiak
Copy link

raydiak commented Apr 30, 2015

perl6 -Ilib -MGrammar::Generative -e 'grammar G { }'
(no output)

perl6 -Ilib -MGrammar::Generative -e 'grammar G { token TOP { . } }'
Segmentation fault

strace perl6 -Ilib -MGrammar::Generative -e 'grammar G { token TOP { . } }'
execve("/home/x/.rakudobrew/bin/perl6", ["perl6", "-Ilib", "-MGrammar::Generative", "-e", "grammar G { token TOP { . } }"], [/* 75 vars */]) = 0
brk(0) = 0x7f8aa1631000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8aa0ac2000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=171048, ...}) = 0
mmap(NULL, 171048, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8aa0a98000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\37\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1840928, ...}) = 0
mmap(NULL, 3949248, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f8aa04dd000
mprotect(0x7f8aa0698000, 2093056, PROT_NONE) = 0
mmap(0x7f8aa0897000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ba000) = 0x7f8aa0897000
mmap(0x7f8aa089d000, 17088, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f8aa089d000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8aa0a97000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8aa0a95000
arch_prctl(ARCH_SET_FS, 0x7f8aa0a95740) = 0
mprotect(0x7f8aa0897000, 16384, PROT_READ) = 0
mprotect(0x7f8aa0ce2000, 8192, PROT_READ) = 0
mprotect(0x7f8aa0ac4000, 4096, PROT_READ) = 0
munmap(0x7f8aa0a98000, 171048) = 0
getpid() = 4789
rt_sigaction(SIGCHLD, {0x7f8aa0ad9460, ~[RTMIN RT_1], SA_RESTORER, 0x7f8aa0513d40}, NULL, 8) = 0
geteuid() = 1000
brk(0) = 0x7f8aa1631000
brk(0x7f8aa1652000) = 0x7f8aa1652000
getppid() = 4786
stat("/home/x/data/projects/perl6/grammar-generative", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/home/x/.rakudobrew/bin/perl6", O_RDONLY) = 3
fcntl(3, F_DUPFD, 10) = 10
close(3) = 0
fcntl(10, F_SETFD, FD_CLOEXEC) = 0
rt_sigaction(SIGINT, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {0x7f8aa0ad9460, ~[RTMIN RT_1], SA_RESTORER, 0x7f8aa0513d40}, NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7f8aa0513d40}, NULL, 8) = 0
rt_sigaction(SIGTERM, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTERM, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7f8aa0513d40}, NULL, 8) = 0
read(10, "#!/bin/sh\n/home/x/.rakudobrew/bi"..., 8192) = 69
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f8aa0a95a10) = 4790
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGSEGV}], 0, NULL) = 4790
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=4790, si_status=SIGSEGV, si_utime=228, si_stime=9} ---
rt_sigreturn() = 4790
write(2, "Segmentation fault\n", 19Segmentation fault
) = 19
read(10, "", 8192) = 0
exit_group(139) = ?
+++ exited with 139 +++

perl6 -v
This is perl6 version 2015.04-83-gb6b180b built on MoarVM version 2015.04-24-g6ef0f8f

uname -a
Linux 3.16.0-28-generic #38-Ubuntu SMP Sat Dec 13 16:13:28 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

@raydiak
Copy link
Author

raydiak commented May 5, 2015

full gdb backtrace from moar built with --debug --optimize=0

> env/install/bin/perl6-gdb-m -Ilib -MGrammar::Generative -e 'grammar G { token TOP { . } }'
================================================================================================
This is Rakudo Perl 6 running in the GNU debugger, which often allwos to generate useful back-
traces to debug or report issues in Rakudo, the MoarVM backend or the currently running code.

This Rakudo version is 2015.4.168.g.1763049 built on MoarVM version 2015.4.64.g.9.bfcf.87,
running on ubuntu (14.4.Trusty.Tahr) / linux (38.Ubuntu.SMP.Sat.Dec.13.16.13.28.UTC.2014)

Type `bt full` to generate a backtrace if applicable, type `q` to quite or `help` for help.
------------------------------------------------------------------------------------------------
Reading symbols from /home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/bin/moar...done.
Starting program: /home/x/data/projects/perl6/grammar-generative/env/install/bin/moar --execname=env/install/bin/perl6-gdb-m --libpath=/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib --libpath=/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/perl6/lib --libpath=/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/perl6/runtime /home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/perl6/runtime/perl6.moarvm -Ilib -MGrammar::Generative -e grammar\ G\ \{\ token\ TOP\ \{\ .\ \}\ \}
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff791bee4 in extract_key (tc=0x6036f0, kdata=0x7fffffffc498, 
    klen=0x7fffffffc4a0, key=0xffffffff00000001)
    at src/6model/reprs/MVMHash.c:21
21          MVM_HASH_EXTRACT_KEY(tc, kdata, klen, key, "MVMHash representation requires MVMString keys")
(gdb) bt full
#0  0x00007ffff791bee4 in extract_key (tc=0x6036f0, kdata=0x7fffffffc498, 
    klen=0x7fffffffc4a0, key=0xffffffff00000001)
    at src/6model/reprs/MVMHash.c:21
No locals.
#1  0x00007ffff791e82e in exists_key (tc=0x6036f0, st=0x605728, 
    root=0x7ffff6551080, data=0x7ffff6551098, key=0xffffffff00000001)
    at src/6model/reprs/MVMHash.c:123
        body = 0x7ffff6551098
        kdata = 0x1d67e78
        entry = 0x6036f0                                                        
        klen = 140737326154616                                                  
#2  0x00007ffff78b4e51 in MVM_interp_run (tc=0x6036f0,                          
    initial_invoke=0x7ffff799c7c3 <toplevel_initial_invoke>,                    
    invoke_data=0x674140) at src/core/interp.c:2046                             
        obj = 0x7ffff6551080                                                    
        op = 325                                                                
        LABELS = {0x7ffff78a52a5 <MVM_interp_run+210>,                          
          0x7ffff78a6840 <MVM_interp_run+5741>,                                 
          0x7ffff78a6842 <MVM_interp_run+5743>,                                 
          0x7ffff78a6842 <MVM_interp_run+5743>,                                 
          0x7ffff78a685d <MVM_interp_run+5770>,                                 
          0x7ffff78a68e6 <MVM_interp_run+5907>,                                 
          0x7ffff78a6901 <MVM_interp_run+5934>, 
          0x7ffff78a6999 <MVM_interp_run+6086>, 
          0x7ffff78a5ba2 <MVM_interp_run+2511>, 
          0x7ffff78a5b6f <MVM_interp_run+2460>, 
          0x7ffff78a5b71 <MVM_interp_run+2462>, 
          0x7ffff78a5b73 <MVM_interp_run+2464>, 
          0x7ffff78a5b75 <MVM_interp_run+2466>, 
          0x7ffff78a5b77 <MVM_interp_run+2468>, 
          0x7ffff78a5b79 <MVM_interp_run+2470>, 
          0x7ffff78a5b7b <MVM_interp_run+2472>, 
          0x7ffff78a5b7d <MVM_interp_run+2474>, 
          0x7ffff78a5b7f <MVM_interp_run+2476>, 
          0x7ffff78a5b81 <MVM_interp_run+2478>, 
          0x7ffff78a5b83 <MVM_interp_run+2480>, 
          0x7ffff78a5b85 <MVM_interp_run+2482>, 
          0x7ffff78a5b87 <MVM_interp_run+2484>, 
          0x7ffff78a5b87 <MVM_interp_run+2484>, 
          0x7ffff78a52e7 <MVM_interp_run+276>, 
          0x7ffff78a5363 <MVM_interp_run+400>, 
          0x7ffff78a541d <MVM_interp_run+586>, 
          0x7ffff78a54d7 <MVM_interp_run+772>, 
          0x7ffff78a55a1 <MVM_interp_run+974>, 
          0x7ffff78a566b <MVM_interp_run+1176>, 
          0x7ffff78a574e <MVM_interp_run+1403>, 
          0x7ffff78a5831 <MVM_interp_run+1630>, 
          0x7ffff78a590b <MVM_interp_run+1848>, 
          0x7ffff78a59e5 <MVM_interp_run+2066>, 
          0x7ffff78a5aaa <MVM_interp_run+2263>, 
          0x7ffff78aa4d4 <MVM_interp_run+21249>, 
          0x7ffff78a5c38 <MVM_interp_run+2661>, 
          0x7ffff78a5e2b <MVM_interp_run+3160>, 
          0x7ffff78a5f3d <MVM_interp_run+3434>, 
          0x7ffff78a5ff0 <MVM_interp_run+3613>, 
          0x7ffff78a60a3 <MVM_interp_run+3792>, 
          0x7ffff78a6156 <MVM_interp_run+3971>, 
          0x7ffff78a6234 <MVM_interp_run+4193>, 
          0x7ffff78a62e6 <MVM_interp_run+4371>, 
          0x7ffff78a639b <MVM_interp_run+4552>, 
          0x7ffff78a644d <MVM_interp_run+4730>, 
          0x7ffff78a6560 <MVM_interp_run+5005>, 
          0x7ffff78a6560 <MVM_interp_run+5005>, 
          0x7ffff78aa710 <MVM_interp_run+21821>, 
          0x7ffff78aa7c8 <MVM_interp_run+22005>, 
          0x7ffff78ab151 <MVM_interp_run+24446>, 
          0x7ffff78ad6c6 <MVM_interp_run+34035>, 
          0x7ffff78a657b <MVM_interp_run+5032>, 
          0x7ffff78a660d <MVM_interp_run+5178>, 
          0x7ffff78a66ab <MVM_interp_run+5336>, 
          0x7ffff78a673d <MVM_interp_run+5482>, 
          0x7ffff78a67cf <MVM_interp_run+5628>, 
          0x7ffff78a8332 <MVM_interp_run+12639>, 
          0x7ffff78a83f3 <MVM_interp_run+12832>, 
          0x7ffff78a84b4 <MVM_interp_run+13025>, 
          0x7ffff78a8575 <MVM_interp_run+13218>, 
          0x7ffff78a8636 <MVM_interp_run+13411>, 
          0x7ffff78a86f7 <MVM_interp_run+13604>, 
          0x7ffff78aaec6 <MVM_interp_run+23795>, 
          0x7ffff78a6a31 <MVM_interp_run+6238>, 
          0x7ffff78a6aec <MVM_interp_run+6425>, 
          0x7ffff78a6baa <MVM_interp_run+6615>, 
          0x7ffff78a6c66 <MVM_interp_run+6803>, 
          0x7ffff78a6dee <MVM_interp_run+7195>, 
          0x7ffff78a6eaf <MVM_interp_run+7388>, 
          0x7ffff78a6fae <MVM_interp_run+7643>, 
          0x7ffff78a7072 <MVM_interp_run+7839>, 
          0x7ffff78a710b <MVM_interp_run+7992>, 
          0x7ffff78a71d2 <MVM_interp_run+8191>, 
          0x7ffff78a724d <MVM_interp_run+8314>, 
          0x7ffff78a72c8 <MVM_interp_run+8437>, 
          0x7ffff78a7343 <MVM_interp_run+8560>, 
          0x7ffff78a9d33 <MVM_interp_run+19296>, 
          0x7ffff78a9dee <MVM_interp_run+19483>, 
          0x7ffff78a9ea9 <MVM_interp_run+19670>, 
          0x7ffff78a9f64 <MVM_interp_run+19857>, 
          0x7ffff78a9ffd <MVM_interp_run+20010>, 
          0x7ffff78aa0bd <MVM_interp_run+20202>, 
          0x7ffff78aa17d <MVM_interp_run+20394>, 
          0x7ffff78ab0b2 <MVM_interp_run+24287>, 
          0x7ffff78b186f <MVM_interp_run+50844>, 
          0x7ffff78b199d <MVM_interp_run+51146>, 
          0x7ffff78a87b8 <MVM_interp_run+13797>, 
          0x7ffff78a8888 <MVM_interp_run+14005>, 
          0x7ffff78a8958 <MVM_interp_run+14213>, 
          0x7ffff78a8a1c <MVM_interp_run+14409>, 
          0x7ffff78a8ae0 <MVM_interp_run+14605>, 
          0x7ffff78a8ba4 <MVM_interp_run+14801>, 
          0x7ffff78aafba <MVM_interp_run+24039>, 
          0x7ffff78a7da0 <MVM_interp_run+11213>, 
          0x7ffff78a7e5f <MVM_interp_run+11404>, 
          0x7ffff78a7f1e <MVM_interp_run+11595>, 
          0x7ffff78a7fdd <MVM_interp_run+11786>, 
          0x7ffff78a809c <MVM_interp_run+11977>, 
          0x7ffff78a81c0 <MVM_interp_run+12269>, 
          0x7ffff78a8264 <MVM_interp_run+12433>, 
          0x7ffff78aa2ba <MVM_interp_run+20711>, 
          0x7ffff78ad7fe <MVM_interp_run+34347>, 
          0x7ffff78ad8b8 <MVM_interp_run+34533>, 
          0x7ffff78b0e10 <MVM_interp_run+48189>, 
          0x7ffff78b0eca <MVM_interp_run+48375>, 
          0x7ffff78b0f84 <MVM_interp_run+48561>, 
          0x7ffff78b103e <MVM_interp_run+48747>, 
          0x7ffff78b10f8 <MVM_interp_run+48933>, 
          0x7ffff78b11b2 <MVM_interp_run+49119>, 
          0x7ffff78b126c <MVM_interp_run+49305>, 
          0x7ffff78b1357 <MVM_interp_run+49540>, 
          0x7ffff78b1413 <MVM_interp_run+49728>, 
          0x7ffff78b14cb <MVM_interp_run+49912>, 
          0x7ffff78b1585 <MVM_interp_run+50098>, 
          0x7ffff78b163f <MVM_interp_run+50284>, 
          0x7ffff78b16f9 <MVM_interp_run+50470>, 
          0x7ffff78b17b5 <MVM_interp_run+50658>, 
          0x7ffff78b3cc9 <MVM_interp_run+60150>, 
          0x7ffff78b3d83 <MVM_interp_run+60336>, 
          0x7ffff78a9bfb <MVM_interp_run+18984>, 
          0x7ffff78a9c97 <MVM_interp_run+19140>, 
          0x7ffff78aa87c <MVM_interp_run+22185>, 
          0x7ffff78aa925 <MVM_interp_run+22354>, 
          0x7ffff78aa9da <MVM_interp_run+22535>, 
          0x7ffff78aaa83 <MVM_interp_run+22704>, 
          0x7ffff78aab3b <MVM_interp_run+22888>, 
          0x7ffff78aabfc <MVM_interp_run+23081>, 
          0x7ffff78a7458 <MVM_interp_run+8837>, 
          0x7ffff78a74db <MVM_interp_run+8968>, 
          0x7ffff78a7579 <MVM_interp_run+9126>, 
          0x7ffff78a7617 <MVM_interp_run+9284>, 
          0x7ffff78a76b5 <MVM_interp_run+9442>, 
          0x7ffff78a8c68 <MVM_interp_run+14997>, 
          0x7ffff78a8cf9 <MVM_interp_run+15142>, 
          0x7ffff78a8d99 <MVM_interp_run+15302>, 
          0x7ffff78a7753 <MVM_interp_run+9600>, 
          0x7ffff78a7880 <MVM_interp_run+9901>, 
          0x7ffff78a79c8 <MVM_interp_run+10229>, 
          0x7ffff78a7b10 <MVM_interp_run+10557>, 
          0x7ffff78a7c58 <MVM_interp_run+10885>, 
          0x7ffff78a8e39 <MVM_interp_run+15462>, 
          0x7ffff78a8ecb <MVM_interp_run+15608>, 
          0x7ffff78a8f74 <MVM_interp_run+15777>, 
          0x7ffff78a901d <MVM_interp_run+15946>, 
          0x7ffff78a90c6 <MVM_interp_run+16115>, 
          0x7ffff78a916f <MVM_interp_run+16284>, 
          0x7ffff78a9259 <MVM_interp_run+16518>, 
          0x7ffff78a9343 <MVM_interp_run+16752>, 
          0x7ffff78a942d <MVM_interp_run+16986>, 
          0x7ffff78a9517 <MVM_interp_run+17220>, 
          0x7ffff78a95d3 <MVM_interp_run+17408>, 
          0x7ffff78a968f <MVM_interp_run+17596>, 
          0x7ffff78a974b <MVM_interp_run+17784>, 
          0x7ffff78a9807 <MVM_interp_run+17972>, 
          0x7ffff78a9904 <MVM_interp_run+18225>, 
          0x7ffff78a9a01 <MVM_interp_run+18478>, 
          0x7ffff78a9afe <MVM_interp_run+18731>, 
          0x7ffff78aacbd <MVM_interp_run+23274>, 
          0x7ffff78aad64 <MVM_interp_run+23441>, 
          0x7ffff78a73be <MVM_interp_run+8683>, 
          0x7ffff78aa603 <MVM_interp_run+21552>, 
          0x7ffff78aa3a5 <MVM_interp_run+20946>, 
          0x7ffff78aa42b <MVM_interp_run+21080>, 
          0x7ffff78abb94 <MVM_interp_run+27073>, 
          0x7ffff78abc3b <MVM_interp_run+27240>, 
          0x7ffff78abd64 <MVM_interp_run+27537>, 
          0x7ffff78abe8d <MVM_interp_run+27834>, 
          0x7ffff78abf88 <MVM_interp_run+28085>, 
          0x7ffff78ac07e <MVM_interp_run+28331>, 
          0x7ffff78ac174 <MVM_interp_run+28577>, 
          0x7ffff78ac26f <MVM_interp_run+28828>, 
          0x7ffff78ac332 <MVM_interp_run+29023>, 
          0x7ffff78ac3f5 <MVM_interp_run+29218>, 
          0x7ffff78ac4b8 <MVM_interp_run+29413>, 
          0x7ffff78ac56b <MVM_interp_run+29592>, 
          0x7ffff78ac61e <MVM_interp_run+29771>, 
          0x7ffff78ac6d1 <MVM_interp_run+29950>, 
          0x7ffff78c024f <MVM_interp_run+110716>, 
          0x7ffff78c02ca <MVM_interp_run+110839>, 
          0x7ffff78ac792 <MVM_interp_run+30143>, 
          0x7ffff78ac844 <MVM_interp_run+30321>,
          0x7ffff78ac8d7 <MVM_interp_run+30468>,
          0x7ffff78adc8a <MVM_interp_run+35511>,
          0x7ffff78ac9cd <MVM_interp_run+30714>,
          0x7ffff78aca5f <MVM_interp_run+30860>,
          0x7ffff78acaf1 <MVM_interp_run+31006>,
          0x7ffff78acc01 <MVM_interp_run+31278>,
          0x7ffff78acd43 <MVM_interp_run+31600>,
          0x7ffff78ace85 <MVM_interp_run+31922>,
          0x7ffff78acfc7 <MVM_interp_run+32244>,
          0x7ffff78ad109 <MVM_interp_run+32566>,
          0x7ffff78c10c5 <MVM_interp_run+114418>,
          0x7ffff78c1203 <MVM_interp_run+114736>,
          0x7ffff78ad350 <MVM_interp_run+33149>,
          0x7ffff78ad511 <MVM_interp_run+33598>,
          0x7ffff78ad5fb <MVM_interp_run+33832>,
          0x7ffff78b93ea <MVM_interp_run+82455>,
          0x7ffff78b8d8b <MVM_interp_run+80824>,
          0x7ffff78ae7c9 <MVM_interp_run+38390>,
          0x7ffff78ae894 <MVM_interp_run+38593>...}
        cur_op = 0x7ffff5aa568c "\n"
        bytecode_start = 0x7ffff5aa547a "\214"
        reg_base = 0x1d67e10
        cu = 0x65e870
        cur_callsite = 0x7ffff7d5d6a0 <inv_arg_callsite>
#3  0x00007ffff799c901 in MVM_vm_run_file (instance=0x603010,
    filename=0x7fffffffdf71 "/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/perl6/runtime/perl6.moarvm") at src/moar.c:218
        start_frame = 0x674140
        tc = 0x6036f0
        cu = 0x65d650
#4  0x00000000004011f6 in main (argc=10, argv=0x7fffffffd9d8) at src/main.c:189
        instance = 0x603010
        input_file = 0x7fffffffdf71 "/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/perl6/runtime/perl6.moarvm"
        executable_name = 0x7fffffffde36 "env/install/bin/perl6-gdb-m"
        lib_path = {
          0x7fffffffde5c "/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib",
          0x7fffffffdeb9 "/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/perl6/lib",
          0x7fffffffdf18 "/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/perl6/runtime", 0x0,
          0x401220 <__libc_csu_init> "AWA\211\377AVI\211\366AUI\211\325ATL\215%`\v ",
          0x400c60 <_start> "1\355I\211\321^H\211\342H\203\344\360PTI\307\300\220\022@", 0x7fffffffd9d0 "\n", 0x0}
        dump = 0
        full_cleanup = 0
        argi = 6
        lib_path_i = 3
        flag = -2
(gdb) q
A debugging session is active.

        Inferior 1 [process 11621] will be killed.

Quit anyway? (y or n) y
>

@raydiak
Copy link
Author

raydiak commented May 5, 2015

(gdb) print MVM_dump_backtrace(tc) 
   at <unknown>:1  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/perl6/runtime/CORE.setting.moarvm:ASSIGN-KEY:4294967295)
 from src/gen/m-CORE.setting:2330  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/perl6/runtime/CORE.setting.moarvm:ASSIGN-KEY:44)
 from src/gen/m-CORE.setting:3758  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/perl6/runtime/CORE.setting.moarvm:postcircumfix:<{ }>:35)
 from src/gen/m-CORE.setting:3751  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/perl6/runtime/CORE.setting.moarvm:postcircumfix:<{ }>:25)
 from /home/x/data/projects/perl6/grammar-generative/lib/Grammar/Generative.pm6:362  (<ephemeral file>:save_rx_ast:66)
 from /home/x/data/projects/perl6/grammar-generative/lib/Grammar/Generative.pm6:390  (<ephemeral file>::46)
 from /home/x/data/projects/perl6/grammar-generative/lib/Grammar/Generative.pm6:389  (<ephemeral file>:regex_def:98)
 from gen/moar/stage2/QRegex.nqp:1248  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/QRegex.moarvm:!reduce:0)
 from gen/moar/stage2/QRegex.nqp:1204  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/QRegex.moarvm:!cursor_pass:0)
 from src/Perl6/Grammar.nqp:2784  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Grammar.moarvm:regex_def:1586)
 from src/Perl6/Grammar.nqp:2744  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Grammar.moarvm:regex_declarator:sym<token>:230)
 from gen/moar/stage2/QRegex.nqp:1264  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/QRegex.moarvm:!protoregex:0)
 from <unknown>:1  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Grammar.moarvm:regex_declarator:10)
 from <unknown>:1  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Grammar.moarvm:term:sym<regex_declarator>:57)
 from gen/moar/stage2/QRegex.nqp:1281  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/QRegex.moarvm:!protoregex:88)
 from src/Perl6/Grammar.nqp:3475  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Grammar.moarvm:termish:0)
 from gen/moar/stage2/NQPHLL.nqp:656  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/NQPHLL.moarvm:EXPR:55)
 from <unknown>:1  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Grammar.moarvm:statement:4294967295)
 from src/Perl6/Grammar.nqp:1092  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Grammar.moarvm:statementlist:280)
 from src/Perl6/Grammar.nqp:1252  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Grammar.moarvm:blockoid:206)
 from src/Perl6/Grammar.nqp:2151  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Grammar.moarvm:package_def:2232)
 from <unknown>:1  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Grammar.moarvm:package_declarator:sym<grammar>:175)
 from gen/moar/stage2/QRegex.nqp:1287  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/QRegex.moarvm:!protoregex:110)
 from <unknown>:1  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Grammar.moarvm:package_declarator:10)
 from <unknown>:1  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Grammar.moarvm:term:sym<package_declarator>:57)
 from gen/moar/stage2/QRegex.nqp:1287  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/QRegex.moarvm:!protoregex:110)
 from src/Perl6/Grammar.nqp:3475  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Grammar.moarvm:termish:0)
 from gen/moar/stage2/NQPHLL.nqp:678  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/NQPHLL.moarvm:EXPR:75)
 from src/Perl6/Grammar.nqp:3515  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Grammar.moarvm:EXPR:24)
 from src/Perl6/Grammar.nqp:1157  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Grammar.moarvm:statement:395)
 from src/Perl6/Grammar.nqp:1092  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Grammar.moarvm:statementlist:280)
 from gen/moar/stage2/NQPHLL.nqp:895  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/NQPHLL.moarvm:LANG:146)
 from src/Perl6/Grammar.nqp:1460  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Grammar.moarvm:FOREIGN_LANG:67)
 from src/Perl6/Grammar.nqp:1069  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Grammar.moarvm:comp_unit:1019)
 from src/Perl6/Grammar.nqp:382  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Grammar.moarvm:TOP:491)
 from gen/moar/stage2/QRegex.nqp:1886  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/QRegex.moarvm:parse:44)
 from gen/moar/stage2/NQPHLL.nqp:1575  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/NQPHLL.moarvm:parse:80)
 from gen/moar/stage2/NQPHLL.nqp:1531  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/NQPHLL.moarvm:compile:203)
 from gen/moar/stage2/NQPHLL.nqp:1272  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/NQPHLL.moarvm:eval:62)
 from gen/moar/stage2/NQPHLL.nqp:1378  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/NQPHLL.moarvm::35)
 from gen/moar/stage2/NQPHLL.nqp:1375  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/NQPHLL.moarvm:command_eval:152)
 from src/Perl6/Compiler.nqp:59  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/Perl6/Compiler.moarvm:command_eval:93)
 from gen/moar/stage2/NQPHLL.nqp:1360  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/nqp/lib/NQPHLL.moarvm:command_line:116)
 from src/gen/m-main.nqp:39  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/perl6/runtime/perl6.moarvm:MAIN:18)
 from src/gen/m-main.nqp:35  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/perl6/runtime/perl6.moarvm:<mainline>:197)
 from <unknown>:1  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/perl6/runtime/perl6.moarvm:<main>:8)
 from <unknown>:1  (/home/x/data/projects/perl6/grammar-generative/env/rakudo/../install/share/perl6/runtime/perl6.moarvm:<entry>:9)
$1 = void
(gdb)

@raiph
Copy link

raiph commented Jul 14, 2015

It's not a segfault on my system.

raiph@hack:~/dev$ perl6 -v
This is perl6 version 2015.06-245-g533d1a9 built on MoarVM version 2015.06-88-g647df11

For reasons not worth talking about atm, I renamed the module to lose the '::'. Other than that, my test is the same basic one that raydiak had golfed to, and it still fails, but it has a cleaner exit than a segfault:

raiph@hack:~/dev$ perl6 -I. -MGrammarGenerative -e 'grammar G { token TOP { . } }'
===SORRY!===
getcodename requires a concrete code object

I get the same message when running this project's t/01-basic.t file.

The debugger shows code setting everything up then starting to go thru method compile(Mu $ast). Initially the variable $ast is a 'QAST::Regex' and $ast.rxtype is "concat". A few calls later $ast.rxtype is "qastnode" and the code falls thru to the end of the switch statement and hits a die at https://github.com/jnthn/grammar-generative/blob/master/lib/Grammar/Generative.pm6#L177.

@fecundf
Copy link

fecundf commented Mar 5, 2016

I'm interested in using reversible grammars, but alas I am also also getting "getcodename requires a concrete code object" when running t01-rules. I'm using Rakudo* 2016.01.1 on Windows 64-bit

Running the test inside perl6-debug-m (is that also your project?) gives a different error, and this backtrace:

perl6-debug-m -I..\lib 01-basic.t

>>> LOADING 01-basic.t
+ 01-basic.t (2 - 6)
| use Test;
| 
| plan 16;
| 
| grammar T01 {
> 
1..16
+ 01-basic.t (7 - 11)
|     token TOP { dog }
| }
| is T01.generate(), 'dog', 'can generate literal';
| 
| grammar T02 {
> 
Unhandled exception: ctxlexpad needs an MVMContext
   at gen/moar/m-CORE.setting:18011  (C:\rakudo/share/perl6/runtime/CORE.setting.moarvm::24)
 from gen/moar/m-CORE.setting:18122  (C:\rakudo/share/perl6/runtime/CORE.setting.moarvm:AT-KEY:0)
 from gen/moar/m-CORE.setting:6025  (C:\rakudo/share/perl6/runtime/CORE.setting.moarvm:postcircumfix:<{ }>:0)
 from C:\rakudo\share\perl6\site\sources\3AA989C1A376FE3F6A06324CA88CF80AB51E663D:736  (C:\Users\yhluc00\Documents\GitHub\grammar-generative\t\lib\.precomp\34C40ED80206941C844106C0BECEBD0BCE0E58E3.1454618830.87862\3A\3AA989C1A376FE3F6A06324CA88CF80AB51E663D::80)
 from gen/moar/m-CORE.setting:3824  (C:\rakudo/share/perl6/runtime/CORE.setting.moarvm:sink-all:168)
 from gen/moar/m-CORE.setting:12357  (C:\rakudo/share/perl6/runtime/CORE.setting.moarvm:sink:0)
 from C:\rakudo\share\perl6\site\sources\3AA989C1A376FE3F6A06324CA88CF80AB51E663D:730  (C:\Users\yhluc00\Documents\GitHub\grammar-generative\t\lib\.precomp\34C40ED80206941C844106C0BECEBD0BCE0E58E3.1454618830.87862\3A\3AA989C1A376FE3F6A06324CA88CF80AB51E663D:unhandled:110)
 from C:\rakudo\share\perl6\site\sources\3AA989C1A376FE3F6A06324CA88CF80AB51E663D:721  (C:\Users\yhluc00\Documents\GitHub\grammar-generative\t\lib\.precomp\34C40ED80206941C844106C0BECEBD0BCE0E58E3.1454618830.87862\3A\3AA989C1A376FE3F6A06324CA88CF80AB51E663D::28)
 from gen/moar/m-Metamodel.nqp:3927  (C:\rakudo\share\nqp\lib/Perl6/Metamodel.moarvm:enter:28)
 from gen/moar/m-CORE.setting:6937  (C:\rakudo/share/perl6/runtime/CORE.setting.moarvm:CALL-ME:53)
 from gen/moar/m-BOOTSTRAP.nqp:2854  (C:\rakudo/share/nqp/lib/Perl6/BOOTSTRAP.moarvm::81)
 from gen\moar\stage2\NQPHLL.nqp:1435  (C:\rakudo\share\nqp\lib/NQPHLL.moarvm:command_eval:380)
 from src/Perl6/Compiler.nqp:69  (C:\rakudo\share\nqp\lib/Perl6/Compiler.moarvm:command_eval:93)
 from gen\moar\stage2\NQPHLL.nqp:1375  (C:\rakudo\share\nqp\lib/NQPHLL.moarvm:command_line:114)
 from gen/moar/m-perl6-debug.nqp:494  (C:\rakudo\share\perl6\runtime\perl6-debug.moarvm:MAIN:183)
 from gen/moar/m-perl6-debug.nqp:440  (C:\rakudo\share\perl6\runtime\perl6-debug.moarvm:<mainline>:68)
 from <unknown>:1  (C:\rakudo\share\perl6\runtime\perl6-debug.moarvm:<main>:8)
 from <unknown>:1  (C:\rakudo\share\perl6\runtime\perl6-debug.moarvm:<entry>:9)

@raydiak
Copy link
Author

raydiak commented Jul 18, 2020

I no longer get a segfault, but this instead:

$ raku -Ilib t/01-basic.t
1..16
Don't know how to generate TOP
in method generator at /home/x/data/projects/raku/grammar-generative/lib/Grammar/Generative.pm6 (Grammar::Generative) line 375
in method generate at /home/x/data/projects/raku/grammar-generative/lib/Grammar/Generative.pm6 (Grammar::Generative) line 324
in block at t/01-basic.t line 9

# You planned 16 tests, but ran 0

@raydiak raydiak changed the title Segfault on current rakudo moar Failure on current rakudo moar Mar 6, 2021
@raydiak
Copy link
Author

raydiak commented Mar 6, 2021

I have golfed and bisected the current failure point to 2017.02: https://gist.github.com/Whateverable/708722d6f5228bbde5907d1619f2fbc8

The comment on rakudo/rakudo@f526c7d looks like a pertinent clue to relevant changes around that time, but we no longer have Cursors, and full-text searching the current docs for "braid" yields 0 results. I don't immediately see where to read for the current best way to accomplish this; more digging will be necessary if nobody better informed steps up.

@jnthn I assume this was a brief and unprofitable side project for you, but any insight to guide the less meta-capable of us who would like to spend some tuits on this module would be greatly appreciated. Even just a link or few to the pertinent doc pages or a similar working model in a maintained module would greatly lower the contribution barrier.

I've also genericized the title of this issue, as various failure modes beyond my original segfault have been added to this discussion.

@raiph
Copy link

raiph commented Mar 11, 2021

Hi @raydiak,

The comment on rakudo/rakudo@f526c7d looks like a pertinent clue to relevant changes around that time, but we no longer have Cursors, and full-text searching the current docs for "braid" yields 0 results.

Ah. That's pretty close to the time Larry stopped working on Rakudo.

Presumably you know all about the braid, right?

@raydiak
Copy link
Author

raydiak commented Mar 12, 2021

Hello @raiph, good to hear from you. I noticed Larry isn't active; I miss him. I do recall a vague impression of reading about the braid somewhere, but it's been so many years that it'd be more productive to assume I know very little. That goes double for things which have changed in the past half decade. Relevant links or explanations are totally welcome, including anything I may have already known. When I have another block of time to throw at this, I was going to look for useful examples in slangs on the ecosystem, and read docs some more. Asking specific questions in #raku was not fruitful, and I've avoided cluttering #raku-dev as I'm not currently contributing to raku itself.

@jnthn
Copy link
Owner

jnthn commented Mar 12, 2021

@jnthn I assume this was a brief and unprofitable side project for you,

It was quite interesting to explore the idea, and I got a conference talk out of it (which I believe remains the most brain-melting one I've done to date). :-)

but any insight to guide the less meta-capable of us who would like to spend some tuits on this module would be greatly appreciated. Even just a link or few to the pertinent doc pages or a similar working model in a maintained module would greatly lower the contribution barrier.

This module always was going to be terribly fragile due to its reliance on Rakudo compiler guts. However, there's good news: the ongoing RakuAST work means that there will finally be a supported API providing access to the grammar syntax tree - at which point there will be a supported way to write a module like this!

I do wonder, however, if that will ultimately be the "easy" part. Glancing the code, it seems I decided to do whatever the generative alternative to backtracking is with copious use of coroutines, nicely embedded in a tree of closures, and I'm still not sure if that's beautiful or terrible (I'm quite sure it isn't going to be very fast, and would be rather "fun" to debug). Looking at it the better part of a decade on, I'm mildly horrified that this relatively small amount of code was able to run, if I remember correctly, a JSON grammar backwards.

Anyway, it'd be a nice thing to resurrect once we have RakuAST.

@raydiak
Copy link
Author

raydiak commented Mar 12, 2021

I did enjoy that talk very much when I originally watched it! Now that I realize it relies on unspeced compiler guts, I understand why it's been so broken for so long and why I've had difficulty determining the correct path forward.

I don't know much about the RakuAST work other than having seen it mentioned, but it sounds quite exciting. If you don't like the tree of closures, perhaps RakuAST could help there also, by building up a single large function for the entire grammar as you walk the tree at compile time, instead of a small separate function for each branch. The same could be done now, but you'd have to build the function textually and then EVAL it (a technique I'm unfortunately reliant on in multiple modules).

Thanks for the update! Keeps me from chasing my tail in circles. I appreciate the context, and the AST excitement to look forward to.

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

No branches or pull requests

4 participants