Skip to content

Commit

Permalink
Add decodelocaltime op
Browse files Browse the repository at this point in the history
  • Loading branch information
pmurias committed Aug 21, 2018
1 parent 02de10c commit f077060
Show file tree
Hide file tree
Showing 9 changed files with 289 additions and 212 deletions.
272 changes: 139 additions & 133 deletions lib/MAST/Ops.nqp
Expand Up @@ -811,16 +811,16 @@ BEGIN {
2028,
2030,
2032,
2036,
2040,
2044,
2047,
2050,
2054,
2058,
2061,
2064,
2068,
2034,
2038,
2042,
2046,
2049,
2052,
2056,
2060,
2063,
2066,
2070,
2072,
2074,
Expand All @@ -831,62 +831,63 @@ BEGIN {
2084,
2086,
2088,
2091,
2094,
2097,
2100,
2104,
2105,
2090,
2093,
2096,
2099,
2102,
2106,
2107,
2111,
2114,
2117,
2120,
2123,
2126,
2129,
2132,
2135,
2138,
2141,
2144,
2147,
2150,
2153,
2156,
2159,
2163,
2167,
2170,
2173,
2176,
2179,
2182,
2185,
2188,
2191,
2194,
2197,
2200,
2204,
2208,
2211,
2214,
2215,
2109,
2113,
2116,
2119,
2122,
2125,
2128,
2131,
2134,
2137,
2140,
2143,
2146,
2149,
2152,
2155,
2158,
2161,
2165,
2169,
2172,
2175,
2178,
2181,
2184,
2187,
2190,
2193,
2196,
2199,
2202,
2206,
2210,
2213,
2216,
2217,
2219,
2221,
2225,
2223,
2227,
2229,
2229,
2229,
2230,
2231,
2231,
2231,
2232,
2233,
2233,
2234,
2238);
2236,
2240);
MAST::Ops.WHO<@counts> := nqp::list_i(0,
2,
2,
Expand Down Expand Up @@ -1694,6 +1695,7 @@ BEGIN {
3,
2,
2,
2,
4,
4,
4,
Expand Down Expand Up @@ -3804,6 +3806,8 @@ BEGIN {
65,
65,
66,
33,
66,
65,
128,
152,
Expand Down Expand Up @@ -4818,83 +4822,84 @@ BEGIN {
'atkey_u', 804,
'coerce_us', 805,
'speshguardnotobj', 806,
'sp_guard', 807,
'sp_guardconc', 808,
'sp_guardtype', 809,
'sp_guardsf', 810,
'sp_guardsfouter', 811,
'sp_guardobj', 812,
'sp_guardnotobj', 813,
'sp_guardjustconc', 814,
'sp_guardjusttype', 815,
'sp_rebless', 816,
'sp_resolvecode', 817,
'sp_decont', 818,
'sp_getlex_o', 819,
'sp_getlex_ins', 820,
'sp_getlex_no', 821,
'sp_getarg_o', 822,
'sp_getarg_i', 823,
'sp_getarg_n', 824,
'sp_getarg_s', 825,
'sp_fastinvoke_v', 826,
'sp_fastinvoke_i', 827,
'sp_fastinvoke_n', 828,
'sp_fastinvoke_s', 829,
'sp_fastinvoke_o', 830,
'sp_speshresolve', 831,
'sp_paramnamesused', 832,
'sp_getspeshslot', 833,
'sp_findmeth', 834,
'sp_fastcreate', 835,
'sp_get_o', 836,
'sp_get_i64', 837,
'sp_get_i32', 838,
'sp_get_i16', 839,
'sp_get_i8', 840,
'sp_get_n', 841,
'sp_get_s', 842,
'sp_bind_o', 843,
'sp_bind_i64', 844,
'sp_bind_i32', 845,
'sp_bind_i16', 846,
'sp_bind_i8', 847,
'sp_bind_n', 848,
'sp_bind_s', 849,
'sp_p6oget_o', 850,
'sp_p6ogetvt_o', 851,
'sp_p6ogetvc_o', 852,
'sp_p6oget_i', 853,
'sp_p6oget_n', 854,
'sp_p6oget_s', 855,
'sp_p6obind_o', 856,
'sp_p6obind_i', 857,
'sp_p6obind_n', 858,
'sp_p6obind_s', 859,
'sp_deref_get_i64', 860,
'sp_deref_get_n', 861,
'sp_deref_bind_i64', 862,
'sp_deref_bind_n', 863,
'sp_getlexvia_o', 864,
'sp_getlexvia_ins', 865,
'sp_getstringfrom', 866,
'sp_getwvalfrom', 867,
'sp_jit_enter', 868,
'sp_boolify_iter', 869,
'sp_boolify_iter_arr', 870,
'sp_boolify_iter_hash', 871,
'sp_cas_o', 872,
'sp_atomicload_o', 873,
'sp_atomicstore_o', 874,
'prof_enter', 875,
'prof_enterspesh', 876,
'prof_enterinline', 877,
'prof_enternative', 878,
'prof_exit', 879,
'prof_allocated', 880,
'ctw_check', 881,
'coverage_log', 882,
'breakpoint', 883);
'decodelocaltime', 807,
'sp_guard', 808,
'sp_guardconc', 809,
'sp_guardtype', 810,
'sp_guardsf', 811,
'sp_guardsfouter', 812,
'sp_guardobj', 813,
'sp_guardnotobj', 814,
'sp_guardjustconc', 815,
'sp_guardjusttype', 816,
'sp_rebless', 817,
'sp_resolvecode', 818,
'sp_decont', 819,
'sp_getlex_o', 820,
'sp_getlex_ins', 821,
'sp_getlex_no', 822,
'sp_getarg_o', 823,
'sp_getarg_i', 824,
'sp_getarg_n', 825,
'sp_getarg_s', 826,
'sp_fastinvoke_v', 827,
'sp_fastinvoke_i', 828,
'sp_fastinvoke_n', 829,
'sp_fastinvoke_s', 830,
'sp_fastinvoke_o', 831,
'sp_speshresolve', 832,
'sp_paramnamesused', 833,
'sp_getspeshslot', 834,
'sp_findmeth', 835,
'sp_fastcreate', 836,
'sp_get_o', 837,
'sp_get_i64', 838,
'sp_get_i32', 839,
'sp_get_i16', 840,
'sp_get_i8', 841,
'sp_get_n', 842,
'sp_get_s', 843,
'sp_bind_o', 844,
'sp_bind_i64', 845,
'sp_bind_i32', 846,
'sp_bind_i16', 847,
'sp_bind_i8', 848,
'sp_bind_n', 849,
'sp_bind_s', 850,
'sp_p6oget_o', 851,
'sp_p6ogetvt_o', 852,
'sp_p6ogetvc_o', 853,
'sp_p6oget_i', 854,
'sp_p6oget_n', 855,
'sp_p6oget_s', 856,
'sp_p6obind_o', 857,
'sp_p6obind_i', 858,
'sp_p6obind_n', 859,
'sp_p6obind_s', 860,
'sp_deref_get_i64', 861,
'sp_deref_get_n', 862,
'sp_deref_bind_i64', 863,
'sp_deref_bind_n', 864,
'sp_getlexvia_o', 865,
'sp_getlexvia_ins', 866,
'sp_getstringfrom', 867,
'sp_getwvalfrom', 868,
'sp_jit_enter', 869,
'sp_boolify_iter', 870,
'sp_boolify_iter_arr', 871,
'sp_boolify_iter_hash', 872,
'sp_cas_o', 873,
'sp_atomicload_o', 874,
'sp_atomicstore_o', 875,
'prof_enter', 876,
'prof_enterspesh', 877,
'prof_enterinline', 878,
'prof_enternative', 879,
'prof_exit', 880,
'prof_allocated', 881,
'ctw_check', 882,
'coverage_log', 883,
'breakpoint', 884);
MAST::Ops.WHO<@names> := nqp::list_s('no_op',
'const_i8',
'const_i16',
Expand Down Expand Up @@ -5702,6 +5707,7 @@ BEGIN {
'atkey_u',
'coerce_us',
'speshguardnotobj',
'decodelocaltime',
'sp_guard',
'sp_guardconc',
'sp_guardtype',
Expand Down
19 changes: 19 additions & 0 deletions src/core/interp.c
Expand Up @@ -5335,6 +5335,25 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex
GET_REG(cur_op, 0).s = MVM_coerce_u_s(tc, GET_REG(cur_op, 2).u64);
cur_op += 4;
goto NEXT;
OP(decodelocaltime): {
int i;
MVMint64 decoded[9];
MVMObject *result = MVM_repr_alloc_init(tc, tc->instance->boot_types.BOOTIntArray);

GET_REG(cur_op, 0).o = result;

MVM_platform_decodelocaltime(GET_REG(cur_op, 2).i64, decoded);

MVMROOT(tc, result, {
REPR(result)->pos_funcs.set_elems(tc, STABLE(result), result, OBJECT_BODY(result), 9);
for (i = 0; i < 9; i++) {
MVM_repr_bind_pos_i(tc, result, i, decoded[i]);
}
});

cur_op += 4;
goto NEXT;
}
OP(speshguardnotobj):
MVM_spesh_plugin_addguard_notobj(tc, GET_REG(cur_op, 0).o, GET_REG(cur_op, 2).o);
cur_op += 4;
Expand Down
2 changes: 1 addition & 1 deletion src/core/oplabels.h
Expand Up @@ -808,6 +808,7 @@ static const void * const LABELS[] = {
&&OP_atkey_u,
&&OP_coerce_us,
&&OP_speshguardnotobj,
&&OP_decodelocaltime,
&&OP_sp_guard,
&&OP_sp_guardconc,
&&OP_sp_guardtype,
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
2 changes: 2 additions & 0 deletions src/core/oplist
Expand Up @@ -868,6 +868,8 @@ atkey_u w(uint64) r(obj) r(str) :specializable
coerce_us w(str) r(uint64) :pure
speshguardnotobj r(obj) r(obj)

decodelocaltime w(obj) r(int64)

# 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 f077060

Please sign in to comment.