summaryrefslogtreecommitdiff
path: root/src/lj_cdata.c
diff options
context:
space:
mode:
authorMike Pall <mike>2010-12-30 12:16:25 +0100
committerMike Pall <mike>2010-12-30 12:16:25 +0100
commit4668b229de64a839857391808c90f92290125ad8 (patch)
treec5ed7341b02e478c636c4422d3968a00c0e44a39 /src/lj_cdata.c
parent158de60b8c5a46b3f00c00ae54ed026ef46487b3 (diff)
downloadluajit-4668b229de64a839857391808c90f92290125ad8.tar.gz
luajit-4668b229de64a839857391808c90f92290125ad8.tar.bz2
luajit-4668b229de64a839857391808c90f92290125ad8.zip
FFI: Add missing GC steps for implicit allocations.
Diffstat (limited to 'src/lj_cdata.c')
-rw-r--r--src/lj_cdata.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lj_cdata.c b/src/lj_cdata.c
index 499dbc4d..71453e27 100644
--- a/src/lj_cdata.c
+++ b/src/lj_cdata.c
@@ -154,16 +154,15 @@ static void cdata_getconst(CTState *cts, TValue *o, CType *ct)
154} 154}
155 155
156/* Get C data value and convert to TValue. */ 156/* Get C data value and convert to TValue. */
157void lj_cdata_get(CTState *cts, CType *s, TValue *o, uint8_t *sp) 157int lj_cdata_get(CTState *cts, CType *s, TValue *o, uint8_t *sp)
158{ 158{
159 CTypeID sid; 159 CTypeID sid;
160 160
161 if (ctype_isconstval(s->info)) { 161 if (ctype_isconstval(s->info)) {
162 cdata_getconst(cts, o, s); 162 cdata_getconst(cts, o, s);
163 return; 163 return 0; /* No GC step needed. */
164 } else if (ctype_isbitfield(s->info)) { 164 } else if (ctype_isbitfield(s->info)) {
165 lj_cconv_tv_bf(cts, s, o, sp); 165 return lj_cconv_tv_bf(cts, s, o, sp);
166 return;
167 } 166 }
168 167
169 /* Get child type of pointer/array/field. */ 168 /* Get child type of pointer/array/field. */
@@ -183,7 +182,7 @@ void lj_cdata_get(CTState *cts, CType *s, TValue *o, uint8_t *sp)
183 while (ctype_isattrib(s->info) || ctype_isenum(s->info)) 182 while (ctype_isattrib(s->info) || ctype_isenum(s->info))
184 s = ctype_child(cts, s); 183 s = ctype_child(cts, s);
185 184
186 lj_cconv_tv_ct(cts, s, sid, o, sp); 185 return lj_cconv_tv_ct(cts, s, sid, o, sp);
187} 186}
188 187
189/* -- C data setters ------------------------------------------------------ */ 188/* -- C data setters ------------------------------------------------------ */