Commit ffad36ab authored by Dominique Dumont's avatar Dominique Dumont

New upstream version 2018.03

parent 2135c669
This diff is collapsed.
......@@ -19,6 +19,10 @@ please visit [the features page on perl6.org](http://perl6.org/compilers/feature
Recent changes and feature additions are documented in the `docs/ChangeLog`
text file.
To receive important notifications from the core developer team, please
subscribe to [the p6lert service](https://alerts.perl6.org) using the RSS feed,
twitter, or [the p6lert commandline script](https://github.com/zoffixznet/perl6-p6lert).
## Building and Installing Rakudo
[![Build Status](https://travis-ci.org/rakudo/rakudo.svg?branch=master)](https://travis-ci.org/rakudo/rakudo) [![Build status](https://ci.appveyor.com/api/projects/status/github/rakudo/rakudo?svg=true)](https://ci.appveyor.com/project/rakudo/rakudo/branch/master)
......@@ -122,8 +126,8 @@ programs, so newbie questions are welcomed there. Newbie questions
are also welcome on the #perl6 channel; the Rakudo and Perl 6
development teams tend to hang out there and are generally glad
to help. You can follow [@perl6org](https://twitter.com/perl6org)
and [@rakudoperl](https://twitter.com/rakudoperl) on Twitter, and there's
a Perl 6 news aggregator at [Planet Perl 6](http://pl6anet.org/).
and on Twitter, there's a Perl 6 news aggregator at
[Planet Perl 6](http://pl6anet.org/).
Questions about NQP can also be posted to the #perl6 IRC channel.
For questions about MoarVM, you can join #moarvm on freenode.
......
New in 2018.03:
+ SPECIAL NOTES:
+ Str.comb(Regex) was fixed to return a Seq instead of a List,
making Str.comb always return a Seq. Code relying on the
specifics of the previous behavior might require some tweaks.
+ Fixes:
+ Fixed various sleep() issues [e3c4db73]
+ Fixed <0/0> to be False [748d1a57]
+ Improved Test.pm6's like/unlike [7c1a6cac]
+ Fixed failure to sink last statements of `for` loops [4c5b81fe]
+ Removed unneeded candidates in &say and &note [3a0d53ce]
+ Made Str.comb(Regex) return a Seq [1da07530]
+ Fixed &say and &note to not auto-thread [b62e0eb7][355b2eb5]
+ Differentiated precomp NC sub setup markers [b27c548f][ec5edcae]
+ Moved chrs() logic to List.chrs and made chrs() the gateway [1894eace]
+ Moved ords() logic to Str.ords [61176475]
+ Fixed bug on ops with subclasses of Range [440fceac]
+ Fixed wrong assumption of Junction execution order [207313be]
[89f33bbe][e9cff795]
+ Fixed cases of mis-scoped QAST::Block of regexes [fb882d49]
+ Fixed .grep(Regex) on Hyper/Race Seqs [5e462e12]
+ Fixed &dd to not mark Failures as handled [7773c3d5][65874b15]
+ Enabled native-int candidates in bitshift operators [29fdb75a][3d735975]
+ Made Int:D (elem) Range:D be independent of size of Range [de30c162]
+ Straightened up `$/` handling in Str.subst[-mutate] [874fcdda]
+ Fixed Metamodel shortname assignments [ce08683f]
+ Fixed Pair.clone [5031dab3]
+ Improved Pod::To::Text to indent tables [57af8b84][dffbd68a]
+ Fixed precomp files of NativeCall users having absolute paths [51c4d4d8]
+ Made sure `samewith`-using routines aren't inlined [e12e305a]
+ Made sure MERGESORT-* don't leak low-level types [511bec0a]
+ Fixed code generation bug affecting private methods calls in roles
where the target private method used a role parameter [21997b62]
+ Various improvements to produced messages [a4f9090e][235d3f1c]
[3b350739][5ae1bbe1][52176c3c]
+ Additions:
+ Implemented IO::CatHandle.handles [d5baa036][eb064922][639c6da0]
+ Made signal handlers cancellable [db010b84][a31579c7]
+ “datagram”-oriented API for UDP sockets [67f36e36][b406b320][dd2c9019]
+ Added support for replacement and strict setting in Buf.decode [0d796fb0]
+ Added support to Encoding::Decoder to use replacements [ea92f550]
+ Removals:
+ Removed no longer used DELETEKEY helper sub [6f2cbcf7]
+ Removed Range.clone-with-op [440fceac]
+ Efficiency:
+ Optimized Uni.list to reify 15x faster (on 10000-char str) [8b7385d8]
+ Made Str.perl 43x faster for some chars [ba6b84bd]
+ Optimized Str.perl by making uniprop(Int, Str) 2.7x faster [6ac56cc0]
+ Made Rational.Str 28% faster [008b9279]
+ Made internal RETURN-LIST sub faster for common case [3a4056bf]
+ Made Num.Bool 9x faster [2a42cdbb]
+ Nano-optimized supervisor thread sleep [4617976d][85ad0eba]
+ Added special cases for 2-tuple infix:<,> that are 10% faster [b6e5d7fc]
[48c46fa7][90079357][ddf00078][d5a148c0]
+ Made Channel.receive/receive-nil-on-close 2.5% faster [4054ca68]
+ Reduced the number of DYNAMIC calls when hypering [598832cc]
+ Made Channel.poll 2x fast [eff92f94]
+ Made HyperIteratorBatcher.produce-batch 3.6x faster [8026cef8]
+ Many HyperToIterator speedups [0194ef46][6232d29e][34889beb]
+ Internal:
+ Turned many subs into multis [16b57af5][55bc053c][182b7ea5][63775474]
[c2d0d3ac][cdb45fa5][4f473867][bf5e3357][5210d702][b704a175][4c67498f]
[7d72387b][838782b7][abfbd1ab][6d6a69fd][c1d2a5bc][4da2418a][62fc3118]
[d3f50dba][b9f40fea][dfef8283][9a0a7bdd][32b08035][51fccdfe][474c512c]
[4f04698f][423e7cc0][ae4204c5][8cba0846][1b94ff6f][5490bacd][e1b711ae]
[a23684f3][804c009a][f5b23a55][4513c279]
+ Marked many subs as “only” [1be26afb][25bedf88]
+ Marked set ops as “pure” on their proto only [af353894]
+ Made Unicode operators aliases of corresponding ASCII subs [254f477e]
[aadd3c12][bc52fefa][a2100ec7][2e7a0e59]
+ Added nqp::getppid [fed92e3b]
+ Many profiler improvements, it now supports multi-threaded programs
[fed92e3b][a5a6c778][dd2c9019]
+ Made substr() just a front for Str.substr [7835652d][b688a6f3][15ccfd33]
+ Made substr-rw() just a front for Str.substr-rw [038837f8]
+ Moved substr/substr-rw catcher methods from Any to Cool [aad79f8a]
+ Remote debug support on MoarVM [ffeff74e][e32bda21]
New in 2018.02.1:
+ Fixes:
+ Fixed Whatever curry QAST::Block migration in stmt mods [5270471c]
......
# Announce: Rakudo Perl 6 compiler, Release #121 (2018.03)
On behalf of the Rakudo development team, I’m very happy to announce the
March 2018 release of Rakudo Perl 6 #121. Rakudo is an implementation of
Perl 6 on the Moar Virtual Machine[^1].
This release implements the 6.c version of the Perl 6 specifications.
It includes bugfixes and optimizations on top of
the 2015.12 release of Rakudo.
Upcoming releases in 2018 will include new functionality that is not
part of the 6.c specification, available with a lexically scoped
pragma. Our goal is to ensure that anything that is tested as part of the
6.c specification will continue to work unchanged. There may be incremental
spec releases this year as well.
The tarball for this release is available from <http://rakudo.org/downloads/rakudo/>.
Please note: This announcement is not for the Rakudo Star
distribution[^2] — it’s announcing a new release of the compiler
only. For the latest Rakudo Star release, see
<http://rakudo.org/downloads/star/>.
The changes in this release are outlined below:
New in 2018.03:
+ SPECIAL NOTES:
+ Str.comb(Regex) was fixed to return a Seq instead of a List,
making Str.comb always return a Seq. Code relying on the
specifics of the previous behavior might require some tweaks.
+ Fixes:
+ Fixed various sleep() issues [e3c4db73]
+ Fixed <0/0> to be False [748d1a57]
+ Improved Test.pm6's like/unlike [7c1a6cac]
+ Fixed failure to sink last statements of `for` loops [4c5b81fe]
+ Removed unneeded candidates in &say and &note [3a0d53ce]
+ Made Str.comb(Regex) return a Seq [1da07530]
+ Fixed &say and &note to not auto-thread [b62e0eb7][355b2eb5]
+ Differentiated precomp NC sub setup markers [b27c548f][ec5edcae]
+ Moved chrs() logic to List.chrs and made chrs() the gateway [1894eace]
+ Moved ords() logic to Str.ords [61176475]
+ Fixed bug on ops with subclasses of Range [440fceac]
+ Fixed wrong assumption of Junction execution order [207313be]
[89f33bbe][e9cff795]
+ Fixed cases of mis-scoped QAST::Block of regexes [fb882d49]
+ Fixed .grep(Regex) on Hyper/Race Seqs [5e462e12]
+ Fixed &dd to not mark Failures as handled [7773c3d5][65874b15]
+ Enabled native-int candidates in bitshift operators [29fdb75a][3d735975]
+ Made Int:D (elem) Range:D be independent of size of Range [de30c162]
+ Straightened up `$/` handling in Str.subst[-mutate] [874fcdda]
+ Fixed Metamodel shortname assignments [ce08683f]
+ Fixed Pair.clone [5031dab3]
+ Improved Pod::To::Text to indent tables [57af8b84][dffbd68a]
+ Fixed precomp files of NativeCall users having absolute paths [51c4d4d8]
+ Made sure `samewith`-using routines aren't inlined [e12e305a]
+ Made sure MERGESORT-* don't leak low-level types [511bec0a]
+ Fixed code generation bug affecting private methods calls in roles
where the target private method used a role parameter [21997b62]
+ Various improvements to produced messages [a4f9090e][235d3f1c]
[3b350739][5ae1bbe1][52176c3c]
+ Additions:
+ Implemented IO::CatHandle.handles [d5baa036][eb064922][639c6da0]
+ Made signal handlers cancellable [db010b84][a31579c7]
+ “datagram”-oriented API for UDP sockets [67f36e36][b406b320][dd2c9019]
+ Added support for replacement and strict setting in Buf.decode [0d796fb0]
+ Added support to Encoding::Decoder to use replacements [ea92f550]
+ Removals:
+ Removed no longer used DELETEKEY helper sub [6f2cbcf7]
+ Removed Range.clone-with-op [440fceac]
+ Efficiency:
+ Optimized Uni.list to reify 15x faster (on 10000-char str) [8b7385d8]
+ Made Str.perl 43x faster for some chars [ba6b84bd]
+ Optimized Str.perl by making uniprop(Int, Str) 2.7x faster [6ac56cc0]
+ Made Rational.Str 28% faster [008b9279]
+ Made internal RETURN-LIST sub faster for common case [3a4056bf]
+ Made Num.Bool 9x faster [2a42cdbb]
+ Nano-optimized supervisor thread sleep [4617976d][85ad0eba]
+ Added special cases for 2-tuple infix:<,> that are 10% faster [b6e5d7fc]
[48c46fa7][90079357][ddf00078][d5a148c0]
+ Made Channel.receive/receive-nil-on-close 2.5% faster [4054ca68]
+ Reduced the number of DYNAMIC calls when hypering [598832cc]
+ Made Channel.poll 2x fast [eff92f94]
+ Made HyperIteratorBatcher.produce-batch 3.6x faster [8026cef8]
+ Many HyperToIterator speedups [0194ef46][6232d29e][34889beb]
+ Internal:
+ Turned many subs into multis [16b57af5][55bc053c][182b7ea5][63775474]
[c2d0d3ac][cdb45fa5][4f473867][bf5e3357][5210d702][b704a175][4c67498f]
[7d72387b][838782b7][abfbd1ab][6d6a69fd][c1d2a5bc][4da2418a][62fc3118]
[d3f50dba][b9f40fea][dfef8283][9a0a7bdd][32b08035][51fccdfe][474c512c]
[4f04698f][423e7cc0][ae4204c5][8cba0846][1b94ff6f][5490bacd][e1b711ae]
[a23684f3][804c009a][f5b23a55][4513c279]
+ Marked many subs as “only” [1be26afb][25bedf88]
+ Marked set ops as “pure” on their proto only [af353894]
+ Made Unicode operators aliases of corresponding ASCII subs [254f477e]
[aadd3c12][bc52fefa][a2100ec7][2e7a0e59]
+ Added nqp::getppid [fed92e3b]
+ Many profiler improvements, it now supports multi-threaded programs
[fed92e3b][a5a6c778][dd2c9019]
+ Made substr() just a front for Str.substr [7835652d][b688a6f3][15ccfd33]
+ Made substr-rw() just a front for Str.substr-rw [038837f8]
+ Moved substr/substr-rw catcher methods from Any to Cool [aad79f8a]
+ Remote debug support on MoarVM [ffeff74e][e32bda21]
The following people contributed to this release:
Zoffix Znet, Elizabeth Mattijsen, JJ Merelo, Will "Coke" Coleda,
Paweł Murias, Christian Bartolomäus, Tom Browder,
Aleks-Daniel Jakimenko-Aleksejev, Luca Ferrari, Timo Paulssen, cfa,
Jonathan Worthington, Itsuki Toyota, Samantha McVey, Daniel Green,
Jan-Olof Hendig, Ronald Schmidt, Nick Logan, Stefan Seifert,
Richard Hainsworth, Steve Mynott, Ben Davies, Jeremy Studer,
Juan Julián Merelo Guervós, Patrick Spek, Alex Chen, Antonio Quinonez,
Brad Gilbert, Wenzel P. P. Peppmeyer, Brian S. Julin, LLFourn, Larry Wall
If you would like to contribute or find out more information, visit
<http://perl6.org>, <http://rakudo.org/how-to-help>, ask on the
<perl6-compiler@perl.org> mailing list, or ask on IRC #perl6 on freenode.
Additionally, we invite you to make a donation to The Perl Foundation
to sponsor Perl 6 development: <https://donate.perlfoundation.org/>
(put “Perl 6 Core Development Fund” in the ‘Purpose’ text field)
The next release of Rakudo (#122), is tentatively scheduled for 2018-04-21.
A list of the other planned release dates is available in the
“docs/release_guide.pod” file.
The development team appreciates feedback! If you’re using Rakudo, do
get back to us. Questions, comments, suggestions for improvements, cool
discoveries, incredible hacks, or any other feedback – get in touch with
us through (the above-mentioned) mailing list or IRC channel. Enjoy!
Please note that recent releases have known issues running on the JVM.
We are working to get the JVM backend working again but do not yet have
an estimated delivery date.
[^1]: See <http://moarvm.org/>
[^2]: What’s the difference between the Rakudo compiler and the Rakudo
Star distribution?
The Rakudo compiler is a compiler for the Perl 6 language.
Not much more.
The Rakudo Star distribution is the Rakudo compiler plus a selection
of useful Perl 6 modules, a module installer, Perl 6 introductory
documentation, and other software that can be used with the Rakudo
compiler to enhance its utility.
This diff is collapsed.
......@@ -2,22 +2,26 @@
Firstly, what's a "commit bit"? If you don't know what it is, you
probably don't need one :-) But, in any case, a "commit bit" is the
colloquial way that #perl6 describes how you obtain access to make
commits directly to the rakudo repository. (i.e., not via a fork and
pull request, but directly to https://github.com/rakudo/rakudo)
colloquial way that L<#perl6|https://webchat.freenode.net/?channels=#perl6>
describes how you obtain access to make commits directly to the rakudo
repository. (i.e., not via a fork and pull request, but directly
to https://github.com/rakudo/rakudo)
Step one, if you haven't already, is to send a signed copy of the
Contributor License Agreement (CLA) to the Perl Foundation. The CLA can
B<Step one,> if you haven't already, is to send a signed copy of the
Contributor License Agreement (CLA) to the Perl Foundation. The CLA and the
address it can be mailed to can
be found at http://www.perlfoundation.org/contributor_license_agreement
Some contributors chose to email the CLA to C<trademark -at- perlfoundation.org>
instead; you can speak to C<[Coke]> on
L<our IRC chat|https://webchat.freenode.net/?channels=#perl6> for details about
the process as well as follow up on whether your CLA has been received by
The Perl Foundation.
Why is a signed CLA necessary for commit access? Historically, it is
because Rakudo used to be part of the Parrot project and that project
required a signed CLA. But the reasons that Parrot required a CLA are
also valid for Rakudo. That is, the CLA helps protect the Perl
Why is a signed CLA necessary for commit access? The CLA helps protect the Perl
Foundation and the Rakudo project and contributors alike from
intellectual property issues. The CLA warrants that your contributions
are yours to give and that they are not encumbered by anyone else's
intellectual "lien" on those contributions.
intellectual "lien" on those contributions.
For instance, some employment contracts stipulate that any intellectual
property that you generate belongs to your employer whether you generate
......@@ -28,8 +32,10 @@ that your employer will later claim ownership of your contributions. The
CLA says that you have done the due diligence in these matters and that
as far as you are aware, your contributions are yours alone to give.
Once you send off your signed CLA, you can then inquire on
irc://freenode.net/#perl6 about getting commit access to the Rakudo
B<Once you send off your signed CLA,> and it's received by The Perl Foundation
you can then inquire on
L<irc://freenode.net/#perl6|https://webchat.freenode.net/?channels=#perl6>
about getting commit access to the Rakudo
repository. The main source code repository for Rakudo is administered
on GitHub, so it would be a good idea to have a github account before
you request a commit bit. There is at least one officer of the Perl
......
......@@ -18,8 +18,7 @@ Note that we are trying very hard to ensure there are no backward
compatibility issues post Christmas. As such, we may end up delaying
some releases to ensure any compatibility issues are resolved.
2018-03-17 Rakudo #121 (AlexDaniel + Releasable)
2018-04-21 Rakudo #122
2018-04-21 Rakudo #122 (AlexDaniel + Releasable)
2018-05-19 Rakudo #123
2018-06-16 Rakudo #124
2018-07-21 Rakudo #125
......@@ -77,13 +76,13 @@ etc. as appropriate.
git add docs/announce/YYYY.MM.md
git commit docs
There is a helper script C<tools/create-release-announcement.pl6> that
There is a helper script C<tools/create-release-announcement.p6> that
will create a basic release announcement for you based on the state
of the repository and the current date. Feel free to use it to
save yourself some time, but please look over its output if you decide
to use it:
./perl6 tools/create-release-announcement.pl6 > docs/announce/YYYY.MM.md
./perl6 tools/create-release-announcement.p6 > docs/announce/YYYY.MM.md
=item *
......@@ -133,7 +132,7 @@ new release is significant.
Include a list of contributors since the last release in the announcement.
You can get an automatically generated list by running
./perl6 tools/contributors.pl6
./perl6 tools/contributors.p6
To obtain all contributors, ensure you have all supporting repositories
checked out, before running (this can be achieved by building rakudo
......@@ -448,6 +447,7 @@ Previous releases were bundled as part of monthly Parrot releases.
2018-01-25 Rakudo #119 "2018.01" (AlexDaniel + Releasable)
2018-02-20 Rakudo #120 "2018.02" (AlexDaniel + Releasable)
2018-02-23 2018.02.1 (AlexDaniel + Releasable)
2018-03-19 Rakudo #121 "2018.02" (AlexDaniel + Releasable)
=head1 COPYRIGHT
......
......@@ -260,6 +260,7 @@ my Lock $setup-lock .= new;
# native call.
our role Native[Routine $r, $libname where Str|Callable|List|IO::Path|Distribution::Resource] {
has int $!setup;
has int $!precomp-setup;
has native_callsite $!call is box_target;
has Mu $!rettype;
has $!cpp-name-mangler;
......@@ -272,8 +273,8 @@ our role Native[Routine $r, $libname where Str|Callable|List|IO::Path|Distributi
method !setup() {
$setup-lock.protect: {
return if $!setup;
# Make sure that C++ methotds are treated as mangled (unless set otherwise)
return if $!setup || $*W && $*W.is_precompilation_mode && $!precomp-setup;
# Make sure that C++ methods are treated as mangled (unless set otherwise)
if self.package.REPR eq 'CPPStruct' and not self.does(NativeCallMangled) {
self does NativeCallMangled[True];
}
......@@ -294,7 +295,7 @@ our role Native[Routine $r, $libname where Str|Callable|List|IO::Path|Distributi
return_hash_for($r.signature, $r, :$!entry-point));
$!rettype := nqp::decont(map_return_type($r.returns)) unless $!rettype;
$!arity = $r.signature.arity;
$!setup = $jitted ?? 2 !! 1;
($*W && $*W.is_precompilation_mode ?? $!precomp-setup !! $!setup) = $jitted ?? 2 !! 1;
$!any-optionals = self!any-optionals;
......@@ -494,11 +495,11 @@ our role Native[Routine $r, $libname where Str|Callable|List|IO::Path|Distributi
$block
}
my $perl6comp := nqp::getcomp("perl6");
my @stages = $perl6comp.stages;
Nil until @stages.shift eq 'optimize';
method !compile-function-body(Mu $block) {
my $perl6comp := nqp::getcomp("perl6");
my @stages = $perl6comp.stages;
Nil until @stages.shift eq 'optimize';
my $result := $block;
$result := $perl6comp.^can($_)
?? $perl6comp."$_"($result)
......
......@@ -74,7 +74,7 @@ sub table2text($pod) {
}
for @rows -> $row {
# Gutter of two spaces between columns
$ret ~= join ' ',
$ret ~= ' ' ~ join ' ',
(@maxes Z=> @$row).map: { .value.fmt("%-{.key}s") };
$ret ~= "\n";
}
......
......@@ -483,47 +483,25 @@ multi sub can-ok(
}
multi sub like(
$got, Regex $expected,
$desc = "text matches '$expected.perl()'"
Str() $got, Regex:D $expected,
$desc = "text matches $expected.perl()"
) is export {
$time_after = nqp::time_n;
$got.defined; # Hack to deal with Failures
my $ok;
if $got ~~ Str:D {
my $test = $got ~~ $expected;
$ok = proclaim($test, $desc);
if !$test {
_diag " expected: '$expected.perl()'\n"
~ " got: '$got'";
}
} else {
$ok = proclaim(False, $desc);
_diag " expected a Str that matches '$expected.perl()'\n"
~ " got: '$got.perl()'";
}
my $ok := proclaim $got ~~ $expected, $desc
or _diag "expected a match with: $expected.perl()\n"
~ " got: $got.perl()";
$time_before = nqp::time_n;
$ok or ($die_on_fail and die-on-fail) or $ok;
}
multi sub unlike(
$got, Regex $expected,
$desc = "text does not match '$expected.perl()'"
Str() $got, Regex:D $expected,
$desc = "text does not match $expected.perl()"
) is export {
$time_after = nqp::time_n;
$got.defined; # Hack to deal with Failures
my $ok;
if $got ~~ Str:D {
my $test = !($got ~~ $expected);
$ok = proclaim($test, $desc);
if !$test {
_diag " expected: '$expected.perl()'\n"
~ " got: '$got'";
}
} else {
$ok = proclaim(False, $desc);
_diag " expected: a Str that matches '$expected.perl()'\n"
~ " got: '$got.perl()'";
}
my $ok := proclaim !($got ~~ $expected), $desc
or _diag "expected no match with: $expected.perl()\n"
~ " got: $got.perl()";
$time_before = nqp::time_n;
$ok or ($die_on_fail and die-on-fail) or $ok;
}
......
......@@ -420,6 +420,8 @@ sub unwanted($ast, $by) {
elsif $node.op eq 'p6for' || $node.op eq 'p6forstmt' {
$node := $node[1];
if nqp::istype($node,QAST::Op) && $node.op eq 'p6capturelex' {
add-sink-to-final-call($node.ann('past_block'), 1)
unless $*COMPILING_CORE_SETTING;
$node.annotate('past_block', UNWANTED($node.ann('past_block'), $byby));
}
}
......@@ -454,6 +456,19 @@ sub unwanted($ast, $by) {
$ast;
}
sub add-sink-to-final-call($parent, $pos, $qast = $parent[$pos]) {
if (nqp::istype($qast, QAST::Stmts) || nqp::istype($qast, QAST::Stmt))
&& nqp::elems($qast) {
add-sink-to-final-call($qast, nqp::elems($qast)-1)
}
elsif nqp::istype($qast, QAST::Want) {
add-sink-to-final-call($parent, $pos, $qast[0])
}
elsif nqp::istype($qast, QAST::Op) && $qast.op eq 'call' {
$parent[$pos] := QAST::Op.new: :op<callmethod>, :name<sink>, $qast
}
}
sub UNWANTED($ast, $by) {
if nqp::istype($ast, QAST::Node) {
$ast := unwanted($ast, $by ~ ' U');
......@@ -4577,7 +4592,10 @@ class Perl6::Actions is HLL::Actions does STDActions {
!! $/.slang_actions('Regex').qbuildsub($qast, $block, code_obj => $code);
}
$past.name($name);
$past.blocktype("declaration_static");
$past.annotate_self('statement_id', $*STATEMENT_ID
).annotate_self( 'in_stmt_mod', $*IN_STMT_MOD,
).annotate_self( 'outer', $*W.cur_lexpad
).blocktype("declaration_static");
# Install a $?REGEX (mostly for the benefit of <~~>).
$block[0].push(QAST::Op.new(
......@@ -5668,7 +5686,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
);
}
if $package.HOW.archetypes.parametric {
$past.unshift(QAST::Var.new( :name('::?CLASS'), :scope('typevar') ));
$past.unshift(typevar_or_lexical_lookup('::?CLASS'));
}
else {
$past.unshift(QAST::WVal.new( :value($package) ));
......@@ -5681,7 +5699,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
elsif $<methodop><quote> {
my $name := $past.shift;
if $package.HOW.archetypes.parametric {
$past.unshift(QAST::Var.new( :name('::?CLASS'), :scope('typevar') ));
$past.unshift(typevar_or_lexical_lookup('::?CLASS'));
}
else {
$past.unshift(QAST::WVal.new( :value($package) ));
......@@ -5695,6 +5713,18 @@ class Perl6::Actions is HLL::Actions does STDActions {
make $past;
}
# We can generate typevar scope when we're in a method and the enclosing
# role declares the symbol we're looking for.
sub typevar_or_lexical_lookup($name) {
if $*HAS_SELF {
my $outer := $*W.cur_lexpad().ann('outer');
if $outer && $outer.symbol($name) {
return QAST::Var.new( :$name, :scope('typevar') );
}
}
return QAST::Var.new( :$name, :scope('lexical') );
}
method methodop($/) {
my $past := $<args> ?? $<args>.ast !! QAST::Op.new( :node($/) );
$past.op('callmethod');
......@@ -9525,7 +9555,8 @@ class Perl6::Actions is HLL::Actions does STDActions {
'nextsame', NQPMu,
'nextwith', NQPMu,
'nextcallee', NQPMu,
'lastcall', NQPMu
'lastcall', NQPMu,
'samewith', NQPMu,
);
sub handle_special_call_names($/, $args, $name) {
if $name eq 'sink' {
......@@ -9793,7 +9824,8 @@ class Perl6::Actions is HLL::Actions does STDActions {
}
elsif nqp::istype($qast, QAST::Block)
|| nqp::istype($qast, QAST::Stmts) || nqp::istype($qast, QAST::Stmt)
|| nqp::istype($qast, QAST::Op) || nqp::istype($qast, QAST::Regex) {
|| nqp::istype($qast, QAST::Op) || nqp::istype($qast, QAST::Regex)
|| nqp::istype($qast, QAST::NodeList) {
for @($qast) {
find_block_calls_and_migrate($from, $to, $_);
}
......@@ -10059,15 +10091,11 @@ class Perl6::QActions is HLL::Actions does STDActions {
walk($past);
# Strip out list op and possible Slip if only one resulting word
nqp::if(
+@($result) == 1,
nqp::if(
nqp::istype($result[0], QAST::Op) && $result[0].name eq 'Slip',
$result[0][0],
$result[0]
),
QAST::Stmts.new( $result )
)
+@($result) == 1
?? nqp::istype($result[0], QAST::Op) && $result[0].name eq 'Slip'
?? $result[0][0]
!! $result[0]
!! QAST::Stmts.new( $result );
}
method postprocess_heredoc($/, $past) {
......
......@@ -109,12 +109,21 @@ and, by default, also executes the compiled code.
instrumented - performance measurements (default)
heap - record heap snapshots after every garbage
collector run
--profile-compile[=kind]
write compile-time profile information to an HTML
file (MoarVM)
instrumented - performance measurements (default)
heap - record heap snapshots after every garbage
collector run
--profile-filename=name
provide a different filename for profile.
Extension controls format:
.json outputs in JSON
.sql outputs in SQL
any other extension outputs in HTML
--profile-stage=stage
write profile information for the given compilation
stage to an HTML file (MoarVM)
--doc=module use Pod::To::[module] to render inline documentation
--repl-mode=interactive|non-interactive
......
......@@ -1324,8 +1324,12 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
token statement($*LABEL = '') {
:my $*QSIGIL := '';
:my $*SCOPE := '';
# NOTE: annotations that use STATEMENT_ID often also need IN_STMT_MOD annotation, in order
# to correctly migrate QAST::Blocks in constructs inside topics of statement modifiers
:my $*STATEMENT_ID := $*NEXT_STATEMENT_ID++;
:my $*IN_STMT_MOD := nqp::getlexdyn('$*IN_STMT_MOD');
:my $*ESCAPEBLOCK := 0;
:my $actions := self.slang_actions('MAIN');
<!!{ $/.set_actions($actions); 1 }>
......@@ -4300,8 +4304,8 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
'<'
[
|| <nibble(self.quote_lang(self.slang_grammar('Quote'), "<", ">", ['q', 'w', 'v']))> '>'
|| <?before \h* [ \d | <.sigil> | ':' ] >
{ $/.panic("Whitespace required before < operator") }
|| '='* <?before \h* [ \d | <.sigil> | ':' ] >
{ $/.panic("Whitespace required before $/ operator") }
|| { $/.panic("Unable to parse quote-words subscript; couldn't find '>' (corresponding '<' was at line {HLL::Compiler.lineof($/.orig(), $/.from(), :cache(1))})") }
]
<O(|%methodcall)>
......
......@@ -298,15 +298,23 @@ my class Binder {
# anything goes.
unless $nom_type =:= Mu || nqp::istype($oval, $nom_type) {
# Type check failed; produce error if needed.
# Try to figure out the most helpful name for the expected
my $expected := (
(my $post := nqp::getattr($param, Parameter,
'@!post_constraints'))
&& ! nqp::istype(nqp::atpos($post, 0), Code)
) ?? nqp::atpos($post, 0) !! $nom_type;
if nqp::defined($error) {
my %ex := nqp::gethllsym('perl6', 'P6EX');
if nqp::isnull(%ex) || !nqp::existskey(%ex, 'X::TypeCheck::Binding::Parameter') {
$error[0] := "Nominal type check failed for parameter '" ~ $varname ~
"'; expected " ~ $nom_type.HOW.name($nom_type) ~