Skip to content

Commit ad81875

Browse files
committed
A couple of ops for special code object marks.
Will eliminate most of the remaining setprop usages.
1 parent dc851e8 commit ad81875

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/QAST/Operations.nqp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,6 +1749,28 @@ QAST::Operations.add_core_op('setstaticlex', -> $qastcomp, $op {
17491749
});
17501750
QAST::Operations.add_core_pirop_mapping('freshcoderef', 'nqp_fresh_stub', 'PP');
17511751
QAST::Operations.add_core_pirop_mapping('replacecoderef', 'assign', '0PP');
1752+
QAST::Operations.add_core_op('markcodestatic', -> $qastcomp, $op {
1753+
if +@($op) != 1 {
1754+
nqp::die('markcodestatic requires one operand');
1755+
}
1756+
my $ops := PIRT::Ops.new();
1757+
my $code := $qastcomp.coerce($qastcomp.as_post($op[0]), 'P');
1758+
$ops.push($code);
1759+
$ops.push_pirop('setprop', $code, "'STATIC_CODE_REF'", $code);
1760+
$ops.result($code);
1761+
$ops
1762+
});
1763+
QAST::Operations.add_core_op('markcodestub', -> $qastcomp, $op {
1764+
if +@($op) != 1 {
1765+
nqp::die('markcodestatic requires one operand');
1766+
}
1767+
my $ops := PIRT::Ops.new();
1768+
my $code := $qastcomp.coerce($qastcomp.as_post($op[0]), 'P');
1769+
$ops.push($code);
1770+
$ops.push_pirop('setprop', $code, "'COMPILER_STUB'", $code);
1771+
$ops.result($code);
1772+
$ops
1773+
});
17521774

17531775
# serialization context related opcodes
17541776
QAST::Operations.add_core_pirop_mapping('sha1', 'nqp_sha1', 'Ss');

0 commit comments

Comments
 (0)