From 541a9ad5903599b22eb66ad6a781531640ce0336 Mon Sep 17 00:00:00 2001 From: darealshinji Date: Sat, 12 Sep 2015 12:38:01 +0200 Subject: [PATCH] LuaJIT 2.0.4 --- vendor/luajit/COPYRIGHT | 2 +- vendor/luajit/README | 4 +- vendor/luajit/dynasm/dasm_arm.h | 2 +- vendor/luajit/dynasm/dasm_arm.lua | 9 ++- vendor/luajit/dynasm/dasm_mips.h | 2 +- vendor/luajit/dynasm/dasm_mips.lua | 2 +- vendor/luajit/dynasm/dasm_ppc.h | 2 +- vendor/luajit/dynasm/dasm_ppc.lua | 2 +- vendor/luajit/dynasm/dasm_proto.h | 2 +- vendor/luajit/dynasm/dasm_x64.lua | 2 +- vendor/luajit/dynasm/dasm_x86.h | 2 +- vendor/luajit/dynasm/dasm_x86.lua | 10 +++- vendor/luajit/dynasm/dynasm.lua | 4 +- vendor/luajit/include/luaconf.h | 4 +- vendor/luajit/include/luajit.h | 10 ++-- vendor/luajit/include/lualib.h | 2 +- vendor/luajit/src/Makefile | 78 +++++++++++++----------- vendor/luajit/src/Makefile.dep | 52 ++++++++-------- vendor/luajit/src/host/buildvm.c | 2 +- vendor/luajit/src/host/buildvm.h | 2 +- vendor/luajit/src/host/buildvm_asm.c | 4 +- vendor/luajit/src/host/buildvm_fold.c | 2 +- vendor/luajit/src/host/buildvm_lib.c | 2 +- vendor/luajit/src/host/buildvm_peobj.c | 2 +- vendor/luajit/src/host/genminilua.lua | 2 +- vendor/luajit/src/jit/bc.lua | 4 +- vendor/luajit/src/jit/bcsave.lua | 6 +- vendor/luajit/src/jit/dis_arm.lua | 2 +- vendor/luajit/src/jit/dis_mips.lua | 2 +- vendor/luajit/src/jit/dis_mipsel.lua | 2 +- vendor/luajit/src/jit/dis_ppc.lua | 2 +- vendor/luajit/src/jit/dis_x64.lua | 2 +- vendor/luajit/src/jit/dis_x86.lua | 2 +- vendor/luajit/src/jit/dump.lua | 4 +- vendor/luajit/src/jit/v.lua | 4 +- vendor/luajit/src/lib_aux.c | 4 +- vendor/luajit/src/lib_base.c | 2 +- vendor/luajit/src/lib_bit.c | 2 +- vendor/luajit/src/lib_debug.c | 2 +- vendor/luajit/src/lib_ffi.c | 3 +- vendor/luajit/src/lib_init.c | 2 +- vendor/luajit/src/lib_io.c | 34 +---------- vendor/luajit/src/lib_jit.c | 2 +- vendor/luajit/src/lib_math.c | 2 +- vendor/luajit/src/lib_os.c | 26 +++----- vendor/luajit/src/lib_package.c | 2 +- vendor/luajit/src/lib_string.c | 2 +- vendor/luajit/src/lib_table.c | 2 +- vendor/luajit/src/lj_alloc.c | 14 +++-- vendor/luajit/src/lj_api.c | 2 +- vendor/luajit/src/lj_arch.h | 17 +++++- vendor/luajit/src/lj_asm.c | 8 ++- vendor/luajit/src/lj_asm.h | 2 +- vendor/luajit/src/lj_asm_arm.h | 2 +- vendor/luajit/src/lj_asm_mips.h | 2 +- vendor/luajit/src/lj_asm_ppc.h | 4 +- vendor/luajit/src/lj_asm_x86.h | 22 +++++-- vendor/luajit/src/lj_bc.c | 2 +- vendor/luajit/src/lj_bc.h | 2 +- vendor/luajit/src/lj_bcdump.h | 2 +- vendor/luajit/src/lj_bcread.c | 2 +- vendor/luajit/src/lj_bcwrite.c | 2 +- vendor/luajit/src/lj_carith.c | 10 ++-- vendor/luajit/src/lj_carith.h | 2 +- vendor/luajit/src/lj_ccall.c | 2 +- vendor/luajit/src/lj_ccall.h | 2 +- vendor/luajit/src/lj_ccallback.c | 2 +- vendor/luajit/src/lj_ccallback.h | 2 +- vendor/luajit/src/lj_cconv.c | 3 +- vendor/luajit/src/lj_cconv.h | 2 +- vendor/luajit/src/lj_cdata.c | 20 +++---- vendor/luajit/src/lj_cdata.h | 2 +- vendor/luajit/src/lj_clib.c | 2 +- vendor/luajit/src/lj_clib.h | 2 +- vendor/luajit/src/lj_cparse.c | 2 +- vendor/luajit/src/lj_cparse.h | 2 +- vendor/luajit/src/lj_crecord.c | 82 ++++++++++++++++---------- vendor/luajit/src/lj_crecord.h | 2 +- vendor/luajit/src/lj_ctype.c | 2 +- vendor/luajit/src/lj_ctype.h | 2 +- vendor/luajit/src/lj_debug.c | 8 ++- vendor/luajit/src/lj_debug.h | 2 +- vendor/luajit/src/lj_def.h | 10 +++- vendor/luajit/src/lj_dispatch.c | 2 +- vendor/luajit/src/lj_dispatch.h | 2 +- vendor/luajit/src/lj_emit_arm.h | 2 +- vendor/luajit/src/lj_emit_mips.h | 2 +- vendor/luajit/src/lj_emit_ppc.h | 2 +- vendor/luajit/src/lj_emit_x86.h | 2 +- vendor/luajit/src/lj_err.c | 31 +++++++--- vendor/luajit/src/lj_err.h | 2 +- vendor/luajit/src/lj_errmsg.h | 2 +- vendor/luajit/src/lj_ff.h | 2 +- vendor/luajit/src/lj_ffrecord.c | 2 +- vendor/luajit/src/lj_ffrecord.h | 2 +- vendor/luajit/src/lj_frame.h | 2 +- vendor/luajit/src/lj_func.c | 2 +- vendor/luajit/src/lj_func.h | 2 +- vendor/luajit/src/lj_gc.c | 6 +- vendor/luajit/src/lj_gc.h | 2 +- vendor/luajit/src/lj_gdbjit.c | 4 +- vendor/luajit/src/lj_gdbjit.h | 2 +- vendor/luajit/src/lj_ir.c | 2 +- vendor/luajit/src/lj_ir.h | 2 +- vendor/luajit/src/lj_ircall.h | 10 +++- vendor/luajit/src/lj_iropt.h | 2 +- vendor/luajit/src/lj_jit.h | 3 +- vendor/luajit/src/lj_lex.c | 3 +- vendor/luajit/src/lj_lex.h | 2 +- vendor/luajit/src/lj_lib.c | 2 +- vendor/luajit/src/lj_lib.h | 2 +- vendor/luajit/src/lj_load.c | 2 +- vendor/luajit/src/lj_mcode.c | 19 +++++- vendor/luajit/src/lj_mcode.h | 2 +- vendor/luajit/src/lj_meta.c | 2 +- vendor/luajit/src/lj_meta.h | 2 +- vendor/luajit/src/lj_obj.c | 2 +- vendor/luajit/src/lj_obj.h | 2 +- vendor/luajit/src/lj_opt_dce.c | 3 +- vendor/luajit/src/lj_opt_fold.c | 31 ++++++---- vendor/luajit/src/lj_opt_loop.c | 2 +- vendor/luajit/src/lj_opt_mem.c | 23 ++++---- vendor/luajit/src/lj_opt_narrow.c | 16 +++-- vendor/luajit/src/lj_opt_sink.c | 2 +- vendor/luajit/src/lj_opt_split.c | 2 +- vendor/luajit/src/lj_parse.c | 8 ++- vendor/luajit/src/lj_parse.h | 2 +- vendor/luajit/src/lj_record.c | 10 +++- vendor/luajit/src/lj_record.h | 2 +- vendor/luajit/src/lj_snap.c | 7 ++- vendor/luajit/src/lj_snap.h | 2 +- vendor/luajit/src/lj_state.c | 4 +- vendor/luajit/src/lj_state.h | 2 +- vendor/luajit/src/lj_str.c | 2 +- vendor/luajit/src/lj_str.h | 2 +- vendor/luajit/src/lj_strscan.c | 11 ++-- vendor/luajit/src/lj_strscan.h | 2 +- vendor/luajit/src/lj_tab.c | 2 +- vendor/luajit/src/lj_tab.h | 2 +- vendor/luajit/src/lj_target.h | 2 +- vendor/luajit/src/lj_target_arm.h | 2 +- vendor/luajit/src/lj_target_mips.h | 2 +- vendor/luajit/src/lj_target_ppc.h | 2 +- vendor/luajit/src/lj_target_x86.h | 2 +- vendor/luajit/src/lj_trace.c | 3 +- vendor/luajit/src/lj_trace.h | 2 +- vendor/luajit/src/lj_traceerr.h | 2 +- vendor/luajit/src/lj_udata.c | 2 +- vendor/luajit/src/lj_udata.h | 2 +- vendor/luajit/src/lj_vm.h | 2 +- vendor/luajit/src/lj_vmevent.c | 2 +- vendor/luajit/src/lj_vmevent.h | 2 +- vendor/luajit/src/lj_vmmath.c | 2 +- vendor/luajit/src/ljamalg.c | 2 +- vendor/luajit/src/luaconf.h | 4 +- vendor/luajit/src/luajit.c | 20 +++---- vendor/luajit/src/luajit.h | 10 ++-- vendor/luajit/src/lualib.h | 2 +- vendor/luajit/src/vm_arm.dasc | 15 +++-- vendor/luajit/src/vm_mips.dasc | 4 +- vendor/luajit/src/vm_ppc.dasc | 39 +++++++++--- vendor/luajit/src/vm_ppcspe.dasc | 2 +- vendor/luajit/src/vm_x86.dasc | 19 +++--- 163 files changed, 559 insertions(+), 424 deletions(-) diff --git a/vendor/luajit/COPYRIGHT b/vendor/luajit/COPYRIGHT index 08936dfb9..1ef7df624 100644 --- a/vendor/luajit/COPYRIGHT +++ b/vendor/luajit/COPYRIGHT @@ -1,7 +1,7 @@ =============================================================================== LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/ -Copyright (C) 2005-2014 Mike Pall. All rights reserved. +Copyright (C) 2005-2015 Mike Pall. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/luajit/README b/vendor/luajit/README index 902a6d2e4..44366af51 100644 --- a/vendor/luajit/README +++ b/vendor/luajit/README @@ -1,11 +1,11 @@ -README for LuaJIT 2.0.3 +README for LuaJIT 2.0.4 ----------------------- LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language. Project Homepage: http://luajit.org/ -LuaJIT is Copyright (C) 2005-2014 Mike Pall. +LuaJIT is Copyright (C) 2005-2015 Mike Pall. LuaJIT is free software, released under the MIT license. See full Copyright Notice in the COPYRIGHT file or in luajit.h. diff --git a/vendor/luajit/dynasm/dasm_arm.h b/vendor/luajit/dynasm/dasm_arm.h index 435bbf5e1..57e0116f5 100644 --- a/vendor/luajit/dynasm/dasm_arm.h +++ b/vendor/luajit/dynasm/dasm_arm.h @@ -1,6 +1,6 @@ /* ** DynASM ARM encoding engine. -** Copyright (C) 2005-2014 Mike Pall. All rights reserved. +** Copyright (C) 2005-2015 Mike Pall. All rights reserved. ** Released under the MIT license. See dynasm.lua for full copyright notice. */ diff --git a/vendor/luajit/dynasm/dasm_arm.lua b/vendor/luajit/dynasm/dasm_arm.lua index b3a8827e3..90a259c5c 100644 --- a/vendor/luajit/dynasm/dasm_arm.lua +++ b/vendor/luajit/dynasm/dasm_arm.lua @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------ -- DynASM ARM module. -- --- Copyright (C) 2005-2014 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2015 Mike Pall. All rights reserved. -- See dynasm.lua for full copyright notice. ------------------------------------------------------------------------------ @@ -923,19 +923,22 @@ local function parse_template(params, template, nparams, pos) end map_op[".template__"] = function(params, template, nparams) - if not params then return sub(template, 9) end + if not params then return template:gsub("%x%x%x%x%x%x%x%x", "") end -- Limit number of section buffer positions used by a single dasm_put(). -- A single opcode needs a maximum of 3 positions. if secpos+3 > maxsecpos then wflush() end local pos = wpos() - local apos, spos = #actargs, secpos + local lpos, apos, spos = #actlist, #actargs, secpos local ok, err for t in gmatch(template, "[^|]+") do ok, err = pcall(parse_template, params, t, nparams, pos) if ok then return end secpos = spos + actlist[lpos+1] = nil + actlist[lpos+2] = nil + actlist[lpos+3] = nil actargs[apos+1] = nil actargs[apos+2] = nil actargs[apos+3] = nil diff --git a/vendor/luajit/dynasm/dasm_mips.h b/vendor/luajit/dynasm/dasm_mips.h index 435958899..2f4c2d222 100644 --- a/vendor/luajit/dynasm/dasm_mips.h +++ b/vendor/luajit/dynasm/dasm_mips.h @@ -1,6 +1,6 @@ /* ** DynASM MIPS encoding engine. -** Copyright (C) 2005-2014 Mike Pall. All rights reserved. +** Copyright (C) 2005-2015 Mike Pall. All rights reserved. ** Released under the MIT license. See dynasm.lua for full copyright notice. */ diff --git a/vendor/luajit/dynasm/dasm_mips.lua b/vendor/luajit/dynasm/dasm_mips.lua index 82942cbb5..ae0dbd7a9 100644 --- a/vendor/luajit/dynasm/dasm_mips.lua +++ b/vendor/luajit/dynasm/dasm_mips.lua @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------ -- DynASM MIPS module. -- --- Copyright (C) 2005-2014 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2015 Mike Pall. All rights reserved. -- See dynasm.lua for full copyright notice. ------------------------------------------------------------------------------ diff --git a/vendor/luajit/dynasm/dasm_ppc.h b/vendor/luajit/dynasm/dasm_ppc.h index 5ccff250f..7df493654 100644 --- a/vendor/luajit/dynasm/dasm_ppc.h +++ b/vendor/luajit/dynasm/dasm_ppc.h @@ -1,6 +1,6 @@ /* ** DynASM PPC encoding engine. -** Copyright (C) 2005-2014 Mike Pall. All rights reserved. +** Copyright (C) 2005-2015 Mike Pall. All rights reserved. ** Released under the MIT license. See dynasm.lua for full copyright notice. */ diff --git a/vendor/luajit/dynasm/dasm_ppc.lua b/vendor/luajit/dynasm/dasm_ppc.lua index 61da50efb..91f4ff9a4 100644 --- a/vendor/luajit/dynasm/dasm_ppc.lua +++ b/vendor/luajit/dynasm/dasm_ppc.lua @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------ -- DynASM PPC module. -- --- Copyright (C) 2005-2014 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2015 Mike Pall. All rights reserved. -- See dynasm.lua for full copyright notice. ------------------------------------------------------------------------------ diff --git a/vendor/luajit/dynasm/dasm_proto.h b/vendor/luajit/dynasm/dasm_proto.h index e77bb8445..a8bc6fd28 100644 --- a/vendor/luajit/dynasm/dasm_proto.h +++ b/vendor/luajit/dynasm/dasm_proto.h @@ -1,6 +1,6 @@ /* ** DynASM encoding engine prototypes. -** Copyright (C) 2005-2014 Mike Pall. All rights reserved. +** Copyright (C) 2005-2015 Mike Pall. All rights reserved. ** Released under the MIT license. See dynasm.lua for full copyright notice. */ diff --git a/vendor/luajit/dynasm/dasm_x64.lua b/vendor/luajit/dynasm/dasm_x64.lua index 91d676d17..b1b62022f 100644 --- a/vendor/luajit/dynasm/dasm_x64.lua +++ b/vendor/luajit/dynasm/dasm_x64.lua @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------ -- DynASM x64 module. -- --- Copyright (C) 2005-2014 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2015 Mike Pall. All rights reserved. -- See dynasm.lua for full copyright notice. ------------------------------------------------------------------------------ -- This module just sets 64 bit mode for the combined x86/x64 module. diff --git a/vendor/luajit/dynasm/dasm_x86.h b/vendor/luajit/dynasm/dasm_x86.h index 97cbbea89..652e8c99b 100644 --- a/vendor/luajit/dynasm/dasm_x86.h +++ b/vendor/luajit/dynasm/dasm_x86.h @@ -1,6 +1,6 @@ /* ** DynASM x86 encoding engine. -** Copyright (C) 2005-2014 Mike Pall. All rights reserved. +** Copyright (C) 2005-2015 Mike Pall. All rights reserved. ** Released under the MIT license. See dynasm.lua for full copyright notice. */ diff --git a/vendor/luajit/dynasm/dasm_x86.lua b/vendor/luajit/dynasm/dasm_x86.lua index f3859e3e1..7ca061d22 100644 --- a/vendor/luajit/dynasm/dasm_x86.lua +++ b/vendor/luajit/dynasm/dasm_x86.lua @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------ -- DynASM x86/x64 module. -- --- Copyright (C) 2005-2014 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2015 Mike Pall. All rights reserved. -- See dynasm.lua for full copyright notice. ------------------------------------------------------------------------------ @@ -1081,6 +1081,9 @@ local map_op = { btr_2 = "mrqdw:0FB3Rm|miqdw:0FBA6mU", bts_2 = "mrqdw:0FABRm|miqdw:0FBA5mU", + shld_3 = "mriqdw:0FA4RmU|mrCqdw:0FA5Rm", + shrd_3 = "mriqdw:0FACRmU|mrCqdw:0FADRm", + rdtsc_0 = "0F31", -- P1+ cpuid_0 = "0FA2", -- P1+ @@ -1114,6 +1117,9 @@ local map_op = { fucompp_0 = "DAE9", fcompp_0 = "DED9", + fldenv_1 = "x.:D94m", + fnstenv_1 = "x.:D96m", + fstenv_1 = "x.:9BD96m", fldcw_1 = "xw:nD95m", fstcw_1 = "xw:n9BD97m", fnstcw_1 = "xw:nD97m", @@ -1189,6 +1195,8 @@ local map_op = { cvttps2dq_2 = "rmo:F30F5BrM", cvttsd2si_2 = "rr/do:F20F2CrM|rr/qo:|rx/dq:|rxq:", cvttss2si_2 = "rr/do:F30F2CrM|rr/qo:|rxd:|rx/qd:", + fxsave_1 = "x.:0FAE0m", + fxrstor_1 = "x.:0FAE1m", ldmxcsr_1 = "xd:0FAE2m", lfence_0 = "0FAEE8", maskmovdqu_2 = "rro:660FF7rM", diff --git a/vendor/luajit/dynasm/dynasm.lua b/vendor/luajit/dynasm/dynasm.lua index 0ea8697c0..fffda7513 100644 --- a/vendor/luajit/dynasm/dynasm.lua +++ b/vendor/luajit/dynasm/dynasm.lua @@ -2,7 +2,7 @@ -- DynASM. A dynamic assembler for code generation engines. -- Originally designed and implemented for LuaJIT. -- --- Copyright (C) 2005-2014 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2015 Mike Pall. All rights reserved. -- See below for full copyright notice. ------------------------------------------------------------------------------ @@ -17,7 +17,7 @@ local _info = { url = "http://luajit.org/dynasm.html", license = "MIT", copyright = [[ -Copyright (C) 2005-2014 Mike Pall. All rights reserved. +Copyright (C) 2005-2015 Mike Pall. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/vendor/luajit/include/luaconf.h b/vendor/luajit/include/luaconf.h index affb7da8f..84fa64187 100644 --- a/vendor/luajit/include/luaconf.h +++ b/vendor/luajit/include/luaconf.h @@ -1,6 +1,6 @@ /* ** Configuration header. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef luaconf_h @@ -37,7 +37,7 @@ #endif #define LUA_LROOT "/usr/local" #define LUA_LUADIR "/lua/5.1/" -#define LUA_LJDIR "/luajit-2.0.3/" +#define LUA_LJDIR "/luajit-2.0.4/" #ifdef LUA_ROOT #define LUA_JROOT LUA_ROOT diff --git a/vendor/luajit/include/luajit.h b/vendor/luajit/include/luajit.h index be721cf4b..9ced18eb8 100644 --- a/vendor/luajit/include/luajit.h +++ b/vendor/luajit/include/luajit.h @@ -1,7 +1,7 @@ /* ** LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/ ** -** Copyright (C) 2005-2014 Mike Pall. All rights reserved. +** Copyright (C) 2005-2015 Mike Pall. All rights reserved. ** ** Permission is hereby granted, free of charge, to any person obtaining ** a copy of this software and associated documentation files (the @@ -30,10 +30,10 @@ #include "lua.h" -#define LUAJIT_VERSION "LuaJIT 2.0.3" -#define LUAJIT_VERSION_NUM 20003 /* Version 2.0.3 = 02.00.03. */ -#define LUAJIT_VERSION_SYM luaJIT_version_2_0_3 -#define LUAJIT_COPYRIGHT "Copyright (C) 2005-2014 Mike Pall" +#define LUAJIT_VERSION "LuaJIT 2.0.4" +#define LUAJIT_VERSION_NUM 20004 /* Version 2.0.4 = 02.00.04. */ +#define LUAJIT_VERSION_SYM luaJIT_version_2_0_4 +#define LUAJIT_COPYRIGHT "Copyright (C) 2005-2015 Mike Pall" #define LUAJIT_URL "http://luajit.org/" /* Modes for luaJIT_setmode. */ diff --git a/vendor/luajit/include/lualib.h b/vendor/luajit/include/lualib.h index 1c1e31799..96530e79a 100644 --- a/vendor/luajit/include/lualib.h +++ b/vendor/luajit/include/lualib.h @@ -1,6 +1,6 @@ /* ** Standard library header. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LUALIB_H diff --git a/vendor/luajit/src/Makefile b/vendor/luajit/src/Makefile index 26c85de70..1d38fa251 100644 --- a/vendor/luajit/src/Makefile +++ b/vendor/luajit/src/Makefile @@ -7,12 +7,12 @@ # Also works with MinGW and Cygwin on Windows. # Please check msvcbuild.bat for building with MSVC on Windows. # -# Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +# Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ############################################################################## MAJVER= 2 MINVER= 0 -RELVER= 3 +RELVER= 4 ABIVER= 5.1 NODOTABIVER= 51 @@ -55,11 +55,11 @@ CCOPT_ppc= CCOPT_ppcspe= CCOPT_mips= # -CCDEBUG=-g +CCDEBUG= # Uncomment the next line to generate debug information: #CCDEBUG= -g # -CCWARN= -Wall -Wno-unused-function +CCWARN= -Wall # Uncomment the next line to enable more warnings: #CCWARN+= -Wextra -Wdeclaration-after-statement -Wredundant-decls -Wshadow -Wpointer-arith # @@ -72,10 +72,10 @@ CCWARN= -Wall -Wno-unused-function # as dynamic mode. # # Mixed mode creates a static + dynamic library and a statically linked luajit. -# BUILDMODE= mixed +BUILDMODE= mixed # # Static mode creates a static library and a statically linked luajit. -BUILDMODE= static +#BUILDMODE= static # # Dynamic mode creates a dynamic library and a dynamically linked luajit. # Note: this executable will only run when the library is installed! @@ -88,7 +88,7 @@ BUILDMODE= static ############################################################################## # Enable/disable these features as needed, but make sure you force a full # recompile with "make clean", followed by "make". -XCFLAGS=-Igen +XCFLAGS= # # Permanently disable the FFI extension to reduce the size of the LuaJIT # executable. But please consider that the FFI library is compiled-in, @@ -100,7 +100,7 @@ XCFLAGS=-Igen # enabled by default. Some other features that *might* break some existing # code (e.g. __pairs or os.execute() return values) can be enabled here. # Note: this does not provide full compatibility with Lua 5.2 at this time. -XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT +#XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT # # Disable the JIT compiler, i.e. turn LuaJIT into a pure interpreter. #XCFLAGS+= -DLUAJIT_DISABLE_JIT @@ -122,8 +122,10 @@ XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT # # Use the system provided memory allocator (realloc) instead of the # bundled memory allocator. This is slower, but sometimes helpful for -# debugging. It's helpful for Valgrind's memcheck tool, too. This option -# cannot be enabled on x64, since the built-in allocator is mandatory. +# debugging. This option cannot be enabled on x64, since realloc usually +# doesn't return addresses in the right address range. +# OTOH this option is mandatory for Valgrind's memcheck tool on x64 and +# the only way to get useful results from it for all other architectures. #XCFLAGS+= -DLUAJIT_USE_SYSMALLOC # # This define is required to run LuaJIT under Valgrind. The Valgrind @@ -188,9 +190,9 @@ TARGET_LD= $(CROSS)$(CC) TARGET_AR= $(CROSS)ar rcus TARGET_STRIP= $(CROSS)strip -TARGET_LIBPATH= ${CURDIR} +TARGET_LIBPATH= $(or $(PREFIX),/usr/local)/$(or $(MULTILIB),lib) TARGET_SONAME= libluajit-$(ABIVER).so.$(MAJVER) -TARGET_DYLIBNAME= libluajit-aegisub.so +TARGET_DYLIBNAME= libluajit-$(ABIVER).$(MAJVER).dylib TARGET_DYLIBPATH= $(TARGET_LIBPATH)/$(TARGET_DYLIBNAME) TARGET_DLLNAME= lua$(NODOTABIVER).dll TARGET_XSHLDFLAGS= -shared -fPIC -Wl,-soname,$(TARGET_SONAME) @@ -288,15 +290,15 @@ ifeq (Windows,$(TARGET_SYS)) TARGET_XSHLDFLAGS= -shared TARGET_DYNXLDOPTS= else +ifeq (,$(shell $(TARGET_CC) -o /dev/null -c -x c /dev/null -fno-stack-protector 2>/dev/null || echo 1)) + TARGET_XCFLAGS+= -fno-stack-protector +endif ifeq (Darwin,$(TARGET_SYS)) ifeq (,$(MACOSX_DEPLOYMENT_TARGET)) export MACOSX_DEPLOYMENT_TARGET=10.4 endif TARGET_STRIP+= -x TARGET_AR+= 2>/dev/null - ifeq (,$(shell $(TARGET_CC) -o /dev/null -c -x c /dev/null -fno-stack-protector 2>/dev/null || echo 1)) - TARGET_XCFLAGS+= -fno-stack-protector - endif TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC TARGET_DYNXLDOPTS= TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER) @@ -308,14 +310,10 @@ else ifeq (iOS,$(TARGET_SYS)) TARGET_STRIP+= -x TARGET_AR+= 2>/dev/null - TARGET_XCFLAGS+= -fno-stack-protector TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC TARGET_DYNXLDOPTS= TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER) else - ifneq (,$(findstring stack-protector,$(shell $(TARGET_CC) -dumpspecs))) - TARGET_XCFLAGS+= -fno-stack-protector - endif ifneq (SunOS,$(TARGET_SYS)) ifneq (PS3,$(TARGET_SYS)) TARGET_XLDFLAGS+= -Wl,-E @@ -475,12 +473,12 @@ LIB_VMDEFP= $(LIB_VMDEF) LUAJIT_O= luajit.o LUAJIT_A= libluajit.a -LUAJIT_SO= libluajit-aegisub.so +LUAJIT_SO= libluajit.so LUAJIT_T= luajit ALL_T= $(LUAJIT_T) $(LUAJIT_A) $(LUAJIT_SO) $(HOST_T) -ALL_HDRGEN= gen/lj_bcdef.h gen/lj_ffdef.h gen/lj_libdef.h gen/lj_recdef.h gen/lj_folddef.h \ - gen/buildvm_arch.h +ALL_HDRGEN= lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h lj_folddef.h \ + host/buildvm_arch.h ALL_GEN= $(LJVM_S) $(ALL_HDRGEN) $(LIB_VMDEFP) WIN_RM= *.obj *.lib *.exp *.dll *.exe *.manifest *.pdb *.ilk ALL_RM= $(ALL_T) $(ALL_GEN) *.o host/*.o $(WIN_RM) @@ -494,11 +492,25 @@ TARGET_O= $(LUAJIT_A) TARGET_T= $(LUAJIT_T) $(LUAJIT_SO) TARGET_DEP= $(LIB_VMDEF) $(LUAJIT_SO) +ifeq (Windows,$(TARGET_SYS)) + TARGET_DYNCC= $(STATIC_CC) + LJVM_MODE= peobj + LJVM_BOUT= $(LJVM_O) + LUAJIT_T= luajit.exe + ifeq (cygwin,$(HOST_MSYS)) + LUAJIT_SO= cyg$(TARGET_DLLNAME) + else + LUAJIT_SO= $(TARGET_DLLNAME) + endif + # Mixed mode is not supported on Windows. And static mode doesn't work well. + # C modules cannot be loaded, because they bind to lua51.dll. + ifneq (static,$(BUILDMODE)) + BUILDMODE= dynamic + TARGET_XCFLAGS+= -DLUA_BUILD_AS_DLL + endif +endif ifeq (Darwin,$(TARGET_SYS)) LJVM_MODE= machasm - # -dead_strip breaks LuaJIT, but we really want it for everything else, so we - # have to dynamically link it - BUILDMODE= dynamic endif ifeq (iOS,$(TARGET_SYS)) LJVM_MODE= machasm @@ -557,6 +569,7 @@ E= @echo default all: $(TARGET_T) amalg: + @grep "^[+|]" ljamalg.c $(MAKE) all "LJCORE_O=ljamalg.o" clean: @@ -586,10 +599,7 @@ $(MINILUA_T): $(MINILUA_O) $(E) "HOSTLINK $@" $(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(MINILUA_O) $(MINILUA_LIBS) $(HOST_ALIBS) -gen: - mkdir -p gen - -gen/buildvm_arch.h: $(DASM_DASC) $(DASM_DEP) gen +host/buildvm_arch.h: $(DASM_DASC) $(DASM_DEP) $(E) "DYNASM $@" $(Q)$(DASM) $(DASM_FLAGS) -o $@ $(DASM_DASC) @@ -603,19 +613,19 @@ $(LJVM_BOUT): $(BUILDVM_T) $(E) "BUILDVM $@" $(Q)$(BUILDVM_X) -m $(LJVM_MODE) -o $@ -gen/lj_bcdef.h: $(BUILDVM_T) $(LJLIB_C) +lj_bcdef.h: $(BUILDVM_T) $(LJLIB_C) $(E) "BUILDVM $@" $(Q)$(BUILDVM_X) -m bcdef -o $@ $(LJLIB_C) -gen/lj_ffdef.h: $(BUILDVM_T) $(LJLIB_C) +lj_ffdef.h: $(BUILDVM_T) $(LJLIB_C) $(E) "BUILDVM $@" $(Q)$(BUILDVM_X) -m ffdef -o $@ $(LJLIB_C) -gen/lj_libdef.h: $(BUILDVM_T) $(LJLIB_C) +lj_libdef.h: $(BUILDVM_T) $(LJLIB_C) $(E) "BUILDVM $@" $(Q)$(BUILDVM_X) -m libdef -o $@ $(LJLIB_C) -gen/lj_recdef.h: $(BUILDVM_T) $(LJLIB_C) +lj_recdef.h: $(BUILDVM_T) $(LJLIB_C) $(E) "BUILDVM $@" $(Q)$(BUILDVM_X) -m recdef -o $@ $(LJLIB_C) @@ -623,7 +633,7 @@ $(LIB_VMDEF): $(BUILDVM_T) $(LJLIB_C) $(E) "BUILDVM $@" $(Q)$(BUILDVM_X) -m vmdef -o $(LIB_VMDEFP) $(LJLIB_C) -gen/lj_folddef.h: $(BUILDVM_T) lj_opt_fold.c +lj_folddef.h: $(BUILDVM_T) lj_opt_fold.c $(E) "BUILDVM $@" $(Q)$(BUILDVM_X) -m folddef -o $@ lj_opt_fold.c diff --git a/vendor/luajit/src/Makefile.dep b/vendor/luajit/src/Makefile.dep index b05b3129f..9e14d6173 100644 --- a/vendor/luajit/src/Makefile.dep +++ b/vendor/luajit/src/Makefile.dep @@ -4,39 +4,39 @@ lib_aux.o: lib_aux.c lua.h luaconf.h lauxlib.h lj_obj.h lj_def.h \ lib_base.o: lib_base.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \ lj_def.h lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_debug.h lj_str.h \ lj_tab.h lj_meta.h lj_state.h lj_ctype.h lj_cconv.h lj_bc.h lj_ff.h \ - gen/lj_ffdef.h lj_dispatch.h lj_jit.h lj_ir.h lj_char.h lj_strscan.h \ - lj_lib.h gen/lj_libdef.h + lj_ffdef.h lj_dispatch.h lj_jit.h lj_ir.h lj_char.h lj_strscan.h \ + lj_lib.h lj_libdef.h lib_bit.o: lib_bit.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ - lj_arch.h lj_err.h lj_errmsg.h lj_str.h lj_lib.h gen/lj_libdef.h + lj_arch.h lj_err.h lj_errmsg.h lj_str.h lj_lib.h lj_libdef.h lib_debug.o: lib_debug.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \ lj_def.h lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_debug.h lj_lib.h \ - gen/lj_libdef.h + lj_libdef.h lib_ffi.o: lib_ffi.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_meta.h \ lj_ctype.h lj_cparse.h lj_cdata.h lj_cconv.h lj_carith.h lj_ccall.h \ - lj_ccallback.h lj_clib.h lj_ff.h gen/lj_ffdef.h lj_lib.h gen/lj_libdef.h + lj_ccallback.h lj_clib.h lj_ff.h lj_ffdef.h lj_lib.h lj_libdef.h lib_init.o: lib_init.c lua.h luaconf.h lauxlib.h lualib.h lj_arch.h lib_io.o: lib_io.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_state.h lj_ff.h \ - gen/lj_ffdef.h lj_lib.h gen/lj_libdef.h + lj_ffdef.h lj_lib.h lj_libdef.h lib_jit.o: lib_jit.c lua.h luaconf.h lauxlib.h lualib.h lj_arch.h \ lj_obj.h lj_def.h lj_err.h lj_errmsg.h lj_debug.h lj_str.h lj_tab.h \ lj_bc.h lj_ir.h lj_jit.h lj_ircall.h lj_iropt.h lj_target.h \ lj_target_*.h lj_dispatch.h lj_vm.h lj_vmevent.h lj_lib.h luajit.h \ - gen/lj_libdef.h + lj_libdef.h lib_math.o: lib_math.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \ - lj_def.h lj_arch.h lj_lib.h lj_vm.h gen/lj_libdef.h + lj_def.h lj_arch.h lj_lib.h lj_vm.h lj_libdef.h lib_os.o: lib_os.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ - lj_arch.h lj_err.h lj_errmsg.h lj_lib.h gen/lj_libdef.h + lj_arch.h lj_err.h lj_errmsg.h lj_lib.h lj_libdef.h lib_package.o: lib_package.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \ lj_def.h lj_arch.h lj_err.h lj_errmsg.h lj_lib.h lib_string.o: lib_string.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \ lj_def.h lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h \ - lj_meta.h lj_state.h lj_ff.h gen/lj_ffdef.h lj_bcdump.h lj_lex.h lj_char.h \ - lj_lib.h gen/lj_libdef.h + lj_meta.h lj_state.h lj_ff.h lj_ffdef.h lj_bcdump.h lj_lex.h lj_char.h \ + lj_lib.h lj_libdef.h lib_table.o: lib_table.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \ lj_def.h lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_tab.h lj_lib.h \ - gen/lj_libdef.h + lj_libdef.h lj_alloc.o: lj_alloc.c lj_def.h lua.h luaconf.h lj_arch.h lj_alloc.h lj_api.o: lj_api.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \ lj_err.h lj_errmsg.h lj_debug.h lj_str.h lj_tab.h lj_func.h lj_udata.h \ @@ -48,7 +48,7 @@ lj_asm.o: lj_asm.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \ lj_snap.h lj_asm.h lj_vm.h lj_target.h lj_target_*.h lj_emit_*.h \ lj_asm_*.h lj_bc.o: lj_bc.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_bc.h \ - gen/lj_bcdef.h + lj_bcdef.h lj_bcread.o: lj_bcread.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_bc.h lj_ctype.h \ lj_cdata.h lualib.h lj_lex.h lj_bcdump.h lj_state.h @@ -83,28 +83,28 @@ lj_cparse.o: lj_cparse.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ lj_crecord.o: lj_crecord.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_frame.h lj_bc.h lj_ctype.h \ lj_gc.h lj_cdata.h lj_cparse.h lj_cconv.h lj_clib.h lj_ccall.h lj_ff.h \ - gen/lj_ffdef.h lj_ir.h lj_jit.h lj_ircall.h lj_iropt.h lj_trace.h \ + lj_ffdef.h lj_ir.h lj_jit.h lj_ircall.h lj_iropt.h lj_trace.h \ lj_dispatch.h lj_traceerr.h lj_record.h lj_ffrecord.h lj_snap.h \ lj_crecord.h lj_ctype.o: lj_ctype.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_ctype.h lj_ccallback.h lj_debug.o: lj_debug.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ lj_err.h lj_errmsg.h lj_debug.h lj_str.h lj_tab.h lj_state.h lj_frame.h \ - lj_bc.h lj_jit.h lj_ir.h + lj_bc.h lj_vm.h lj_jit.h lj_ir.h lj_dispatch.o: lj_dispatch.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ lj_err.h lj_errmsg.h lj_func.h lj_str.h lj_tab.h lj_meta.h lj_debug.h \ - lj_state.h lj_frame.h lj_bc.h lj_ff.h gen/lj_ffdef.h lj_jit.h lj_ir.h \ + lj_state.h lj_frame.h lj_bc.h lj_ff.h lj_ffdef.h lj_jit.h lj_ir.h \ lj_ccallback.h lj_ctype.h lj_gc.h lj_trace.h lj_dispatch.h lj_traceerr.h \ lj_vm.h luajit.h lj_err.o: lj_err.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_err.h \ lj_errmsg.h lj_debug.h lj_str.h lj_func.h lj_state.h lj_frame.h lj_bc.h \ - lj_ff.h gen/lj_ffdef.h lj_trace.h lj_jit.h lj_ir.h lj_dispatch.h \ + lj_ff.h lj_ffdef.h lj_trace.h lj_jit.h lj_ir.h lj_dispatch.h \ lj_traceerr.h lj_vm.h lj_ffrecord.o: lj_ffrecord.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_frame.h lj_bc.h lj_ff.h \ - gen/lj_ffdef.h lj_ir.h lj_jit.h lj_ircall.h lj_iropt.h lj_trace.h \ + lj_ffdef.h lj_ir.h lj_jit.h lj_ircall.h lj_iropt.h lj_trace.h \ lj_dispatch.h lj_traceerr.h lj_record.h lj_ffrecord.h lj_crecord.h \ - lj_vm.h lj_strscan.h gen/lj_recdef.h + lj_vm.h lj_strscan.h lj_recdef.h lj_func.o: lj_func.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \ lj_func.h lj_trace.h lj_jit.h lj_ir.h lj_dispatch.h lj_bc.h \ lj_traceerr.h lj_vm.h @@ -140,7 +140,7 @@ lj_opt_dce.o: lj_opt_dce.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ lj_opt_fold.o: lj_opt_fold.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ lj_str.h lj_tab.h lj_ir.h lj_jit.h lj_iropt.h lj_trace.h lj_dispatch.h \ lj_bc.h lj_traceerr.h lj_ctype.h lj_gc.h lj_carith.h lj_vm.h \ - lj_strscan.h gen/lj_folddef.h + lj_strscan.h lj_folddef.h lj_opt_loop.o: lj_opt_loop.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ lj_err.h lj_errmsg.h lj_str.h lj_ir.h lj_jit.h lj_iropt.h lj_trace.h \ lj_dispatch.h lj_bc.h lj_traceerr.h lj_snap.h lj_vm.h @@ -159,7 +159,7 @@ lj_parse.o: lj_parse.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ lj_state.h lj_bc.h lj_ctype.h lj_lex.h lj_parse.h lj_vm.h lj_vmevent.h lj_record.o: lj_record.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_meta.h lj_frame.h lj_bc.h \ - lj_ctype.h lj_gc.h lj_ff.h gen/lj_ffdef.h lj_ir.h lj_jit.h lj_ircall.h \ + lj_ctype.h lj_gc.h lj_ff.h lj_ffdef.h lj_ir.h lj_jit.h lj_ircall.h \ lj_iropt.h lj_trace.h lj_dispatch.h lj_traceerr.h lj_record.h \ lj_ffrecord.h lj_snap.h lj_vm.h lj_snap.o: lj_snap.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \ @@ -192,7 +192,7 @@ ljamalg.o: ljamalg.c lua.h luaconf.h lauxlib.h lj_gc.c lj_obj.h lj_def.h \ lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_func.h \ lj_udata.h lj_meta.h lj_state.h lj_frame.h lj_bc.h lj_ctype.h lj_cdata.h \ lj_trace.h lj_jit.h lj_ir.h lj_dispatch.h lj_traceerr.h lj_vm.h lj_err.c \ - lj_debug.h lj_ff.h gen/lj_ffdef.h lj_char.c lj_char.h lj_bc.c gen/lj_bcdef.h \ + lj_debug.h lj_ff.h lj_ffdef.h lj_char.c lj_char.h lj_bc.c lj_bcdef.h \ lj_obj.c lj_str.c lj_tab.c lj_func.c lj_udata.c lj_meta.c lj_strscan.h \ lj_debug.c lj_state.c lj_lex.h lj_alloc.h lj_dispatch.c lj_ccallback.h \ luajit.h lj_vmevent.c lj_vmevent.h lj_vmmath.c lj_strscan.c lj_api.c \ @@ -201,12 +201,12 @@ ljamalg.o: ljamalg.c lua.h luaconf.h lauxlib.h lj_gc.c lj_obj.h lj_def.h \ lj_ccall.c lj_ccall.h lj_ccallback.c lj_target.h lj_target_*.h \ lj_mcode.h lj_carith.c lj_carith.h lj_clib.c lj_clib.h lj_cparse.c \ lj_cparse.h lj_lib.c lj_lib.h lj_ir.c lj_ircall.h lj_iropt.h \ - lj_opt_mem.c lj_opt_fold.c gen/lj_folddef.h lj_opt_narrow.c lj_opt_dce.c \ + lj_opt_mem.c lj_opt_fold.c lj_folddef.h lj_opt_narrow.c lj_opt_dce.c \ lj_opt_loop.c lj_snap.h lj_opt_split.c lj_opt_sink.c lj_mcode.c \ lj_snap.c lj_record.c lj_record.h lj_ffrecord.h lj_crecord.c \ - lj_crecord.h lj_ffrecord.c gen/lj_recdef.h lj_asm.c lj_asm.h lj_emit_*.h \ + lj_crecord.h lj_ffrecord.c lj_recdef.h lj_asm.c lj_asm.h lj_emit_*.h \ lj_asm_*.h lj_trace.c lj_gdbjit.h lj_gdbjit.c lj_alloc.c lib_aux.c \ - lib_base.c gen/lj_libdef.h lib_math.c lib_string.c lib_table.c lib_io.c \ + lib_base.c lj_libdef.h lib_math.c lib_string.c lib_table.c lib_io.c \ lib_os.c lib_package.c lib_debug.c lib_bit.c lib_jit.c lib_ffi.c \ lib_init.c luajit.o: luajit.c lua.h luaconf.h lauxlib.h lualib.h luajit.h lj_arch.h @@ -214,7 +214,7 @@ host/buildvm.o: host/buildvm.c host/buildvm.h lj_def.h lua.h luaconf.h \ lj_arch.h lj_obj.h lj_def.h lj_arch.h lj_gc.h lj_obj.h lj_bc.h lj_ir.h \ lj_ircall.h lj_ir.h lj_jit.h lj_frame.h lj_bc.h lj_dispatch.h lj_ctype.h \ lj_gc.h lj_ccall.h lj_ctype.h luajit.h \ - gen/buildvm_arch.h lj_traceerr.h + host/buildvm_arch.h lj_traceerr.h host/buildvm_asm.o: host/buildvm_asm.c host/buildvm.h lj_def.h lua.h luaconf.h \ lj_arch.h lj_bc.h lj_def.h lj_arch.h host/buildvm_fold.o: host/buildvm_fold.c host/buildvm.h lj_def.h lua.h \ diff --git a/vendor/luajit/src/host/buildvm.c b/vendor/luajit/src/host/buildvm.c index 7687ad7ad..07122a645 100644 --- a/vendor/luajit/src/host/buildvm.c +++ b/vendor/luajit/src/host/buildvm.c @@ -1,6 +1,6 @@ /* ** LuaJIT VM builder. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** This is a tool to build the hand-tuned assembler code required for ** LuaJIT's bytecode interpreter. It supports a variety of output formats diff --git a/vendor/luajit/src/host/buildvm.h b/vendor/luajit/src/host/buildvm.h index f9dc8c4f2..b26218502 100644 --- a/vendor/luajit/src/host/buildvm.h +++ b/vendor/luajit/src/host/buildvm.h @@ -1,6 +1,6 @@ /* ** LuaJIT VM builder. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _BUILDVM_H diff --git a/vendor/luajit/src/host/buildvm_asm.c b/vendor/luajit/src/host/buildvm_asm.c index 9b28b3b38..2c9a2d482 100644 --- a/vendor/luajit/src/host/buildvm_asm.c +++ b/vendor/luajit/src/host/buildvm_asm.c @@ -1,6 +1,6 @@ /* ** LuaJIT VM builder: Assembler source code emitter. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #include "buildvm.h" @@ -286,7 +286,7 @@ void emit_asm(BuildCtx *ctx) fprintf(ctx->fp, "\n"); switch (ctx->mode) { case BUILD_elfasm: -#if !LJ_TARGET_PS3 +#if !(LJ_TARGET_PS3 || LJ_TARGET_PSVITA) fprintf(ctx->fp, "\t.section .note.GNU-stack,\"\"," ELFASM_PX "progbits\n"); #endif #if LJ_TARGET_PPCSPE diff --git a/vendor/luajit/src/host/buildvm_fold.c b/vendor/luajit/src/host/buildvm_fold.c index 7f5d9f2f1..daed7eccb 100644 --- a/vendor/luajit/src/host/buildvm_fold.c +++ b/vendor/luajit/src/host/buildvm_fold.c @@ -1,6 +1,6 @@ /* ** LuaJIT VM builder: IR folding hash table generator. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #include "buildvm.h" diff --git a/vendor/luajit/src/host/buildvm_lib.c b/vendor/luajit/src/host/buildvm_lib.c index eafdab981..c37301d46 100644 --- a/vendor/luajit/src/host/buildvm_lib.c +++ b/vendor/luajit/src/host/buildvm_lib.c @@ -1,6 +1,6 @@ /* ** LuaJIT VM builder: library definition compiler. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #include "buildvm.h" diff --git a/vendor/luajit/src/host/buildvm_peobj.c b/vendor/luajit/src/host/buildvm_peobj.c index 138b04232..4279f5005 100644 --- a/vendor/luajit/src/host/buildvm_peobj.c +++ b/vendor/luajit/src/host/buildvm_peobj.c @@ -1,6 +1,6 @@ /* ** LuaJIT VM builder: PE object emitter. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Only used for building on Windows, since we cannot assume the presence ** of a suitable assembler. The host and target byte order must match. diff --git a/vendor/luajit/src/host/genminilua.lua b/vendor/luajit/src/host/genminilua.lua index 04c551887..cd0d94662 100644 --- a/vendor/luajit/src/host/genminilua.lua +++ b/vendor/luajit/src/host/genminilua.lua @@ -2,7 +2,7 @@ -- Lua script to generate a customized, minified version of Lua. -- The resulting 'minilua' is used for the build process of LuaJIT. ---------------------------------------------------------------------------- --- Copyright (C) 2005-2014 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2015 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- diff --git a/vendor/luajit/src/jit/bc.lua b/vendor/luajit/src/jit/bc.lua index 9df19c7bf..46a40892e 100644 --- a/vendor/luajit/src/jit/bc.lua +++ b/vendor/luajit/src/jit/bc.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT bytecode listing module. -- --- Copyright (C) 2005-2014 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2015 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- @@ -41,7 +41,7 @@ -- Cache some library functions and objects. local jit = require("jit") -assert(jit.version_num == 20003, "LuaJIT core/library version mismatch") +assert(jit.version_num == 20004, "LuaJIT core/library version mismatch") local jutil = require("jit.util") local vmdef = require("jit.vmdef") local bit = require("bit") diff --git a/vendor/luajit/src/jit/bcsave.lua b/vendor/luajit/src/jit/bcsave.lua index f55bda970..0319b3d25 100644 --- a/vendor/luajit/src/jit/bcsave.lua +++ b/vendor/luajit/src/jit/bcsave.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT module to save/list bytecode. -- --- Copyright (C) 2005-2014 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2015 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- @@ -11,7 +11,7 @@ ------------------------------------------------------------------------------ local jit = require("jit") -assert(jit.version_num == 20003, "LuaJIT core/library version mismatch") +assert(jit.version_num == 20004, "LuaJIT core/library version mismatch") local bit = require("bit") -- Symbol name prefix for LuaJIT bytecode. @@ -69,7 +69,7 @@ local map_arch = { local map_os = { linux = true, windows = true, osx = true, freebsd = true, netbsd = true, - openbsd = true, solaris = true, + openbsd = true, dragonfly = true, solaris = true, } local function checkarg(str, map, err) diff --git a/vendor/luajit/src/jit/dis_arm.lua b/vendor/luajit/src/jit/dis_arm.lua index b3d0ebc2c..59be715a9 100644 --- a/vendor/luajit/src/jit/dis_arm.lua +++ b/vendor/luajit/src/jit/dis_arm.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT ARM disassembler module. -- --- Copyright (C) 2005-2014 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2015 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/vendor/luajit/src/jit/dis_mips.lua b/vendor/luajit/src/jit/dis_mips.lua index 47a7a83bc..acdd2be16 100644 --- a/vendor/luajit/src/jit/dis_mips.lua +++ b/vendor/luajit/src/jit/dis_mips.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPS disassembler module. -- --- Copyright (C) 2005-2014 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2015 Mike Pall. All rights reserved. -- Released under the MIT/X license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/vendor/luajit/src/jit/dis_mipsel.lua b/vendor/luajit/src/jit/dis_mipsel.lua index d19de3193..dd9d26ae6 100644 --- a/vendor/luajit/src/jit/dis_mipsel.lua +++ b/vendor/luajit/src/jit/dis_mipsel.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT MIPSEL disassembler wrapper module. -- --- Copyright (C) 2005-2014 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2015 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the little-endian functions from the diff --git a/vendor/luajit/src/jit/dis_ppc.lua b/vendor/luajit/src/jit/dis_ppc.lua index cfaf982fa..d05c43111 100644 --- a/vendor/luajit/src/jit/dis_ppc.lua +++ b/vendor/luajit/src/jit/dis_ppc.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT PPC disassembler module. -- --- Copyright (C) 2005-2014 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2015 Mike Pall. All rights reserved. -- Released under the MIT/X license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/vendor/luajit/src/jit/dis_x64.lua b/vendor/luajit/src/jit/dis_x64.lua index 4f4916953..a80981bd5 100644 --- a/vendor/luajit/src/jit/dis_x64.lua +++ b/vendor/luajit/src/jit/dis_x64.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT x64 disassembler wrapper module. -- --- Copyright (C) 2005-2014 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2015 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This module just exports the 64 bit functions from the combined diff --git a/vendor/luajit/src/jit/dis_x86.lua b/vendor/luajit/src/jit/dis_x86.lua index 0b865ab6e..078d6094d 100644 --- a/vendor/luajit/src/jit/dis_x86.lua +++ b/vendor/luajit/src/jit/dis_x86.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT x86/x64 disassembler module. -- --- Copyright (C) 2005-2014 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2015 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- This is a helper module used by the LuaJIT machine code dumper module. diff --git a/vendor/luajit/src/jit/dump.lua b/vendor/luajit/src/jit/dump.lua index 556ce8830..d15c528ea 100644 --- a/vendor/luajit/src/jit/dump.lua +++ b/vendor/luajit/src/jit/dump.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- LuaJIT compiler dump module. -- --- Copyright (C) 2005-2014 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2015 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- @@ -55,7 +55,7 @@ -- Cache some library functions and objects. local jit = require("jit") -assert(jit.version_num == 20003, "LuaJIT core/library version mismatch") +assert(jit.version_num == 20004, "LuaJIT core/library version mismatch") local jutil = require("jit.util") local vmdef = require("jit.vmdef") local funcinfo, funcbc = jutil.funcinfo, jutil.funcbc diff --git a/vendor/luajit/src/jit/v.lua b/vendor/luajit/src/jit/v.lua index 197e67c69..32666fd1a 100644 --- a/vendor/luajit/src/jit/v.lua +++ b/vendor/luajit/src/jit/v.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- Verbose mode of the LuaJIT compiler. -- --- Copyright (C) 2005-2014 Mike Pall. All rights reserved. +-- Copyright (C) 2005-2015 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- @@ -59,7 +59,7 @@ -- Cache some library functions and objects. local jit = require("jit") -assert(jit.version_num == 20003, "LuaJIT core/library version mismatch") +assert(jit.version_num == 20004, "LuaJIT core/library version mismatch") local jutil = require("jit.util") local vmdef = require("jit.vmdef") local funcinfo, traceinfo = jutil.funcinfo, jutil.traceinfo diff --git a/vendor/luajit/src/lib_aux.c b/vendor/luajit/src/lib_aux.c index 1b01fe070..4a1b70ddc 100644 --- a/vendor/luajit/src/lib_aux.c +++ b/vendor/luajit/src/lib_aux.c @@ -1,6 +1,6 @@ /* ** Auxiliary library for the Lua/C API. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Major parts taken verbatim or adapted from the Lua interpreter. ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h @@ -302,7 +302,7 @@ static int panic(lua_State *L) #ifdef LUAJIT_USE_SYSMALLOC -#if LJ_64 +#if LJ_64 && !defined(LUAJIT_USE_VALGRIND) #error "Must use builtin allocator for 64 bit target" #endif diff --git a/vendor/luajit/src/lib_base.c b/vendor/luajit/src/lib_base.c index 30e88f19d..17b9525d6 100644 --- a/vendor/luajit/src/lib_base.c +++ b/vendor/luajit/src/lib_base.c @@ -1,6 +1,6 @@ /* ** Base and coroutine library. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Major portions taken verbatim or adapted from the Lua interpreter. ** Copyright (C) 1994-2011 Lua.org, PUC-Rio. See Copyright Notice in lua.h diff --git a/vendor/luajit/src/lib_bit.c b/vendor/luajit/src/lib_bit.c index 739924b09..583e04b0c 100644 --- a/vendor/luajit/src/lib_bit.c +++ b/vendor/luajit/src/lib_bit.c @@ -1,6 +1,6 @@ /* ** Bit manipulation library. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lib_bit_c diff --git a/vendor/luajit/src/lib_debug.c b/vendor/luajit/src/lib_debug.c index 97f032f11..e87c35cfe 100644 --- a/vendor/luajit/src/lib_debug.c +++ b/vendor/luajit/src/lib_debug.c @@ -1,6 +1,6 @@ /* ** Debug library. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Major portions taken verbatim or adapted from the Lua interpreter. ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h diff --git a/vendor/luajit/src/lib_ffi.c b/vendor/luajit/src/lib_ffi.c index e789ad6c3..f6df39d67 100644 --- a/vendor/luajit/src/lib_ffi.c +++ b/vendor/luajit/src/lib_ffi.c @@ -1,6 +1,6 @@ /* ** FFI library. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lib_ffi_c @@ -136,6 +136,7 @@ static int ffi_index_meta(lua_State *L, CTState *cts, CType *ct, MMS mm) return 0; } } + copyTV(L, base, L->top); tv = L->top-1; } return lj_meta_tailcall(L, tv); diff --git a/vendor/luajit/src/lib_init.c b/vendor/luajit/src/lib_init.c index a729d1255..85c194af4 100644 --- a/vendor/luajit/src/lib_init.c +++ b/vendor/luajit/src/lib_init.c @@ -1,6 +1,6 @@ /* ** Library initialization. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Major parts taken verbatim from the Lua interpreter. ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h diff --git a/vendor/luajit/src/lib_io.c b/vendor/luajit/src/lib_io.c index b59d34bfc..037aa28e5 100644 --- a/vendor/luajit/src/lib_io.c +++ b/vendor/luajit/src/lib_io.c @@ -1,6 +1,6 @@ /* ** I/O library. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Major portions taken verbatim or adapted from the Lua interpreter. ** Copyright (C) 1994-2011 Lua.org, PUC-Rio. See Copyright Notice in lua.h @@ -24,16 +24,6 @@ #include "lj_ff.h" #include "lj_lib.h" -#if LJ_TARGET_WINDOWS -#define WIN32_LEAN_AND_MEAN -#include - -static int widen(const char *in, wchar_t *out) -{ - return MultiByteToWideChar(CP_UTF8, 0, in, -1, out, MAX_PATH); -} -#endif - /* Userdata payload for I/O file. */ typedef struct IOFileUD { FILE *fp; /* File handle. */ @@ -92,15 +82,7 @@ static IOFileUD *io_file_open(lua_State *L, const char *mode) { const char *fname = strdata(lj_lib_checkstr(L, 1)); IOFileUD *iof = io_file_new(L); -#if LJ_TARGET_WINDOWS - wchar_t wfname[MAX_PATH]; - wchar_t wmode[MAX_PATH]; - if (!widen(fname, wfname) || !widen(mode, wmode)) - luaL_argerror(L, 1, lj_str_pushf(L, "%s: failed to convert path to utf-16", fname)); - iof->fp = _wfopen(wfname, wmode); -#else iof->fp = fopen(fname, mode); -#endif if (iof->fp == NULL) luaL_argerror(L, 1, lj_str_pushf(L, "%s: %s", fname, strerror(errno))); return iof; @@ -417,14 +399,7 @@ LJLIB_CF(io_open) GCstr *s = lj_lib_optstr(L, 2); const char *mode = s ? strdata(s) : "r"; IOFileUD *iof = io_file_new(L); -#if LJ_TARGET_WINDOWS - wchar_t wfname[MAX_PATH]; - wchar_t wmode[MAX_PATH]; - if (widen(fname, wfname) && widen(mode, wmode)) - iof->fp = _wfopen(wfname, wmode); -#else iof->fp = fopen(fname, mode); -#endif return iof->fp != NULL ? 1 : luaL_fileresult(L, 0, fname); } @@ -440,10 +415,7 @@ LJLIB_CF(io_popen) fflush(NULL); iof->fp = popen(fname, mode); #else - wchar_t wfname[MAX_PATH]; - wchar_t wmode[MAX_PATH]; - if (widen(fname, wfname) && widen(mode, wmode)) - iof->fp = _wpopen(wfname, wmode); + iof->fp = _popen(fname, mode); #endif return iof->fp != NULL ? 1 : luaL_fileresult(L, 0, fname); #else @@ -454,7 +426,7 @@ LJLIB_CF(io_popen) LJLIB_CF(io_tmpfile) { IOFileUD *iof = io_file_new(L); -#if LJ_TARGET_PS3 || LJ_TARGET_PS4 +#if LJ_TARGET_PS3 || LJ_TARGET_PS4 || LJ_TARGET_PSVITA iof->fp = NULL; errno = ENOSYS; #else iof->fp = tmpfile(); diff --git a/vendor/luajit/src/lib_jit.c b/vendor/luajit/src/lib_jit.c index 0fadf8b9e..96525faf2 100644 --- a/vendor/luajit/src/lib_jit.c +++ b/vendor/luajit/src/lib_jit.c @@ -1,6 +1,6 @@ /* ** JIT library. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lib_jit_c diff --git a/vendor/luajit/src/lib_math.c b/vendor/luajit/src/lib_math.c index 3aa5c6b01..40f29142d 100644 --- a/vendor/luajit/src/lib_math.c +++ b/vendor/luajit/src/lib_math.c @@ -1,6 +1,6 @@ /* ** Math library. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #include diff --git a/vendor/luajit/src/lib_os.c b/vendor/luajit/src/lib_os.c index df03b4d24..bb5a141e3 100644 --- a/vendor/luajit/src/lib_os.c +++ b/vendor/luajit/src/lib_os.c @@ -1,13 +1,12 @@ /* ** OS library. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Major portions taken verbatim or adapted from the Lua interpreter. ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h */ #include -#include #include #define lib_os_c @@ -27,21 +26,8 @@ #include #endif -/* ------------------------------------------------------------------------ */ - -#if LJ_TARGET_WINDOWS -#define WIN32_LEAN_AND_MEAN -#include - -static wchar_t *widen_static(const char *narrow, int idx) -{ - __declspec(thread) static wchar_t buffer[2][MAX_PATH]; - return MultiByteToWideChar(CP_UTF8, 0, narrow, -1, buffer[idx], MAX_PATH) ? buffer[idx] : L""; -} - -#define remove(x) _wremove(widen_static(x, 0)) -#define system(x) _wsystem(widen_static(x, 0)) -#define rename(x, y) _wrename(widen_static(x, 0), widen_static(y, 1)) +#if !LJ_TARGET_PSVITA +#include #endif /* ------------------------------------------------------------------------ */ @@ -87,7 +73,7 @@ LJLIB_CF(os_rename) LJLIB_CF(os_tmpname) { -#if LJ_TARGET_PS3 || LJ_TARGET_PS4 +#if LJ_TARGET_PS3 || LJ_TARGET_PS4 || LJ_TARGET_PSVITA lj_err_caller(L, LJ_ERR_OSUNIQF); return 0; #else @@ -271,6 +257,9 @@ LJLIB_CF(os_difftime) LJLIB_CF(os_setlocale) { +#if LJ_TARGET_PSVITA + lua_pushliteral(L, "C"); +#else GCstr *s = lj_lib_optstr(L, 1); const char *str = s ? strdata(s) : NULL; int opt = lj_lib_checkopt(L, 2, 6, @@ -282,6 +271,7 @@ LJLIB_CF(os_setlocale) else if (opt == 4) opt = LC_MONETARY; else if (opt == 6) opt = LC_ALL; lua_pushstring(L, setlocale(opt, str)); +#endif return 1; } diff --git a/vendor/luajit/src/lib_package.c b/vendor/luajit/src/lib_package.c index e3410390b..ac38c8158 100644 --- a/vendor/luajit/src/lib_package.c +++ b/vendor/luajit/src/lib_package.c @@ -1,6 +1,6 @@ /* ** Package library. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Major portions taken verbatim or adapted from the Lua interpreter. ** Copyright (C) 1994-2012 Lua.org, PUC-Rio. See Copyright Notice in lua.h diff --git a/vendor/luajit/src/lib_string.c b/vendor/luajit/src/lib_string.c index 9ec6d0c3d..c6168edbb 100644 --- a/vendor/luajit/src/lib_string.c +++ b/vendor/luajit/src/lib_string.c @@ -1,6 +1,6 @@ /* ** String library. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Major portions taken verbatim or adapted from the Lua interpreter. ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h diff --git a/vendor/luajit/src/lib_table.c b/vendor/luajit/src/lib_table.c index e0e8302fc..fbfe86387 100644 --- a/vendor/luajit/src/lib_table.c +++ b/vendor/luajit/src/lib_table.c @@ -1,6 +1,6 @@ /* ** Table library. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Major portions taken verbatim or adapted from the Lua interpreter. ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h diff --git a/vendor/luajit/src/lj_alloc.c b/vendor/luajit/src/lj_alloc.c index f856a7a01..7c7ec6787 100644 --- a/vendor/luajit/src/lj_alloc.c +++ b/vendor/luajit/src/lj_alloc.c @@ -179,23 +179,29 @@ static LJ_AINLINE int CALL_MUNMAP(void *ptr, size_t size) #if defined(MAP_32BIT) +#if defined(__sun__) +#define MMAP_REGION_START ((uintptr_t)0x1000) +#else /* Actually this only gives us max. 1GB in current Linux kernels. */ +#define MMAP_REGION_START ((uintptr_t)0) +#endif + static LJ_AINLINE void *CALL_MMAP(size_t size) { int olderr = errno; - void *ptr = mmap(NULL, size, MMAP_PROT, MAP_32BIT|MMAP_FLAGS, -1, 0); + void *ptr = mmap((void *)MMAP_REGION_START, size, MMAP_PROT, MAP_32BIT|MMAP_FLAGS, -1, 0); errno = olderr; return ptr; } -#elif LJ_TARGET_OSX || LJ_TARGET_PS4 || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun__) +#elif LJ_TARGET_OSX || LJ_TARGET_PS4 || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun__) /* OSX and FreeBSD mmap() use a naive first-fit linear search. ** That's perfect for us. Except that -pagezero_size must be set for OSX, ** otherwise the lower 4GB are blocked. And the 32GB RLIMIT_DATA needs ** to be reduced to 250MB on FreeBSD. */ -#if LJ_TARGET_OSX +#if LJ_TARGET_OSX || defined(__DragonFly__) #define MMAP_REGION_START ((uintptr_t)0x10000) #elif LJ_TARGET_PS4 #define MMAP_REGION_START ((uintptr_t)0x4000) @@ -232,7 +238,7 @@ static LJ_AINLINE void *CALL_MMAP(size_t size) return p; } if (p != CMFAIL) munmap(p, size); -#ifdef __sun__ +#if defined(__sun__) || defined(__DragonFly__) alloc_hint += 0x1000000; /* Need near-exhaustive linear scan. */ if (alloc_hint + size < MMAP_REGION_END) continue; #endif diff --git a/vendor/luajit/src/lj_api.c b/vendor/luajit/src/lj_api.c index bc5290b24..3bedb39fd 100644 --- a/vendor/luajit/src/lj_api.c +++ b/vendor/luajit/src/lj_api.c @@ -1,6 +1,6 @@ /* ** Public Lua/C API. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Major portions taken verbatim or adapted from the Lua interpreter. ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h diff --git a/vendor/luajit/src/lj_arch.h b/vendor/luajit/src/lj_arch.h index 0196eedc0..d3a9d57d7 100644 --- a/vendor/luajit/src/lj_arch.h +++ b/vendor/luajit/src/lj_arch.h @@ -1,6 +1,6 @@ /* ** Target architecture selection. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_ARCH_H @@ -67,7 +67,8 @@ #elif defined(__MACH__) && defined(__APPLE__) #define LUAJIT_OS LUAJIT_OS_OSX #elif (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ - defined(__NetBSD__) || defined(__OpenBSD__)) && !defined(__ORBIS__) + defined(__NetBSD__) || defined(__OpenBSD__) || \ + defined(__DragonFly__)) && !defined(__ORBIS__) #define LUAJIT_OS LUAJIT_OS_BSD #elif (defined(__sun__) && defined(__svr4__)) || defined(__CYGWIN__) #define LUAJIT_OS LUAJIT_OS_POSIX @@ -111,6 +112,11 @@ #define NULL ((void*)0) #endif +#ifdef __psp2__ +#define LJ_TARGET_PSVITA 1 +#define LJ_TARGET_CONSOLE 1 +#endif + #if _XBOX_VER >= 200 #define LJ_TARGET_XBOX360 1 #define LJ_TARGET_CONSOLE 1 @@ -175,7 +181,9 @@ #define LJ_TARGET_UNIFYROT 2 /* Want only IR_BROR. */ #define LJ_ARCH_NUMMODE LJ_NUMMODE_DUAL -#if __ARM_ARCH_7__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH_7S__ +#if __ARM_ARCH____ARM_ARCH_8__ || __ARM_ARCH_8A__ +#define LJ_ARCH_VERSION 80 +#elif __ARM_ARCH_7__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH_7S__ || __ARM_ARCH_7VE__ #define LJ_ARCH_VERSION 70 #elif __ARM_ARCH_6T2__ #define LJ_ARCH_VERSION 61 @@ -334,6 +342,9 @@ #if defined(__mips_soft_float) #error "No support for MIPS CPUs without FPU" #endif +#if defined(_LP64) +#error "No support for MIPS64" +#endif #endif #endif diff --git a/vendor/luajit/src/lj_asm.c b/vendor/luajit/src/lj_asm.c index 264649aeb..804b4dc80 100644 --- a/vendor/luajit/src/lj_asm.c +++ b/vendor/luajit/src/lj_asm.c @@ -1,6 +1,6 @@ /* ** IR assembler (SSA IR -> machine code). -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_asm_c @@ -353,6 +353,7 @@ static Reg ra_rematk(ASMState *as, IRRef ref) static int32_t ra_spill(ASMState *as, IRIns *ir) { int32_t slot = ir->s; + lua_assert(ir >= as->ir + REF_TRUE); if (!ra_hasspill(slot)) { if (irt_is64(ir->t)) { slot = as->evenspill; @@ -1372,6 +1373,11 @@ static void asm_head_side(ASMState *as) int pass3 = 0; IRRef i; + if (as->snapno && as->topslot > as->parent->topslot) { + /* Force snap #0 alloc to prevent register overwrite in stack check. */ + as->snapno = 0; + asm_snap_alloc(as); + } allow = asm_head_side_base(as, irp, allow); /* Scan all parent SLOADs and collect register dependencies. */ diff --git a/vendor/luajit/src/lj_asm.h b/vendor/luajit/src/lj_asm.h index f5d0159b1..85f297632 100644 --- a/vendor/luajit/src/lj_asm.h +++ b/vendor/luajit/src/lj_asm.h @@ -1,6 +1,6 @@ /* ** IR assembler (SSA IR -> machine code). -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_ASM_H diff --git a/vendor/luajit/src/lj_asm_arm.h b/vendor/luajit/src/lj_asm_arm.h index 72f205d90..9e4cf4367 100644 --- a/vendor/luajit/src/lj_asm_arm.h +++ b/vendor/luajit/src/lj_asm_arm.h @@ -1,6 +1,6 @@ /* ** ARM IR assembler (SSA IR -> machine code). -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ /* -- Register allocator extensions --------------------------------------- */ diff --git a/vendor/luajit/src/lj_asm_mips.h b/vendor/luajit/src/lj_asm_mips.h index e5c67b53e..78bd26d5d 100644 --- a/vendor/luajit/src/lj_asm_mips.h +++ b/vendor/luajit/src/lj_asm_mips.h @@ -1,6 +1,6 @@ /* ** MIPS IR assembler (SSA IR -> machine code). -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ /* -- Register allocator extensions --------------------------------------- */ diff --git a/vendor/luajit/src/lj_asm_ppc.h b/vendor/luajit/src/lj_asm_ppc.h index e1a496a7e..2c5d74a8d 100644 --- a/vendor/luajit/src/lj_asm_ppc.h +++ b/vendor/luajit/src/lj_asm_ppc.h @@ -1,6 +1,6 @@ /* ** PPC IR assembler (SSA IR -> machine code). -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ /* -- Register allocator extensions --------------------------------------- */ @@ -49,6 +49,8 @@ static void asm_exitstub_setup(ASMState *as, ExitNo nexits) { ExitNo i; MCode *mxp = as->mctop; + if (mxp - (nexits + 3 + MCLIM_REDZONE) < as->mclim) + asm_mclimit(as); /* 1: mflr r0; bl ->vm_exit_handler; li r0, traceno; bl <1; bl <1; ... */ for (i = nexits-1; (int32_t)i >= 0; i--) *--mxp = PPCI_BL|(((-3-i)&0x00ffffffu)<<2); diff --git a/vendor/luajit/src/lj_asm_x86.h b/vendor/luajit/src/lj_asm_x86.h index fda911e50..0b6b2d4a5 100644 --- a/vendor/luajit/src/lj_asm_x86.h +++ b/vendor/luajit/src/lj_asm_x86.h @@ -1,6 +1,6 @@ /* ** x86/x64 IR assembler (SSA IR -> machine code). -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ /* -- Guard handling ------------------------------------------------------ */ @@ -325,6 +325,14 @@ static Reg asm_fuseload(ASMState *as, IRRef ref, RegSet allow) as->mrm.base = as->mrm.idx = RID_NONE; return RID_MRM; } + } else if (ir->o == IR_KINT64) { + RegSet avail = as->freeset & ~as->modset & RSET_GPR; + lua_assert(allow != RSET_EMPTY); + if (!(avail & (avail-1))) { /* Fuse if less than two regs available. */ + as->mrm.ofs = ptr2addr(ir_kint64(ir)); + as->mrm.base = as->mrm.idx = RID_NONE; + return RID_MRM; + } } else if (mayfuse(as, ref)) { RegSet xallow = (allow & RSET_GPR) ? allow : RSET_GPR; if (ir->o == IR_SLOAD) { @@ -361,7 +369,7 @@ static Reg asm_fuseload(ASMState *as, IRRef ref, RegSet allow) return RID_MRM; } } - if (!(as->freeset & allow) && + if (!(as->freeset & allow) && !irref_isk(ref) && (allow == RSET_EMPTY || ra_hasspill(ir->s) || iscrossref(as, ref))) goto fusespill; return ra_allocref(as, ref, allow); @@ -571,7 +579,7 @@ static void asm_setupresult(ASMState *as, IRIns *ir, const CCallInfo *ci) lua_assert(!irt_ispri(ir->t)); ra_destreg(as, ir, RID_RET); } - } else if (LJ_32 && irt_isfp(ir->t)) { + } else if (LJ_32 && irt_isfp(ir->t) && !(ci->flags & CCI_CASTU64)) { emit_x87op(as, XI_FPOP); /* Pop unused result from x87 st0. */ } } @@ -1828,8 +1836,12 @@ static void asm_intarith(ASMState *as, IRIns *ir, x86Arith xa) Reg dest, right; int32_t k = 0; if (as->flagmcp == as->mcp) { /* Drop test r,r instruction. */ - as->flagmcp = NULL; - as->mcp += (LJ_64 && *as->mcp < XI_TESTb) ? 3 : 2; + MCode *p = as->mcp + ((LJ_64 && *as->mcp < XI_TESTb) ? 3 : 2); + if ((p[1] & 15) < 14) { + if ((p[1] & 15) >= 12) p[1] -= 4; /* L <->S, NL <-> NS */ + as->flagmcp = NULL; + as->mcp = p; + } /* else: cannot transform LE/NLE to cc without use of OF. */ } right = IR(rref)->r; if (ra_hasreg(right)) { diff --git a/vendor/luajit/src/lj_bc.c b/vendor/luajit/src/lj_bc.c index d5d3d78db..a8f444c26 100644 --- a/vendor/luajit/src/lj_bc.c +++ b/vendor/luajit/src/lj_bc.c @@ -1,6 +1,6 @@ /* ** Bytecode instruction modes. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_bc_c diff --git a/vendor/luajit/src/lj_bc.h b/vendor/luajit/src/lj_bc.h index 1a4ade317..7436fabfe 100644 --- a/vendor/luajit/src/lj_bc.h +++ b/vendor/luajit/src/lj_bc.h @@ -1,6 +1,6 @@ /* ** Bytecode instruction format. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_BC_H diff --git a/vendor/luajit/src/lj_bcdump.h b/vendor/luajit/src/lj_bcdump.h index 77a789e9e..812d0e151 100644 --- a/vendor/luajit/src/lj_bcdump.h +++ b/vendor/luajit/src/lj_bcdump.h @@ -1,6 +1,6 @@ /* ** Bytecode dump definitions. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_BCDUMP_H diff --git a/vendor/luajit/src/lj_bcread.c b/vendor/luajit/src/lj_bcread.c index c0baece46..25859d2fa 100644 --- a/vendor/luajit/src/lj_bcread.c +++ b/vendor/luajit/src/lj_bcread.c @@ -1,6 +1,6 @@ /* ** Bytecode reader. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_bcread_c diff --git a/vendor/luajit/src/lj_bcwrite.c b/vendor/luajit/src/lj_bcwrite.c index dcdaa10a6..ff97450b8 100644 --- a/vendor/luajit/src/lj_bcwrite.c +++ b/vendor/luajit/src/lj_bcwrite.c @@ -1,6 +1,6 @@ /* ** Bytecode writer. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_bcwrite_c diff --git a/vendor/luajit/src/lj_carith.c b/vendor/luajit/src/lj_carith.c index 9f94091d4..2a358a9bb 100644 --- a/vendor/luajit/src/lj_carith.c +++ b/vendor/luajit/src/lj_carith.c @@ -1,6 +1,6 @@ /* ** C data arithmetic. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #include "lj_obj.h" @@ -62,7 +62,7 @@ static int carith_checkarg(lua_State *L, CTState *cts, CDArith *ca) TValue *o2 = i == 0 ? o+1 : o-1; CType *ct = ctype_raw(cts, cdataV(o2)->ctypeid); ca->ct[i] = NULL; - ca->p[i] = NULL; + ca->p[i] = (uint8_t *)strVdata(o); ok = 0; if (ctype_isenum(ct->info)) { CTSize ofs; @@ -79,7 +79,7 @@ static int carith_checkarg(lua_State *L, CTState *cts, CDArith *ca) } } else { ca->ct[i] = NULL; - ca->p[i] = NULL; + ca->p[i] = (void *)(intptr_t)1; /* To make it unequal. */ ok = 0; } } @@ -234,7 +234,9 @@ static int lj_carith_meta(lua_State *L, CTState *cts, CDArith *ca, MMS mm) const char *repr[2]; int i, isenum = -1, isstr = -1; if (mm == MM_eq) { /* Equality checks never raise an error. */ - setboolV(L->top-1, 0); + int eq = ca->p[0] == ca->p[1]; + setboolV(L->top-1, eq); + setboolV(&G(L)->tmptv2, eq); /* Remember for trace recorder. */ return 1; } for (i = 0; i < 2; i++) { diff --git a/vendor/luajit/src/lj_carith.h b/vendor/luajit/src/lj_carith.h index 8b28556d8..8c4bdbbe2 100644 --- a/vendor/luajit/src/lj_carith.h +++ b/vendor/luajit/src/lj_carith.h @@ -1,6 +1,6 @@ /* ** C data arithmetic. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_CARITH_H diff --git a/vendor/luajit/src/lj_ccall.c b/vendor/luajit/src/lj_ccall.c index 70c9ba5ec..998417c1c 100644 --- a/vendor/luajit/src/lj_ccall.c +++ b/vendor/luajit/src/lj_ccall.c @@ -1,6 +1,6 @@ /* ** FFI C call handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #include "lj_obj.h" diff --git a/vendor/luajit/src/lj_ccall.h b/vendor/luajit/src/lj_ccall.h index c3ea9e6f9..f55301093 100644 --- a/vendor/luajit/src/lj_ccall.h +++ b/vendor/luajit/src/lj_ccall.h @@ -1,6 +1,6 @@ /* ** FFI C call handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_CCALL_H diff --git a/vendor/luajit/src/lj_ccallback.c b/vendor/luajit/src/lj_ccallback.c index d872d6715..b210641f9 100644 --- a/vendor/luajit/src/lj_ccallback.c +++ b/vendor/luajit/src/lj_ccallback.c @@ -1,6 +1,6 @@ /* ** FFI C callback handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #include "lj_obj.h" diff --git a/vendor/luajit/src/lj_ccallback.h b/vendor/luajit/src/lj_ccallback.h index 45b5ff02d..83dbe048b 100644 --- a/vendor/luajit/src/lj_ccallback.h +++ b/vendor/luajit/src/lj_ccallback.h @@ -1,6 +1,6 @@ /* ** FFI C callback handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_CCALLBACK_H diff --git a/vendor/luajit/src/lj_cconv.c b/vendor/luajit/src/lj_cconv.c index de4938e4f..8a270766f 100644 --- a/vendor/luajit/src/lj_cconv.c +++ b/vendor/luajit/src/lj_cconv.c @@ -1,6 +1,6 @@ /* ** C type conversions. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #include "lj_obj.h" @@ -702,6 +702,7 @@ static void cconv_substruct_init(CTState *cts, CType *d, uint8_t *dp, } else if (ctype_isxattrib(df->info, CTA_SUBTYPE)) { cconv_substruct_init(cts, ctype_rawchild(cts, df), dp+df->size, o, len, ip); + if ((d->info & CTF_UNION)) break; } /* Ignore all other entries in the chain. */ } } diff --git a/vendor/luajit/src/lj_cconv.h b/vendor/luajit/src/lj_cconv.h index 17e0f050e..2bd50ff46 100644 --- a/vendor/luajit/src/lj_cconv.h +++ b/vendor/luajit/src/lj_cconv.h @@ -1,6 +1,6 @@ /* ** C type conversions. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_CCONV_H diff --git a/vendor/luajit/src/lj_cdata.c b/vendor/luajit/src/lj_cdata.c index 590ddf106..39fc13a9f 100644 --- a/vendor/luajit/src/lj_cdata.c +++ b/vendor/luajit/src/lj_cdata.c @@ -1,6 +1,6 @@ /* ** C data management. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #include "lj_obj.h" @@ -127,16 +127,16 @@ collect_attrib: integer_key: if (ctype_ispointer(ct->info)) { CTSize sz = lj_ctype_size(cts, ctype_cid(ct->info)); /* Element size. */ - if (sz != CTSIZE_INVALID) { - if (ctype_isptr(ct->info)) { - p = (uint8_t *)cdata_getptr(p, ct->size); - } else if ((ct->info & (CTF_VECTOR|CTF_COMPLEX))) { - if ((ct->info & CTF_COMPLEX)) idx &= 1; - *qual |= CTF_CONST; /* Valarray elements are constant. */ - } - *pp = p + idx*(int32_t)sz; - return ct; + if (sz == CTSIZE_INVALID) + lj_err_caller(cts->L, LJ_ERR_FFI_INVSIZE); + if (ctype_isptr(ct->info)) { + p = (uint8_t *)cdata_getptr(p, ct->size); + } else if ((ct->info & (CTF_VECTOR|CTF_COMPLEX))) { + if ((ct->info & CTF_COMPLEX)) idx &= 1; + *qual |= CTF_CONST; /* Valarray elements are constant. */ } + *pp = p + idx*(int32_t)sz; + return ct; } } else if (tviscdata(key)) { /* Integer cdata key. */ GCcdata *cdk = cdataV(key); diff --git a/vendor/luajit/src/lj_cdata.h b/vendor/luajit/src/lj_cdata.h index 6c8e7a1ad..3a1275e6c 100644 --- a/vendor/luajit/src/lj_cdata.h +++ b/vendor/luajit/src/lj_cdata.h @@ -1,6 +1,6 @@ /* ** C data management. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_CDATA_H diff --git a/vendor/luajit/src/lj_clib.c b/vendor/luajit/src/lj_clib.c index ccb99e55a..d35260909 100644 --- a/vendor/luajit/src/lj_clib.c +++ b/vendor/luajit/src/lj_clib.c @@ -1,6 +1,6 @@ /* ** FFI C library loader. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #include "lj_obj.h" diff --git a/vendor/luajit/src/lj_clib.h b/vendor/luajit/src/lj_clib.h index 473732882..e5dc98e1c 100644 --- a/vendor/luajit/src/lj_clib.h +++ b/vendor/luajit/src/lj_clib.h @@ -1,6 +1,6 @@ /* ** FFI C library loader. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_CLIB_H diff --git a/vendor/luajit/src/lj_cparse.c b/vendor/luajit/src/lj_cparse.c index 6ffe16a2f..b9df88d77 100644 --- a/vendor/luajit/src/lj_cparse.c +++ b/vendor/luajit/src/lj_cparse.c @@ -1,6 +1,6 @@ /* ** C declaration parser. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #include "lj_obj.h" diff --git a/vendor/luajit/src/lj_cparse.h b/vendor/luajit/src/lj_cparse.h index 586f49456..441580de6 100644 --- a/vendor/luajit/src/lj_cparse.h +++ b/vendor/luajit/src/lj_cparse.h @@ -1,6 +1,6 @@ /* ** C declaration parser. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_CPARSE_H diff --git a/vendor/luajit/src/lj_crecord.c b/vendor/luajit/src/lj_crecord.c index da9013f0c..a46665e9a 100644 --- a/vendor/luajit/src/lj_crecord.c +++ b/vendor/luajit/src/lj_crecord.c @@ -1,6 +1,6 @@ /* ** Trace recorder for C data operations. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_ffrecord_c @@ -794,7 +794,7 @@ again: } } else if (tref_isstr(idx)) { GCstr *name = strV(&rd->argv[1]); - if (cd->ctypeid == CTID_CTYPEID) + if (cd && cd->ctypeid == CTID_CTYPEID) ct = ctype_raw(cts, crec_constructor(J, cd, ptr)); if (ctype_isstruct(ct->info)) { CTSize fofs; @@ -835,6 +835,7 @@ again: CType *cct = ctype_rawchild(cts, ct); if (ctype_isstruct(cct->info)) { ct = cct; + cd = NULL; if (tref_isstr(idx)) goto again; } } @@ -847,8 +848,11 @@ again: /* Resolve reference for field. */ ct = ctype_get(cts, sid); - if (ctype_isref(ct->info)) + if (ctype_isref(ct->info)) { ptr = emitir(IRT(IR_XLOAD, IRT_PTR), ptr, 0); + sid = ctype_cid(ct->info); + ct = ctype_get(cts, sid); + } while (ctype_isattrib(ct->info)) ct = ctype_child(cts, ct); /* Skip attributes. */ @@ -1317,7 +1321,8 @@ static TRef crec_arith_ptr(jit_State *J, TRef *sp, CType **s, MMS mm) } /* Record ctype arithmetic metamethods. */ -static void crec_arith_meta(jit_State *J, CTState *cts, RecordFFData *rd) +static TRef crec_arith_meta(jit_State *J, TRef *sp, CType **s, CTState *cts, + RecordFFData *rd) { cTValue *tv = NULL; if (J->base[0]) { @@ -1338,13 +1343,20 @@ static void crec_arith_meta(jit_State *J, CTState *cts, RecordFFData *rd) if (tvisfunc(tv)) { J->base[-1] = lj_ir_kfunc(J, funcV(tv)) | TREF_FRAME; rd->nres = -1; /* Pending tailcall. */ - return; + return 0; } /* NYI: non-function metamethods. */ - } else if ((MMS)rd->data == MM_eq) { - J->base[0] = TREF_FALSE; - return; + } else if ((MMS)rd->data == MM_eq) { /* Fallback cdata pointer comparison. */ + if (sp[0] && sp[1] && ctype_isnum(s[0]->info) == ctype_isnum(s[1]->info)) { + /* Assume true comparison. Fixup and emit pending guard later. */ + lj_ir_set(J, IRTG(IR_EQ, IRT_PTR), sp[0], sp[1]); + J->postproc = LJ_POST_FIXGUARD; + return TREF_TRUE; + } else { + return TREF_FALSE; + } } lj_trace_err(J, LJ_TRERR_BADTYPE); + return 0; } void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd) @@ -1357,7 +1369,7 @@ void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd) TRef tr = J->base[i]; CType *ct = ctype_get(cts, CTID_DOUBLE); if (!tr) { - goto trymeta; + lj_trace_err(J, LJ_TRERR_BADTYPE); } else if (tref_iscdata(tr)) { CTypeID id = argv2cdata(J, tr, &rd->argv[i])->ctypeid; IRType t; @@ -1387,11 +1399,12 @@ void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd) } if (ctype_isenum(ct->info)) ct = ctype_child(cts, ct); if (ctype_isnum(ct->info)) { - if (t == IRT_CDATA) goto trymeta; - if (t == IRT_I64 || t == IRT_U64) lj_needsplit(J); - tr = emitir(IRT(IR_XLOAD, t), tr, 0); - } else if (!(ctype_isptr(ct->info) || ctype_isrefarray(ct->info))) { - goto trymeta; + if (t == IRT_CDATA) { + tr = 0; + } else { + if (t == IRT_I64 || t == IRT_U64) lj_needsplit(J); + tr = emitir(IRT(IR_XLOAD, t), tr, 0); + } } } else if (tref_isnil(tr)) { tr = lj_ir_kptr(J, NULL); @@ -1411,10 +1424,17 @@ void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd) emitir(IRTG(IR_EQ, IRT_STR), tr, lj_ir_kstr(J, str)); ct = ctype_child(cts, cct); tr = lj_ir_kint(J, (int32_t)ofs); - } /* else: interpreter will throw. */ - } /* else: interpreter will throw. */ + } else { /* Interpreter will throw or return false. */ + ct = ctype_get(cts, CTID_P_VOID); + } + } else if (ctype_isptr(ct->info)) { + tr = emitir(IRT(IR_ADD, IRT_PTR), tr, lj_ir_kintp(J, sizeof(GCstr))); + } else { + ct = ctype_get(cts, CTID_P_VOID); + } } else if (!tref_isnum(tr)) { - goto trymeta; + tr = 0; + ct = ctype_get(cts, CTID_P_VOID); } ok: s[i] = ct; @@ -1422,22 +1442,20 @@ void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd) } { TRef tr; - if ((tr = crec_arith_int64(J, sp, s, (MMS)rd->data)) || - (tr = crec_arith_ptr(J, sp, s, (MMS)rd->data))) { - J->base[0] = tr; - /* Fixup cdata comparisons, too. Avoids some cdata escapes. */ - if (J->postproc == LJ_POST_FIXGUARD && frame_iscont(J->L->base-1) && - !irt_isguard(J->guardemit)) { - const BCIns *pc = frame_contpc(J->L->base-1) - 1; - if (bc_op(*pc) <= BC_ISNEP) { - setframe_pc(&J2G(J)->tmptv, pc); - J2G(J)->tmptv.u32.lo = ((tref_istrue(tr) ^ bc_op(*pc)) & 1); - J->postproc = LJ_POST_FIXCOMP; - } + if (!(tr = crec_arith_int64(J, sp, s, (MMS)rd->data)) && + !(tr = crec_arith_ptr(J, sp, s, (MMS)rd->data)) && + !(tr = crec_arith_meta(J, sp, s, cts, rd))) + return; + J->base[0] = tr; + /* Fixup cdata comparisons, too. Avoids some cdata escapes. */ + if (J->postproc == LJ_POST_FIXGUARD && frame_iscont(J->L->base-1) && + !irt_isguard(J->guardemit)) { + const BCIns *pc = frame_contpc(J->L->base-1) - 1; + if (bc_op(*pc) <= BC_ISNEP) { + setframe_pc(&J2G(J)->tmptv, pc); + J2G(J)->tmptv.u32.lo = ((tref_istrue(tr) ^ bc_op(*pc)) & 1); + J->postproc = LJ_POST_FIXCOMP; } - } else { - trymeta: - crec_arith_meta(J, cts, rd); } } } diff --git a/vendor/luajit/src/lj_crecord.h b/vendor/luajit/src/lj_crecord.h index fb77ca608..a4628caca 100644 --- a/vendor/luajit/src/lj_crecord.h +++ b/vendor/luajit/src/lj_crecord.h @@ -1,6 +1,6 @@ /* ** Trace recorder for C data operations. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_CRECORD_H diff --git a/vendor/luajit/src/lj_ctype.c b/vendor/luajit/src/lj_ctype.c index e9fe0943f..ac3017494 100644 --- a/vendor/luajit/src/lj_ctype.c +++ b/vendor/luajit/src/lj_ctype.c @@ -1,6 +1,6 @@ /* ** C type management. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #include "lj_obj.h" diff --git a/vendor/luajit/src/lj_ctype.h b/vendor/luajit/src/lj_ctype.h index ff8ee069b..3df26f095 100644 --- a/vendor/luajit/src/lj_ctype.h +++ b/vendor/luajit/src/lj_ctype.h @@ -1,6 +1,6 @@ /* ** C type management. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_CTYPE_H diff --git a/vendor/luajit/src/lj_debug.c b/vendor/luajit/src/lj_debug.c index 4653a4ec1..bd2fa1f56 100644 --- a/vendor/luajit/src/lj_debug.c +++ b/vendor/luajit/src/lj_debug.c @@ -1,6 +1,6 @@ /* ** Debugging and introspection. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_debug_c @@ -14,6 +14,7 @@ #include "lj_state.h" #include "lj_frame.h" #include "lj_bc.h" +#include "lj_vm.h" #if LJ_HASJIT #include "lj_jit.h" #endif @@ -86,7 +87,8 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe) if (frame_islua(f)) { f = frame_prevl(f); } else { - if (frame_isc(f)) + if (frame_isc(f) || (LJ_HASFFI && frame_iscont(f) && + (f-1)->u32.lo == LJ_CONT_FFI_CALLBACK)) cf = cframe_raw(cframe_prev(cf)); f = frame_prevd(f); } @@ -463,7 +465,7 @@ int lj_debug_getinfo(lua_State *L, const char *what, lj_Debug *ar, int ext) lj_debug_shortname(ar->short_src, name); ar->linedefined = (int)firstline; ar->lastlinedefined = (int)(firstline + pt->numline); - ar->what = firstline ? "Lua" : "main"; + ar->what = (firstline || !pt->numline) ? "Lua" : "main"; } else { ar->source = "=[C]"; ar->short_src[0] = '['; diff --git a/vendor/luajit/src/lj_debug.h b/vendor/luajit/src/lj_debug.h index bec6b4f35..fa8988c3e 100644 --- a/vendor/luajit/src/lj_debug.h +++ b/vendor/luajit/src/lj_debug.h @@ -1,6 +1,6 @@ /* ** Debugging and introspection. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_DEBUG_H diff --git a/vendor/luajit/src/lj_def.h b/vendor/luajit/src/lj_def.h index 3c43be788..e666c9e30 100644 --- a/vendor/luajit/src/lj_def.h +++ b/vendor/luajit/src/lj_def.h @@ -1,6 +1,6 @@ /* ** LuaJIT common internal definitions. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_DEF_H @@ -111,7 +111,7 @@ typedef uintptr_t BloomFilter; #define bloomset(b, x) ((b) |= bloombit((x))) #define bloomtest(b, x) ((b) & bloombit((x))) -#if defined(__GNUC__) +#if defined(__GNUC__) || defined(__psp2__) #define LJ_NORET __attribute__((noreturn)) #define LJ_ALIGN(n) __attribute__((aligned(n))) @@ -119,7 +119,7 @@ typedef uintptr_t BloomFilter; #define LJ_AINLINE inline __attribute__((always_inline)) #define LJ_NOINLINE __attribute__((noinline)) -#if defined(__ELF__) || defined(__MACH__) +#if defined(__ELF__) || defined(__MACH__) || defined(__psp2__) #if !((defined(__sun__) && defined(__svr4__)) || defined(__CELLOS_LV2__)) #define LJ_NOAPI extern __attribute__((visibility("hidden"))) #endif @@ -150,6 +150,9 @@ static LJ_AINLINE uint32_t lj_fls(uint32_t x) #if defined(__arm__) static LJ_AINLINE uint32_t lj_bswap(uint32_t x) { +#if defined(__psp2__) + return __builtin_rev(x); +#else uint32_t r; #if __ARM_ARCH_6__ || __ARM_ARCH_6J__ || __ARM_ARCH_6T2__ || __ARM_ARCH_6Z__ ||\ __ARM_ARCH_6ZK__ || __ARM_ARCH_7__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ @@ -163,6 +166,7 @@ static LJ_AINLINE uint32_t lj_bswap(uint32_t x) #endif return ((r & 0xff00ffffu) >> 8) ^ lj_ror(x, 8); #endif +#endif } static LJ_AINLINE uint64_t lj_bswap64(uint64_t x) diff --git a/vendor/luajit/src/lj_dispatch.c b/vendor/luajit/src/lj_dispatch.c index 58d6c3e2b..37256576e 100644 --- a/vendor/luajit/src/lj_dispatch.c +++ b/vendor/luajit/src/lj_dispatch.c @@ -1,6 +1,6 @@ /* ** Instruction dispatch handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_dispatch_c diff --git a/vendor/luajit/src/lj_dispatch.h b/vendor/luajit/src/lj_dispatch.h index 5960e64a6..778affc8c 100644 --- a/vendor/luajit/src/lj_dispatch.h +++ b/vendor/luajit/src/lj_dispatch.h @@ -1,6 +1,6 @@ /* ** Instruction dispatch handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_DISPATCH_H diff --git a/vendor/luajit/src/lj_emit_arm.h b/vendor/luajit/src/lj_emit_arm.h index 3bac3679a..8c5e5379c 100644 --- a/vendor/luajit/src/lj_emit_arm.h +++ b/vendor/luajit/src/lj_emit_arm.h @@ -1,6 +1,6 @@ /* ** ARM instruction emitter. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ /* -- Constant encoding --------------------------------------------------- */ diff --git a/vendor/luajit/src/lj_emit_mips.h b/vendor/luajit/src/lj_emit_mips.h index dc9197ad8..0fc07d910 100644 --- a/vendor/luajit/src/lj_emit_mips.h +++ b/vendor/luajit/src/lj_emit_mips.h @@ -1,6 +1,6 @@ /* ** MIPS instruction emitter. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ /* -- Emit basic instructions --------------------------------------------- */ diff --git a/vendor/luajit/src/lj_emit_ppc.h b/vendor/luajit/src/lj_emit_ppc.h index 3a2ae3894..14edf00fd 100644 --- a/vendor/luajit/src/lj_emit_ppc.h +++ b/vendor/luajit/src/lj_emit_ppc.h @@ -1,6 +1,6 @@ /* ** PPC instruction emitter. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ /* -- Emit basic instructions --------------------------------------------- */ diff --git a/vendor/luajit/src/lj_emit_x86.h b/vendor/luajit/src/lj_emit_x86.h index 8cfb654f3..3a2f6510b 100644 --- a/vendor/luajit/src/lj_emit_x86.h +++ b/vendor/luajit/src/lj_emit_x86.h @@ -1,6 +1,6 @@ /* ** x86/x64 instruction emitter. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ /* -- Emit basic instructions --------------------------------------------- */ diff --git a/vendor/luajit/src/lj_err.c b/vendor/luajit/src/lj_err.c index db1826733..081bfde4a 100644 --- a/vendor/luajit/src/lj_err.c +++ b/vendor/luajit/src/lj_err.c @@ -1,6 +1,6 @@ /* ** Error handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_err_c @@ -378,7 +378,7 @@ typedef struct UndocumentedDispatcherContext { ULONG64 EstablisherFrame; ULONG64 TargetIp; PCONTEXT ContextRecord; - PEXCEPTION_ROUTINE LanguageHandler; + void (*LanguageHandler)(void); PVOID HandlerData; PUNWIND_HISTORY_TABLE HistoryTable; ULONG ScopeIndex; @@ -499,8 +499,7 @@ static ptrdiff_t finderrfunc(lua_State *L) { cTValue *frame = L->base-1, *bot = tvref(L->stack); void *cf = L->cframe; - while (frame > bot) { - lua_assert(cf != NULL); + while (frame > bot && cf) { while (cframe_nres(cframe_raw(cf)) < 0) { /* cframe without frame? */ if (frame >= restorestack(L, -cframe_nres(cf))) break; @@ -518,12 +517,14 @@ static ptrdiff_t finderrfunc(lua_State *L) case FRAME_C: cf = cframe_prev(cf); /* fallthrough */ + case FRAME_VARG: + frame = frame_prevd(frame); + break; case FRAME_CONT: #if LJ_HASFFI if ((frame-1)->u32.lo == LJ_CONT_FFI_CALLBACK) cf = cframe_prev(cf); #endif - case FRAME_VARG: frame = frame_prevd(frame); break; case FRAME_CP: @@ -725,9 +726,23 @@ LJ_NOINLINE void lj_err_arg(lua_State *L, int narg, ErrMsg em) /* Typecheck error for arguments. */ LJ_NOINLINE void lj_err_argtype(lua_State *L, int narg, const char *xname) { - TValue *o = narg < 0 ? L->top + narg : L->base + narg-1; - const char *tname = o < L->top ? lj_typename(o) : lj_obj_typename[0]; - const char *msg = lj_str_pushf(L, err2msg(LJ_ERR_BADTYPE), xname, tname); + const char *tname, *msg; + if (narg <= LUA_REGISTRYINDEX) { + if (narg >= LUA_GLOBALSINDEX) { + tname = lj_obj_itypename[~LJ_TTAB]; + } else { + GCfunc *fn = curr_func(L); + int idx = LUA_GLOBALSINDEX - narg; + if (idx <= fn->c.nupvalues) + tname = lj_typename(&fn->c.upvalue[idx-1]); + else + tname = lj_obj_typename[0]; + } + } else { + TValue *o = narg < 0 ? L->top + narg : L->base + narg-1; + tname = o < L->top ? lj_typename(o) : lj_obj_typename[0]; + } + msg = lj_str_pushf(L, err2msg(LJ_ERR_BADTYPE), xname, tname); err_argmsg(L, narg, msg); } diff --git a/vendor/luajit/src/lj_err.h b/vendor/luajit/src/lj_err.h index 7ea512a34..03a56f036 100644 --- a/vendor/luajit/src/lj_err.h +++ b/vendor/luajit/src/lj_err.h @@ -1,6 +1,6 @@ /* ** Error handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_ERR_H diff --git a/vendor/luajit/src/lj_errmsg.h b/vendor/luajit/src/lj_errmsg.h index 137831eb3..1c9487607 100644 --- a/vendor/luajit/src/lj_errmsg.h +++ b/vendor/luajit/src/lj_errmsg.h @@ -1,6 +1,6 @@ /* ** VM error messages. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ /* This file may be included multiple times with different ERRDEF macros. */ diff --git a/vendor/luajit/src/lj_ff.h b/vendor/luajit/src/lj_ff.h index d91a7395b..73dad9695 100644 --- a/vendor/luajit/src/lj_ff.h +++ b/vendor/luajit/src/lj_ff.h @@ -1,6 +1,6 @@ /* ** Fast function IDs. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_FF_H diff --git a/vendor/luajit/src/lj_ffrecord.c b/vendor/luajit/src/lj_ffrecord.c index 794bbd43c..69f71ab2e 100644 --- a/vendor/luajit/src/lj_ffrecord.c +++ b/vendor/luajit/src/lj_ffrecord.c @@ -1,6 +1,6 @@ /* ** Fast function call recorder. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_ffrecord_c diff --git a/vendor/luajit/src/lj_ffrecord.h b/vendor/luajit/src/lj_ffrecord.h index b3bc66279..f858ca29c 100644 --- a/vendor/luajit/src/lj_ffrecord.h +++ b/vendor/luajit/src/lj_ffrecord.h @@ -1,6 +1,6 @@ /* ** Fast function call recorder. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_FFRECORD_H diff --git a/vendor/luajit/src/lj_frame.h b/vendor/luajit/src/lj_frame.h index fb533b0e5..cd57be223 100644 --- a/vendor/luajit/src/lj_frame.h +++ b/vendor/luajit/src/lj_frame.h @@ -1,6 +1,6 @@ /* ** Stack frames. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_FRAME_H diff --git a/vendor/luajit/src/lj_func.c b/vendor/luajit/src/lj_func.c index 9a59b0f0c..eb8a9dbbf 100644 --- a/vendor/luajit/src/lj_func.c +++ b/vendor/luajit/src/lj_func.c @@ -1,6 +1,6 @@ /* ** Function handling (prototypes, functions and upvalues). -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Portions taken verbatim or adapted from the Lua interpreter. ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h diff --git a/vendor/luajit/src/lj_func.h b/vendor/luajit/src/lj_func.h index 88732e83e..a6e534e77 100644 --- a/vendor/luajit/src/lj_func.h +++ b/vendor/luajit/src/lj_func.h @@ -1,6 +1,6 @@ /* ** Function handling (prototypes, functions and upvalues). -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_FUNC_H diff --git a/vendor/luajit/src/lj_gc.c b/vendor/luajit/src/lj_gc.c index c2bc397d4..b498abaa8 100644 --- a/vendor/luajit/src/lj_gc.c +++ b/vendor/luajit/src/lj_gc.c @@ -1,6 +1,6 @@ /* ** Garbage collector. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Major portions taken verbatim or adapted from the Lua interpreter. ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h @@ -631,6 +631,8 @@ static size_t gc_onestep(lua_State *L) case GCSsweep: { MSize old = g->gc.total; setmref(g->gc.sweep, gc_sweep(g, mref(g->gc.sweep, GCRef), GCSWEEPMAX)); + lua_assert(old >= g->gc.total); + g->gc.estimate -= old - g->gc.total; if (gcref(*mref(g->gc.sweep, GCRef)) == NULL) { gc_shrink(g, L); if (gcref(g->gc.mmudata)) { /* Need any finalizations? */ @@ -643,8 +645,6 @@ static size_t gc_onestep(lua_State *L) g->gc.debt = 0; } } - lua_assert(old >= g->gc.total); - g->gc.estimate -= old - g->gc.total; return GCSWEEPMAX*GCSWEEPCOST; } case GCSfinalize: diff --git a/vendor/luajit/src/lj_gc.h b/vendor/luajit/src/lj_gc.h index c85d0756b..ba061bc5d 100644 --- a/vendor/luajit/src/lj_gc.h +++ b/vendor/luajit/src/lj_gc.h @@ -1,6 +1,6 @@ /* ** Garbage collector. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_GC_H diff --git a/vendor/luajit/src/lj_gdbjit.c b/vendor/luajit/src/lj_gdbjit.c index 5e7fca1c1..d3f3e6119 100644 --- a/vendor/luajit/src/lj_gdbjit.c +++ b/vendor/luajit/src/lj_gdbjit.c @@ -1,6 +1,6 @@ /* ** Client for the GDB JIT API. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_gdbjit_c @@ -356,6 +356,8 @@ static const ELFheader elfhdr_template = { .eosabi = 2, #elif defined(__OpenBSD__) .eosabi = 12, +#elif defined(__DragonFly__) + .eosabi = 0, #elif (defined(__sun__) && defined(__svr4__)) .eosabi = 6, #else diff --git a/vendor/luajit/src/lj_gdbjit.h b/vendor/luajit/src/lj_gdbjit.h index 9ae504fc5..49c586301 100644 --- a/vendor/luajit/src/lj_gdbjit.h +++ b/vendor/luajit/src/lj_gdbjit.h @@ -1,6 +1,6 @@ /* ** Client for the GDB JIT API. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_GDBJIT_H diff --git a/vendor/luajit/src/lj_ir.c b/vendor/luajit/src/lj_ir.c index b2170a10e..439f3fc34 100644 --- a/vendor/luajit/src/lj_ir.c +++ b/vendor/luajit/src/lj_ir.c @@ -1,6 +1,6 @@ /* ** SSA IR (Intermediate Representation) emitter. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_ir_c diff --git a/vendor/luajit/src/lj_ir.h b/vendor/luajit/src/lj_ir.h index 80763d88e..8126482e8 100644 --- a/vendor/luajit/src/lj_ir.h +++ b/vendor/luajit/src/lj_ir.h @@ -1,6 +1,6 @@ /* ** SSA IR (Intermediate Representation) format. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_IR_H diff --git a/vendor/luajit/src/lj_ircall.h b/vendor/luajit/src/lj_ircall.h index af30ba8fc..893dac2f8 100644 --- a/vendor/luajit/src/lj_ircall.h +++ b/vendor/luajit/src/lj_ircall.h @@ -1,6 +1,6 @@ /* ** IR CALL* instruction definitions. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_IRCALL_H @@ -86,6 +86,12 @@ typedef struct CCallInfo { #define IRCALLCOND_FFI32(x) NULL #endif +#if LJ_TARGET_X86 +#define CCI_RANDFPR 0 /* Clang on OSX/x86 is overzealous. */ +#else +#define CCI_RANDFPR CCI_NOFPRCLOBBER +#endif + #if LJ_SOFTFP #define ARG1_FP 2 /* Treat as 2 32 bit arguments. */ #else @@ -112,7 +118,7 @@ typedef struct CCallInfo { _(ANY, lj_gc_step_jit, 2, FS, NIL, CCI_L) \ _(ANY, lj_gc_barrieruv, 2, FS, NIL, 0) \ _(ANY, lj_mem_newgco, 2, FS, P32, CCI_L) \ - _(ANY, lj_math_random_step, 1, FS, NUM, CCI_CASTU64|CCI_NOFPRCLOBBER) \ + _(ANY, lj_math_random_step, 1, FS, NUM, CCI_CASTU64|CCI_RANDFPR)\ _(ANY, lj_vm_modi, 2, FN, INT, 0) \ _(ANY, sinh, ARG1_FP, N, NUM, 0) \ _(ANY, cosh, ARG1_FP, N, NUM, 0) \ diff --git a/vendor/luajit/src/lj_iropt.h b/vendor/luajit/src/lj_iropt.h index e45ae2b7b..4e424e700 100644 --- a/vendor/luajit/src/lj_iropt.h +++ b/vendor/luajit/src/lj_iropt.h @@ -1,6 +1,6 @@ /* ** Common header for IR emitter and optimizations. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_IROPT_H diff --git a/vendor/luajit/src/lj_jit.h b/vendor/luajit/src/lj_jit.h index b69e4f4ef..eb7654770 100644 --- a/vendor/luajit/src/lj_jit.h +++ b/vendor/luajit/src/lj_jit.h @@ -1,6 +1,6 @@ /* ** Common definitions for the JIT compiler. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_JIT_H @@ -279,6 +279,7 @@ typedef struct BPropEntry { /* Scalar evolution analysis cache. */ typedef struct ScEvEntry { + MRef pc; /* Bytecode PC of FORI. */ IRRef1 idx; /* Index reference. */ IRRef1 start; /* Constant start reference. */ IRRef1 stop; /* Constant stop reference. */ diff --git a/vendor/luajit/src/lj_lex.c b/vendor/luajit/src/lj_lex.c index 4fa39313f..e1dc3cdfd 100644 --- a/vendor/luajit/src/lj_lex.c +++ b/vendor/luajit/src/lj_lex.c @@ -1,6 +1,6 @@ /* ** Lexical analyzer. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Major portions taken verbatim or adapted from the Lua interpreter. ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h @@ -378,6 +378,7 @@ int lj_lex_setup(lua_State *L, LexState *ls) ls->vtop = 0; ls->bcstack = NULL; ls->sizebcstack = 0; + ls->token = 0; ls->lookahead = TK_eof; /* No look-ahead token. */ ls->linenumber = 1; ls->lastline = 1; diff --git a/vendor/luajit/src/lj_lex.h b/vendor/luajit/src/lj_lex.h index a7ff29a01..fe0176864 100644 --- a/vendor/luajit/src/lj_lex.h +++ b/vendor/luajit/src/lj_lex.h @@ -1,6 +1,6 @@ /* ** Lexical analyzer. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_LEX_H diff --git a/vendor/luajit/src/lj_lib.c b/vendor/luajit/src/lj_lib.c index 76c8a064a..856685ee3 100644 --- a/vendor/luajit/src/lj_lib.c +++ b/vendor/luajit/src/lj_lib.c @@ -1,6 +1,6 @@ /* ** Library function support. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_lib_c diff --git a/vendor/luajit/src/lj_lib.h b/vendor/luajit/src/lj_lib.h index daacb9213..9320f34fd 100644 --- a/vendor/luajit/src/lj_lib.h +++ b/vendor/luajit/src/lj_lib.h @@ -1,6 +1,6 @@ /* ** Library function support. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_LIB_H diff --git a/vendor/luajit/src/lj_load.c b/vendor/luajit/src/lj_load.c index edfdc9037..ff7b85117 100644 --- a/vendor/luajit/src/lj_load.c +++ b/vendor/luajit/src/lj_load.c @@ -1,6 +1,6 @@ /* ** Load and dump code. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #include diff --git a/vendor/luajit/src/lj_mcode.c b/vendor/luajit/src/lj_mcode.c index 5a7329607..d95ebeb1f 100644 --- a/vendor/luajit/src/lj_mcode.c +++ b/vendor/luajit/src/lj_mcode.c @@ -1,6 +1,6 @@ /* ** Machine code management. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_mcode_c @@ -145,7 +145,7 @@ static void mcode_free(jit_State *J, void *p, size_t sz) /* -- MCode area protection ----------------------------------------------- */ -/* Define this ONLY if the page protection twiddling becomes a bottleneck. */ +/* Define this ONLY if page protection twiddling becomes a bottleneck. */ #ifdef LUAJIT_UNPROTECT_MCODE /* It's generally considered to be a potential security risk to have @@ -252,7 +252,20 @@ static void *mcode_alloc(jit_State *J, size_t sz) #else /* All memory addresses are reachable by relative jumps. */ -#define mcode_alloc(J, sz) mcode_alloc_at((J), 0, (sz), MCPROT_GEN) +static void *mcode_alloc(jit_State *J, size_t sz) +{ +#ifdef __OpenBSD__ + /* Allow better executable memory allocation for OpenBSD W^X mode. */ + void *p = mcode_alloc_at(J, 0, sz, MCPROT_RUN); + if (p && mcode_setprot(p, sz, MCPROT_GEN)) { + mcode_free(J, p, sz); + return NULL; + } + return p; +#else + return mcode_alloc_at(J, 0, sz, MCPROT_GEN); +#endif +} #endif diff --git a/vendor/luajit/src/lj_mcode.h b/vendor/luajit/src/lj_mcode.h index 89344fc73..ee6045234 100644 --- a/vendor/luajit/src/lj_mcode.h +++ b/vendor/luajit/src/lj_mcode.h @@ -1,6 +1,6 @@ /* ** Machine code management. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_MCODE_H diff --git a/vendor/luajit/src/lj_meta.c b/vendor/luajit/src/lj_meta.c index 0a5266710..faaaf7026 100644 --- a/vendor/luajit/src/lj_meta.c +++ b/vendor/luajit/src/lj_meta.c @@ -1,6 +1,6 @@ /* ** Metamethod handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Portions taken verbatim or adapted from the Lua interpreter. ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h diff --git a/vendor/luajit/src/lj_meta.h b/vendor/luajit/src/lj_meta.h index 8d7c2cd41..2c1ad0dd9 100644 --- a/vendor/luajit/src/lj_meta.h +++ b/vendor/luajit/src/lj_meta.h @@ -1,6 +1,6 @@ /* ** Metamethod handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_META_H diff --git a/vendor/luajit/src/lj_obj.c b/vendor/luajit/src/lj_obj.c index c7f3bc121..7fab714e5 100644 --- a/vendor/luajit/src/lj_obj.c +++ b/vendor/luajit/src/lj_obj.c @@ -1,6 +1,6 @@ /* ** Miscellaneous object handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_obj_c diff --git a/vendor/luajit/src/lj_obj.h b/vendor/luajit/src/lj_obj.h index cc999aa41..6e8381cba 100644 --- a/vendor/luajit/src/lj_obj.h +++ b/vendor/luajit/src/lj_obj.h @@ -1,6 +1,6 @@ /* ** LuaJIT VM tags, values and objects. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Portions taken verbatim or adapted from the Lua interpreter. ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h diff --git a/vendor/luajit/src/lj_opt_dce.c b/vendor/luajit/src/lj_opt_dce.c index be8018947..7f1faafe6 100644 --- a/vendor/luajit/src/lj_opt_dce.c +++ b/vendor/luajit/src/lj_opt_dce.c @@ -1,6 +1,6 @@ /* ** DCE: Dead Code Elimination. Pre-LOOP only -- ASM already performs DCE. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_opt_dce_c @@ -69,6 +69,7 @@ void lj_opt_dce(jit_State *J) if ((J->flags & JIT_F_OPT_DCE)) { dce_marksnap(J); dce_propagate(J); + memset(J->bpropcache, 0, sizeof(J->bpropcache)); /* Invalidate cache. */ } } diff --git a/vendor/luajit/src/lj_opt_fold.c b/vendor/luajit/src/lj_opt_fold.c index 8a5b41cc2..d00fdd56f 100644 --- a/vendor/luajit/src/lj_opt_fold.c +++ b/vendor/luajit/src/lj_opt_fold.c @@ -2,7 +2,7 @@ ** FOLD: Constant Folding, Algebraic Simplifications and Reassociation. ** ABCelim: Array Bounds Check Elimination. ** CSE: Common-Subexpression Elimination. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_opt_fold_c @@ -505,13 +505,14 @@ LJFOLDF(kfold_strref_snew) } else { /* Reassociate: strref(snew(strref(str, a), len), b) ==> strref(str, a+b) */ IRIns *ir = IR(fleft->op1); - IRRef1 str = ir->op1; /* IRIns * is not valid across emitir. */ - lua_assert(ir->o == IR_STRREF); - PHIBARRIER(ir); - fins->op2 = emitir(IRTI(IR_ADD), ir->op2, fins->op2); /* Clobbers fins! */ - fins->op1 = str; - fins->ot = IRT(IR_STRREF, IRT_P32); - return RETRYFOLD; + if (ir->o == IR_STRREF) { + IRRef1 str = ir->op1; /* IRIns * is not valid across emitir. */ + PHIBARRIER(ir); + fins->op2 = emitir(IRTI(IR_ADD), ir->op2, fins->op2); /* Clobbers fins! */ + fins->op1 = str; + fins->ot = IRT(IR_STRREF, IRT_P32); + return RETRYFOLD; + } } return NEXTFOLD; } @@ -1005,11 +1006,16 @@ LJFOLDF(simplify_conv_flt_num) LJFOLD(TOBIT CONV KNUM) LJFOLDF(simplify_tobit_conv) { - if ((fleft->op2 & IRCONV_SRCMASK) == IRT_INT || - (fleft->op2 & IRCONV_SRCMASK) == IRT_U32) { - /* Fold even across PHI to avoid expensive num->int conversions in loop. */ + /* Fold even across PHI to avoid expensive num->int conversions in loop. */ + if ((fleft->op2 & IRCONV_SRCMASK) == IRT_INT) { lua_assert(irt_isnum(fleft->t)); return fleft->op1; + } else if ((fleft->op2 & IRCONV_SRCMASK) == IRT_U32) { + lua_assert(irt_isnum(fleft->t)); + fins->o = IR_CONV; + fins->op1 = fleft->op1; + fins->op2 = (IRT_INT<<5)|IRT_U32; + return RETRYFOLD; } return NEXTFOLD; } @@ -1825,7 +1831,8 @@ LJFOLDF(merge_eqne_snew_kgc) if (len <= FOLD_SNEW_MAX_LEN) { IROp op = (IROp)fins->o; IRRef strref = fleft->op1; - lua_assert(IR(strref)->o == IR_STRREF); + if (IR(strref)->o != IR_STRREF) + return NEXTFOLD; if (op == IR_EQ) { emitir(IRTGI(IR_EQ), fleft->op2, lj_ir_kint(J, len)); /* Caveat: fins/fleft/fright is no longer valid after emitir. */ diff --git a/vendor/luajit/src/lj_opt_loop.c b/vendor/luajit/src/lj_opt_loop.c index fa001151a..b7d1923ed 100644 --- a/vendor/luajit/src/lj_opt_loop.c +++ b/vendor/luajit/src/lj_opt_loop.c @@ -1,6 +1,6 @@ /* ** LOOP: Loop Optimizations. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_opt_loop_c diff --git a/vendor/luajit/src/lj_opt_mem.c b/vendor/luajit/src/lj_opt_mem.c index c8cdc3e5f..a4d96fc0f 100644 --- a/vendor/luajit/src/lj_opt_mem.c +++ b/vendor/luajit/src/lj_opt_mem.c @@ -3,7 +3,7 @@ ** AA: Alias Analysis using high-level semantic disambiguation. ** FWD: Load Forwarding (L2L) + Store Forwarding (S2L). ** DSE: Dead-Store Elimination. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_opt_mem_c @@ -740,21 +740,19 @@ retry: case ALIAS_MUST: /* Emit conversion if the loaded type doesn't match the forwarded type. */ if (!irt_sametype(fins->t, IR(store->op2)->t)) { - IRType st = irt_type(fins->t); - if (st == IRT_I8 || st == IRT_I16) { /* Trunc + sign-extend. */ - st |= IRCONV_SEXT; - } else if (st == IRT_U8 || st == IRT_U16) { /* Trunc + zero-extend. */ - } else if (st == IRT_INT) { - st = irt_type(IR(store->op2)->t); /* Needs dummy CONV.int.*. */ - } else { /* I64/U64 are boxed, U32 is hidden behind a CONV.num.u32. */ - goto store_fwd; + IRType dt = irt_type(fins->t), st = irt_type(IR(store->op2)->t); + if (dt == IRT_I8 || dt == IRT_I16) { /* Trunc + sign-extend. */ + st = dt | IRCONV_SEXT; + dt = IRT_INT; + } else if (dt == IRT_U8 || dt == IRT_U16) { /* Trunc + zero-extend. */ + st = dt; + dt = IRT_INT; } - fins->ot = IRTI(IR_CONV); + fins->ot = IRT(IR_CONV, dt); fins->op1 = store->op2; - fins->op2 = (IRT_INT<<5)|st; + fins->op2 = (dt<<5)|st; return RETRYFOLD; } - store_fwd: return store->op2; /* Store forwarding. */ } ref = store->prev; @@ -795,6 +793,7 @@ TRef LJ_FASTCALL lj_opt_dse_xstore(jit_State *J) IRRef ref = *refp; if (J->chain[IR_CALLXS] > lim) lim = J->chain[IR_CALLXS]; if (J->chain[IR_XBAR] > lim) lim = J->chain[IR_XBAR]; + if (J->chain[IR_XSNEW] > lim) lim = J->chain[IR_XSNEW]; while (ref > lim) { /* Search for redundant or conflicting stores. */ IRIns *store = IR(ref); switch (aa_xref(J, xr, fins, store)) { diff --git a/vendor/luajit/src/lj_opt_narrow.c b/vendor/luajit/src/lj_opt_narrow.c index 2cecf65da..58b3763db 100644 --- a/vendor/luajit/src/lj_opt_narrow.c +++ b/vendor/luajit/src/lj_opt_narrow.c @@ -1,7 +1,7 @@ /* ** NARROW: Narrowing of numbers to integers (double to int32_t). ** STRIPOV: Stripping of overflow checks. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_opt_narrow_c @@ -247,10 +247,16 @@ static void narrow_stripov_backprop(NarrowConv *nc, IRRef ref, int depth) if (bp) { ref = bp->val; } else if (++depth < NARROW_MAX_BACKPROP && nc->sp < nc->maxsp) { + NarrowIns *savesp = nc->sp; narrow_stripov_backprop(nc, ir->op1, depth); - narrow_stripov_backprop(nc, ir->op2, depth); - *nc->sp++ = NARROWINS(IRT(ir->o - IR_ADDOV + IR_ADD, IRT_INT), ref); - return; + if (nc->sp < nc->maxsp) { + narrow_stripov_backprop(nc, ir->op2, depth); + if (nc->sp < nc->maxsp) { + *nc->sp++ = NARROWINS(IRT(ir->o - IR_ADDOV + IR_ADD, IRT_INT), ref); + return; + } + } + nc->sp = savesp; /* Path too deep, need to backtrack. */ } } *nc->sp++ = NARROWINS(NARROW_REF, ref); @@ -263,6 +269,8 @@ static int narrow_conv_backprop(NarrowConv *nc, IRRef ref, int depth) IRIns *ir = IR(ref); IRRef cref; + if (nc->sp >= nc->maxsp) return 10; /* Path too deep. */ + /* Check the easy cases first. */ if (ir->o == IR_CONV && (ir->op2 & IRCONV_SRCMASK) == IRT_INT) { if ((nc->mode & IRCONV_CONVMASK) <= IRCONV_ANY) diff --git a/vendor/luajit/src/lj_opt_sink.c b/vendor/luajit/src/lj_opt_sink.c index 3a3334616..a98e9dfe3 100644 --- a/vendor/luajit/src/lj_opt_sink.c +++ b/vendor/luajit/src/lj_opt_sink.c @@ -1,6 +1,6 @@ /* ** SINK: Allocation Sinking and Store Sinking. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_opt_sink_c diff --git a/vendor/luajit/src/lj_opt_split.c b/vendor/luajit/src/lj_opt_split.c index 99d10584f..1cee5093b 100644 --- a/vendor/luajit/src/lj_opt_split.c +++ b/vendor/luajit/src/lj_opt_split.c @@ -1,6 +1,6 @@ /* ** SPLIT: Split 64 bit IR instructions into 32 bit IR instructions. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_opt_split_c diff --git a/vendor/luajit/src/lj_parse.c b/vendor/luajit/src/lj_parse.c index e8aafba20..abfac3c0c 100644 --- a/vendor/luajit/src/lj_parse.c +++ b/vendor/luajit/src/lj_parse.c @@ -1,6 +1,6 @@ /* ** Lua parser (source code -> bytecode). -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Major portions taken verbatim or adapted from the Lua interpreter. ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h @@ -685,10 +685,12 @@ static BCPos bcemit_jmp(FuncState *fs) BCPos j = fs->pc - 1; BCIns *ip = &fs->bcbase[j].ins; fs->jpc = NO_JMP; - if ((int32_t)j >= (int32_t)fs->lasttarget && bc_op(*ip) == BC_UCLO) + if ((int32_t)j >= (int32_t)fs->lasttarget && bc_op(*ip) == BC_UCLO) { setbc_j(ip, NO_JMP); - else + fs->lasttarget = j+1; + } else { j = bcemit_AJ(fs, BC_JMP, fs->freereg, NO_JMP); + } jmp_append(fs, &j, jpc); return j; } diff --git a/vendor/luajit/src/lj_parse.h b/vendor/luajit/src/lj_parse.h index 532657a01..dc4fd405d 100644 --- a/vendor/luajit/src/lj_parse.h +++ b/vendor/luajit/src/lj_parse.h @@ -1,6 +1,6 @@ /* ** Lua parser (source code -> bytecode). -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_PARSE_H diff --git a/vendor/luajit/src/lj_record.c b/vendor/luajit/src/lj_record.c index c6848fc09..843108c85 100644 --- a/vendor/luajit/src/lj_record.c +++ b/vendor/luajit/src/lj_record.c @@ -1,6 +1,6 @@ /* ** Trace recorder (bytecode -> SSA IR). -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_record_c @@ -421,6 +421,7 @@ static void rec_for_loop(jit_State *J, const BCIns *fori, ScEvEntry *scev, J->base[ra+FORL_IDX] = idx = emitir(IRT(IR_ADD, t), idx, step); J->base[ra+FORL_EXT] = idx; scev->idx = tref_ref(idx); + setmref(scev->pc, fori); J->maxslot = ra+FORL_EXT+1; } @@ -436,7 +437,7 @@ static LoopEvent rec_for(jit_State *J, const BCIns *fori, int isforl) IRType t; if (isforl) { /* Handle FORL/JFORL opcodes. */ TRef idx = tr[FORL_IDX]; - if (tref_ref(idx) == J->scev.idx) { + if (mref(J->scev.pc, const BCIns) == fori && tref_ref(idx) == J->scev.idx) { t = J->scev.t.irt; stop = J->scev.stop; idx = emitir(IRT(IR_ADD, t), idx, J->scev.step); @@ -744,6 +745,8 @@ void lj_record_ret(jit_State *J, BCReg rbase, ptrdiff_t gotresults) } else if (J->parent == 0 && !bc_isret(bc_op(J->cur.startins))) { /* Return to lower frame would leave the loop in a root trace. */ lj_trace_err(J, LJ_TRERR_LLEAVE); + } else if (J->needsnap) { /* Tailcalled to ff with side-effects. */ + lj_trace_err(J, LJ_TRERR_NYIRETL); /* No way to insert snapshot here. */ } else { /* Return to lower frame. Guard for the target we return to. */ TRef trpt = lj_ir_kgc(J, obj2gco(pt), IRT_PROTO); TRef trpc = lj_ir_kptr(J, (void *)frame_pc(frame)); @@ -1059,7 +1062,7 @@ static void rec_idx_abc(jit_State *J, TRef asizeref, TRef ikey, uint32_t asize) lua_assert(irt_isint(J->scev.t) && ir->o == IR_SLOAD); stop = numberVint(&(J->L->base - J->baseslot)[ir->op1 + FORL_STOP]); /* Runtime value for stop of loop is within bounds? */ - if ((int64_t)stop + ofs < (int64_t)asize) { + if ((uint64_t)stop + ofs < (uint64_t)asize) { /* Emit invariant bounds check for stop. */ emitir(IRTG(IR_ABC, IRT_P32), asizeref, ofs == 0 ? J->scev.stop : emitir(IRTI(IR_ADD), J->scev.stop, ofsref)); @@ -2153,6 +2156,7 @@ void lj_record_setup(jit_State *J) memset(J->chain, 0, sizeof(J->chain)); memset(J->bpropcache, 0, sizeof(J->bpropcache)); J->scev.idx = REF_NIL; + setmref(J->scev.pc, NULL); J->baseslot = 1; /* Invoking function is at base[-1]. */ J->base = J->slot + J->baseslot; diff --git a/vendor/luajit/src/lj_record.h b/vendor/luajit/src/lj_record.h index 940e105fb..c9f4882a9 100644 --- a/vendor/luajit/src/lj_record.h +++ b/vendor/luajit/src/lj_record.h @@ -1,6 +1,6 @@ /* ** Trace recorder (bytecode -> SSA IR). -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_RECORD_H diff --git a/vendor/luajit/src/lj_snap.c b/vendor/luajit/src/lj_snap.c index 1c978c26a..5c870bafd 100644 --- a/vendor/luajit/src/lj_snap.c +++ b/vendor/luajit/src/lj_snap.c @@ -1,6 +1,6 @@ /* ** Snapshot handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_snap_c @@ -104,8 +104,6 @@ static BCReg snapshot_framelinks(jit_State *J, SnapEntry *map) if (frame_islua(frame)) { map[f++] = SNAP_MKPC(frame_pc(frame)); frame = frame_prevl(frame); - if (frame + funcproto(frame_func(frame))->framesize > ftop) - ftop = frame + funcproto(frame_func(frame))->framesize; } else if (frame_iscont(frame)) { map[f++] = SNAP_MKFTSZ(frame_ftsz(frame)); map[f++] = SNAP_MKPC(frame_contpc(frame)); @@ -114,7 +112,10 @@ static BCReg snapshot_framelinks(jit_State *J, SnapEntry *map) lua_assert(!frame_isc(frame)); map[f++] = SNAP_MKFTSZ(frame_ftsz(frame)); frame = frame_prevd(frame); + continue; } + if (frame + funcproto(frame_func(frame))->framesize > ftop) + ftop = frame + funcproto(frame_func(frame))->framesize; } lua_assert(f == (MSize)(1 + J->framedepth)); return (BCReg)(ftop - lim); diff --git a/vendor/luajit/src/lj_snap.h b/vendor/luajit/src/lj_snap.h index 1b2d74da7..9a125be7f 100644 --- a/vendor/luajit/src/lj_snap.h +++ b/vendor/luajit/src/lj_snap.h @@ -1,6 +1,6 @@ /* ** Snapshot handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_SNAP_H diff --git a/vendor/luajit/src/lj_state.c b/vendor/luajit/src/lj_state.c index f972fdced..e654afaeb 100644 --- a/vendor/luajit/src/lj_state.c +++ b/vendor/luajit/src/lj_state.c @@ -1,6 +1,6 @@ /* ** State and stack handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Portions taken verbatim or adapted from the Lua interpreter. ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h @@ -175,7 +175,7 @@ static void close_state(lua_State *L) g->allocf(g->allocd, G2GG(g), sizeof(GG_State), 0); } -#if LJ_64 +#if LJ_64 && !(defined(LUAJIT_USE_VALGRIND) && defined(LUAJIT_USE_SYSMALLOC)) lua_State *lj_state_newstate(lua_Alloc f, void *ud) #else LUA_API lua_State *lua_newstate(lua_Alloc f, void *ud) diff --git a/vendor/luajit/src/lj_state.h b/vendor/luajit/src/lj_state.h index 74249d9bb..687889a26 100644 --- a/vendor/luajit/src/lj_state.h +++ b/vendor/luajit/src/lj_state.h @@ -1,6 +1,6 @@ /* ** State and stack handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_STATE_H diff --git a/vendor/luajit/src/lj_str.c b/vendor/luajit/src/lj_str.c index aead8b536..ca60bccb7 100644 --- a/vendor/luajit/src/lj_str.c +++ b/vendor/luajit/src/lj_str.c @@ -1,6 +1,6 @@ /* ** String handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Portions taken verbatim or adapted from the Lua interpreter. ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h diff --git a/vendor/luajit/src/lj_str.h b/vendor/luajit/src/lj_str.h index 1602c980c..99697051d 100644 --- a/vendor/luajit/src/lj_str.h +++ b/vendor/luajit/src/lj_str.h @@ -1,6 +1,6 @@ /* ** String handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_STR_H diff --git a/vendor/luajit/src/lj_strscan.c b/vendor/luajit/src/lj_strscan.c index a21c414ab..568f647d6 100644 --- a/vendor/luajit/src/lj_strscan.c +++ b/vendor/luajit/src/lj_strscan.c @@ -1,6 +1,6 @@ /* ** String scanning. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #include @@ -199,7 +199,7 @@ static StrScanFmt strscan_dec(const uint8_t *p, TValue *o, *xip++ = d + ((*p != '.' ? *p : *++p) & 15); p++; } /* Scan and realign trailing digit. */ - if (i) *xip++ = 10 * ((*p != '.' ? *p : *++p) & 15), ex10--, p++; + if (i) *xip++ = 10 * ((*p != '.' ? *p : *++p) & 15), ex10--, dig++, p++; /* Summarize rounding-effect of excess digits. */ if (dig > STRSCAN_MAXDIG) { @@ -289,14 +289,15 @@ static StrScanFmt strscan_dec(const uint8_t *p, TValue *o, /* Scale down until no more than 17 or 18 integer part digits remain. */ while (idig > 9) { - uint32_t i, cy = 0; + uint32_t i = hi, cy = 0; ex2 += 6; - for (i = hi; i != lo; i = DNEXT(i)) { + do { cy += xi[i]; xi[i] = (cy >> 6); cy = 100 * (cy & 0x3f); if (xi[i] == 0 && i == hi) hi = DNEXT(hi), idig--; - } + i = DNEXT(i); + } while (i != lo); while (cy) { if (hi == lo) { xi[DPREV(lo)] |= 1; break; } xi[lo] = (cy >> 6); lo = DNEXT(lo); diff --git a/vendor/luajit/src/lj_strscan.h b/vendor/luajit/src/lj_strscan.h index 15abd6afb..776068936 100644 --- a/vendor/luajit/src/lj_strscan.h +++ b/vendor/luajit/src/lj_strscan.h @@ -1,6 +1,6 @@ /* ** String scanning. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_STRSCAN_H diff --git a/vendor/luajit/src/lj_tab.c b/vendor/luajit/src/lj_tab.c index fc7d0f1c1..a8062db7c 100644 --- a/vendor/luajit/src/lj_tab.c +++ b/vendor/luajit/src/lj_tab.c @@ -1,6 +1,6 @@ /* ** Table handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Major portions taken verbatim or adapted from the Lua interpreter. ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h diff --git a/vendor/luajit/src/lj_tab.h b/vendor/luajit/src/lj_tab.h index 44b1bbbd9..f0d228eb2 100644 --- a/vendor/luajit/src/lj_tab.h +++ b/vendor/luajit/src/lj_tab.h @@ -1,6 +1,6 @@ /* ** Table handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_TAB_H diff --git a/vendor/luajit/src/lj_target.h b/vendor/luajit/src/lj_target.h index 820a97a45..1a242325f 100644 --- a/vendor/luajit/src/lj_target.h +++ b/vendor/luajit/src/lj_target.h @@ -1,6 +1,6 @@ /* ** Definitions for target CPU. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_TARGET_H diff --git a/vendor/luajit/src/lj_target_arm.h b/vendor/luajit/src/lj_target_arm.h index 63a0c925d..6d4d0aed0 100644 --- a/vendor/luajit/src/lj_target_arm.h +++ b/vendor/luajit/src/lj_target_arm.h @@ -1,6 +1,6 @@ /* ** Definitions for ARM CPUs. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_TARGET_ARM_H diff --git a/vendor/luajit/src/lj_target_mips.h b/vendor/luajit/src/lj_target_mips.h index e0fc152d6..0ab140bf3 100644 --- a/vendor/luajit/src/lj_target_mips.h +++ b/vendor/luajit/src/lj_target_mips.h @@ -1,6 +1,6 @@ /* ** Definitions for MIPS CPUs. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_TARGET_MIPS_H diff --git a/vendor/luajit/src/lj_target_ppc.h b/vendor/luajit/src/lj_target_ppc.h index 475e04651..2caeeb044 100644 --- a/vendor/luajit/src/lj_target_ppc.h +++ b/vendor/luajit/src/lj_target_ppc.h @@ -1,6 +1,6 @@ /* ** Definitions for PPC CPUs. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_TARGET_PPC_H diff --git a/vendor/luajit/src/lj_target_x86.h b/vendor/luajit/src/lj_target_x86.h index 41f401b04..d12a1b87c 100644 --- a/vendor/luajit/src/lj_target_x86.h +++ b/vendor/luajit/src/lj_target_x86.h @@ -1,6 +1,6 @@ /* ** Definitions for x86 and x64 CPUs. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_TARGET_X86_H diff --git a/vendor/luajit/src/lj_trace.c b/vendor/luajit/src/lj_trace.c index 9e5e400f4..e51ec5467 100644 --- a/vendor/luajit/src/lj_trace.c +++ b/vendor/luajit/src/lj_trace.c @@ -1,6 +1,6 @@ /* ** Trace management. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_trace_c @@ -607,6 +607,7 @@ static TValue *trace_state(lua_State *L, lua_CFunction dummy, void *ud) } lj_opt_split(J); lj_opt_sink(J); + if (!J->loopref) J->cur.snap[J->cur.nsnap-1].count = SNAPCOUNT_DONE; J->state = LJ_TRACE_ASM; break; diff --git a/vendor/luajit/src/lj_trace.h b/vendor/luajit/src/lj_trace.h index f3109081b..4fbe5cf25 100644 --- a/vendor/luajit/src/lj_trace.h +++ b/vendor/luajit/src/lj_trace.h @@ -1,6 +1,6 @@ /* ** Trace management. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_TRACE_H diff --git a/vendor/luajit/src/lj_traceerr.h b/vendor/luajit/src/lj_traceerr.h index 521560a18..9bef117ab 100644 --- a/vendor/luajit/src/lj_traceerr.h +++ b/vendor/luajit/src/lj_traceerr.h @@ -1,6 +1,6 @@ /* ** Trace compiler error messages. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ /* This file may be included multiple times with different TREDEF macros. */ diff --git a/vendor/luajit/src/lj_udata.c b/vendor/luajit/src/lj_udata.c index 6cd357ec5..d401a3d8e 100644 --- a/vendor/luajit/src/lj_udata.c +++ b/vendor/luajit/src/lj_udata.c @@ -1,6 +1,6 @@ /* ** Userdata handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_udata_c diff --git a/vendor/luajit/src/lj_udata.h b/vendor/luajit/src/lj_udata.h index e03d9a3a8..676e970f4 100644 --- a/vendor/luajit/src/lj_udata.h +++ b/vendor/luajit/src/lj_udata.h @@ -1,6 +1,6 @@ /* ** Userdata handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_UDATA_H diff --git a/vendor/luajit/src/lj_vm.h b/vendor/luajit/src/lj_vm.h index 4a8f03f07..036cabc57 100644 --- a/vendor/luajit/src/lj_vm.h +++ b/vendor/luajit/src/lj_vm.h @@ -1,6 +1,6 @@ /* ** Assembler VM interface definitions. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_VM_H diff --git a/vendor/luajit/src/lj_vmevent.c b/vendor/luajit/src/lj_vmevent.c index e14ad5b60..81fe47d4d 100644 --- a/vendor/luajit/src/lj_vmevent.c +++ b/vendor/luajit/src/lj_vmevent.c @@ -1,6 +1,6 @@ /* ** VM event handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #include diff --git a/vendor/luajit/src/lj_vmevent.h b/vendor/luajit/src/lj_vmevent.h index 51bae015a..231e00ecd 100644 --- a/vendor/luajit/src/lj_vmevent.h +++ b/vendor/luajit/src/lj_vmevent.h @@ -1,6 +1,6 @@ /* ** VM event handling. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LJ_VMEVENT_H diff --git a/vendor/luajit/src/lj_vmmath.c b/vendor/luajit/src/lj_vmmath.c index 63886aa7e..31c6029fc 100644 --- a/vendor/luajit/src/lj_vmmath.c +++ b/vendor/luajit/src/lj_vmmath.c @@ -1,6 +1,6 @@ /* ** Math helper functions for assembler VM. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #define lj_vmmath_c diff --git a/vendor/luajit/src/ljamalg.c b/vendor/luajit/src/ljamalg.c index 52a86153c..9b237b7e9 100644 --- a/vendor/luajit/src/ljamalg.c +++ b/vendor/luajit/src/ljamalg.c @@ -1,6 +1,6 @@ /* ** LuaJIT core and libraries amalgamation. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ /* diff --git a/vendor/luajit/src/luaconf.h b/vendor/luajit/src/luaconf.h index affb7da8f..84fa64187 100644 --- a/vendor/luajit/src/luaconf.h +++ b/vendor/luajit/src/luaconf.h @@ -1,6 +1,6 @@ /* ** Configuration header. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef luaconf_h @@ -37,7 +37,7 @@ #endif #define LUA_LROOT "/usr/local" #define LUA_LUADIR "/lua/5.1/" -#define LUA_LJDIR "/luajit-2.0.3/" +#define LUA_LJDIR "/luajit-2.0.4/" #ifdef LUA_ROOT #define LUA_JROOT LUA_ROOT diff --git a/vendor/luajit/src/luajit.c b/vendor/luajit/src/luajit.c index 4cccf04e6..85d713fb4 100644 --- a/vendor/luajit/src/luajit.c +++ b/vendor/luajit/src/luajit.c @@ -1,6 +1,6 @@ /* ** LuaJIT frontend. Runs commands, scripts, read-eval-print (REPL) etc. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ** ** Major portions taken verbatim or adapted from the Lua interpreter. ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h @@ -301,17 +301,17 @@ static int loadjitmodule(lua_State *L) lua_concat(L, 2); if (lua_pcall(L, 1, 1, 0)) { const char *msg = lua_tostring(L, -1); - if (msg && !strncmp(msg, "module ", 7)) { - err: - l_message(progname, - "unknown luaJIT command or jit.* modules not installed"); - return 1; - } else { - return report(L, 1); - } + if (msg && !strncmp(msg, "module ", 7)) + goto nomodule; + return report(L, 1); } lua_getfield(L, -1, "start"); - if (lua_isnil(L, -1)) goto err; + if (lua_isnil(L, -1)) { + nomodule: + l_message(progname, + "unknown luaJIT command or jit.* modules not installed"); + return 1; + } lua_remove(L, -2); /* Drop module table. */ return 0; } diff --git a/vendor/luajit/src/luajit.h b/vendor/luajit/src/luajit.h index be721cf4b..9ced18eb8 100644 --- a/vendor/luajit/src/luajit.h +++ b/vendor/luajit/src/luajit.h @@ -1,7 +1,7 @@ /* ** LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/ ** -** Copyright (C) 2005-2014 Mike Pall. All rights reserved. +** Copyright (C) 2005-2015 Mike Pall. All rights reserved. ** ** Permission is hereby granted, free of charge, to any person obtaining ** a copy of this software and associated documentation files (the @@ -30,10 +30,10 @@ #include "lua.h" -#define LUAJIT_VERSION "LuaJIT 2.0.3" -#define LUAJIT_VERSION_NUM 20003 /* Version 2.0.3 = 02.00.03. */ -#define LUAJIT_VERSION_SYM luaJIT_version_2_0_3 -#define LUAJIT_COPYRIGHT "Copyright (C) 2005-2014 Mike Pall" +#define LUAJIT_VERSION "LuaJIT 2.0.4" +#define LUAJIT_VERSION_NUM 20004 /* Version 2.0.4 = 02.00.04. */ +#define LUAJIT_VERSION_SYM luaJIT_version_2_0_4 +#define LUAJIT_COPYRIGHT "Copyright (C) 2005-2015 Mike Pall" #define LUAJIT_URL "http://luajit.org/" /* Modes for luaJIT_setmode. */ diff --git a/vendor/luajit/src/lualib.h b/vendor/luajit/src/lualib.h index 1c1e31799..96530e79a 100644 --- a/vendor/luajit/src/lualib.h +++ b/vendor/luajit/src/lualib.h @@ -1,6 +1,6 @@ /* ** Standard library header. -** Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h */ #ifndef _LUALIB_H diff --git a/vendor/luajit/src/vm_arm.dasc b/vendor/luajit/src/vm_arm.dasc index 82cba909c..457efa63c 100644 --- a/vendor/luajit/src/vm_arm.dasc +++ b/vendor/luajit/src/vm_arm.dasc @@ -1,6 +1,6 @@ |// Low-level VM code for ARM CPUs. |// Bytecode interpreter, fast functions and helper functions. -|// Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +|// Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h | |.arch arm |.section code_op, code_sub @@ -335,7 +335,7 @@ static void build_subroutines(BuildCtx *ctx) | // - The GC shrinks the stack in between. | // - A return back from a lua_call() with (high) nresults adjustment. | str BASE, L->top // Save current top held in BASE (yes). - | mov CARG2, KBASE + | lsr CARG2, KBASE, #3 | mov CARG1, L | bl extern lj_state_growstack // (lua_State *L, int n) | ldr BASE, L->top // Need the (realloced) L->top in BASE. @@ -389,7 +389,7 @@ static void build_subroutines(BuildCtx *ctx) | str BASE, L->base | add PC, PC, #4 // Must point after first instruction. | str RC, L->top - | lsr CARG3, RA, #3 + | lsr CARG2, RA, #3 |2: | // L->base = new base, L->top = top | str PC, SAVE_PC @@ -539,9 +539,8 @@ static void build_subroutines(BuildCtx *ctx) |1: | beq ->cont_ffi_callback // cont = 1: return from FFI callback. | // cont = 0: tailcall from C function. - | ldr CARG3, [BASE, FRAME_FUNC] - | sub CARG4, CARG4, #16 - | sub RC, CARG4, BASE + | sub CARG4, CARG4, #16 + | sub RC, CARG4, BASE | b ->vm_call_tail |.endif | @@ -3241,10 +3240,10 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | mvn RC, RC | ldr UPVAL:CARG2, [LFUNC:CARG2, RA] | ldr STR:CARG3, [KBASE, RC, lsl #2] - | mvn CARG4, #~LJ_TSTR | ldrb RB, UPVAL:CARG2->marked - | ldr CARG2, UPVAL:CARG2->v | ldrb RC, UPVAL:CARG2->closed + | ldr CARG2, UPVAL:CARG2->v + | mvn CARG4, #~LJ_TSTR | tst RB, #LJ_GC_BLACK // isblack(uv) | ldrb RB, STR:CARG3->marked | strd CARG34, [CARG2] diff --git a/vendor/luajit/src/vm_mips.dasc b/vendor/luajit/src/vm_mips.dasc index 0ec13e608..ac8346bbd 100644 --- a/vendor/luajit/src/vm_mips.dasc +++ b/vendor/luajit/src/vm_mips.dasc @@ -1,6 +1,6 @@ |// Low-level VM code for MIPS CPUs. |// Bytecode interpreter, fast functions and helper functions. -|// Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +|// Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h | |.arch mips |.section code_op, code_sub @@ -398,7 +398,7 @@ static void build_subroutines(BuildCtx *ctx) | // - A return back from a lua_call() with (high) nresults adjustment. | load_got lj_state_growstack | move MULTRES, RD - | move CARG2, TMP2 + | srl CARG2, TMP2, 3 | call_intern lj_state_growstack // (lua_State *L, int n) |. move CARG1, L | lw TMP2, SAVE_NRES diff --git a/vendor/luajit/src/vm_ppc.dasc b/vendor/luajit/src/vm_ppc.dasc index da75f556d..ad8a023e4 100644 --- a/vendor/luajit/src/vm_ppc.dasc +++ b/vendor/luajit/src/vm_ppc.dasc @@ -1,6 +1,6 @@ |// Low-level VM code for PowerPC CPUs. |// Bytecode interpreter, fast functions and helper functions. -|// Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +|// Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h | |.arch ppc |.section code_op, code_sub @@ -75,6 +75,29 @@ |.endif |.endmacro | +|.macro clrso, reg +|.if PPE +| li reg, 0 +| mtxer reg +|.else +| mcrxr cr0 +|.endif +|.endmacro +| +|.macro checkov, reg, noov +|.if PPE +| mfxer reg +| add reg, reg, reg +| cmpwi reg, 0 +| li reg, 0 +| mtxer reg +| bgey noov +|.else +| mcrxr cr0 +| bley noov +|.endif +|.endmacro +| |//----------------------------------------------------------------------- | |// Fixed register assignments for the interpreter. @@ -563,7 +586,7 @@ static void build_subroutines(BuildCtx *ctx) | // - A return back from a lua_call() with (high) nresults adjustment. | stp BASE, L->top // Save current top held in BASE (yes). | mr SAVE0, RD - | mr CARG2, TMP2 + | srwi CARG2, TMP2, 3 | mr CARG1, L | bl extern lj_state_growstack // (lua_State *L, int n) | lwz TMP2, SAVE_NRES @@ -2587,7 +2610,7 @@ static void build_subroutines(BuildCtx *ctx) | stw CARG2, DISPATCH_GL(vmstate)(DISPATCH) | savex_ 0,1,2,3 | stw CARG1, 0(sp) // Store extended stack chain. - | mcrxr cr0 // Clear SO flag. + | clrso TMP1 | savex_ 4,5,6,7 | addi CARG2, sp, 16+32*8+32*4 // Recompute original value of sp. | savex_ 8,9,10,11 @@ -2706,7 +2729,7 @@ static void build_subroutines(BuildCtx *ctx) | cmpwi CARG2, 0 | li CARG1, 0 | beqlr - | mcrxr cr0 // Clear SO for -2147483648 % -1 and return 0. + | clrso TMP0 // Clear SO for -2147483648 % -1 and return 0. | blr | |//----------------------------------------------------------------------- @@ -3309,7 +3332,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) |4: |.if not GPR64 | // Potential overflow. - | mcrxr cr0; bley <1 // Ignore unrelated overflow. + | checkov TMP1, <1 // Ignore unrelated overflow. |.endif | lus TMP1, 0x41e0 // 2^31. | li TMP0, 0 @@ -3494,7 +3517,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) |2: | ins_next2 |4: // Overflow. - | mcrxr cr0; bley <1 // Ignore unrelated overflow. + | checkov TMP0, <1 // Ignore unrelated overflow. | ins_arithfallback b |5: // FP variant. ||if (vk == 1) { @@ -4692,7 +4715,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | b <1 if (vk) { |6: // Potential overflow. - | mcrxr cr0; bley <4 // Ignore unrelated overflow. + | checkov TMP0, <4 // Ignore unrelated overflow. | b <2 } |.endif @@ -4832,7 +4855,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | // Traces on PPC don't store the trace number, so use 0. | stw ZERO, DISPATCH_GL(vmstate)(DISPATCH) | lwzx TRACE:TMP2, TMP1, RD - | mcrxr cr0 // Clear SO flag. + | clrso TMP1 | lp TMP2, TRACE:TMP2->mcode | stw BASE, DISPATCH_GL(jit_base)(DISPATCH) | mtctr TMP2 diff --git a/vendor/luajit/src/vm_ppcspe.dasc b/vendor/luajit/src/vm_ppcspe.dasc index adcec244a..53ea2d965 100644 --- a/vendor/luajit/src/vm_ppcspe.dasc +++ b/vendor/luajit/src/vm_ppcspe.dasc @@ -1,6 +1,6 @@ |// Low-level VM code for PowerPC/e500 CPUs. |// Bytecode interpreter, fast functions and helper functions. -|// Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +|// Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h | |.arch ppc |.section code_op, code_sub diff --git a/vendor/luajit/src/vm_x86.dasc b/vendor/luajit/src/vm_x86.dasc index 8a9b536df..6cdb8cbd2 100644 --- a/vendor/luajit/src/vm_x86.dasc +++ b/vendor/luajit/src/vm_x86.dasc @@ -1,6 +1,6 @@ |// Low-level VM code for x86 CPUs. |// Bytecode interpreter, fast functions and helper functions. -|// Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h +|// Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h | |.if P64 |.arch x64 @@ -1617,7 +1617,7 @@ static void build_subroutines(BuildCtx *ctx) | mov RD, 1+3 | jmp ->fff_res | - |.ffunc_1 ipairs_aux + |.ffunc_2 ipairs_aux | cmp dword [BASE+4], LJ_TTAB; jne ->fff_fallback | cmp dword [BASE+12], LJ_TISNUM |.if DUALNUM @@ -2198,7 +2198,7 @@ static void build_subroutines(BuildCtx *ctx) |.endif | |.ffunc_nnr math_fmod - |1: ; fprem; fnstsw ax; sahf; jp <1 + |1: ; fprem; fnstsw ax; and ax, 0x400; jnz <1 | fpop1 | jmp ->fff_resn | @@ -2564,8 +2564,8 @@ static void build_subroutines(BuildCtx *ctx) | |.define TOBIT_BIAS, 0x59c00000 // 2^52 + 2^51 (float, not double!). | - |.macro .ffunc_bit, name, kind - | .ffunc_1 name + |.macro .ffunc_bit, name, kind, fdef + | fdef name |.if kind == 2 |.if SSE | sseconst_tobit xmm1, RBa @@ -2608,6 +2608,10 @@ static void build_subroutines(BuildCtx *ctx) |2: |.endmacro | + |.macro .ffunc_bit, name, kind + | .ffunc_bit name, kind, .ffunc_1 + |.endmacro + | |.ffunc_bit bit_tobit, 0 |.if DUALNUM or SSE |.if not SSE @@ -2681,7 +2685,7 @@ static void build_subroutines(BuildCtx *ctx) | |.macro .ffunc_bit_sh, name, ins |.if DUALNUM - | .ffunc_bit name, 1 + | .ffunc_bit name, 1, .ffunc_2 | // Note: no inline conversion from number for 2nd argument! | cmp dword [BASE+12], LJ_TISNUM; jne ->fff_fallback | mov RA, dword [BASE+8] @@ -5320,8 +5324,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | jnz <4 | movzx RA, PC_RA | not RAa - | lea RA, [BASE+RA*8] - | mov LFUNC:KBASE, [RA-8] // Need to prepare KBASE. + | mov LFUNC:KBASE, [BASE+RA*8-8] // Need to prepare KBASE. | mov KBASE, LFUNC:KBASE->pc | mov KBASE, [KBASE+PC2PROTO(k)] | jmp <4