immunio 1.1.2 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/immunio/version.rb +1 -1
- data/lua-hooks/Makefile +56 -109
- data/lua-hooks/ext/all.c +3 -14
- data/lua-hooks/ext/libinjection/module.mk +5 -0
- data/lua-hooks/ext/lpeg/module.mk +6 -0
- data/lua-hooks/ext/lua-cmsgpack/module.mk +2 -0
- data/lua-hooks/ext/lua-snapshot/module.mk +2 -0
- data/lua-hooks/ext/luajit/COPYRIGHT +1 -1
- data/lua-hooks/ext/luajit/Makefile +2 -2
- data/lua-hooks/ext/luajit/README +2 -2
- data/lua-hooks/ext/luajit/doc/bluequad-print.css +1 -1
- data/lua-hooks/ext/luajit/doc/bluequad.css +1 -1
- data/lua-hooks/ext/luajit/doc/changes.html +15 -2
- data/lua-hooks/ext/luajit/doc/contact.html +3 -3
- data/lua-hooks/ext/luajit/doc/ext_c_api.html +2 -2
- data/lua-hooks/ext/luajit/doc/ext_ffi.html +2 -2
- data/lua-hooks/ext/luajit/doc/ext_ffi_api.html +2 -2
- data/lua-hooks/ext/luajit/doc/ext_ffi_semantics.html +4 -2
- data/lua-hooks/ext/luajit/doc/ext_ffi_tutorial.html +2 -2
- data/lua-hooks/ext/luajit/doc/ext_jit.html +2 -2
- data/lua-hooks/ext/luajit/doc/ext_profiler.html +2 -2
- data/lua-hooks/ext/luajit/doc/extensions.html +9 -2
- data/lua-hooks/ext/luajit/doc/faq.html +2 -2
- data/lua-hooks/ext/luajit/doc/install.html +22 -18
- data/lua-hooks/ext/luajit/doc/luajit.html +3 -3
- data/lua-hooks/ext/luajit/doc/running.html +2 -2
- data/lua-hooks/ext/luajit/doc/status.html +2 -2
- data/lua-hooks/ext/luajit/dynasm/dasm_arm.h +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_arm.lua +4 -4
- data/lua-hooks/ext/luajit/dynasm/dasm_arm64.h +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_arm64.lua +4 -4
- data/lua-hooks/ext/luajit/dynasm/dasm_mips.h +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_mips.lua +4 -4
- data/lua-hooks/ext/luajit/dynasm/dasm_ppc.h +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_ppc.lua +4 -4
- data/lua-hooks/ext/luajit/dynasm/dasm_proto.h +3 -3
- data/lua-hooks/ext/luajit/dynasm/dasm_x64.lua +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_x86.h +34 -7
- data/lua-hooks/ext/luajit/dynasm/dasm_x86.lua +427 -102
- data/lua-hooks/ext/luajit/dynasm/dynasm.lua +5 -5
- data/lua-hooks/ext/luajit/etc/luajit.1 +1 -1
- data/lua-hooks/ext/luajit/etc/luajit.pc +1 -1
- data/lua-hooks/ext/luajit/src/Makefile +36 -21
- data/lua-hooks/ext/luajit/src/Makefile.dep +3 -1
- data/lua-hooks/ext/luajit/src/host/buildvm.c +1 -1
- data/lua-hooks/ext/luajit/src/host/buildvm.h +1 -1
- data/lua-hooks/ext/luajit/src/host/buildvm_asm.c +10 -1
- data/lua-hooks/ext/luajit/src/host/buildvm_fold.c +1 -1
- data/lua-hooks/ext/luajit/src/host/buildvm_lib.c +1 -1
- data/lua-hooks/ext/luajit/src/host/buildvm_peobj.c +1 -1
- data/lua-hooks/ext/luajit/src/host/genlibbc.lua +1 -1
- data/lua-hooks/ext/luajit/src/host/genminilua.lua +1 -1
- data/lua-hooks/ext/luajit/src/jit/bc.lua +1 -1
- data/lua-hooks/ext/luajit/src/jit/bcsave.lua +2 -2
- data/lua-hooks/ext/luajit/src/jit/dis_arm.lua +1 -1
- data/lua-hooks/ext/luajit/src/jit/dis_mips.lua +1 -1
- data/lua-hooks/ext/luajit/src/jit/dis_mipsel.lua +1 -1
- data/lua-hooks/ext/luajit/src/jit/dis_ppc.lua +1 -1
- data/lua-hooks/ext/luajit/src/jit/dis_x64.lua +1 -1
- data/lua-hooks/ext/luajit/src/jit/dis_x86.lua +163 -73
- data/lua-hooks/ext/luajit/src/jit/dump.lua +2 -1
- data/lua-hooks/ext/luajit/src/jit/p.lua +1 -1
- data/lua-hooks/ext/luajit/src/jit/v.lua +1 -1
- data/lua-hooks/ext/luajit/src/jit/zone.lua +1 -1
- data/lua-hooks/ext/luajit/src/lib_aux.c +1 -1
- data/lua-hooks/ext/luajit/src/lib_base.c +4 -5
- data/lua-hooks/ext/luajit/src/lib_bit.c +1 -1
- data/lua-hooks/ext/luajit/src/lib_debug.c +1 -1
- data/lua-hooks/ext/luajit/src/lib_ffi.c +2 -5
- data/lua-hooks/ext/luajit/src/lib_init.c +1 -1
- data/lua-hooks/ext/luajit/src/lib_io.c +2 -3
- data/lua-hooks/ext/luajit/src/lib_jit.c +1 -1
- data/lua-hooks/ext/luajit/src/lib_math.c +1 -1
- data/lua-hooks/ext/luajit/src/lib_os.c +2 -2
- data/lua-hooks/ext/luajit/src/lib_package.c +1 -1
- data/lua-hooks/ext/luajit/src/lib_string.c +1 -1
- data/lua-hooks/ext/luajit/src/lib_table.c +1 -1
- data/lua-hooks/ext/luajit/src/lj.supp +15 -0
- data/lua-hooks/ext/luajit/src/lj_alloc.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_api.c +4 -1
- data/lua-hooks/ext/luajit/src/lj_arch.h +33 -7
- data/lua-hooks/ext/luajit/src/lj_asm.c +12 -5
- data/lua-hooks/ext/luajit/src/lj_asm.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_asm_arm.h +3 -13
- data/lua-hooks/ext/luajit/src/lj_asm_mips.h +337 -71
- data/lua-hooks/ext/luajit/src/lj_asm_ppc.h +2 -2
- data/lua-hooks/ext/luajit/src/lj_asm_x86.h +2 -2
- data/lua-hooks/ext/luajit/src/lj_bc.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_bc.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_bcdump.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_bcread.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_bcwrite.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_buf.c +2 -4
- data/lua-hooks/ext/luajit/src/lj_buf.h +1 -3
- data/lua-hooks/ext/luajit/src/lj_carith.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_carith.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ccall.c +37 -14
- data/lua-hooks/ext/luajit/src/lj_ccall.h +3 -3
- data/lua-hooks/ext/luajit/src/lj_ccallback.c +16 -7
- data/lua-hooks/ext/luajit/src/lj_ccallback.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_cconv.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_cconv.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_cdata.c +10 -1
- data/lua-hooks/ext/luajit/src/lj_cdata.h +3 -1
- data/lua-hooks/ext/luajit/src/lj_clib.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_clib.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_cparse.c +27 -6
- data/lua-hooks/ext/luajit/src/lj_cparse.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_crecord.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_crecord.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ctype.c +10 -8
- data/lua-hooks/ext/luajit/src/lj_ctype.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_debug.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_debug.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_def.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_dispatch.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_dispatch.h +21 -4
- data/lua-hooks/ext/luajit/src/lj_emit_arm.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_emit_mips.h +7 -5
- data/lua-hooks/ext/luajit/src/lj_emit_ppc.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_emit_x86.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_err.c +69 -31
- data/lua-hooks/ext/luajit/src/lj_err.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_errmsg.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ff.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ffrecord.c +10 -40
- data/lua-hooks/ext/luajit/src/lj_ffrecord.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_frame.h +12 -1
- data/lua-hooks/ext/luajit/src/lj_func.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_func.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_gc.c +2 -2
- data/lua-hooks/ext/luajit/src/lj_gc.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_gdbjit.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_gdbjit.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ir.c +31 -15
- data/lua-hooks/ext/luajit/src/lj_ir.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ircall.h +29 -1
- data/lua-hooks/ext/luajit/src/lj_iropt.h +2 -1
- data/lua-hooks/ext/luajit/src/lj_jit.h +2 -1
- data/lua-hooks/ext/luajit/src/lj_lex.c +28 -1
- data/lua-hooks/ext/luajit/src/lj_lex.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_lib.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_lib.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_load.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_mcode.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_mcode.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_meta.c +8 -8
- data/lua-hooks/ext/luajit/src/lj_meta.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_obj.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_obj.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_opt_dce.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_opt_fold.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_opt_loop.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_opt_mem.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_opt_narrow.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_opt_sink.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_opt_split.c +10 -5
- data/lua-hooks/ext/luajit/src/lj_parse.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_parse.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_profile.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_profile.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_record.c +13 -5
- data/lua-hooks/ext/luajit/src/lj_record.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_snap.c +20 -23
- data/lua-hooks/ext/luajit/src/lj_snap.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_state.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_state.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_str.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_str.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_strfmt.c +12 -98
- data/lua-hooks/ext/luajit/src/lj_strfmt.h +4 -4
- data/lua-hooks/ext/luajit/src/lj_strfmt_num.c +591 -0
- data/lua-hooks/ext/luajit/src/lj_strscan.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_strscan.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_tab.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_tab.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_target.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_target_arm.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_target_arm64.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_target_mips.h +30 -2
- data/lua-hooks/ext/luajit/src/lj_target_ppc.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_target_x86.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_trace.c +7 -2
- data/lua-hooks/ext/luajit/src/lj_trace.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_traceerr.h +1 -3
- data/lua-hooks/ext/luajit/src/lj_udata.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_udata.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_vm.h +5 -3
- data/lua-hooks/ext/luajit/src/lj_vmevent.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_vmevent.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_vmmath.c +15 -15
- data/lua-hooks/ext/luajit/src/ljamalg.c +2 -1
- data/lua-hooks/ext/luajit/src/lua.h +1 -0
- data/lua-hooks/ext/luajit/src/luaconf.h +2 -2
- data/lua-hooks/ext/luajit/src/luajit.c +1 -1
- data/lua-hooks/ext/luajit/src/luajit.h +4 -4
- data/lua-hooks/ext/luajit/src/lualib.h +1 -1
- data/lua-hooks/ext/luajit/src/msvcbuild.bat +1 -1
- data/lua-hooks/ext/luajit/src/ps4build.bat +26 -6
- data/lua-hooks/ext/luajit/src/vm_arm.dasc +17 -9
- data/lua-hooks/ext/luajit/src/vm_arm64.dasc +1 -1
- data/lua-hooks/ext/luajit/src/vm_mips.dasc +1562 -656
- data/lua-hooks/ext/luajit/src/vm_ppc.dasc +3 -7
- data/lua-hooks/ext/luajit/src/vm_x64.dasc +10 -2
- data/lua-hooks/ext/luajit/src/vm_x86.dasc +5 -8
- data/lua-hooks/ext/luautf8/module.mk +2 -0
- data/lua-hooks/ext/module.mk +15 -0
- data/lua-hooks/ext/modules.h +17 -0
- data/lua-hooks/ext/perf/luacpu.c +1 -1
- data/lua-hooks/ext/perf/lualoadavg.c +1 -1
- data/lua-hooks/ext/perf/luameminfo.c +1 -1
- data/lua-hooks/ext/perf/luaoslib.c +124 -2
- data/lua-hooks/ext/perf/module.mk +5 -0
- data/lua-hooks/ext/sha1/luasha1.c +4 -2
- data/lua-hooks/ext/sha1/module.mk +5 -0
- data/lua-hooks/ext/sha2/luasha256.c +4 -2
- data/lua-hooks/ext/sha2/module.mk +5 -0
- data/lua-hooks/ext/sysutils/lua_utils.c +56 -0
- data/lua-hooks/ext/sysutils/module.mk +2 -0
- data/lua-hooks/lib/boot.lua +2 -1
- data/lua-hooks/lib/hooks/module.mk +31 -0
- data/lua-hooks/lib/hooks/xss/module.mk +4 -0
- data/lua-hooks/lib/lexers/module.mk +10 -0
- data/lua-hooks/lib/module.mk +38 -0
- data/lua-hooks/lib/schema/module.mk +3 -0
- data/lua-hooks/options.mk +59 -0
- metadata +21 -2
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
** PPC IR assembler (SSA IR -> machine code).
|
3
|
-
** Copyright (C) 2005-
|
3
|
+
** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
|
4
4
|
*/
|
5
5
|
|
6
6
|
/* -- Register allocator extensions --------------------------------------- */
|
@@ -298,7 +298,7 @@ static void asm_gencall(ASMState *as, const CCallInfo *ci, IRRef *args)
|
|
298
298
|
static void asm_setupresult(ASMState *as, IRIns *ir, const CCallInfo *ci)
|
299
299
|
{
|
300
300
|
RegSet drop = RSET_SCRATCH;
|
301
|
-
int hiop = ((ir+1)->o == IR_HIOP);
|
301
|
+
int hiop = ((ir+1)->o == IR_HIOP && !irt_isnil((ir+1)->t));
|
302
302
|
if ((ci->flags & CCI_NOFPRCLOBBER))
|
303
303
|
drop &= ~RSET_FPR;
|
304
304
|
if (ra_hasreg(ir->r))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
** x86/x64 IR assembler (SSA IR -> machine code).
|
3
|
-
** Copyright (C) 2005-
|
3
|
+
** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
|
4
4
|
*/
|
5
5
|
|
6
6
|
/* -- Guard handling ------------------------------------------------------ */
|
@@ -531,7 +531,7 @@ static void asm_gencall(ASMState *as, const CCallInfo *ci, IRRef *args)
|
|
531
531
|
static void asm_setupresult(ASMState *as, IRIns *ir, const CCallInfo *ci)
|
532
532
|
{
|
533
533
|
RegSet drop = RSET_SCRATCH;
|
534
|
-
int hiop = (LJ_32 && (ir+1)->o == IR_HIOP);
|
534
|
+
int hiop = (LJ_32 && (ir+1)->o == IR_HIOP && !irt_isnil((ir+1)->t));
|
535
535
|
if ((ci->flags & CCI_NOFPRCLOBBER))
|
536
536
|
drop &= ~RSET_FPR;
|
537
537
|
if (ra_hasreg(ir->r))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
** Buffer handling.
|
3
|
-
** Copyright (C) 2005-
|
3
|
+
** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
|
4
4
|
*/
|
5
5
|
|
6
6
|
#define lj_buf_c
|
@@ -77,7 +77,6 @@ SBuf *lj_buf_putmem(SBuf *sb, const void *q, MSize len)
|
|
77
77
|
return sb;
|
78
78
|
}
|
79
79
|
|
80
|
-
#if LJ_HASJIT
|
81
80
|
SBuf * LJ_FASTCALL lj_buf_putchar(SBuf *sb, int c)
|
82
81
|
{
|
83
82
|
char *p = lj_buf_more(sb, 1);
|
@@ -85,7 +84,6 @@ SBuf * LJ_FASTCALL lj_buf_putchar(SBuf *sb, int c)
|
|
85
84
|
setsbufP(sb, p);
|
86
85
|
return sb;
|
87
86
|
}
|
88
|
-
#endif
|
89
87
|
|
90
88
|
SBuf * LJ_FASTCALL lj_buf_putstr(SBuf *sb, GCstr *s)
|
91
89
|
{
|
@@ -186,7 +184,7 @@ SBuf *lj_buf_puttab(SBuf *sb, GCtab *t, GCstr *sep, int32_t i, int32_t e)
|
|
186
184
|
} else if (tvisint(o)) {
|
187
185
|
p = lj_strfmt_wint(lj_buf_more(sb, STRFMT_MAXBUF_INT+seplen), intV(o));
|
188
186
|
} else if (tvisnum(o)) {
|
189
|
-
p =
|
187
|
+
p = lj_buf_more(lj_strfmt_putfnum(sb, STRFMT_G14, numV(o)), seplen);
|
190
188
|
} else {
|
191
189
|
goto badtype;
|
192
190
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
** Buffer handling.
|
3
|
-
** Copyright (C) 2005-
|
3
|
+
** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
|
4
4
|
*/
|
5
5
|
|
6
6
|
#ifndef _LJ_BUF_H
|
@@ -67,9 +67,7 @@ static LJ_AINLINE char *lj_buf_more(SBuf *sb, MSize sz)
|
|
67
67
|
|
68
68
|
/* Low-level buffer put operations */
|
69
69
|
LJ_FUNC SBuf *lj_buf_putmem(SBuf *sb, const void *q, MSize len);
|
70
|
-
#if LJ_HASJIT
|
71
70
|
LJ_FUNC SBuf * LJ_FASTCALL lj_buf_putchar(SBuf *sb, int c);
|
72
|
-
#endif
|
73
71
|
LJ_FUNC SBuf * LJ_FASTCALL lj_buf_putstr(SBuf *sb, GCstr *s);
|
74
72
|
|
75
73
|
static LJ_AINLINE char *lj_buf_wmem(char *p, const void *q, MSize len)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
** FFI C call handling.
|
3
|
-
** Copyright (C) 2005-
|
3
|
+
** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
|
4
4
|
*/
|
5
5
|
|
6
6
|
#include "lj_obj.h"
|
@@ -418,6 +418,18 @@
|
|
418
418
|
/* Complex values are returned in 1 or 2 FPRs. */ \
|
419
419
|
cc->retref = 0;
|
420
420
|
|
421
|
+
#if LJ_ABI_SOFTFP
|
422
|
+
#define CCALL_HANDLE_COMPLEXRET2 \
|
423
|
+
if (ctr->size == 2*sizeof(float)) { /* Copy complex float from GPRs. */ \
|
424
|
+
((intptr_t *)dp)[0] = cc->gpr[0]; \
|
425
|
+
((intptr_t *)dp)[1] = cc->gpr[1]; \
|
426
|
+
} else { /* Copy complex double from GPRs. */ \
|
427
|
+
((intptr_t *)dp)[0] = cc->gpr[0]; \
|
428
|
+
((intptr_t *)dp)[1] = cc->gpr[1]; \
|
429
|
+
((intptr_t *)dp)[2] = cc->gpr[2]; \
|
430
|
+
((intptr_t *)dp)[3] = cc->gpr[3]; \
|
431
|
+
}
|
432
|
+
#else
|
421
433
|
#define CCALL_HANDLE_COMPLEXRET2 \
|
422
434
|
if (ctr->size == 2*sizeof(float)) { /* Copy complex float from FPRs. */ \
|
423
435
|
((float *)dp)[0] = cc->fpr[0].f; \
|
@@ -426,6 +438,7 @@
|
|
426
438
|
((double *)dp)[0] = cc->fpr[0].d; \
|
427
439
|
((double *)dp)[1] = cc->fpr[1].d; \
|
428
440
|
}
|
441
|
+
#endif
|
429
442
|
|
430
443
|
#define CCALL_HANDLE_STRUCTARG \
|
431
444
|
/* Pass all structs by value in registers and/or on the stack. */
|
@@ -433,6 +446,22 @@
|
|
433
446
|
#define CCALL_HANDLE_COMPLEXARG \
|
434
447
|
/* Pass complex by value in 2 or 4 GPRs. */
|
435
448
|
|
449
|
+
#define CCALL_HANDLE_GPR \
|
450
|
+
if ((d->info & CTF_ALIGN) > CTALIGN_PTR) \
|
451
|
+
ngpr = (ngpr + 1u) & ~1u; /* Align to regpair. */ \
|
452
|
+
if (ngpr < maxgpr) { \
|
453
|
+
dp = &cc->gpr[ngpr]; \
|
454
|
+
if (ngpr + n > maxgpr) { \
|
455
|
+
nsp += ngpr + n - maxgpr; /* Assumes contiguous gpr/stack fields. */ \
|
456
|
+
if (nsp > CCALL_MAXSTACK) goto err_nyi; /* Too many arguments. */ \
|
457
|
+
ngpr = maxgpr; \
|
458
|
+
} else { \
|
459
|
+
ngpr += n; \
|
460
|
+
} \
|
461
|
+
goto done; \
|
462
|
+
}
|
463
|
+
|
464
|
+
#if !LJ_ABI_SOFTFP /* MIPS32 hard-float */
|
436
465
|
#define CCALL_HANDLE_REGARG \
|
437
466
|
if (isfp && nfpr < CCALL_NARG_FPR && !(ct->info & CTF_VARARG)) { \
|
438
467
|
/* Try to pass argument in FPRs. */ \
|
@@ -441,24 +470,18 @@
|
|
441
470
|
goto done; \
|
442
471
|
} else { /* Try to pass argument in GPRs. */ \
|
443
472
|
nfpr = CCALL_NARG_FPR; \
|
444
|
-
|
445
|
-
ngpr = (ngpr + 1u) & ~1u; /* Align to regpair. */ \
|
446
|
-
if (ngpr < maxgpr) { \
|
447
|
-
dp = &cc->gpr[ngpr]; \
|
448
|
-
if (ngpr + n > maxgpr) { \
|
449
|
-
nsp += ngpr + n - maxgpr; /* Assumes contiguous gpr/stack fields. */ \
|
450
|
-
if (nsp > CCALL_MAXSTACK) goto err_nyi; /* Too many arguments. */ \
|
451
|
-
ngpr = maxgpr; \
|
452
|
-
} else { \
|
453
|
-
ngpr += n; \
|
454
|
-
} \
|
455
|
-
goto done; \
|
456
|
-
} \
|
473
|
+
CCALL_HANDLE_GPR \
|
457
474
|
}
|
475
|
+
#else /* MIPS32 soft-float */
|
476
|
+
#define CCALL_HANDLE_REGARG CCALL_HANDLE_GPR
|
477
|
+
#endif
|
458
478
|
|
479
|
+
#if !LJ_ABI_SOFTFP
|
480
|
+
/* On MIPS64 soft-float, position of float return values is endian-dependant. */
|
459
481
|
#define CCALL_HANDLE_RET \
|
460
482
|
if (ctype_isfp(ctr->info) && ctr->size == sizeof(float)) \
|
461
483
|
sp = (uint8_t *)&cc->fpr[0].f;
|
484
|
+
#endif
|
462
485
|
|
463
486
|
#else
|
464
487
|
#error "Missing calling convention definitions for this architecture"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
** FFI C call handling.
|
3
|
-
** Copyright (C) 2005-
|
3
|
+
** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
|
4
4
|
*/
|
5
5
|
|
6
6
|
#ifndef _LJ_CCALL_H
|
@@ -98,9 +98,9 @@ typedef double FPRArg;
|
|
98
98
|
#elif LJ_TARGET_MIPS
|
99
99
|
|
100
100
|
#define CCALL_NARG_GPR 4
|
101
|
-
#define CCALL_NARG_FPR 2
|
101
|
+
#define CCALL_NARG_FPR (LJ_ABI_SOFTFP ? 0 : 2)
|
102
102
|
#define CCALL_NRET_GPR 2
|
103
|
-
#define CCALL_NRET_FPR 2
|
103
|
+
#define CCALL_NRET_FPR (LJ_ABI_SOFTFP ? 0 : 2)
|
104
104
|
#define CCALL_SPS_EXTRA 7
|
105
105
|
#define CCALL_SPS_FREE 1
|
106
106
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
** FFI C callback handling.
|
3
|
-
** Copyright (C) 2005-
|
3
|
+
** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
|
4
4
|
*/
|
5
5
|
|
6
6
|
#include "lj_obj.h"
|
@@ -427,6 +427,15 @@ void lj_ccallback_mcode_free(CTState *cts)
|
|
427
427
|
|
428
428
|
#elif LJ_TARGET_MIPS
|
429
429
|
|
430
|
+
#define CALLBACK_HANDLE_GPR \
|
431
|
+
if (n > 1) ngpr = (ngpr + 1u) & ~1u; /* Align to regpair. */ \
|
432
|
+
if (ngpr + n <= maxgpr) { \
|
433
|
+
sp = &cts->cb.gpr[ngpr]; \
|
434
|
+
ngpr += n; \
|
435
|
+
goto done; \
|
436
|
+
}
|
437
|
+
|
438
|
+
#if !LJ_ABI_SOFTFP /* MIPS32 hard-float */
|
430
439
|
#define CALLBACK_HANDLE_REGARG \
|
431
440
|
if (isfp && nfpr < CCALL_NARG_FPR) { /* Try to pass argument in FPRs. */ \
|
432
441
|
sp = (void *)((uint8_t *)&cts->cb.fpr[nfpr] + ((LJ_BE && n==1) ? 4 : 0)); \
|
@@ -434,13 +443,13 @@ void lj_ccallback_mcode_free(CTState *cts)
|
|
434
443
|
goto done; \
|
435
444
|
} else { /* Try to pass argument in GPRs. */ \
|
436
445
|
nfpr = CCALL_NARG_FPR; \
|
437
|
-
|
438
|
-
if (ngpr + n <= maxgpr) { \
|
439
|
-
sp = &cts->cb.gpr[ngpr]; \
|
440
|
-
ngpr += n; \
|
441
|
-
goto done; \
|
442
|
-
} \
|
446
|
+
CALLBACK_HANDLE_GPR \
|
443
447
|
}
|
448
|
+
#else /* MIPS32 soft-float */
|
449
|
+
#define CALLBACK_HANDLE_REGARG \
|
450
|
+
CALLBACK_HANDLE_GPR \
|
451
|
+
UNUSED(isfp);
|
452
|
+
#endif
|
444
453
|
|
445
454
|
#define CALLBACK_HANDLE_RET \
|
446
455
|
if (ctype_isfp(ctr->info) && ctr->size == sizeof(float)) \
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
** C data management.
|
3
|
-
** Copyright (C) 2005-
|
3
|
+
** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
|
4
4
|
*/
|
5
5
|
|
6
6
|
#include "lj_obj.h"
|
@@ -49,6 +49,15 @@ GCcdata *lj_cdata_newv(lua_State *L, CTypeID id, CTSize sz, CTSize align)
|
|
49
49
|
return cd;
|
50
50
|
}
|
51
51
|
|
52
|
+
/* Allocate arbitrary C data object. */
|
53
|
+
GCcdata *lj_cdata_newx(CTState *cts, CTypeID id, CTSize sz, CTInfo info)
|
54
|
+
{
|
55
|
+
if (!(info & CTF_VLA) && ctype_align(info) <= CT_MEMALIGN)
|
56
|
+
return lj_cdata_new(cts, id, sz);
|
57
|
+
else
|
58
|
+
return lj_cdata_newv(cts->L, id, sz, ctype_align(info));
|
59
|
+
}
|
60
|
+
|
52
61
|
/* Free a C data object. */
|
53
62
|
void LJ_FASTCALL lj_cdata_free(global_State *g, GCcdata *cd)
|
54
63
|
{
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
** C data management.
|
3
|
-
** Copyright (C) 2005-
|
3
|
+
** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
|
4
4
|
*/
|
5
5
|
|
6
6
|
#ifndef _LJ_CDATA_H
|
@@ -60,6 +60,8 @@ static LJ_AINLINE GCcdata *lj_cdata_new_(lua_State *L, CTypeID id, CTSize sz)
|
|
60
60
|
LJ_FUNC GCcdata *lj_cdata_newref(CTState *cts, const void *pp, CTypeID id);
|
61
61
|
LJ_FUNC GCcdata *lj_cdata_newv(lua_State *L, CTypeID id, CTSize sz,
|
62
62
|
CTSize align);
|
63
|
+
LJ_FUNC GCcdata *lj_cdata_newx(CTState *cts, CTypeID id, CTSize sz,
|
64
|
+
CTInfo info);
|
63
65
|
|
64
66
|
LJ_FUNC void LJ_FASTCALL lj_cdata_free(global_State *g, GCcdata *cd);
|
65
67
|
LJ_FUNC void lj_cdata_setfin(lua_State *L, GCcdata *cd, GCobj *obj,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
** C declaration parser.
|
3
|
-
** Copyright (C) 2005-
|
3
|
+
** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
|
4
4
|
*/
|
5
5
|
|
6
6
|
#include "lj_obj.h"
|
@@ -1744,6 +1744,16 @@ static void cp_pragma(CPState *cp, BCLine pragmaline)
|
|
1744
1744
|
}
|
1745
1745
|
}
|
1746
1746
|
|
1747
|
+
/* Handle line number. */
|
1748
|
+
static void cp_line(CPState *cp, BCLine hashline)
|
1749
|
+
{
|
1750
|
+
BCLine newline = cp->val.u32;
|
1751
|
+
/* TODO: Handle file name and include it in error messages. */
|
1752
|
+
while (cp->tok != CTOK_EOF && cp->linenumber == hashline)
|
1753
|
+
cp_next(cp);
|
1754
|
+
cp->linenumber = newline;
|
1755
|
+
}
|
1756
|
+
|
1747
1757
|
/* Parse multiple C declarations of types or extern identifiers. */
|
1748
1758
|
static void cp_decl_multi(CPState *cp)
|
1749
1759
|
{
|
@@ -1756,12 +1766,23 @@ static void cp_decl_multi(CPState *cp)
|
|
1756
1766
|
continue;
|
1757
1767
|
}
|
1758
1768
|
if (cp->tok == '#') { /* Workaround, since we have no preprocessor, yet. */
|
1759
|
-
BCLine
|
1760
|
-
|
1761
|
-
|
1769
|
+
BCLine hashline = cp->linenumber;
|
1770
|
+
CPToken tok = cp_next(cp);
|
1771
|
+
if (tok == CTOK_INTEGER) {
|
1772
|
+
cp_line(cp, hashline);
|
1773
|
+
continue;
|
1774
|
+
} else if (tok == CTOK_IDENT &&
|
1775
|
+
cp->str->hash == H_(187aab88,fcb60b42)) { /* line */
|
1776
|
+
if (cp_next(cp) != CTOK_INTEGER) cp_err_token(cp, tok);
|
1777
|
+
cp_line(cp, hashline);
|
1778
|
+
continue;
|
1779
|
+
} else if (tok == CTOK_IDENT &&
|
1780
|
+
cp->str->hash == H_(f5e6b4f8,1d509107)) { /* pragma */
|
1781
|
+
cp_pragma(cp, hashline);
|
1782
|
+
continue;
|
1783
|
+
} else {
|
1762
1784
|
cp_errmsg(cp, cp->tok, LJ_ERR_XSYMBOL);
|
1763
|
-
|
1764
|
-
continue;
|
1785
|
+
}
|
1765
1786
|
}
|
1766
1787
|
scl = cp_decl_spec(cp, &decl, CDF_TYPEDEF|CDF_EXTERN|CDF_STATIC);
|
1767
1788
|
if ((cp->tok == ';' || cp->tok == CTOK_EOF) &&
|