From 6aecd2a70ee6a69de7250cbf410f64c73935be15 Mon Sep 17 00:00:00 2001 From: jnthn Date: Wed, 7 Oct 2015 11:42:58 +0200 Subject: [PATCH] Stub in fc (fold case) op. Just as an alias for lc at present. --- lib/MAST/Ops.nqp | 192 +++++++++++++++++++++++--------------------- src/core/interp.c | 4 + src/core/oplabels.h | 2 +- src/core/oplist | 1 + src/core/ops.c | 13 ++- src/core/ops.h | 109 ++++++++++++------------- src/strings/ops.c | 1 + src/strings/ops.h | 1 + 8 files changed, 174 insertions(+), 149 deletions(-) diff --git a/lib/MAST/Ops.nqp b/lib/MAST/Ops.nqp index fb39648f45..9ed29e46a5 100644 --- a/lib/MAST/Ops.nqp +++ b/lib/MAST/Ops.nqp @@ -698,58 +698,59 @@ BEGIN { 1721, 1723, 1725, - 1725, + 1727, 1727, 1729, - 1732, - 1735, + 1731, + 1734, 1737, 1739, 1741, 1743, 1745, - 1748, - 1751, - 1754, - 1757, - 1758, + 1747, + 1750, + 1753, + 1756, + 1759, 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, + 1762, + 1766, + 1769, + 1772, + 1775, + 1778, + 1781, + 1784, + 1787, + 1790, + 1793, + 1796, + 1799, + 1802, + 1805, + 1808, + 1811, + 1814, + 1818, + 1822, + 1825, + 1828, + 1831, + 1834, + 1837, + 1840, + 1843, 1844, 1846, 1848, - 1848, - 1848, - 1849, 1850, 1850, - 1851); + 1850, + 1851, + 1852, + 1852, + 1853); MAST::Ops.WHO<@counts> := nqp::list_i(0, 2, 2, @@ -1444,6 +1445,7 @@ BEGIN { 2, 2, 2, + 2, 0, 2, 2, @@ -3220,6 +3222,8 @@ BEGIN { 65, 34, 65, + 58, + 57, 65, 16, 65, @@ -4043,60 +4047,61 @@ BEGIN { 'numdimensions', 690, 'ctxcode', 691, '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); + 'fc', 693, + 'sp_log', 694, + 'sp_osrfinalize', 695, + 'sp_guardconc', 696, + 'sp_guardtype', 697, + 'sp_guardcontconc', 698, + 'sp_guardconttype', 699, + 'sp_getarg_o', 700, + 'sp_getarg_i', 701, + 'sp_getarg_n', 702, + 'sp_getarg_s', 703, + 'sp_fastinvoke_v', 704, + 'sp_fastinvoke_i', 705, + 'sp_fastinvoke_n', 706, + 'sp_fastinvoke_s', 707, + 'sp_fastinvoke_o', 708, + 'sp_namedarg_used', 709, + 'sp_getspeshslot', 710, + 'sp_findmeth', 711, + 'sp_fastcreate', 712, + 'sp_get_o', 713, + 'sp_get_i64', 714, + 'sp_get_i32', 715, + 'sp_get_i16', 716, + 'sp_get_i8', 717, + 'sp_get_n', 718, + 'sp_get_s', 719, + 'sp_bind_o', 720, + 'sp_bind_i64', 721, + 'sp_bind_i32', 722, + 'sp_bind_i16', 723, + 'sp_bind_i8', 724, + 'sp_bind_n', 725, + 'sp_bind_s', 726, + 'sp_p6oget_o', 727, + 'sp_p6ogetvt_o', 728, + 'sp_p6ogetvc_o', 729, + 'sp_p6oget_i', 730, + 'sp_p6oget_n', 731, + 'sp_p6oget_s', 732, + 'sp_p6obind_o', 733, + 'sp_p6obind_i', 734, + 'sp_p6obind_n', 735, + 'sp_p6obind_s', 736, + 'sp_jit_enter', 737, + 'sp_boolify_iter', 738, + 'sp_boolify_iter_arr', 739, + 'sp_boolify_iter_hash', 740, + 'prof_enter', 741, + 'prof_enterspesh', 742, + 'prof_enterinline', 743, + 'prof_enternative', 744, + 'prof_exit', 745, + 'prof_allocated', 746, + 'ctw_check', 747); MAST::Ops.WHO<@names> := nqp::list_s('no_op', 'const_i8', 'const_i16', @@ -4790,6 +4795,7 @@ BEGIN { 'numdimensions', 'ctxcode', 'isrwcont', + 'fc', 'sp_log', 'sp_osrfinalize', 'sp_guardconc', diff --git a/src/core/interp.c b/src/core/interp.c index 854c094f9d..2364a6e232 100644 --- a/src/core/interp.c +++ b/src/core/interp.c @@ -4707,6 +4707,10 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex cur_op += 4; goto NEXT; } + OP(fc): + GET_REG(cur_op, 0).s = MVM_string_fc(tc, GET_REG(cur_op, 2).s); + 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), diff --git a/src/core/oplabels.h b/src/core/oplabels.h index 6941b5f628..d6ab440876 100644 --- a/src/core/oplabels.h +++ b/src/core/oplabels.h @@ -694,6 +694,7 @@ static const void * const LABELS[] = { &&OP_numdimensions, &&OP_ctxcode, &&OP_isrwcont, + &&OP_fc, &&OP_sp_log, &&OP_sp_osrfinalize, &&OP_sp_guardconc, @@ -1024,7 +1025,6 @@ static const void * const LABELS[] = { NULL, NULL, NULL, - NULL, &&OP_CALL_EXTOP, &&OP_CALL_EXTOP, &&OP_CALL_EXTOP, diff --git a/src/core/oplist b/src/core/oplist index bdf8d52d21..d7c9852858 100644 --- a/src/core/oplist +++ b/src/core/oplist @@ -731,6 +731,7 @@ setdimensions r(obj) r(obj) numdimensions w(int64) r(obj) ctxcode w(obj) r(obj) isrwcont w(int64) r(obj) +fc w(str) r(str) :pure # Spesh ops. Naming convention: start with sp_. Must all be marked .s, which # is how the validator knows to exclude them. diff --git a/src/core/ops.c b/src/core/ops.c index f559c7816a..a8564e2e06 100644 --- a/src/core/ops.c +++ b/src/core/ops.c @@ -7616,6 +7616,17 @@ static const MVMOpInfo MVM_op_infos[] = { 0, { MVM_operand_write_reg | MVM_operand_int64, MVM_operand_read_reg | MVM_operand_obj } }, + { + MVM_OP_fc, + "fc", + " ", + 2, + 1, + 0, + 0, + 0, + { MVM_operand_write_reg | MVM_operand_str, MVM_operand_read_reg | MVM_operand_str } + }, { MVM_OP_sp_log, "sp_log", @@ -8208,7 +8219,7 @@ static const MVMOpInfo MVM_op_infos[] = { }, }; -static const unsigned short MVM_op_counts = 747; +static const unsigned short MVM_op_counts = 748; MVM_PUBLIC const MVMOpInfo * MVM_op_get_op(unsigned short op) { if (op >= MVM_op_counts) diff --git a/src/core/ops.h b/src/core/ops.h index 024bf9fb3f..646f6c9f14 100644 --- a/src/core/ops.h +++ b/src/core/ops.h @@ -694,60 +694,61 @@ #define MVM_OP_numdimensions 690 #define MVM_OP_ctxcode 691 #define MVM_OP_isrwcont 692 -#define MVM_OP_sp_log 693 -#define MVM_OP_sp_osrfinalize 694 -#define MVM_OP_sp_guardconc 695 -#define MVM_OP_sp_guardtype 696 -#define MVM_OP_sp_guardcontconc 697 -#define MVM_OP_sp_guardconttype 698 -#define MVM_OP_sp_getarg_o 699 -#define MVM_OP_sp_getarg_i 700 -#define MVM_OP_sp_getarg_n 701 -#define MVM_OP_sp_getarg_s 702 -#define MVM_OP_sp_fastinvoke_v 703 -#define MVM_OP_sp_fastinvoke_i 704 -#define MVM_OP_sp_fastinvoke_n 705 -#define MVM_OP_sp_fastinvoke_s 706 -#define MVM_OP_sp_fastinvoke_o 707 -#define MVM_OP_sp_namedarg_used 708 -#define MVM_OP_sp_getspeshslot 709 -#define MVM_OP_sp_findmeth 710 -#define MVM_OP_sp_fastcreate 711 -#define MVM_OP_sp_get_o 712 -#define MVM_OP_sp_get_i64 713 -#define MVM_OP_sp_get_i32 714 -#define MVM_OP_sp_get_i16 715 -#define MVM_OP_sp_get_i8 716 -#define MVM_OP_sp_get_n 717 -#define MVM_OP_sp_get_s 718 -#define MVM_OP_sp_bind_o 719 -#define MVM_OP_sp_bind_i64 720 -#define MVM_OP_sp_bind_i32 721 -#define MVM_OP_sp_bind_i16 722 -#define MVM_OP_sp_bind_i8 723 -#define MVM_OP_sp_bind_n 724 -#define MVM_OP_sp_bind_s 725 -#define MVM_OP_sp_p6oget_o 726 -#define MVM_OP_sp_p6ogetvt_o 727 -#define MVM_OP_sp_p6ogetvc_o 728 -#define MVM_OP_sp_p6oget_i 729 -#define MVM_OP_sp_p6oget_n 730 -#define MVM_OP_sp_p6oget_s 731 -#define MVM_OP_sp_p6obind_o 732 -#define MVM_OP_sp_p6obind_i 733 -#define MVM_OP_sp_p6obind_n 734 -#define MVM_OP_sp_p6obind_s 735 -#define MVM_OP_sp_jit_enter 736 -#define MVM_OP_sp_boolify_iter 737 -#define MVM_OP_sp_boolify_iter_arr 738 -#define MVM_OP_sp_boolify_iter_hash 739 -#define MVM_OP_prof_enter 740 -#define MVM_OP_prof_enterspesh 741 -#define MVM_OP_prof_enterinline 742 -#define MVM_OP_prof_enternative 743 -#define MVM_OP_prof_exit 744 -#define MVM_OP_prof_allocated 745 -#define MVM_OP_ctw_check 746 +#define MVM_OP_fc 693 +#define MVM_OP_sp_log 694 +#define MVM_OP_sp_osrfinalize 695 +#define MVM_OP_sp_guardconc 696 +#define MVM_OP_sp_guardtype 697 +#define MVM_OP_sp_guardcontconc 698 +#define MVM_OP_sp_guardconttype 699 +#define MVM_OP_sp_getarg_o 700 +#define MVM_OP_sp_getarg_i 701 +#define MVM_OP_sp_getarg_n 702 +#define MVM_OP_sp_getarg_s 703 +#define MVM_OP_sp_fastinvoke_v 704 +#define MVM_OP_sp_fastinvoke_i 705 +#define MVM_OP_sp_fastinvoke_n 706 +#define MVM_OP_sp_fastinvoke_s 707 +#define MVM_OP_sp_fastinvoke_o 708 +#define MVM_OP_sp_namedarg_used 709 +#define MVM_OP_sp_getspeshslot 710 +#define MVM_OP_sp_findmeth 711 +#define MVM_OP_sp_fastcreate 712 +#define MVM_OP_sp_get_o 713 +#define MVM_OP_sp_get_i64 714 +#define MVM_OP_sp_get_i32 715 +#define MVM_OP_sp_get_i16 716 +#define MVM_OP_sp_get_i8 717 +#define MVM_OP_sp_get_n 718 +#define MVM_OP_sp_get_s 719 +#define MVM_OP_sp_bind_o 720 +#define MVM_OP_sp_bind_i64 721 +#define MVM_OP_sp_bind_i32 722 +#define MVM_OP_sp_bind_i16 723 +#define MVM_OP_sp_bind_i8 724 +#define MVM_OP_sp_bind_n 725 +#define MVM_OP_sp_bind_s 726 +#define MVM_OP_sp_p6oget_o 727 +#define MVM_OP_sp_p6ogetvt_o 728 +#define MVM_OP_sp_p6ogetvc_o 729 +#define MVM_OP_sp_p6oget_i 730 +#define MVM_OP_sp_p6oget_n 731 +#define MVM_OP_sp_p6oget_s 732 +#define MVM_OP_sp_p6obind_o 733 +#define MVM_OP_sp_p6obind_i 734 +#define MVM_OP_sp_p6obind_n 735 +#define MVM_OP_sp_p6obind_s 736 +#define MVM_OP_sp_jit_enter 737 +#define MVM_OP_sp_boolify_iter 738 +#define MVM_OP_sp_boolify_iter_arr 739 +#define MVM_OP_sp_boolify_iter_hash 740 +#define MVM_OP_prof_enter 741 +#define MVM_OP_prof_enterspesh 742 +#define MVM_OP_prof_enterinline 743 +#define MVM_OP_prof_enternative 744 +#define MVM_OP_prof_exit 745 +#define MVM_OP_prof_allocated 746 +#define MVM_OP_ctw_check 747 #define MVM_OP_EXT_BASE 1024 #define MVM_OP_EXT_CU_LIMIT 1024 diff --git a/src/strings/ops.c b/src/strings/ops.c index 032778605d..800723115c 100644 --- a/src/strings/ops.c +++ b/src/strings/ops.c @@ -668,6 +668,7 @@ MVMString * funcname(MVMThreadContext *tc, MVMString *s) { \ case_change_func(MVM_string_uc, MVM_unicode_case_change_type_upper, "uc") case_change_func(MVM_string_lc, MVM_unicode_case_change_type_lower, "lc") case_change_func(MVM_string_tc, MVM_unicode_case_change_type_title, "tc") +case_change_func(MVM_string_fc, MVM_unicode_case_change_type_lower, "fc") /* Decodes a C buffer to an MVMString, dependent on the encoding type flag. */ MVMString * MVM_string_decode(MVMThreadContext *tc, diff --git a/src/strings/ops.h b/src/strings/ops.h index 0b734a2df0..92dca30007 100644 --- a/src/strings/ops.h +++ b/src/strings/ops.h @@ -52,6 +52,7 @@ MVMint64 MVM_string_index_of_grapheme(MVMThreadContext *tc, MVMString *a, MVMGra MVMString * MVM_string_uc(MVMThreadContext *tc, MVMString *s); MVMString * MVM_string_lc(MVMThreadContext *tc, MVMString *s); MVMString * MVM_string_tc(MVMThreadContext *tc, MVMString *s); +MVMString * MVM_string_fc(MVMThreadContext *tc, MVMString *s); MVMString * MVM_string_decode(MVMThreadContext *tc, const MVMObject *type_object, char *Cbuf, MVMint64 byte_length, MVMint64 encoding_flag); char * MVM_string_encode(MVMThreadContext *tc, MVMString *s, MVMint64 start, MVMint64 length, MVMuint64 *output_size, MVMint64 encoding_flag); void MVM_string_encode_to_buf(MVMThreadContext *tc, MVMString *s, MVMString *enc_name, MVMObject *buf);