Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Eliminate p6store op in favor of nqp::assign.
Note some more work needed before this will work.
  • Loading branch information
jnthn committed Mar 19, 2013
1 parent a5aa552 commit c7911a2
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 47 deletions.
20 changes: 10 additions & 10 deletions src/Perl6/Actions.pm
Expand Up @@ -944,7 +944,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
my $*SCOPE := 'my';
declare_variable($/, QAST::Stmts.new(), '$', '*', 'FATAL', []);
$past := QAST::Op.new(
:op('p6store'), :node($/),
:op('assign'), :node($/),
QAST::Var.new( :name('$*FATAL'), :scope('lexical') ),
QAST::Op.new( :op('p6bool'), QAST::IVal.new( :value(1) ) )
);
Expand Down Expand Up @@ -1105,7 +1105,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
:resultchild(0),
$block,
QAST::Op.new(
:op('p6store'),
:op('assign'),
QAST::Var.new( :name<$!>, :scope<lexical> ),
QAST::Var.new( :name<Any>, :scope<lexical> )
)
Expand All @@ -1114,7 +1114,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
# On failure, capture the exception object into $!.
'CATCH', QAST::Stmts.new(
QAST::Op.new(
:op('p6store'),
:op('assign'),
QAST::Var.new(:name<$!>, :scope<lexical>),
QAST::Op.new(
:name<&EXCEPTION>, :op<call>,
Expand Down Expand Up @@ -4489,7 +4489,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
$past<nosink> := 1;
}
else {
$past := QAST::Op.new( :node($/), :op('p6store'),
$past := QAST::Op.new( :node($/), :op('assign'),
$lhs_ast, $rhs_ast);
}
return $past;
Expand Down Expand Up @@ -4624,7 +4624,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
($max_excl ??
QAST::Stmts.new(
QAST::Op.new(
:op('p6store'),
:op('assign'),
QAST::Var.new( :name($state), :scope('lexical') ),
$zero
),
Expand All @@ -4640,7 +4640,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
)
),
QAST::Op.new(
:op('p6store'),
:op('assign'),
QAST::Var.new( :name($state), :scope('lexical') ),
$zero
),
Expand Down Expand Up @@ -4670,7 +4670,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
$min_excl || $max_excl ?? $nil !! $one,
QAST::Stmts.new(
QAST::Op.new(
:op('p6store'),
:op('assign'),
QAST::Var.new( :name($state), :scope('lexical') ),
$one
),
Expand Down Expand Up @@ -5160,7 +5160,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
# match, don't assing to $/ (which imposes item context)
make $past;
} else {
make QAST::Op.new( :op('p6store'),
make QAST::Op.new( :op('assign'),
QAST::Var.new(:name('$/'), :scope('lexical')),
$past
);
Expand Down Expand Up @@ -5477,7 +5477,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
QAST::Var.new( :scope('local'), :name($exceptionreg) )
)
),
QAST::Op.new( :op('p6store'),
QAST::Op.new( :op('assign'),
QAST::VM.new( :pirop('find_lex_skip_current__Ps'),
QAST::SVal.new( :value('$!') )),
QAST::Var.new( :scope('lexical'), :name('$_') ),
Expand Down Expand Up @@ -6136,7 +6136,7 @@ class Perl6::RegexActions is QRegex::P6Regex::Actions does STDActions {
my $past :=
QAST::Stmts.new(
QAST::Op.new(
:op('p6store'),
:op('assign'),
QAST::Var.new( :name('$/'), :scope<lexical> ),
QAST::Op.new(
QAST::Var.new( :name(''), :scope<lexical> ),
Expand Down
1 change: 0 additions & 1 deletion src/Perl6/Ops.pm
Expand Up @@ -10,7 +10,6 @@ $ops.add_hll_pirop_mapping('perl6', 'p6listiter', 'perl6_iter_from_rpa', 'PPP',
$ops.add_hll_pirop_mapping('perl6', 'p6list', 'perl6_list_from_rpa', 'PPPP', :inlinable(1));
$ops.add_hll_pirop_mapping('perl6', 'p6listitems', 'perl6_listitems', 'PP', :inlinable(1));
$ops.add_hll_pirop_mapping('perl6', 'p6recont_ro', 'perl6_recontainerize_to_ro', 'PP', :inlinable(1));
$ops.add_hll_pirop_mapping('perl6', 'p6store', 'perl6_container_store', '0PP', :inlinable(1));
$ops.add_hll_pirop_mapping('perl6', 'p6type', 'perl6ize_type', 'PP', :inlinable(1));
$ops.add_hll_pirop_mapping('perl6', 'p6takedisp', 'perl6_take_dispatcher', 'v');
$ops.add_hll_pirop_mapping('perl6', 'p6var', 'perl6_var', 'PP', :inlinable(1));
Expand Down
4 changes: 2 additions & 2 deletions src/Perl6/World.pm
Expand Up @@ -1126,7 +1126,7 @@ class Perl6::World is HLL::World {
:op('while'),
QAST::Var.new( :name($value_stash), :scope('lexical') ),
QAST::Op.new(
:op('p6store'),
:op('assign'),
QAST::Op.new(
:op('shift'),
QAST::Var.new( :name($value_stash), :scope('lexical') )
Expand Down Expand Up @@ -1683,7 +1683,7 @@ class Perl6::World is HLL::World {
:op('if'),
QAST::Op.new( :op('p6stateinit') ),
QAST::Op.new(
:op('p6store'),
:op('assign'),
QAST::Var.new( :name($sym), :scope('lexical') ),
QAST::Op.new( :op('call'), QAST::WVal.new( :value($block) ) )
),
Expand Down
2 changes: 1 addition & 1 deletion src/core/Range.pm
Expand Up @@ -121,7 +121,7 @@ my class Range is Iterable is Cool does Positional {
goto loop
done:
$P0 = perl6_box_bigint value
perl6_container_store value_pmc, $P0
nqp_assign value_pmc, $P0
%r = rpa
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/operators.pm
Expand Up @@ -4,7 +4,7 @@
## Int/Rat/Num operators are in {Int|Rat|Num}.pm

sub infix:<=>(Mu \a, Mu \b) is rw {
pir::perl6_container_store__0PP(a, b)
nqp::assign(a, b)
}

proto infix:<does>(Mu, Mu, *%) { * }
Expand Down
32 changes: 0 additions & 32 deletions src/ops/perl6.ops
Expand Up @@ -902,38 +902,6 @@ inline op perl6_recontainerize_to_ro(out PMC, in PMC) :base_core {
}


/*

=item perl6_container_store(in PMC, in PMC)

Stores a value in a container. If it's Scalar, there's a fast path;
otherwise, calls the .STORE method.

=cut

*/
inline op perl6_container_store(in PMC, in PMC) :base_core {
Rakudo_cont_store(interp, $1, $2, 1, 1);
}


/*

=item perl6_container_store_unchecked(in PMC, in PMC)

Stores a value in a container. If it's Scalar, there's a fast path;
otherwise, calls the .STORE method. In the fast path case, with this
op no rw or type checking is done (assumes that the compiler has
already decided that it's safe).

=cut

*/
inline op perl6_container_store_unchecked(in PMC, in PMC) :base_core {
Rakudo_cont_store(interp, $1, $2, 0, 0);
}


/*

=item perl6_create_container_descriptor
Expand Down

0 comments on commit c7911a2

Please sign in to comment.