Skip to content

Commit

Permalink
Fix Mu ~~ $smartmatch
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Jun 3, 2011
1 parent b6269f8 commit 0e96ea2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
5 changes: 5 additions & 0 deletions perf/perf.TODO
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ Reduce redundant Cursor creation for, e.g., { say 2 }
Reduce ContextHelper use in ws, or make it faster.

81537 Mu.new attr: 14093 RxOp.zyg,

Junctions: $x == any($y,$z) could be optimized to a == that knows it
is dealing with a junction. Once we have staticer types and can say
that $x ~~ Any, then the == knows it has *exactly one* junction and
can statically unroll the correct loop for epic win.
9 changes: 5 additions & 4 deletions src/Op.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ method code_labelled($body, $label) { self.code($body) } #OK not used
# binds. Further, we don't need to generate the bvalues explicitly, since
# we know they'll just be bound.
method code_bvalue($body, $ro, $rhscg) { #OK not used
die "Illegal use of $.typename in bvalue context"; # XXX niecza
die "Illegal use of {self.WHAT.perl} in bvalue context";
}

method statement_level() { self }
Expand Down Expand Up @@ -633,7 +633,6 @@ class Attribute is Op {
has $.accessor; # Bool
has $.initializer; # Body, is rw
has $.typeconstraint; # Array of Str
has $.sigil;
has $.rw;

method code($) { CgOp.corelex('Nil') }
Expand Down Expand Up @@ -702,7 +701,8 @@ class Lexical is Op {

method code_bvalue($ , $ro, $rhscg) {
CgOp.prog(
CgOp.scopedlex($.name, CgOp.newboundvar(+?$ro, +(?($.list || $.hash)), $rhscg)),
CgOp.scopedlex($.name, defined($ro) ?? CgOp.newboundvar(+?$ro,
+(?($.list || $.hash)), $rhscg) !! $rhscg),
CgOp.scopedlex($.name));
}
}
Expand Down Expand Up @@ -740,7 +740,8 @@ class PackageVar is Op {
method code_bvalue($ , $ro, $rhscg) {
CgOp.prog(
CgOp.scopedlex($.slot,
CgOp.newboundvar(+?$ro, +(?($.list || $.hash)), $rhscg)),
defined($ro) ?? CgOp.newboundvar(+?$ro,
+(?($.list || $.hash)), $rhscg) !! $rhscg),
CgOp.scopedlex($.slot));
}
}
Expand Down
6 changes: 2 additions & 4 deletions src/OpHelpers.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ sub mkbool($i) is export { ::Op::Lexical.new(name => $i ?? 'True' !! 'False') }
sub mktemptopic($/, $item, $expr) is export {
mklet(mklex($/, '$_'), -> $old_ {
::Op::StatementList.new(|node($/), children => [
# XXX should be a raw bind
::Op::Bind.new(:!readonly, lhs => mklex($/, '$_'), rhs => $item),
::Op::Bind.new(:readonly(Bool), lhs=>mklex($/,'$_'), rhs => $item),
mklet($expr, -> $result {
::Op::StatementList.new(children => [
# XXX should be a raw bind
::Op::Bind.new(:!readonly, lhs => mklex($/, '$_'),
::Op::Bind.new(:readonly(Bool), lhs => mklex($/, '$_'),
rhs => $old_),
$result]) }) ]) });
}
Expand Down

0 comments on commit 0e96ea2

Please sign in to comment.