mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
FFI: Record ffi.errno().
This commit is contained in:
parent
1a42c03807
commit
e3c7476533
@ -1119,7 +1119,7 @@ value.</li>
|
|||||||
<li>Calls to the following <a href="ext_ffi_api.html">ffi.* API</a>
|
<li>Calls to the following <a href="ext_ffi_api.html">ffi.* API</a>
|
||||||
functions: <tt>cdef</tt>, <tt>load</tt>, <tt>typeof</tt>,
|
functions: <tt>cdef</tt>, <tt>load</tt>, <tt>typeof</tt>,
|
||||||
<tt>metatype</tt>, <tt>gc</tt>, <tt>sizeof</tt>, <tt>alignof</tt>,
|
<tt>metatype</tt>, <tt>gc</tt>, <tt>sizeof</tt>, <tt>alignof</tt>,
|
||||||
<tt>offsetof</tt>, <tt>errno</tt>.</li>
|
<tt>offsetof</tt>.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>
|
<p>
|
||||||
Other missing features:
|
Other missing features:
|
||||||
|
@ -603,7 +603,7 @@ LJLIB_CF(ffi_offsetof)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LJLIB_CF(ffi_errno)
|
LJLIB_CF(ffi_errno) LJLIB_REC(.)
|
||||||
{
|
{
|
||||||
int err = errno;
|
int err = errno;
|
||||||
if (L->top > L->base)
|
if (L->top > L->base)
|
||||||
|
@ -1205,6 +1205,14 @@ void LJ_FASTCALL recff_ffi_new(jit_State *J, RecordFFData *rd)
|
|||||||
crec_alloc(J, rd, argv2ctype(J, J->base[0], &rd->argv[0]));
|
crec_alloc(J, rd, argv2ctype(J, J->base[0], &rd->argv[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LJ_FASTCALL recff_ffi_errno(jit_State *J, RecordFFData *rd)
|
||||||
|
{
|
||||||
|
UNUSED(rd);
|
||||||
|
if (J->base[0])
|
||||||
|
lj_trace_err(J, LJ_TRERR_NYICALL);
|
||||||
|
J->base[0] = lj_ir_call(J, IRCALL_lj_vm_errno);
|
||||||
|
}
|
||||||
|
|
||||||
void LJ_FASTCALL recff_ffi_string(jit_State *J, RecordFFData *rd)
|
void LJ_FASTCALL recff_ffi_string(jit_State *J, RecordFFData *rd)
|
||||||
{
|
{
|
||||||
CTState *cts = ctype_ctsG(J2G(J));
|
CTState *cts = ctype_ctsG(J2G(J));
|
||||||
|
@ -16,6 +16,7 @@ LJ_FUNC void LJ_FASTCALL recff_cdata_call(jit_State *J, RecordFFData *rd);
|
|||||||
LJ_FUNC void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd);
|
LJ_FUNC void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd);
|
||||||
LJ_FUNC void LJ_FASTCALL recff_clib_index(jit_State *J, RecordFFData *rd);
|
LJ_FUNC void LJ_FASTCALL recff_clib_index(jit_State *J, RecordFFData *rd);
|
||||||
LJ_FUNC void LJ_FASTCALL recff_ffi_new(jit_State *J, RecordFFData *rd);
|
LJ_FUNC void LJ_FASTCALL recff_ffi_new(jit_State *J, RecordFFData *rd);
|
||||||
|
LJ_FUNC void LJ_FASTCALL recff_ffi_errno(jit_State *J, RecordFFData *rd);
|
||||||
LJ_FUNC void LJ_FASTCALL recff_ffi_string(jit_State *J, RecordFFData *rd);
|
LJ_FUNC void LJ_FASTCALL recff_ffi_string(jit_State *J, RecordFFData *rd);
|
||||||
LJ_FUNC void LJ_FASTCALL recff_ffi_copy(jit_State *J, RecordFFData *rd);
|
LJ_FUNC void LJ_FASTCALL recff_ffi_copy(jit_State *J, RecordFFData *rd);
|
||||||
LJ_FUNC void LJ_FASTCALL recff_ffi_fill(jit_State *J, RecordFFData *rd);
|
LJ_FUNC void LJ_FASTCALL recff_ffi_fill(jit_State *J, RecordFFData *rd);
|
||||||
@ -28,6 +29,7 @@ LJ_FUNC void LJ_FASTCALL lj_crecord_tonumber(jit_State *J, RecordFFData *rd);
|
|||||||
#define recff_cdata_arith recff_nyi
|
#define recff_cdata_arith recff_nyi
|
||||||
#define recff_clib_index recff_nyi
|
#define recff_clib_index recff_nyi
|
||||||
#define recff_ffi_new recff_nyi
|
#define recff_ffi_new recff_nyi
|
||||||
|
#define recff_ffi_errno recff_nyi
|
||||||
#define recff_ffi_string recff_nyi
|
#define recff_ffi_string recff_nyi
|
||||||
#define recff_ffi_copy recff_nyi
|
#define recff_ffi_copy recff_nyi
|
||||||
#define recff_ffi_fill recff_nyi
|
#define recff_ffi_fill recff_nyi
|
||||||
|
@ -171,6 +171,7 @@ typedef struct CCallInfo {
|
|||||||
_(FFI, strlen, 1, N, INTP, 0) \
|
_(FFI, strlen, 1, N, INTP, 0) \
|
||||||
_(FFI, memcpy, 3, S, PTR, 0) \
|
_(FFI, memcpy, 3, S, PTR, 0) \
|
||||||
_(FFI, memset, 3, S, PTR, 0) \
|
_(FFI, memset, 3, S, PTR, 0) \
|
||||||
|
_(FFI, lj_vm_errno, 0, S, INT, CCI_NOFPRCLOBBER) \
|
||||||
_(FFI32, lj_carith_mul64, ARG2_64, N, I64, CCI_NOFPRCLOBBER)
|
_(FFI32, lj_carith_mul64, ARG2_64, N, I64, CCI_NOFPRCLOBBER)
|
||||||
\
|
\
|
||||||
/* End of list. */
|
/* End of list. */
|
||||||
|
@ -78,6 +78,9 @@ LJ_ASMF double lj_vm_exp2(double);
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
LJ_ASMF int32_t LJ_FASTCALL lj_vm_modi(int32_t, int32_t);
|
LJ_ASMF int32_t LJ_FASTCALL lj_vm_modi(int32_t, int32_t);
|
||||||
|
#if LJ_HASFFI
|
||||||
|
LJ_ASMF int lj_vm_errno(void);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Continuations for metamethods. */
|
/* Continuations for metamethods. */
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#define lj_vmmath_c
|
#define lj_vmmath_c
|
||||||
#define LUA_CORE
|
#define LUA_CORE
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "lj_obj.h"
|
#include "lj_obj.h"
|
||||||
@ -108,4 +109,11 @@ double lj_vm_foldfpm(double x, int fpm)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if LJ_HASFFI
|
||||||
|
int lj_vm_errno(void)
|
||||||
|
{
|
||||||
|
return errno;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user