aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lj_ffrecord.c30
-rw-r--r--src/lj_ir.h10
-rw-r--r--src/lj_ircall.h56
-rw-r--r--src/lj_record.c4
4 files changed, 51 insertions, 49 deletions
diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c
index baf7279d..6c7eb2a0 100644
--- a/src/lj_ffrecord.c
+++ b/src/lj_ffrecord.c
@@ -707,7 +707,7 @@ static void LJ_FASTCALL recff_bit_tohex(jit_State *J, RecordFFData *rd)
707#if LJ_HASFFI 707#if LJ_HASFFI
708 TRef hdr = recff_bufhdr(J); 708 TRef hdr = recff_bufhdr(J);
709 TRef tr = recff_bit64_tohex(J, rd, hdr); 709 TRef tr = recff_bit64_tohex(J, rd, hdr);
710 J->base[0] = emitir(IRT(IR_BUFSTR, IRT_STR), tr, hdr); 710 J->base[0] = emitir(IRTG(IR_BUFSTR, IRT_STR), tr, hdr);
711#else 711#else
712 recff_nyiu(J, rd); /* Don't bother working around this NYI. */ 712 recff_nyiu(J, rd); /* Don't bother working around this NYI. */
713#endif 713#endif
@@ -833,8 +833,8 @@ static void LJ_FASTCALL recff_string_char(jit_State *J, RecordFFData *rd)
833 if (i > 1) { /* Concatenate the strings, if there's more than one. */ 833 if (i > 1) { /* Concatenate the strings, if there's more than one. */
834 TRef hdr = recff_bufhdr(J), tr = hdr; 834 TRef hdr = recff_bufhdr(J), tr = hdr;
835 for (i = 0; J->base[i] != 0; i++) 835 for (i = 0; J->base[i] != 0; i++)
836 tr = emitir(IRT(IR_BUFPUT, IRT_PGC), tr, J->base[i]); 836 tr = emitir(IRTG(IR_BUFPUT, IRT_PGC), tr, J->base[i]);
837 J->base[0] = emitir(IRT(IR_BUFSTR, IRT_STR), tr, hdr); 837 J->base[0] = emitir(IRTG(IR_BUFSTR, IRT_STR), tr, hdr);
838 } else if (i == 0) { 838 } else if (i == 0) {
839 J->base[0] = lj_ir_kstr(J, &J2G(J)->strempty); 839 J->base[0] = lj_ir_kstr(J, &J2G(J)->strempty);
840 } 840 }
@@ -852,19 +852,19 @@ static void LJ_FASTCALL recff_string_rep(jit_State *J, RecordFFData *rd)
852 emitir(IRTGI(vrep > 1 ? IR_GT : IR_LE), rep, lj_ir_kint(J, 1)); 852 emitir(IRTGI(vrep > 1 ? IR_GT : IR_LE), rep, lj_ir_kint(J, 1));
853 if (vrep > 1) { 853 if (vrep > 1) {
854 TRef hdr2 = recff_bufhdr(J); 854 TRef hdr2 = recff_bufhdr(J);
855 TRef tr2 = emitir(IRT(IR_BUFPUT, IRT_PGC), hdr2, sep); 855 TRef tr2 = emitir(IRTG(IR_BUFPUT, IRT_PGC), hdr2, sep);
856 tr2 = emitir(IRT(IR_BUFPUT, IRT_PGC), tr2, str); 856 tr2 = emitir(IRTG(IR_BUFPUT, IRT_PGC), tr2, str);
857 str2 = emitir(IRT(IR_BUFSTR, IRT_STR), tr2, hdr2); 857 str2 = emitir(IRTG(IR_BUFSTR, IRT_STR), tr2, hdr2);
858 } 858 }
859 } 859 }
860 tr = hdr = recff_bufhdr(J); 860 tr = hdr = recff_bufhdr(J);
861 if (str2) { 861 if (str2) {
862 tr = emitir(IRT(IR_BUFPUT, IRT_PGC), tr, str); 862 tr = emitir(IRTG(IR_BUFPUT, IRT_PGC), tr, str);
863 str = str2; 863 str = str2;
864 rep = emitir(IRTI(IR_ADD), rep, lj_ir_kint(J, -1)); 864 rep = emitir(IRTI(IR_ADD), rep, lj_ir_kint(J, -1));
865 } 865 }
866 tr = lj_ir_call(J, IRCALL_lj_buf_putstr_rep, tr, str, rep); 866 tr = lj_ir_call(J, IRCALL_lj_buf_putstr_rep, tr, str, rep);
867 J->base[0] = emitir(IRT(IR_BUFSTR, IRT_STR), tr, hdr); 867 J->base[0] = emitir(IRTG(IR_BUFSTR, IRT_STR), tr, hdr);
868} 868}
869 869
870static void LJ_FASTCALL recff_string_op(jit_State *J, RecordFFData *rd) 870static void LJ_FASTCALL recff_string_op(jit_State *J, RecordFFData *rd)
@@ -872,7 +872,7 @@ static void LJ_FASTCALL recff_string_op(jit_State *J, RecordFFData *rd)
872 TRef str = lj_ir_tostr(J, J->base[0]); 872 TRef str = lj_ir_tostr(J, J->base[0]);
873 TRef hdr = recff_bufhdr(J); 873 TRef hdr = recff_bufhdr(J);
874 TRef tr = lj_ir_call(J, rd->data, hdr, str); 874 TRef tr = lj_ir_call(J, rd->data, hdr, str);
875 J->base[0] = emitir(IRT(IR_BUFSTR, IRT_STR), tr, hdr); 875 J->base[0] = emitir(IRTG(IR_BUFSTR, IRT_STR), tr, hdr);
876} 876}
877 877
878static void LJ_FASTCALL recff_string_find(jit_State *J, RecordFFData *rd) 878static void LJ_FASTCALL recff_string_find(jit_State *J, RecordFFData *rd)
@@ -953,7 +953,7 @@ static void LJ_FASTCALL recff_string_format(jit_State *J, RecordFFData *rd)
953 IRCallID id; 953 IRCallID id;
954 switch (STRFMT_TYPE(sf)) { 954 switch (STRFMT_TYPE(sf)) {
955 case STRFMT_LIT: 955 case STRFMT_LIT:
956 tr = emitir(IRT(IR_BUFPUT, IRT_PGC), tr, 956 tr = emitir(IRTG(IR_BUFPUT, IRT_PGC), tr,
957 lj_ir_kstr(J, lj_str_new(J->L, fs.str, fs.len))); 957 lj_ir_kstr(J, lj_str_new(J->L, fs.str, fs.len)));
958 break; 958 break;
959 case STRFMT_INT: 959 case STRFMT_INT:
@@ -962,7 +962,7 @@ static void LJ_FASTCALL recff_string_format(jit_State *J, RecordFFData *rd)
962 if (!tref_isinteger(tra)) 962 if (!tref_isinteger(tra))
963 goto handle_num; 963 goto handle_num;
964 if (sf == STRFMT_INT) { /* Shortcut for plain %d. */ 964 if (sf == STRFMT_INT) { /* Shortcut for plain %d. */
965 tr = emitir(IRT(IR_BUFPUT, IRT_PGC), tr, 965 tr = emitir(IRTG(IR_BUFPUT, IRT_PGC), tr,
966 emitir(IRT(IR_TOSTR, IRT_STR), tra, IRTOSTR_INT)); 966 emitir(IRT(IR_TOSTR, IRT_STR), tra, IRTOSTR_INT));
967 } else { 967 } else {
968#if LJ_HASFFI 968#if LJ_HASFFI
@@ -992,7 +992,7 @@ static void LJ_FASTCALL recff_string_format(jit_State *J, RecordFFData *rd)
992 return; 992 return;
993 } 993 }
994 if (sf == STRFMT_STR) /* Shortcut for plain %s. */ 994 if (sf == STRFMT_STR) /* Shortcut for plain %s. */
995 tr = emitir(IRT(IR_BUFPUT, IRT_PGC), tr, tra); 995 tr = emitir(IRTG(IR_BUFPUT, IRT_PGC), tr, tra);
996 else if ((sf & STRFMT_T_QUOTED)) 996 else if ((sf & STRFMT_T_QUOTED))
997 tr = lj_ir_call(J, IRCALL_lj_strfmt_putquoted, tr, tra); 997 tr = lj_ir_call(J, IRCALL_lj_strfmt_putquoted, tr, tra);
998 else 998 else
@@ -1001,7 +1001,7 @@ static void LJ_FASTCALL recff_string_format(jit_State *J, RecordFFData *rd)
1001 case STRFMT_CHAR: 1001 case STRFMT_CHAR:
1002 tra = lj_opt_narrow_toint(J, tra); 1002 tra = lj_opt_narrow_toint(J, tra);
1003 if (sf == STRFMT_CHAR) /* Shortcut for plain %c. */ 1003 if (sf == STRFMT_CHAR) /* Shortcut for plain %c. */
1004 tr = emitir(IRT(IR_BUFPUT, IRT_PGC), tr, 1004 tr = emitir(IRTG(IR_BUFPUT, IRT_PGC), tr,
1005 emitir(IRT(IR_TOSTR, IRT_STR), tra, IRTOSTR_CHAR)); 1005 emitir(IRT(IR_TOSTR, IRT_STR), tra, IRTOSTR_CHAR));
1006 else 1006 else
1007 tr = lj_ir_call(J, IRCALL_lj_strfmt_putfchar, tr, trsf, tra); 1007 tr = lj_ir_call(J, IRCALL_lj_strfmt_putfchar, tr, trsf, tra);
@@ -1013,7 +1013,7 @@ static void LJ_FASTCALL recff_string_format(jit_State *J, RecordFFData *rd)
1013 return; 1013 return;
1014 } 1014 }
1015 } 1015 }
1016 J->base[0] = emitir(IRT(IR_BUFSTR, IRT_STR), tr, hdr); 1016 J->base[0] = emitir(IRTG(IR_BUFSTR, IRT_STR), tr, hdr);
1017} 1017}
1018 1018
1019/* -- Table library fast functions ---------------------------------------- */ 1019/* -- Table library fast functions ---------------------------------------- */
@@ -1054,7 +1054,7 @@ static void LJ_FASTCALL recff_table_concat(jit_State *J, RecordFFData *rd)
1054 TRef hdr = recff_bufhdr(J); 1054 TRef hdr = recff_bufhdr(J);
1055 TRef tr = lj_ir_call(J, IRCALL_lj_buf_puttab, hdr, tab, sep, tri, tre); 1055 TRef tr = lj_ir_call(J, IRCALL_lj_buf_puttab, hdr, tab, sep, tri, tre);
1056 emitir(IRTG(IR_NE, IRT_PTR), tr, lj_ir_kptr(J, NULL)); 1056 emitir(IRTG(IR_NE, IRT_PTR), tr, lj_ir_kptr(J, NULL));
1057 J->base[0] = emitir(IRT(IR_BUFSTR, IRT_STR), tr, hdr); 1057 J->base[0] = emitir(IRTG(IR_BUFSTR, IRT_STR), tr, hdr);
1058 } /* else: Interpreter will throw. */ 1058 } /* else: Interpreter will throw. */
1059 UNUSED(rd); 1059 UNUSED(rd);
1060} 1060}
diff --git a/src/lj_ir.h b/src/lj_ir.h
index 1aedfd0e..aacef2b4 100644
--- a/src/lj_ir.h
+++ b/src/lj_ir.h
@@ -124,8 +124,8 @@
124 \ 124 \
125 /* Buffer operations. */ \ 125 /* Buffer operations. */ \
126 _(BUFHDR, L , ref, lit) \ 126 _(BUFHDR, L , ref, lit) \
127 _(BUFPUT, L , ref, ref) \ 127 _(BUFPUT, LW, ref, ref) \
128 _(BUFSTR, A , ref, ref) \ 128 _(BUFSTR, AW, ref, ref) \
129 \ 129 \
130 /* Barriers. */ \ 130 /* Barriers. */ \
131 _(TBAR, S , ref, ___) \ 131 _(TBAR, S , ref, ___) \
@@ -139,9 +139,9 @@
139 _(STRTO, N , ref, ___) \ 139 _(STRTO, N , ref, ___) \
140 \ 140 \
141 /* Calls. */ \ 141 /* Calls. */ \
142 _(CALLN, N , ref, lit) \ 142 _(CALLN, NW, ref, lit) \
143 _(CALLA, A , ref, lit) \ 143 _(CALLA, AW, ref, lit) \
144 _(CALLL, L , ref, lit) \ 144 _(CALLL, LW, ref, lit) \
145 _(CALLS, S , ref, lit) \ 145 _(CALLS, S , ref, lit) \
146 _(CALLXS, S , ref, ref) \ 146 _(CALLXS, S , ref, ref) \
147 _(CARG, N , ref, ref) \ 147 _(CARG, N , ref, ref) \
diff --git a/src/lj_ircall.h b/src/lj_ircall.h
index d467403e..13501ba1 100644
--- a/src/lj_ircall.h
+++ b/src/lj_ircall.h
@@ -30,10 +30,12 @@ typedef struct CCallInfo {
30#define CCI_CALL_L (IR_CALLL << CCI_OPSHIFT) 30#define CCI_CALL_L (IR_CALLL << CCI_OPSHIFT)
31#define CCI_CALL_S (IR_CALLS << CCI_OPSHIFT) 31#define CCI_CALL_S (IR_CALLS << CCI_OPSHIFT)
32#define CCI_CALL_FN (CCI_CALL_N|CCI_CC_FASTCALL) 32#define CCI_CALL_FN (CCI_CALL_N|CCI_CC_FASTCALL)
33#define CCI_CALL_FA (CCI_CALL_A|CCI_CC_FASTCALL)
33#define CCI_CALL_FL (CCI_CALL_L|CCI_CC_FASTCALL) 34#define CCI_CALL_FL (CCI_CALL_L|CCI_CC_FASTCALL)
34#define CCI_CALL_FS (CCI_CALL_S|CCI_CC_FASTCALL) 35#define CCI_CALL_FS (CCI_CALL_S|CCI_CC_FASTCALL)
35 36
36/* C call info flags. */ 37/* C call info flags. */
38#define CCI_T (IRT_GUARD << CCI_OTSHIFT) /* May throw. */
37#define CCI_L 0x0100 /* Implicit L arg. */ 39#define CCI_L 0x0100 /* Implicit L arg. */
38#define CCI_CASTU64 0x0200 /* Cast u64 result to number. */ 40#define CCI_CASTU64 0x0200 /* Cast u64 result to number. */
39#define CCI_NOFPRCLOBBER 0x0400 /* Does not clobber any FPRs. */ 41#define CCI_NOFPRCLOBBER 0x0400 /* Does not clobber any FPRs. */
@@ -139,39 +141,39 @@ typedef struct CCallInfo {
139#define IRCALLDEF(_) \ 141#define IRCALLDEF(_) \
140 _(ANY, lj_str_cmp, 2, FN, INT, CCI_NOFPRCLOBBER) \ 142 _(ANY, lj_str_cmp, 2, FN, INT, CCI_NOFPRCLOBBER) \
141 _(ANY, lj_str_find, 4, N, PGC, 0) \ 143 _(ANY, lj_str_find, 4, N, PGC, 0) \
142 _(ANY, lj_str_new, 3, S, STR, CCI_L) \ 144 _(ANY, lj_str_new, 3, S, STR, CCI_L|CCI_T) \
143 _(ANY, lj_strscan_num, 2, FN, INT, 0) \ 145 _(ANY, lj_strscan_num, 2, FN, INT, 0) \
144 _(ANY, lj_strfmt_int, 2, FN, STR, CCI_L) \ 146 _(ANY, lj_strfmt_int, 2, FN, STR, CCI_L|CCI_T) \
145 _(ANY, lj_strfmt_num, 2, FN, STR, CCI_L) \ 147 _(ANY, lj_strfmt_num, 2, FN, STR, CCI_L|CCI_T) \
146 _(ANY, lj_strfmt_char, 2, FN, STR, CCI_L) \ 148 _(ANY, lj_strfmt_char, 2, FN, STR, CCI_L|CCI_T) \
147 _(ANY, lj_strfmt_putint, 2, FL, PGC, 0) \ 149 _(ANY, lj_strfmt_putint, 2, FL, PGC, CCI_T) \
148 _(ANY, lj_strfmt_putnum, 2, FL, PGC, 0) \ 150 _(ANY, lj_strfmt_putnum, 2, FL, PGC, CCI_T) \
149 _(ANY, lj_strfmt_putquoted, 2, FL, PGC, 0) \ 151 _(ANY, lj_strfmt_putquoted, 2, FL, PGC, CCI_T) \
150 _(ANY, lj_strfmt_putfxint, 3, L, PGC, XA_64) \ 152 _(ANY, lj_strfmt_putfxint, 3, L, PGC, XA_64|CCI_T) \
151 _(ANY, lj_strfmt_putfnum_int, 3, L, PGC, XA_FP) \ 153 _(ANY, lj_strfmt_putfnum_int, 3, L, PGC, XA_FP|CCI_T) \
152 _(ANY, lj_strfmt_putfnum_uint, 3, L, PGC, XA_FP) \ 154 _(ANY, lj_strfmt_putfnum_uint, 3, L, PGC, XA_FP|CCI_T) \
153 _(ANY, lj_strfmt_putfnum, 3, L, PGC, XA_FP) \ 155 _(ANY, lj_strfmt_putfnum, 3, L, PGC, XA_FP|CCI_T) \
154 _(ANY, lj_strfmt_putfstr, 3, L, PGC, 0) \ 156 _(ANY, lj_strfmt_putfstr, 3, L, PGC, CCI_T) \
155 _(ANY, lj_strfmt_putfchar, 3, L, PGC, 0) \ 157 _(ANY, lj_strfmt_putfchar, 3, L, PGC, CCI_T) \
156 _(ANY, lj_buf_putmem, 3, S, PGC, 0) \ 158 _(ANY, lj_buf_putmem, 3, S, PGC, CCI_T) \
157 _(ANY, lj_buf_putstr, 2, FL, PGC, 0) \ 159 _(ANY, lj_buf_putstr, 2, FL, PGC, CCI_T) \
158 _(ANY, lj_buf_putchar, 2, FL, PGC, 0) \ 160 _(ANY, lj_buf_putchar, 2, FL, PGC, CCI_T) \
159 _(ANY, lj_buf_putstr_reverse, 2, FL, PGC, 0) \ 161 _(ANY, lj_buf_putstr_reverse, 2, FL, PGC, CCI_T) \
160 _(ANY, lj_buf_putstr_lower, 2, FL, PGC, 0) \ 162 _(ANY, lj_buf_putstr_lower, 2, FL, PGC, CCI_T) \
161 _(ANY, lj_buf_putstr_upper, 2, FL, PGC, 0) \ 163 _(ANY, lj_buf_putstr_upper, 2, FL, PGC, CCI_T) \
162 _(ANY, lj_buf_putstr_rep, 3, L, PGC, 0) \ 164 _(ANY, lj_buf_putstr_rep, 3, L, PGC, CCI_T) \
163 _(ANY, lj_buf_puttab, 5, L, PGC, 0) \ 165 _(ANY, lj_buf_puttab, 5, L, PGC, CCI_T) \
164 _(ANY, lj_buf_tostr, 1, FL, STR, 0) \ 166 _(ANY, lj_buf_tostr, 1, FL, STR, CCI_T) \
165 _(ANY, lj_tab_new_ah, 3, A, TAB, CCI_L) \ 167 _(ANY, lj_tab_new_ah, 3, A, TAB, CCI_L|CCI_T) \
166 _(ANY, lj_tab_new1, 2, FS, TAB, CCI_L) \ 168 _(ANY, lj_tab_new1, 2, FA, TAB, CCI_L|CCI_T) \
167 _(ANY, lj_tab_dup, 2, FS, TAB, CCI_L) \ 169 _(ANY, lj_tab_dup, 2, FA, TAB, CCI_L|CCI_T) \
168 _(ANY, lj_tab_clear, 1, FS, NIL, 0) \ 170 _(ANY, lj_tab_clear, 1, FS, NIL, 0) \
169 _(ANY, lj_tab_newkey, 3, S, PGC, CCI_L) \ 171 _(ANY, lj_tab_newkey, 3, S, PGC, CCI_L|CCI_T) \
170 _(ANY, lj_tab_len, 1, FL, INT, 0) \ 172 _(ANY, lj_tab_len, 1, FL, INT, 0) \
171 _(ANY, lj_tab_len_hint, 2, FL, INT, 0) \ 173 _(ANY, lj_tab_len_hint, 2, FL, INT, 0) \
172 _(ANY, lj_gc_step_jit, 2, FS, NIL, CCI_L) \ 174 _(ANY, lj_gc_step_jit, 2, FS, NIL, CCI_L) \
173 _(ANY, lj_gc_barrieruv, 2, FS, NIL, 0) \ 175 _(ANY, lj_gc_barrieruv, 2, FS, NIL, 0) \
174 _(ANY, lj_mem_newgco, 2, FS, PGC, CCI_L) \ 176 _(ANY, lj_mem_newgco, 2, FA, PGC, CCI_L|CCI_T) \
175 _(ANY, lj_prng_u64d, 1, FS, NUM, CCI_CASTU64) \ 177 _(ANY, lj_prng_u64d, 1, FS, NUM, CCI_CASTU64) \
176 _(ANY, lj_vm_modi, 2, FN, INT, 0) \ 178 _(ANY, lj_vm_modi, 2, FN, INT, 0) \
177 _(ANY, log10, 1, N, NUM, XA_FP) \ 179 _(ANY, log10, 1, N, NUM, XA_FP) \
diff --git a/src/lj_record.c b/src/lj_record.c
index c1adaa74..a4779933 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -1935,9 +1935,9 @@ static TRef rec_cat(jit_State *J, BCReg baseslot, BCReg topslot)
1935 tr = hdr = emitir(IRT(IR_BUFHDR, IRT_PGC), 1935 tr = hdr = emitir(IRT(IR_BUFHDR, IRT_PGC),
1936 lj_ir_kptr(J, &J2G(J)->tmpbuf), IRBUFHDR_RESET); 1936 lj_ir_kptr(J, &J2G(J)->tmpbuf), IRBUFHDR_RESET);
1937 do { 1937 do {
1938 tr = emitir(IRT(IR_BUFPUT, IRT_PGC), tr, *trp++); 1938 tr = emitir(IRTG(IR_BUFPUT, IRT_PGC), tr, *trp++);
1939 } while (trp <= top); 1939 } while (trp <= top);
1940 tr = emitir(IRT(IR_BUFSTR, IRT_STR), tr, hdr); 1940 tr = emitir(IRTG(IR_BUFSTR, IRT_STR), tr, hdr);
1941 J->maxslot = (BCReg)(xbase - J->base); 1941 J->maxslot = (BCReg)(xbase - J->base);
1942 if (xbase == base) return tr; /* Return simple concatenation result. */ 1942 if (xbase == base) return tr; /* Return simple concatenation result. */
1943 /* Pass partial result. */ 1943 /* Pass partial result. */