aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2011-01-10 03:38:23 +0100
committerMike Pall <mike>2011-01-10 03:38:23 +0100
commitd215747fd5a97b3299262f8190803994a492b4d1 (patch)
treeee6e3fd2ac24fafd2411d5e0b32a73d4aa0cd078 /src
parent9502afb35b47ca90e52516721abd1ebf273e539e (diff)
downloadluajit-d215747fd5a97b3299262f8190803994a492b4d1.tar.gz
luajit-d215747fd5a97b3299262f8190803994a492b4d1.tar.bz2
luajit-d215747fd5a97b3299262f8190803994a492b4d1.zip
FFI: Fix function pointer lookup for calls.
Diffstat (limited to 'src')
-rw-r--r--src/lj_ccall.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lj_ccall.c b/src/lj_ccall.c
index 2f0a04dd..03f0ec06 100644
--- a/src/lj_ccall.c
+++ b/src/lj_ccall.c
@@ -340,14 +340,15 @@ int lj_ccall_func(lua_State *L, GCcdata *cd)
340{ 340{
341 CTState *cts = ctype_cts(L); 341 CTState *cts = ctype_cts(L);
342 CType *ct = ctype_raw(cts, cd->typeid); 342 CType *ct = ctype_raw(cts, cd->typeid);
343 CTSize sz = ct->size; 343 CTSize sz = CTSIZE_PTR;
344 void *p = cdataptr(cd); 344 if (ctype_isptr(ct->info)) {
345 if (ctype_isptr(ct->info)) 345 sz = ct->size;
346 ct = ctype_rawchild(cts, ct); 346 ct = ctype_rawchild(cts, ct);
347 }
347 if (ctype_isfunc(ct->info)) { 348 if (ctype_isfunc(ct->info)) {
348 CCallState cc; 349 CCallState cc;
349 int gcsteps, ret; 350 int gcsteps, ret;
350 cc.func = (void (*)(void))cdata_getptr(p, sz); 351 cc.func = (void (*)(void))cdata_getptr(cdataptr(cd), sz);
351 gcsteps = ccall_set_args(L, cts, ct, &cc); 352 gcsteps = ccall_set_args(L, cts, ct, &cc);
352 lj_vm_ffi_call(&cc); 353 lj_vm_ffi_call(&cc);
353 gcsteps += ccall_get_results(L, cts, ct, &cc, &ret); 354 gcsteps += ccall_get_results(L, cts, ct, &cc, &ret);