Skip to content

Commit

Permalink
Add isrwcont op.
Browse files Browse the repository at this point in the history
For checking if we have a rw container.
  • Loading branch information
jnthn committed Sep 25, 2015
1 parent 663e71a commit d28e310
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 149 deletions.
192 changes: 99 additions & 93 deletions lib/MAST/Ops.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -697,58 +697,59 @@ BEGIN {
1719,
1721,
1723,
1723,
1725,
1725,
1727,
1730,
1733,
1729,
1732,
1735,
1737,
1739,
1741,
1743,
1746,
1749,
1752,
1755,
1756,
1745,
1748,
1751,
1754,
1757,
1758,
1762,
1765,
1768,
1771,
1774,
1777,
1780,
1783,
1786,
1789,
1792,
1795,
1798,
1801,
1804,
1807,
1810,
1814,
1818,
1821,
1824,
1827,
1830,
1833,
1836,
1839,
1840,
1760,
1764,
1767,
1770,
1773,
1776,
1779,
1782,
1785,
1788,
1791,
1794,
1797,
1800,
1803,
1806,
1809,
1812,
1816,
1820,
1823,
1826,
1829,
1832,
1835,
1838,
1841,
1842,
1844,
1846,
1846,
1846,
1847,
1848,
1848,
1849);
1848,
1849,
1850,
1850,
1851);
MAST::Ops.WHO<@counts> := nqp::list_i(0,
2,
2,
Expand Down Expand Up @@ -1442,6 +1443,7 @@ BEGIN {
2,
2,
2,
2,
0,
2,
2,
Expand Down Expand Up @@ -3216,6 +3218,8 @@ BEGIN {
65,
66,
65,
34,
65,
65,
16,
65,
Expand Down Expand Up @@ -4038,60 +4042,61 @@ BEGIN {
'setdimensions', 689,
'numdimensions', 690,
'ctxcode', 691,
'sp_log', 692,
'sp_osrfinalize', 693,
'sp_guardconc', 694,
'sp_guardtype', 695,
'sp_guardcontconc', 696,
'sp_guardconttype', 697,
'sp_getarg_o', 698,
'sp_getarg_i', 699,
'sp_getarg_n', 700,
'sp_getarg_s', 701,
'sp_fastinvoke_v', 702,
'sp_fastinvoke_i', 703,
'sp_fastinvoke_n', 704,
'sp_fastinvoke_s', 705,
'sp_fastinvoke_o', 706,
'sp_namedarg_used', 707,
'sp_getspeshslot', 708,
'sp_findmeth', 709,
'sp_fastcreate', 710,
'sp_get_o', 711,
'sp_get_i64', 712,
'sp_get_i32', 713,
'sp_get_i16', 714,
'sp_get_i8', 715,
'sp_get_n', 716,
'sp_get_s', 717,
'sp_bind_o', 718,
'sp_bind_i64', 719,
'sp_bind_i32', 720,
'sp_bind_i16', 721,
'sp_bind_i8', 722,
'sp_bind_n', 723,
'sp_bind_s', 724,
'sp_p6oget_o', 725,
'sp_p6ogetvt_o', 726,
'sp_p6ogetvc_o', 727,
'sp_p6oget_i', 728,
'sp_p6oget_n', 729,
'sp_p6oget_s', 730,
'sp_p6obind_o', 731,
'sp_p6obind_i', 732,
'sp_p6obind_n', 733,
'sp_p6obind_s', 734,
'sp_jit_enter', 735,
'sp_boolify_iter', 736,
'sp_boolify_iter_arr', 737,
'sp_boolify_iter_hash', 738,
'prof_enter', 739,
'prof_enterspesh', 740,
'prof_enterinline', 741,
'prof_enternative', 742,
'prof_exit', 743,
'prof_allocated', 744,
'ctw_check', 745);
'isrwcont', 692,
'sp_log', 693,
'sp_osrfinalize', 694,
'sp_guardconc', 695,
'sp_guardtype', 696,
'sp_guardcontconc', 697,
'sp_guardconttype', 698,
'sp_getarg_o', 699,
'sp_getarg_i', 700,
'sp_getarg_n', 701,
'sp_getarg_s', 702,
'sp_fastinvoke_v', 703,
'sp_fastinvoke_i', 704,
'sp_fastinvoke_n', 705,
'sp_fastinvoke_s', 706,
'sp_fastinvoke_o', 707,
'sp_namedarg_used', 708,
'sp_getspeshslot', 709,
'sp_findmeth', 710,
'sp_fastcreate', 711,
'sp_get_o', 712,
'sp_get_i64', 713,
'sp_get_i32', 714,
'sp_get_i16', 715,
'sp_get_i8', 716,
'sp_get_n', 717,
'sp_get_s', 718,
'sp_bind_o', 719,
'sp_bind_i64', 720,
'sp_bind_i32', 721,
'sp_bind_i16', 722,
'sp_bind_i8', 723,
'sp_bind_n', 724,
'sp_bind_s', 725,
'sp_p6oget_o', 726,
'sp_p6ogetvt_o', 727,
'sp_p6ogetvc_o', 728,
'sp_p6oget_i', 729,
'sp_p6oget_n', 730,
'sp_p6oget_s', 731,
'sp_p6obind_o', 732,
'sp_p6obind_i', 733,
'sp_p6obind_n', 734,
'sp_p6obind_s', 735,
'sp_jit_enter', 736,
'sp_boolify_iter', 737,
'sp_boolify_iter_arr', 738,
'sp_boolify_iter_hash', 739,
'prof_enter', 740,
'prof_enterspesh', 741,
'prof_enterinline', 742,
'prof_enternative', 743,
'prof_exit', 744,
'prof_allocated', 745,
'ctw_check', 746);
MAST::Ops.WHO<@names> := nqp::list_s('no_op',
'const_i8',
'const_i16',
Expand Down Expand Up @@ -4784,6 +4789,7 @@ BEGIN {
'setdimensions',
'numdimensions',
'ctxcode',
'isrwcont',
'sp_log',
'sp_osrfinalize',
'sp_guardconc',
Expand Down
11 changes: 11 additions & 0 deletions src/core/interp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4696,6 +4696,17 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex
cur_op += 4;
goto NEXT;
}
OP(isrwcont): {
MVMObject *obj = GET_REG(cur_op, 2).o;
MVMint64 is_rw = 0;
if (!MVM_is_null(tc, obj)) {
MVMContainerSpec *cs = STABLE(obj)->container_spec;
is_rw = cs && cs->can_store(tc, obj);
}
GET_REG(cur_op, 0).i64 = is_rw;
cur_op += 4;
goto NEXT;
}
OP(sp_log):
if (tc->cur_frame->spesh_log_idx >= 0) {
MVM_ASSIGN_REF(tc, &(tc->cur_frame->static_info->common.header),
Expand Down
2 changes: 1 addition & 1 deletion src/core/oplabels.h
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ static const void * const LABELS[] = {
&&OP_setdimensions,
&&OP_numdimensions,
&&OP_ctxcode,
&&OP_isrwcont,
&&OP_sp_log,
&&OP_sp_osrfinalize,
&&OP_sp_guardconc,
Expand Down Expand Up @@ -1024,7 +1025,6 @@ static const void * const LABELS[] = {
NULL,
NULL,
NULL,
NULL,
&&OP_CALL_EXTOP,
&&OP_CALL_EXTOP,
&&OP_CALL_EXTOP,
Expand Down
1 change: 1 addition & 0 deletions src/core/oplist
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ dimensions w(obj) r(obj)
setdimensions r(obj) r(obj)
numdimensions w(int64) r(obj)
ctxcode w(obj) r(obj)
isrwcont w(int64) r(obj)

# Spesh ops. Naming convention: start with sp_. Must all be marked .s, which
# is how the validator knows to exclude them.
Expand Down
13 changes: 12 additions & 1 deletion src/core/ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -7605,6 +7605,17 @@ static const MVMOpInfo MVM_op_infos[] = {
0,
{ MVM_operand_write_reg | MVM_operand_obj, MVM_operand_read_reg | MVM_operand_obj }
},
{
MVM_OP_isrwcont,
"isrwcont",
" ",
2,
0,
0,
0,
0,
{ MVM_operand_write_reg | MVM_operand_int64, MVM_operand_read_reg | MVM_operand_obj }
},
{
MVM_OP_sp_log,
"sp_log",
Expand Down Expand Up @@ -8197,7 +8208,7 @@ static const MVMOpInfo MVM_op_infos[] = {
},
};

static const unsigned short MVM_op_counts = 746;
static const unsigned short MVM_op_counts = 747;

MVM_PUBLIC const MVMOpInfo * MVM_op_get_op(unsigned short op) {
if (op >= MVM_op_counts)
Expand Down
Loading

0 comments on commit d28e310

Please sign in to comment.