Skip to content

Commit

Permalink
Update compile time resolution of multis; this busts the setting if t…
Browse files Browse the repository at this point in the history
…urned on, sadly...needs some more analysis.
  • Loading branch information
jnthn committed Jul 23, 2012
1 parent d1aef7e commit 678541a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/Perl6/Ops.pm
Expand Up @@ -41,6 +41,7 @@ $ops.add_hll_pirop_mapping('perl6', 'p6return', 'perl6_returncc', '0P');
$ops.add_hll_pirop_mapping('perl6', 'p6assoccode', 'perl6_associate_sub_code_object', 'vPP');
$ops.add_hll_pirop_mapping('perl6', 'p6getouterctx', 'perl6_get_outer_ctx', 'PP');
$ops.add_hll_pirop_mapping('perl6', 'p6mdthunk', 'perl6_multi_dispatch_thunk', 'PP');
$ops.add_hll_pirop_mapping('perl6', 'p6mdcandthunk', 'perl6_multi_dispatch_cand_thunk', 'PPi');
$ops.add_hll_op('perl6', 'p6getcallsig', -> $qastcomp, $op {
my $reg := $*REGALLOC.fresh_p();
my $ops := $qastcomp.post_new('Ops', :result($reg));
Expand Down
9 changes: 5 additions & 4 deletions src/Perl6/Optimizer.pm
Expand Up @@ -501,16 +501,17 @@ class Perl6::Optimizer {

# If we decide a dispatch at compile time, this emits the direct call.
method call_ct_chosen_multi($call, $proto, $chosen) {
# XXX still needs updating
# XXX sadly, busts the setting
return $call;
my @cands := $proto.dispatchees();
my $idx := 0;
for @cands {
if $_ =:= $chosen {
$call.unshift(PAST::Op.new(
:pirop('perl6_multi_dispatch_cand_thunk PPi'),
$call.unshift(QAST::Op.new(
:op('p6mdcandthunk'),
QAST::Var.new( :name($call.name), :scope('lexical') ),
$idx));
QAST::IVal.new( :value($idx) )
));
$call.name(nqp::null());
$call.op('call');
#say("# Compile-time resolved a call to " ~ $proto.name);
Expand Down

0 comments on commit 678541a

Please sign in to comment.