Skip to content

Instantly share code, notes, and snippets.

View usev6's full-sized avatar

Christian Bartolomäus usev6

  • Berlin, Germany
View GitHub Profile
@usev6
usev6 / gist:cc463b2166e1107f06bd
Created November 28, 2015 09:30
Avoid NullPointerException executing 'my %h; say %h'
diff --git a/src/core/Mu.pm b/src/core/Mu.pm
index f123489..896630e 100644
--- a/src/core/Mu.pm
+++ b/src/core/Mu.pm
@@ -342,7 +342,7 @@ Please refactor this code using the new Iterator / Seq interface.
method gistseen(Mu:D \SELF: $id, $gist, *%named) {
if $*gistseen -> \sems {
my str $WHICH = nqp::unbox_s(self.WHICH);
- if nqp::atkey(sems,$WHICH) {
+ if sems<$WHICH> {
@usev6
usev6 / gist:13268ed977a0b1ff69a6
Created December 5, 2015 08:25
Only first execution of command dies as expected with 'use Test'
$ ./perl6-m -e 'my %h = b => 2, c => 3; say %h<b>:zorp'
Unexpected named parameter 'zorp' passed
in block <unit> at -e:1
$ echo "#" >> lib/Test.pm
$ PERL6LIB=lib ./perl6-m -e 'use Test; my %h = b => 2, c => 3; say %h<b>:zorp'
Unexpected named parameter 'zorp' passed
in block <unit> at -e:1
$ PERL6LIB=lib ./perl6-m -e 'use Test; my %h = b => 2, c => 3; say %h<b>:zorp'
2
$ PERL6LIB=lib ./perl6-m -e 'use Test; my %h = b => 2, c => 3; say %h<b>:zorp'
@usev6
usev6 / gist:6280b4010aabeada760f
Last active December 11, 2015 09:11
weird aborts with routine 'supply'
While trying to golf spectest failures in S17-supply/syntax.t I found some really weird behaviour.
Consider the following program 'S17-supply_syntax_golf.p6':
====
use v6;
for ^1 { my $foo };
my $a = supply { };
my $b = supply { };
@usev6
usev6 / gist:480ef340281ab3fb8df2
Last active December 14, 2015 21:39
missing '.' in $*REPO
1: $*REPO contains '.' and 'lib'
$ ./perl6-m -e 'use lib <. lib>; say $*REPO.repo-chain.map(*.Str).join("\n").indent(4)'
/p6dir/lib
/p6dir
/home/christian/.perl6/2015.11-550-g9e53fa9
/p6dir/install/share/perl6/site
/p6dir/install/share/perl6/vendor
/p6dir/install/share/perl6
CompUnit::Repository::NQP<140600819436888>
@usev6
usev6 / gist:86f025b89dd6d3e751b6
Last active December 15, 2015 19:37
build error for MoarVM on FreeBSD 10.2
$ uname -a
FreeBSD tabarz210.aglaz.de 10.2-RELEASE-p7 FreeBSD 10.2-RELEASE-p7 #0: Mon Nov 2 14:19:39 UTC 2015 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
$ perl Configure.pl
Welcome to MoarVM!
Updating submodules .................................... OK
Configuring native build environment ................... OK
probing whether your compiler thinks that it is gcc YES
probing how your compiler does static inline ....... static __inline__
@usev6
usev6 / gist:057d64b0fc9b3c830c2f
Created January 9, 2016 11:04
failing build for nqp-j
$ make
/usr/local/bin/perl5.20.2 -MExtUtils::Command -e mkpath gen/jvm/stage1
/usr/local/bin/perl5.20.2 tools/build/gen-cat.pl jvm src/vm/jvm/HLL/Backend.nqp src/HLL/Grammar.nqp src/HLL/Actions.nqp src/HLL/Compiler.nqp src/HLL/CommandLine.nqp src/HLL/World.nqp src/HLL/sprintf.nqp > gen/jvm/stage1/NQPHLL.nqp
java -cp src/vm/jvm/stage0 -Xbootclasspath/a:src/vm/jvm/stage0:nqp-runtime.jar:3rdparty/asm/asm-4.1.jar:3rdparty/asm/asm-tree-4.1.jar:3rdparty/jline/jline-1.0.jar:3rdparty/jna/jna.jar:src/vm/jvm/stage0/nqp.jar nqp --bootstrap --module-path=gen/jvm/stage1 --setting-path=gen/jvm/stage1 --setting=NQPCORE --no-regex-lib --target=jar --output=gen/jvm/stage1/NQPHLL.jar gen/jvm/stage1/NQPHLL.nqp
Error while compiling op lexotic: Method 'jast' not found for invocant of class 'NQPMu'
in as_jast (gen/jvm/stage2/QAST.nqp:4114)
in as_jast (gen/jvm/stage2/QAST.nqp:3248)
in compile_all_the_stmts (gen/jvm/stage2/QAST.nqp:4080)
in (gen/jvm/stage2/QAST.nqp:3662)
in (gen/jvm/stage2/QAST.nqp:3659)
I'm trying to debug the following NullPointerException:
$ perl6-j -e 'CallFrame.new.perl'
java.lang.NullPointerException
in block <unit> at -e line 1
For some reasons iterating over the values of a specially constructed Stash (using nqp::iterval) does not work. I get the following output with the program below.
$ perl6-m iterating.p6 # works fine
-- Iterating using $h.values --
@usev6
usev6 / gist:607c0f00e4e6341a2276b9592e29bcda
Last active May 8, 2016 17:56
Issues with rakudo-j after merge of branch 'relocateable-precomp'
There are different issues with Rakudo on JVM after the merge of 'relocateable-precomp'.
I compared an installation on the merge commit e8fd55bbe6 with a second installation
on that commit plus 'git revert -m 1 e8fd55bbe6'.
* a lot of new failing tests in S10-packages/precompilation.rakudo.jvm (some others where
fudged before): 2-4, 7-21, 24-26, 28-30, 32, 38, 39
* test for RT #114354 fails (S06-other/main.t aborts), because 'sub MAIN' in
t/spec/packages/HasMain.pm (line 5) is called with @*ARGS containing five elements
@usev6
usev6 / gist:a721447b09781a1e32622676ecffd38f
Last active May 15, 2016 15:58
Issues with nqp::readlinechompfh and nqp::readallfh on nqp-j
$ cat data
this is the deps
thisisthebytecodenotreallyhaha
$ ./nqp-j -e 'my $fh := nqp::open("data", "r"); nqp::say(nqp::readlinechompfh($fh)); nqp::say(nqp::readallfh($fh)); nqp::closefh($fh)'
this is the deps
this is the deps
thisisthebytec
$ vi src/vm/jvm/runtime/org/perl6/nqp/io/SyncHandle.java # trying a fix
@usev6
usev6 / gist:788d5ee384897674733aeef2a83aab22
Last active May 16, 2016 17:26
$fh.get and $fh.slurp-rest(:bin) on rakudo-j
diff --git a/src/vm/jvm/runtime/org/perl6/nqp/io/SyncHandle.java b/src/vm/jvm/runtime/org/perl6/nqp/io/SyncHandle
index 5bc61db..7e31abc 100644
--- a/src/vm/jvm/runtime/org/perl6/nqp/io/SyncHandle.java
+++ b/src/vm/jvm/runtime/org/perl6/nqp/io/SyncHandle.java
@@ -222,12 +222,19 @@ public abstract class SyncHandle implements IIOClosable, IIOEncodable,
public byte[] read(ThreadContext tc, int bytes) {
try {
- ByteBuffer buffer = ByteBuffer.allocate(bytes);
- chan.read(buffer);