Skip to content

Instantly share code, notes, and snippets.

@dogbert17
dogbert17 / gist:810f1471907e2c2fa433dde90bb57a19
Created November 18, 2021 12:57
GC bug with small nursery
Starting program: /home/dogbert/repos/rakudo/install/bin/moar --execname=/home/dogbert/repos/rakudo/rakudo-gdb-m --libpath=/home/dogbert/repos/rakudo --libpath=/home/dogbert/repos/rakudo/blib --libpath=/home/dogbert/repos/rakudo/install/share/nqp/lib /home/dogbert/repos/rakudo/perl6.moarvm -Ilib t/spec/S04-blocks-and-statements/let.t
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff72f8700 (LWP 210684)]
Thread 1 "moar" hit Breakpoint 1, MVM_panic (exitCode=exitCode@entry=1, messageFormat=messageFormat@entry=0x7ffff7a4f118 "Adding pointer %p to past fromspace to GC worklist") at src/core/exceptions.c:840
840 MVM_NO_RETURN void MVM_panic(MVMint32 exitCode, const char *messageFormat, ...) {
(gdb) bt
#0 MVM_panic (exitCode=exitCode@entry=1, messageFormat=messageFormat@entry=0x7ffff7a4f118 "Adding pointer %p to past fromspace to GC worklist") at src/core/exceptions.c:840
#1 0x00007ffff78b99c4 in MVM_callsite_mark (tc=tc@e
@dogbert17
dogbert17 / gist:93fc8512fda91df90563d5ce49522baa
Created November 12, 2021 17:53
Memory allocation error
dogbert@dogbert-VirtualBox:~/repos/rakudo$ MVM_SPESH_NODELAY=1 ./rakudo-gdb-m -Ilib t/spec/S32-num/complex.t
================================================================================================
This is Rakudo running in the debugger, which often allows the user to generate useful back-
traces to debug or report issues in Rakudo, the MoarVM backend or the currently running code.
This Rakudo version is 2021.10.90.gfca.63.e.6.c.0 built on MoarVM version 2021.10.65.gf.8.addda.15,
running on linuxmint (20.Ulyana) / linux
Type `bt full` to generate a backtrace if applicable, type `q` to quit or `help` for help.
------------------------------------------------------------------------------------------------
dogbert@dogbert-VirtualBox:~/repos/rakudo/nqp$ git diff
diff --git a/src/HLL/sprintf.nqp b/src/HLL/sprintf.nqp
index 0c34b976b..307dff86d 100644
--- a/src/HLL/sprintf.nqp
+++ b/src/HLL/sprintf.nqp
@@ -1,6 +1,5 @@
my module sprintf {
my @handlers;
- my $assert_used_args;
@dogbert17
dogbert17 / gist:aba76e5696ae6aaaa3cc6b405c9d94ce
Created November 6, 2021 12:41
Failure in t/spec/S07-hyperrace/basics.t
ok 32 - Correct result of .hyper.map(*+1) (try 4)
Directive x not applicable for value of type Int
at gen/moar/stage2/NQPHLL.nqp:3180 (/home/dogbert/repos/rakudo/install/share/nqp/lib/NQPHLL.moarvm:panic)
from gen/moar/stage2/NQPHLL.nqp:3187 (/home/dogbert/repos/rakudo/install/share/nqp/lib/NQPHLL.moarvm:bad-type-for-directive)
from gen/moar/stage2/NQPHLL.nqp:3676 (/home/dogbert/repos/rakudo/install/share/nqp/lib/NQPHLL.moarvm:)
from <unknown>:1 (/home/dogbert/repos/rakudo/install/share/nqp/lib/NQPHLL.moarvm:)
from gen/moar/stage2/NQPHLL.nqp:3225 (/home/dogbert/repos/rakudo/install/share/nqp/lib/NQPHLL.moarvm:intify)
from gen/moar/stage2/NQPHLL.nqp:3674 (/home/dogbert/repos/rakudo/install/share/nqp/lib/NQPHLL.moarvm:directive:sym<x>)
from <unknown>:1 (/home/dogbert/repos/rakudo/install/share/nqp/lib/NQPHLL.moarvm:directive:sym<x>)
from gen/moar/stage2/QRegex.nqp:1704 (/home/dogbert/repos/rakudo/install/share/nqp/lib/QRegex.moarvm:!protoregex)
use Test;
for ^1000 {
subtest 'Complex smartmatch against Range' => {
my @false = [i, 1..10], [i, -2e300.Int..2e300.Int], [i, -2e300.Int..2e300.Int],
[<0+0i>, 1..10], [i, 'a'..Inf], [i, 'a'..'z'];
# these cases are true because the imaginary part is small enough that
# we can convert these Complex into Real
my @true = [<0+0i>, -1..10], [<42+0i>, 10..50],
@dogbert17
dogbert17 / gist:9c648c7e45d31a09abc686c6e046b573
Last active November 1, 2021 20:53
MVM_SPESH_BLOCKING=1 MVM_SPESH_NODELAY=1 ./rakudo-m -Ilib --ll-exception t/spec/S02-types/range.t
Already set resume init args for this dispatcher
at gen/moar/BOOTSTRAP/v6c.nqp:6483 (/home/dogbert/repos/rakudo/blib/Perl6/BOOTSTRAP/v6c.moarvm:)
from SETTING::src/core.c/control.pm6:142 (/home/dogbert/repos/rakudo/blib/CORE.c.setting.moarvm:nextwith)
from t/spec/S02-types/range.t:424 (<ephemeral file>:)
from t/spec/S02-types/range.t:424 (<ephemeral file>:)
from /home/dogbert/repos/rakudo/lib/Test.rakumod (Test):437 (/home/dogbert/repos/rakudo/lib/.precomp/C601F303FBC246C4EF142E264D5F787A045E64E9/5E/5EA2A7E78354B30F3134E1ECF9CECB9AA20D5387:)
from /home/dogbert/repos/rakudo/lib/Test.rakumod (Test):427 (/home/dogbert/repos/rakudo/lib/.precomp/C601F303FBC246C4EF142E264D5F787A045E64E9/5E/5EA2A7E78354B30F3134E1ECF9CECB9AA20D5387:subtest)
from /home/dogbert/repos/rakudo/lib/Test.rakumod (Test):425 (/home/dogbert/repos/rakudo/lib/.precomp/C601F303FBC246C4EF142E264D5F787A045E64E9/5E/5EA2A7E78354B30F3134E1ECF9CECB9AA20D5387:subtest)
from t/spec/S02-types/range.t:411 (<ephemeral file>:<unit>)
from t/
1..7
ok 1 - no lastcall, so we defer up the inheritance tree
ok 2 - sanity test for clearing
ok 3 - lastcall means nextsame causes Nil return of method
ok 4 - lastcall meant nextsame failed, no deferal happened
00000 checkarity 1, 1
00001 param_rp_o loc_0_obj, 0
00002 paramnamesused
annotation: gen/moar/BOOTSTRAP/v6c.nqp:5248
00003 const_s loc_5_str, 'dispatcher-get-resume-state'
@dogbert17
dogbert17 / gist:d3fee0f081bb30be355108854faa2f71
Last active October 24, 2021 20:34
Flapper in t/spec/S12-methods/lastcall.t
Notes: nursery is set to 20k. It seems as if adding MVM_SPESH_OSR_DISABLE=1 makes the problem go away.
dogbert@dogbert-VirtualBox:~/repos/rakudo$ MVM_SPESH_NODELAY=1 MVM_SPESH_BLOCKING=1 ./rakudo-gdb-m -Ilib --ll-exception t/spec/S12-methods/lastcall.t
================================================================================================
This is Rakudo running in the debugger, which often allows the user to generate useful back-
traces to debug or report issues in Rakudo, the MoarVM backend or the currently running code.
This Rakudo version is 2021.09.282.g.6.d.45.da.84.c built on MoarVM version 2021.09.676.g.8.c.7.b.734.d.8,
running on linuxmint (20.Ulyana) / linux
@dogbert17
dogbert17 / white-noise.raku
Created October 8, 2021 14:58
Thundergnat
use NativeCall;
use SDL2::Raw;
my int ($w, $h) = 320, 240;
SDL_Init(VIDEO);
my SDL_Window $window = SDL_CreateWindow(
"White Noise - Raku",
SDL_WINDOWPOS_CENTERED_MASK, SDL_WINDOWPOS_CENTERED_MASK,
@dogbert17
dogbert17 / euler-12.raku
Created October 7, 2021 12:57
Runs faster with expr-jit turned off
# What is the value of the first triangle number to have over five hundred divisors?
use v6;
my $numFactors = 500;
my $sum = 0;
for (1...*) -> $term {
$sum += $term;
my $factors = (1..floor(sqrt($sum))).grep( -> $x { $sum % $x == 0} ).elems * 2;
$factors-- if floor(sqrt($sum)) == sqrt($sum);
if $factors > $numFactors {