Skip to content

Instantly share code, notes, and snippets.

@gerdr
gerdr / deps.txt
Last active December 12, 2015 09:19
pir deps for ext/:compiler/
ops2c.pir
.include "except_types.pasm"
load_bytecode "opsc.pbc"
load_bytecode "Getopt/Obj.pbc"
ext/nqp-rx/src/stage0/HLL-s0.pir
load_bytecode 'Regex.pbc'
.include 'cclass.pasm'
.include "except_types.pasm"
load_bytecode "PCT/HLLCompiler.pbc"
@gerdr
gerdr / notes.md
Last active December 12, 2015 09:49 — forked from anonymous/notes.md
random stuff that needs doing on the road to Parrot 6

Easy(-ish) stuff

  • resurrect tools/build/nativecall.pl (removed in Parrot 2.1.0) or port tools/dev/nci_thunk_gen.pir to Perl5 ( I've started with the latter, but progress is slow as it's boring )

    this is desirable as nci_thunk_gen.pir pulls in TGE via compilers/data_json

  • put the axe to runtime/parrot/library

  • migrate ops2c to NQP proper (or even Perl6)

it should be feasible as the files generated for NQP dynops can be checked-in the same way the Parrot ones already are

$ make
[...]
make: *** No rule to make target `"/usr/local/bin"/"cygparrot-5.0.0.dll"', needed by `"cygparrot-5.0.0.dll"'. Stop.
$ ls /usr/local/bin/cygparrot-5.0.0.dll
/usr/local/bin/cygparrot-5.0.0.dll
$ ./nqp --target=pbc -o fib.pbc examples/fib.nqp
"pbc" => PMC 'PackfileView' { ... }
$ parrot fib.pbc
Cannot fetch object from non-existent serialization context 9D6CB3292159C3DFEFB9A37BBA9C78F2A5885BC3-1361052816.30436
current instr.: '' pc 256 ((file unknown):119) (examples/fib.nqp:4)
diff --git a/src/HLL/Compiler.pm b/src/HLL/Compiler.pm
index f9869b3..0981ee3 100644
--- a/src/HLL/Compiler.pm
+++ b/src/HLL/Compiler.pm
@@ -78,7 +78,7 @@ class HLL::Compiler {
$stdin.encoding($encoding);
}
- my $target := nqp::lc(%adverbs<target>);
+ my $target := %adverbs<target>;
chunk @m42_core
ptr %ip = $0
i64 %ia, %ib
f64 %fa, %fb
ptr %pa, %pb
jmp ptr(%ip)
@.set_ia:
lea %ip, val(%ip[1])
use v6;
module float16;
my sub frac($bits) {
state @fracs = map 0.5e0 / 2e0 ** *, reverse ^10;
[+] @fracs.kv.map({ $bits +& (1 +< $^k) ?? $^v !! 0e0 })
}
our sub enc(Num $num --> Int) {
!!!
use v6;
sub pretty($perl, :$indent = ' ') is export {
my ($pc, $depth, $string, $esc) = '', 0, False, False;
join '', gather for $perl.comb -> $cc {
NEXT $pc = $cc;
unless $string {
given \($pc, $cc) {
@gerdr
gerdr / gist:5106672
Created March 7, 2013 09:15
rakudo compilation bug
$ perl6 -Ilib -MM42::PASM::Backends -e 'say M42::PASM::Backend::.perl'
("GNUC" => M42::PASM::Backend::GNUC).hash
$ rm $(find lib -name '*.pbc')
$ perl6 -Ilib -MM42::PASM::Backends -e 'say M42::PASM::Backend::.perl'
("GNUC" => M42::PASM::Backend::GNUC).hash
$ rm $(find lib -name '*.pir')
@gerdr
gerdr / not-ready.md
Last active December 14, 2015 15:19

Rakudo: Not production ready

There's been some discussion on #perl6 as to what's missing from Rakudo to make it 'production-ready'.

I recently started my first moderately-sized Perl6 project, which currently clocks in with 1021 lines of Perl6 code (without documentation).

This translates to a parsing stage of 11.5s, which makes it very painful to use without module precompilation.

As there's no automatic precompilation yet, it needs to be done manually, which is tricky as compilation needs to happen in dependency order.