summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2013-05-23 22:17:45 +0200
committerMike Pall <mike>2013-05-23 22:17:45 +0200
commit7ef2b55fc0e8d1058b0bdac89e3f4c46db41f553 (patch)
treef62d904f23e950745e61ef9417dfd5f056b5f38a
parent890754ee27d564335865a0ba731e69c6a6191655 (diff)
downloadluajit2-7ef2b55fc0e8d1058b0bdac89e3f4c46db41f553.tar.gz
FFI: Fix unroll limit for ffi.fill().
-rw-r--r--src/lj_crecord.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/lj_crecord.c b/src/lj_crecord.c
index e3973fc1..8577de2c 100644
--- a/src/lj_crecord.c
+++ b/src/lj_crecord.c
@@ -125,11 +125,6 @@ static IRType crec_ct2irt(CTState *cts, CType *ct)
#define CREC_COPY_MAXLEN 128
#define CREC_FILL_MAXUNROLL 16
-#if LJ_TARGET_UNALIGNED
-#define CREC_FILL_MAXLEN (CTSIZE_PTR * CREC_FILL_MAXUNROLL)
-#else
-#define CREC_FILL_MAXLEN CREC_FILL_MAXUNROLL
-#endif
/* Number of windowed registers used for optimized memory copy. */
#if LJ_TARGET_X86
@@ -320,9 +315,9 @@ static void crec_fill(jit_State *J, TRef trdst, TRef trlen, TRef trfill,
MSize mlp;
CTSize len = (CTSize)IR(tref_ref(trlen))->i;
if (len == 0) return; /* Shortcut. */
- if (len > CREC_FILL_MAXLEN) goto fallback;
if (LJ_TARGET_UNALIGNED || step >= CTSIZE_PTR)
step = CTSIZE_PTR;
+ if (step * CREC_FILL_MAXUNROLL < len) goto fallback;
mlp = crec_fill_unroll(ml, len, step);
if (!mlp) goto fallback;
if (tref_isk(trfill) || ml[0].tp != IRT_U8)