Skip to content

Commit

Permalink
Rework handling of OPSIZE macro
Browse files Browse the repository at this point in the history
  • Loading branch information
bacek committed Feb 28, 2011
1 parent a92c6ed commit a3f5157
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions compilers/opsc/src/Ops/Compiler/Actions.pm
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,7 @@ method op ($/, $key?) {
my $goto_next := PAST::Op.new(
:pasttype('macro'),
:name('goto_offset'),
PAST::Val.new(
:value($OP.size),
:returns('int'),
)
self.opsize,
);

$OP[0].push($goto_next);
Expand Down Expand Up @@ -296,10 +293,7 @@ method op_macro:sym<expr next>($/) {
my $past := PAST::Op.new(
:pasttype<macro>,
:name<expr_offset>,
PAST::Op.new(
:pasttype<macro>,
:name<OPSIZE>,
)
self.opsize,
);

$OP.add_jump('PARROT_JUMP_RELATIVE');
Expand All @@ -311,10 +305,7 @@ method op_macro:sym<goto next>($/) {
my $past := PAST::Op.new(
:pasttype<macro>,
:name<goto_offset>,
PAST::Op.new(
:pasttype<macro>,
:name<OPSIZE>,
)
self.opsize,
);

$OP.add_jump('PARROT_JUMP_RELATIVE');
Expand All @@ -330,10 +321,7 @@ method op_macro:sym<restart next> ($/) {
PAST::Op.new(
:pasttype<macro>,
:name<restart_offset>,
PAST::Op.new(
:pasttype<macro>,
:name<OPSIZE>,
)
self.opsize,
),
PAST::Op.new(
:pasttype<macro>,
Expand Down Expand Up @@ -610,6 +598,14 @@ method prefix:sym<( )> ($/) {
);
}

# Helper method for generating PAST::Val with opsize
method opsize () {
make PAST::Val.new(
:value($OP.size),
:returns('int'),
);
}

# Local Variables:
# mode: perl6
# fill-column: 100
Expand Down

0 comments on commit a3f5157

Please sign in to comment.