From 4a97faef7ef7e9b12235adcb98e3e591b0db7122 Mon Sep 17 00:00:00 2001
From: Mike Pall
Date: Tue, 9 Oct 2012 21:50:09 +0200
Subject: [PATCH] FFI: Compile array/struct copies.
---
doc/ext_ffi_semantics.html | 1 -
src/lj_crecord.c | 6 +++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/doc/ext_ffi_semantics.html b/doc/ext_ffi_semantics.html
index 498bbbb4..36c3be32 100644
--- a/doc/ext_ffi_semantics.html
+++ b/doc/ext_ffi_semantics.html
@@ -1140,7 +1140,6 @@ The following operations are currently not compiled and may exhibit
suboptimal performance, especially when used in inner loops:
-- Array/struct copies and bulk initializations.
- Bitfield accesses and initializations.
- Vector operations.
- Table initializers.
diff --git a/src/lj_crecord.c b/src/lj_crecord.c
index 47ae65b4..6a22544a 100644
--- a/src/lj_crecord.c
+++ b/src/lj_crecord.c
@@ -526,11 +526,11 @@ static TRef crec_ct_ct(jit_State *J, CType *d, CType *s, TRef dp, TRef sp,
/* Destination is an array. */
case CCX(A, A):
- goto err_nyi;
-
/* Destination is a struct/union. */
case CCX(S, S):
- goto err_nyi;
+ if (dp == 0) goto err_conv;
+ crec_copy(J, dp, sp, lj_ir_kint(J, dsize), d);
+ break;
default:
err_conv: