Skip to content

Commit

Permalink
First stab at a writedouble op
Browse files Browse the repository at this point in the history
  • Loading branch information
niner committed Sep 19, 2018
1 parent e5fd915 commit b50afaf
Show file tree
Hide file tree
Showing 6 changed files with 290 additions and 197 deletions.
256 changes: 140 additions & 116 deletions lib/MAST/Ops.nqp
Expand Up @@ -818,34 +818,33 @@ BEGIN {
2045,
2049,
2053,
2056,
2059,
2063,
2067,
2070,
2073,
2077,
2057,
2061,
2065,
2068,
2071,
2075,
2079,
2081,
2083,
2082,
2085,
2087,
2089,
2091,
2093,
2095,
2097,
2100,
2099,
2101,
2103,
2106,
2105,
2107,
2109,
2113,
2114,
2116,
2120,
2123,
2112,
2115,
2118,
2121,
2125,
2126,
2129,
2128,
2132,
2135,
2138,
Expand All @@ -859,11 +858,11 @@ BEGIN {
2162,
2165,
2168,
2172,
2176,
2179,
2182,
2185,
2171,
2174,
2177,
2180,
2184,
2188,
2191,
2194,
Expand All @@ -872,25 +871,29 @@ BEGIN {
2203,
2206,
2209,
2213,
2217,
2220,
2223,
2224,
2226,
2228,
2230,
2234,
2212,
2215,
2218,
2221,
2225,
2229,
2232,
2235,
2236,
2238,
2238,
2238,
2239,
2240,
2240,
2241,
2243,
2247);
2242,
2246,
2248,
2250,
2250,
2250,
2251,
2252,
2252,
2253,
2255,
2259);
MAST::Ops.WHO<@counts> := nqp::list_i(0,
2,
2,
Expand Down Expand Up @@ -1705,6 +1708,9 @@ BEGIN {
4,
4,
4,
4,
4,
4,
3,
3,
4,
Expand Down Expand Up @@ -3820,6 +3826,18 @@ BEGIN {
33,
66,
65,
65,
161,
33,
161,
65,
161,
161,
161,
65,
161,
49,
161,
66,
65,
128,
Expand Down Expand Up @@ -4839,83 +4857,86 @@ BEGIN {
'hllboolfor', 808,
'decodelocaltime', 809,
'buffertocu', 810,
'sp_guard', 811,
'sp_guardconc', 812,
'sp_guardtype', 813,
'sp_guardsf', 814,
'sp_guardsfouter', 815,
'sp_guardobj', 816,
'sp_guardnotobj', 817,
'sp_guardjustconc', 818,
'sp_guardjusttype', 819,
'sp_rebless', 820,
'sp_resolvecode', 821,
'sp_decont', 822,
'sp_getlex_o', 823,
'sp_getlex_ins', 824,
'sp_getlex_no', 825,
'sp_getarg_o', 826,
'sp_getarg_i', 827,
'sp_getarg_n', 828,
'sp_getarg_s', 829,
'sp_fastinvoke_v', 830,
'sp_fastinvoke_i', 831,
'sp_fastinvoke_n', 832,
'sp_fastinvoke_s', 833,
'sp_fastinvoke_o', 834,
'sp_speshresolve', 835,
'sp_paramnamesused', 836,
'sp_getspeshslot', 837,
'sp_findmeth', 838,
'sp_fastcreate', 839,
'sp_get_o', 840,
'sp_get_i64', 841,
'sp_get_i32', 842,
'sp_get_i16', 843,
'sp_get_i8', 844,
'sp_get_n', 845,
'sp_get_s', 846,
'sp_bind_o', 847,
'sp_bind_i64', 848,
'sp_bind_i32', 849,
'sp_bind_i16', 850,
'sp_bind_i8', 851,
'sp_bind_n', 852,
'sp_bind_s', 853,
'sp_p6oget_o', 854,
'sp_p6ogetvt_o', 855,
'sp_p6ogetvc_o', 856,
'sp_p6oget_i', 857,
'sp_p6oget_n', 858,
'sp_p6oget_s', 859,
'sp_p6obind_o', 860,
'sp_p6obind_i', 861,
'sp_p6obind_n', 862,
'sp_p6obind_s', 863,
'sp_deref_get_i64', 864,
'sp_deref_get_n', 865,
'sp_deref_bind_i64', 866,
'sp_deref_bind_n', 867,
'sp_getlexvia_o', 868,
'sp_getlexvia_ins', 869,
'sp_getstringfrom', 870,
'sp_getwvalfrom', 871,
'sp_jit_enter', 872,
'sp_boolify_iter', 873,
'sp_boolify_iter_arr', 874,
'sp_boolify_iter_hash', 875,
'sp_cas_o', 876,
'sp_atomicload_o', 877,
'sp_atomicstore_o', 878,
'prof_enter', 879,
'prof_enterspesh', 880,
'prof_enterinline', 881,
'prof_enternative', 882,
'prof_exit', 883,
'prof_allocated', 884,
'ctw_check', 885,
'coverage_log', 886,
'breakpoint', 887);
'writeint', 811,
'writeuint', 812,
'writenum', 813,
'sp_guard', 814,
'sp_guardconc', 815,
'sp_guardtype', 816,
'sp_guardsf', 817,
'sp_guardsfouter', 818,
'sp_guardobj', 819,
'sp_guardnotobj', 820,
'sp_guardjustconc', 821,
'sp_guardjusttype', 822,
'sp_rebless', 823,
'sp_resolvecode', 824,
'sp_decont', 825,
'sp_getlex_o', 826,
'sp_getlex_ins', 827,
'sp_getlex_no', 828,
'sp_getarg_o', 829,
'sp_getarg_i', 830,
'sp_getarg_n', 831,
'sp_getarg_s', 832,
'sp_fastinvoke_v', 833,
'sp_fastinvoke_i', 834,
'sp_fastinvoke_n', 835,
'sp_fastinvoke_s', 836,
'sp_fastinvoke_o', 837,
'sp_speshresolve', 838,
'sp_paramnamesused', 839,
'sp_getspeshslot', 840,
'sp_findmeth', 841,
'sp_fastcreate', 842,
'sp_get_o', 843,
'sp_get_i64', 844,
'sp_get_i32', 845,
'sp_get_i16', 846,
'sp_get_i8', 847,
'sp_get_n', 848,
'sp_get_s', 849,
'sp_bind_o', 850,
'sp_bind_i64', 851,
'sp_bind_i32', 852,
'sp_bind_i16', 853,
'sp_bind_i8', 854,
'sp_bind_n', 855,
'sp_bind_s', 856,
'sp_p6oget_o', 857,
'sp_p6ogetvt_o', 858,
'sp_p6ogetvc_o', 859,
'sp_p6oget_i', 860,
'sp_p6oget_n', 861,
'sp_p6oget_s', 862,
'sp_p6obind_o', 863,
'sp_p6obind_i', 864,
'sp_p6obind_n', 865,
'sp_p6obind_s', 866,
'sp_deref_get_i64', 867,
'sp_deref_get_n', 868,
'sp_deref_bind_i64', 869,
'sp_deref_bind_n', 870,
'sp_getlexvia_o', 871,
'sp_getlexvia_ins', 872,
'sp_getstringfrom', 873,
'sp_getwvalfrom', 874,
'sp_jit_enter', 875,
'sp_boolify_iter', 876,
'sp_boolify_iter_arr', 877,
'sp_boolify_iter_hash', 878,
'sp_cas_o', 879,
'sp_atomicload_o', 880,
'sp_atomicstore_o', 881,
'prof_enter', 882,
'prof_enterspesh', 883,
'prof_enterinline', 884,
'prof_enternative', 885,
'prof_exit', 886,
'prof_allocated', 887,
'ctw_check', 888,
'coverage_log', 889,
'breakpoint', 890);
MAST::Ops.WHO<@names> := nqp::list_s('no_op',
'const_i8',
'const_i16',
Expand Down Expand Up @@ -5727,6 +5748,9 @@ BEGIN {
'hllboolfor',
'decodelocaltime',
'buffertocu',
'writeint',
'writeuint',
'writenum',
'sp_guard',
'sp_guardconc',
'sp_guardtype',
Expand Down
18 changes: 18 additions & 0 deletions src/core/interp.c
Expand Up @@ -5377,6 +5377,24 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex
cur_op += 6;
goto NEXT;
}
OP(writeint):
OP(writeuint):
OP(writenum): {
MVMObject *buf = GET_REG(cur_op, 0).o;
MVMuint64 off = (MVMuint64)GET_REG(cur_op, 2).i64;
MVMuint64 num = *(MVMuint64*)&GET_REG(cur_op, 4).n64;
MVMuint64 flags = (MVMuint64)GET_REG(cur_op, 6).i64;
MVMRegister byte;
char i;
for(i = 0; i < 8; i++) {
byte.i64 = (unsigned char)((num & (0xFFull << (i * 8))) >> (i * 8));
REPR(buf)->pos_funcs.bind_pos(tc, STABLE(buf), buf,
OBJECT_BODY(buf), off + i, byte, MVM_reg_int64);
}
MVM_SC_WB_OBJ(tc, buf);
cur_op += 8;
goto NEXT;
}
OP(sp_guard): {
MVMObject *check = GET_REG(cur_op, 2).o;
MVMSTable *want = (MVMSTable *)tc->cur_frame
Expand Down
6 changes: 3 additions & 3 deletions src/core/oplabels.h
Expand Up @@ -812,6 +812,9 @@ static const void * const LABELS[] = {
&&OP_hllboolfor,
&&OP_decodelocaltime,
&&OP_buffertocu,
&&OP_writeint,
&&OP_writeuint,
&&OP_writenum,
&&OP_sp_guard,
&&OP_sp_guardconc,
&&OP_sp_guardtype,
Expand Down Expand Up @@ -1022,9 +1025,6 @@ static const void * const LABELS[] = {
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
&&OP_CALL_EXTOP,
&&OP_CALL_EXTOP,
&&OP_CALL_EXTOP,
Expand Down
3 changes: 3 additions & 0 deletions src/core/oplist
Expand Up @@ -871,6 +871,9 @@ hllbool w(obj) r(int64) :pure :useshll
hllboolfor w(obj) r(int64) r(str) :pure :useshll
decodelocaltime w(obj) r(int64)
buffertocu w(obj) r(obj) :invokish :maycausedeopt
writeint r(obj) r(uint64) r(int64) r(uint64)
writeuint r(obj) r(uint64) r(uint64) r(uint64)
writenum r(obj) r(uint64) r(num64) r(uint64)

# Spesh ops. Naming convention: start with sp_. Must all be marked .s, which
# is how the validator knows to exclude them.
Expand Down

0 comments on commit b50afaf

Please sign in to comment.