View calculate.nqp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env nqp | |
# From https://www.johnhawthorn.com/2018/02/playing-with-ruby-jit-mjit/ | |
sub calculate(int $a, int $b, int $n) { | |
my int $i := 0; | |
my int $c := 0; | |
while $i < $n { | |
$a := $a * 16807 % 2147483647; | |
$b := $b * 48271 % 2147483647; |
View mislabel.sam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; we jump inbetween this and the next, and so corrupt our stack and our frame | |
505a: 4c 8b 5b 58 mov r11,QWORD PTR [rbx+0x58] | |
505e: 48 8b 53 60 mov rdx,QWORD PTR [rbx+0x60] | |
5062: 48 89 93 e8 02 00 00 mov QWORD PTR [rbx+0x2e8],rdx | |
5069: 48 c7 c2 04 00 00 00 mov rdx,0x4 | |
5070: 48 8b 8b d8 02 00 00 mov rcx,QWORD PTR [rbx+0x2d8] | |
5077: 4c 89 5c 24 20 mov QWORD PTR [rsp+0x20],r11 | |
507c: 48 89 54 24 30 mov QWORD PTR [rsp+0x30],rdx | |
5081: 4c 89 c0 mov rax,r8 | |
5084: 4c 89 ca mov rdx,r9 |
View search_frame_handlers_lex.s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0x0000000069bc7443 <+0>: push rbp | |
0x0000000069bc7444 <+1>: push rbx | |
0x0000000069bc7445 <+2>: sub rsp,0x98 | |
0x0000000069bc744c <+9>: lea rbp,[rsp+0x80] | |
0x0000000069bc7454 <+17>: mov QWORD PTR [rbp+0x30],rcx | |
0x0000000069bc7458 <+21>: mov QWORD PTR [rbp+0x38],rdx | |
0x0000000069bc745c <+25>: mov DWORD PTR [rbp+0x40],r8d | |
0x0000000069bc7460 <+29>: mov QWORD PTR [rbp+0x48],r9 | |
0x0000000069bc7464 <+33>: mov rax,QWORD PTR [rbp+0x58] | |
0x0000000069bc7468 <+37>: mov eax,DWORD PTR [rax] |
View gist:e9b7c6e3e92e788d2fdcec6df6c171ab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl6 | |
multi sub euclid ($a is copy, $b is copy) { | |
while ($b != 0) { | |
($a, $b) = ($b, $a % $b); | |
} | |
return $a; | |
} | |
multi sub euclid ($a, $b where $a < $b) { |
View sub-declaration.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
sub foo { | |
my ($x) = @_; | |
return 0 if ($x == 0); | |
return foo $x - 1; | |
} | |
foo 3; |
View linear-scan.log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Starting dump of JIT expression tree | |
==================================== | |
digraph { | |
n_0001 [label="LOCAL"]; | |
n_0002 [label="ADDR(0xd8)"]; | |
n_0002 -> n_0001; | |
n_0008 [label="TC"]; | |
n_0009 [label="ADDR(0x1b0)"]; | |
n_0009 -> n_0008; | |
n_0012 [label="LOAD(0x8)"]; |
View channel-breakage.pl6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl6 | |
use v6; | |
for (0..1000) { | |
my $channel = Channel.new; | |
$channel.close; | |
my $result = (try $channel.receive) // buf8; | |
say "Result is undefined" unless $result.defined; | |
} |
View heapsnapshot.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/profiler/heapsnapshot.c b/src/profiler/heapsnapshot.c | |
index 071954f..a4a6d9c 100644 | |
--- a/src/profiler/heapsnapshot.c | |
+++ b/src/profiler/heapsnapshot.c | |
@@ -820,7 +820,7 @@ void references_to_filehandle(MVMThreadContext *tc, MVMHeapSnapshotCollection *c | |
MVMuint64 maxval = MAX(kind, cindex); | |
- if (maxval + 1 >= 1l << 32) { | |
+ if (maxval + 1 >= (UINT64_C(1) << 32)) { |
View make-an-adhoc-jit-graph.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void adhoc_jit_graph (MVMThreadContext *tc) { | |
MVMJitGraph graph; | |
MVMJitNode label_node, call_node; | |
void *labels[2]; | |
labels[0] = &label_node; | |
labels[1] = &graph; | |
MVMJitCode *code; | |
graph.labels = labels; | |
graph.first_node = &label_node; | |
label_node.type = MVM_JIT_NODE_LABEL; |
View spesh-log.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Specialization of 'compile_node' (cuid: 118) | |
Before: | |
Spesh of 'compile_node' (cuid: 118, file: gen/moar/stage2/QAST.nqp:5747) | |
BB 0 (0x101d20430): | |
line: 5747 (pc 0) | |
Instructions: | |
no_op | |
Successors: 1 |