mirror of https://github.com/odrling/Aegisub
Update LuaJIT to 2.0.5
This commit is contained in:
parent
a621072e7d
commit
90586ca588
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** DynASM ARM encoding engine.
|
||||
** Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
** Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
||||
** Released under the MIT license. See dynasm.lua for full copyright notice.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
------------------------------------------------------------------------------
|
||||
-- DynASM ARM module.
|
||||
--
|
||||
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
||||
-- See dynasm.lua for full copyright notice.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** DynASM MIPS encoding engine.
|
||||
** Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
** Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
||||
** Released under the MIT license. See dynasm.lua for full copyright notice.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
------------------------------------------------------------------------------
|
||||
-- DynASM MIPS module.
|
||||
--
|
||||
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
||||
-- See dynasm.lua for full copyright notice.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** DynASM PPC encoding engine.
|
||||
** Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
** Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
||||
** Released under the MIT license. See dynasm.lua for full copyright notice.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
------------------------------------------------------------------------------
|
||||
-- DynASM PPC module.
|
||||
--
|
||||
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
||||
-- See dynasm.lua for full copyright notice.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** DynASM encoding engine prototypes.
|
||||
** Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
** Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
||||
** Released under the MIT license. See dynasm.lua for full copyright notice.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
------------------------------------------------------------------------------
|
||||
-- DynASM x64 module.
|
||||
--
|
||||
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
-- Copyright (C) 2005-2017 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.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** DynASM x86 encoding engine.
|
||||
** Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
** Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
||||
** Released under the MIT license. See dynasm.lua for full copyright notice.
|
||||
*/
|
||||
|
||||
|
@ -204,7 +204,8 @@ void dasm_put(Dst_DECL, int start, ...)
|
|||
case DASM_SPACE: p++; ofs += n; break;
|
||||
case DASM_SETLABEL: b[pos-2] = -0x40000000; break; /* Neg. label ofs. */
|
||||
case DASM_VREG: CK((n&-8) == 0 && (n != 4 || (*p&1) == 0), RANGE_VREG);
|
||||
if (*p++ == 1 && *p == DASM_DISP) mrm = n; continue;
|
||||
if (*p++ == 1 && *p == DASM_DISP) mrm = n;
|
||||
continue;
|
||||
}
|
||||
mrm = 4;
|
||||
} else {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
------------------------------------------------------------------------------
|
||||
-- DynASM x86/x64 module.
|
||||
--
|
||||
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
||||
-- See dynasm.lua for full copyright notice.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
|
@ -1081,10 +1081,11 @@ 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",
|
||||
shld_3 = "mriqdw:0FA4RmU|mrC/qq:0FA5Rm|mrC/dd:|mrC/ww:",
|
||||
shrd_3 = "mriqdw:0FACRmU|mrC/qq:0FADRm|mrC/dd:|mrC/ww:",
|
||||
|
||||
rdtsc_0 = "0F31", -- P1+
|
||||
rdpmc_0 = "0F33", -- P6+
|
||||
cpuid_0 = "0FA2", -- P1+
|
||||
|
||||
-- floating point ops
|
||||
|
@ -1190,7 +1191,7 @@ local map_op = {
|
|||
cvtsi2sd_2 = "rm/od:F20F2ArM|rm/oq:F20F2ArXM",
|
||||
cvtsi2ss_2 = "rm/od:F30F2ArM|rm/oq:F30F2ArXM",
|
||||
cvtss2sd_2 = "rro:F30F5ArM|rx/od:",
|
||||
cvtss2si_2 = "rr/do:F20F2CrM|rr/qo:|rxd:|rx/qd:",
|
||||
cvtss2si_2 = "rr/do:F30F2DrM|rr/qo:|rxd:|rx/qd:",
|
||||
cvttpd2dq_2 = "rmo:660FE6rM",
|
||||
cvttps2dq_2 = "rmo:F30F5BrM",
|
||||
cvttsd2si_2 = "rr/do:F20F2CrM|rr/qo:|rx/dq:|rxq:",
|
||||
|
@ -1247,7 +1248,7 @@ local map_op = {
|
|||
pcmpgtb_2 = "rmo:660F64rM",
|
||||
pcmpgtd_2 = "rmo:660F66rM",
|
||||
pcmpgtw_2 = "rmo:660F65rM",
|
||||
pextrw_3 = "rri/do:660FC5rMU|xri/wo:660F3A15nrMU", -- Mem op: SSE4.1 only.
|
||||
pextrw_3 = "rri/do:660FC5rMU|xri/wo:660F3A15nRmU", -- Mem op: SSE4.1 only.
|
||||
pinsrw_3 = "rri/od:660FC4rMU|rxi/ow:",
|
||||
pmaddwd_2 = "rmo:660FF5rM",
|
||||
pmaxsw_2 = "rmo:660FEErM",
|
||||
|
@ -1352,7 +1353,7 @@ local map_op = {
|
|||
dpps_3 = "rmio:660F3A40rMU",
|
||||
extractps_3 = "mri/do:660F3A17RmU|rri/qo:660F3A17RXmU",
|
||||
insertps_3 = "rrio:660F3A41rMU|rxi/od:",
|
||||
movntdqa_2 = "rmo:660F382ArM",
|
||||
movntdqa_2 = "rxo:660F382ArM",
|
||||
mpsadbw_3 = "rmio:660F3A42rMU",
|
||||
packusdw_2 = "rmo:660F382BrM",
|
||||
pblendvb_3 = "rmRo:660F3810rM",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
-- DynASM. A dynamic assembler for code generation engines.
|
||||
-- Originally designed and implemented for LuaJIT.
|
||||
--
|
||||
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
-- Copyright (C) 2005-2017 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-2015 Mike Pall. All rights reserved.
|
||||
Copyright (C) 2005-2017 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Configuration header.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 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.4/"
|
||||
#define LUA_LJDIR "/luajit-2.0.5/"
|
||||
|
||||
#ifdef LUA_ROOT
|
||||
#define LUA_JROOT LUA_ROOT
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
** LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/
|
||||
**
|
||||
** Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
** Copyright (C) 2005-2017 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.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_VERSION "LuaJIT 2.0.5"
|
||||
#define LUAJIT_VERSION_NUM 20005 /* Version 2.0.5 = 02.00.05. */
|
||||
#define LUAJIT_VERSION_SYM luaJIT_version_2_0_5
|
||||
#define LUAJIT_COPYRIGHT "Copyright (C) 2005-2017 Mike Pall"
|
||||
#define LUAJIT_URL "http://luajit.org/"
|
||||
|
||||
/* Modes for luaJIT_setmode. */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Standard library header.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LUALIB_H
|
||||
|
|
|
@ -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-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
# Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
##############################################################################
|
||||
|
||||
MAJVER= 2
|
||||
MINVER= 0
|
||||
RELVER= 4
|
||||
RELVER= 5
|
||||
ABIVER= 5.1
|
||||
NODOTABIVER= 51
|
||||
|
||||
|
@ -24,11 +24,13 @@ NODOTABIVER= 51
|
|||
# removing the '#' in front of them. Make sure you force a full recompile
|
||||
# with "make clean", followed by "make" if you change any options.
|
||||
#
|
||||
DEFAULT_CC = gcc
|
||||
#
|
||||
# LuaJIT builds as a native 32 or 64 bit binary by default.
|
||||
CC= gcc
|
||||
CC= $(DEFAULT_CC)
|
||||
#
|
||||
# Use this if you want to force a 32 bit build on a 64 bit multilib OS.
|
||||
#CC= gcc -m32
|
||||
#CC= $(DEFAULT_CC) -m32
|
||||
#
|
||||
# Since the assembler part does NOT maintain a frame pointer, it's pointless
|
||||
# to slow down the C part by not omitting it. Debugging, tracebacks and
|
||||
|
@ -55,11 +57,11 @@ CCOPT_ppc=
|
|||
CCOPT_ppcspe=
|
||||
CCOPT_mips=
|
||||
#
|
||||
#CCDEBUG=
|
||||
CCDEBUG=
|
||||
# Uncomment the next line to generate debug information:
|
||||
CCDEBUG= -g
|
||||
#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 +74,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 +90,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 +102,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
|
||||
|
@ -150,6 +152,25 @@ XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT
|
|||
# You probably don't need to change anything below this line!
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# Host system detection.
|
||||
##############################################################################
|
||||
|
||||
ifeq (Windows,$(findstring Windows,$(OS))$(MSYSTEM)$(TERM))
|
||||
HOST_SYS= Windows
|
||||
HOST_RM= del
|
||||
else
|
||||
HOST_SYS:= $(shell uname -s)
|
||||
ifneq (,$(findstring MINGW,$(HOST_SYS)))
|
||||
HOST_SYS= Windows
|
||||
HOST_MSYS= mingw
|
||||
endif
|
||||
ifneq (,$(findstring CYGWIN,$(HOST_SYS)))
|
||||
HOST_SYS= Windows
|
||||
HOST_MSYS= cygwin
|
||||
endif
|
||||
endif
|
||||
|
||||
##############################################################################
|
||||
# Flags and options for host and target.
|
||||
##############################################################################
|
||||
|
@ -187,14 +208,12 @@ TARGET_CC= $(STATIC_CC)
|
|||
TARGET_STCC= $(STATIC_CC)
|
||||
TARGET_DYNCC= $(DYNAMIC_CC)
|
||||
TARGET_LD= $(CROSS)$(CC)
|
||||
TARGET_AR= $(CROSS)ar rcus
|
||||
TARGET_AR= $(CROSS)ar rcus 2>/dev/null
|
||||
TARGET_STRIP= $(CROSS)strip
|
||||
|
||||
TARGET_LIBPATH= $(CURDIR)
|
||||
#TARGET_LIBPATH= $(or $(PREFIX),/usr/local)/$(or $(MULTILIB),lib)
|
||||
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_DYLIBNAME= libluajit-$(ABIVER).$(MAJVER).dylib
|
||||
TARGET_DYLIBPATH= $(TARGET_LIBPATH)/$(TARGET_DYLIBNAME)
|
||||
TARGET_DLLNAME= lua$(NODOTABIVER).dll
|
||||
TARGET_XSHLDFLAGS= -shared -fPIC -Wl,-soname,$(TARGET_SONAME)
|
||||
|
@ -245,9 +264,6 @@ ifneq (,$(findstring LJ_TARGET_PS3 1,$(TARGET_TESTARCH)))
|
|||
TARGET_ARCH+= -D__CELLOS_LV2__
|
||||
TARGET_XCFLAGS+= -DLUAJIT_USE_SYSMALLOC
|
||||
endif
|
||||
ifneq (,$(findstring LJ_NO_UNWIND 1,$(TARGET_TESTARCH)))
|
||||
TARGET_ARCH+= -DLUAJIT_NO_UNWIND
|
||||
endif
|
||||
|
||||
TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH))
|
||||
TARGET_ARCH+= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET_LJARCH))
|
||||
|
@ -268,24 +284,9 @@ ifneq (,$(LMULTILIB))
|
|||
endif
|
||||
|
||||
##############################################################################
|
||||
# System detection.
|
||||
# Target system detection.
|
||||
##############################################################################
|
||||
|
||||
ifeq (Windows,$(findstring Windows,$(OS))$(MSYSTEM)$(TERM))
|
||||
HOST_SYS= Windows
|
||||
HOST_RM= del
|
||||
else
|
||||
HOST_SYS:= $(shell uname -s)
|
||||
ifneq (,$(findstring MINGW,$(HOST_SYS)))
|
||||
HOST_SYS= Windows
|
||||
HOST_MSYS= mingw
|
||||
endif
|
||||
ifneq (,$(findstring CYGWIN,$(HOST_SYS)))
|
||||
HOST_SYS= Windows
|
||||
HOST_MSYS= cygwin
|
||||
endif
|
||||
endif
|
||||
|
||||
TARGET_SYS?= $(HOST_SYS)
|
||||
ifeq (Windows,$(TARGET_SYS))
|
||||
TARGET_STRIP+= --strip-unneeded
|
||||
|
@ -300,7 +301,6 @@ ifeq (Darwin,$(TARGET_SYS))
|
|||
export MACOSX_DEPLOYMENT_TARGET=10.4
|
||||
endif
|
||||
TARGET_STRIP+= -x
|
||||
TARGET_AR+= 2>/dev/null
|
||||
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)
|
||||
|
@ -311,7 +311,6 @@ ifeq (Darwin,$(TARGET_SYS))
|
|||
else
|
||||
ifeq (iOS,$(TARGET_SYS))
|
||||
TARGET_STRIP+= -x
|
||||
TARGET_AR+= 2>/dev/null
|
||||
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)
|
||||
|
@ -399,6 +398,10 @@ ifeq (,$(findstring LJ_ABI_SOFTFP 1,$(TARGET_TESTARCH)))
|
|||
else
|
||||
TARGET_ARCH+= -DLJ_ABI_SOFTFP=1
|
||||
endif
|
||||
ifneq (,$(findstring LJ_NO_UNWIND 1,$(TARGET_TESTARCH)))
|
||||
DASM_AFLAGS+= -D NO_UNWIND
|
||||
TARGET_ARCH+= -DLUAJIT_NO_UNWIND
|
||||
endif
|
||||
DASM_AFLAGS+= -D VER=$(subst LJ_ARCH_VERSION_,,$(filter LJ_ARCH_VERSION_%,$(subst LJ_ARCH_VERSION ,LJ_ARCH_VERSION_,$(TARGET_TESTARCH))))
|
||||
ifeq (Windows,$(TARGET_SYS))
|
||||
DASM_AFLAGS+= -D WIN
|
||||
|
@ -475,12 +478,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)
|
||||
|
@ -513,9 +516,6 @@ ifeq (Windows,$(TARGET_SYS))
|
|||
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
|
||||
|
@ -562,13 +562,10 @@ endif
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(V),1)
|
||||
Q=
|
||||
E= @:
|
||||
else
|
||||
Q= @
|
||||
E= @echo
|
||||
endif
|
||||
#Q=
|
||||
#E= @:
|
||||
|
||||
##############################################################################
|
||||
# Make targets.
|
||||
|
@ -577,6 +574,7 @@ endif
|
|||
default all: $(TARGET_T)
|
||||
|
||||
amalg:
|
||||
@grep "^[+|]" ljamalg.c
|
||||
$(MAKE) all "LJCORE_O=ljamalg.o"
|
||||
|
||||
clean:
|
||||
|
@ -606,10 +604,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)
|
||||
|
||||
|
@ -623,19 +618,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)
|
||||
|
||||
|
@ -643,7 +638,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
|
||||
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** LuaJIT VM builder.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** LuaJIT VM builder.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _BUILDVM_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** LuaJIT VM builder: Assembler source code emitter.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#include "buildvm.h"
|
||||
|
@ -183,7 +183,8 @@ static void emit_asm_label(BuildCtx *ctx, const char *name, int size, int isfunc
|
|||
case BUILD_machasm:
|
||||
fprintf(ctx->fp,
|
||||
"\n\t.private_extern %s\n"
|
||||
"%s:\n", name, name);
|
||||
"\t.no_dead_strip %s\n"
|
||||
"%s:\n", name, name, name);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** LuaJIT VM builder: IR folding hash table generator.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#include "buildvm.h"
|
||||
|
@ -9,7 +9,7 @@
|
|||
|
||||
/* Context for the folding hash table generator. */
|
||||
static int lineno;
|
||||
static int funcidx;
|
||||
static uint32_t funcidx;
|
||||
static uint32_t foldkeys[BUILD_MAX_FOLD];
|
||||
static uint32_t nkeys;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** LuaJIT VM builder: library definition compiler.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#include "buildvm.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** LuaJIT VM builder: PE object emitter.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 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.
|
||||
|
|
|
@ -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-2015 Mike Pall. All rights reserved.
|
||||
-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
||||
-- Released under the MIT license. See Copyright Notice in luajit.h
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
|
@ -157,11 +157,11 @@ local function merge_includes(src)
|
|||
if includes[name] then return "" end
|
||||
includes[name] = true
|
||||
local fp = assert(io.open(LUA_SOURCE..name, "r"))
|
||||
local src = fp:read("*a")
|
||||
local inc = fp:read("*a")
|
||||
assert(fp:close())
|
||||
src = gsub(src, "#ifndef%s+%w+_h\n#define%s+%w+_h\n", "")
|
||||
src = gsub(src, "#endif%s*$", "")
|
||||
return merge_includes(src)
|
||||
inc = gsub(inc, "#ifndef%s+%w+_h\n#define%s+%w+_h\n", "")
|
||||
inc = gsub(inc, "#endif%s*$", "")
|
||||
return merge_includes(inc)
|
||||
end)
|
||||
end
|
||||
|
||||
|
@ -300,6 +300,7 @@ local function strip_unused3(src)
|
|||
src = gsub(src, "if%([^\n]*hookmask[^\n]*&&\n[^\n]*%b{}\n", "")
|
||||
src = gsub(src, "(twoto%b()%()", "%1(size_t)")
|
||||
src = gsub(src, "i<sizenode", "i<(int)sizenode")
|
||||
src = gsub(src, "cast%(unsigned int,key%-1%)", "cast(unsigned int,key)-1")
|
||||
return gsub(src, "\n\n+", "\n")
|
||||
end
|
||||
|
||||
|
|
|
@ -1606,7 +1606,7 @@ luaC_barriert(L,t,key);
|
|||
return gval(mp);
|
||||
}
|
||||
static const TValue*luaH_getnum(Table*t,int key){
|
||||
if(cast(unsigned int,key-1)<cast(unsigned int,t->sizearray))
|
||||
if(cast(unsigned int,key)-1<cast(unsigned int,t->sizearray))
|
||||
return&t->array[key-1];
|
||||
else{
|
||||
lua_Number nk=cast_num(key);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
----------------------------------------------------------------------------
|
||||
-- LuaJIT bytecode listing module.
|
||||
--
|
||||
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
-- Copyright (C) 2005-2017 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 == 20004, "LuaJIT core/library version mismatch")
|
||||
assert(jit.version_num == 20005, "LuaJIT core/library version mismatch")
|
||||
local jutil = require("jit.util")
|
||||
local vmdef = require("jit.vmdef")
|
||||
local bit = require("bit")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
----------------------------------------------------------------------------
|
||||
-- LuaJIT module to save/list bytecode.
|
||||
--
|
||||
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
-- Copyright (C) 2005-2017 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 == 20004, "LuaJIT core/library version mismatch")
|
||||
assert(jit.version_num == 20005, "LuaJIT core/library version mismatch")
|
||||
local bit = require("bit")
|
||||
|
||||
-- Symbol name prefix for LuaJIT bytecode.
|
||||
|
@ -239,7 +239,7 @@ typedef struct {
|
|||
hdr.type = f16(1)
|
||||
hdr.machine = f16(({ x86=3, x64=62, arm=40, ppc=20, ppcspe=20, mips=8, mipsel=8 })[ctx.arch])
|
||||
if ctx.arch == "mips" or ctx.arch == "mipsel" then
|
||||
hdr.flags = 0x50001006
|
||||
hdr.flags = f32(0x50001006)
|
||||
end
|
||||
hdr.version = f32(1)
|
||||
hdr.shofs = fofs(ffi.offsetof(o, "sect"))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
----------------------------------------------------------------------------
|
||||
-- LuaJIT ARM disassembler module.
|
||||
--
|
||||
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
-- Copyright (C) 2005-2017 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.
|
||||
|
@ -12,7 +12,7 @@
|
|||
|
||||
local type = type
|
||||
local sub, byte, format = string.sub, string.byte, string.format
|
||||
local match, gmatch, gsub = string.match, string.gmatch, string.gsub
|
||||
local match, gmatch = string.match, string.gmatch
|
||||
local concat = table.concat
|
||||
local bit = require("bit")
|
||||
local band, bor, ror, tohex = bit.band, bit.bor, bit.ror, bit.tohex
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
----------------------------------------------------------------------------
|
||||
-- LuaJIT MIPS disassembler module.
|
||||
--
|
||||
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
-- Copyright (C) 2005-2017 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.
|
||||
|
@ -11,8 +11,8 @@
|
|||
------------------------------------------------------------------------------
|
||||
|
||||
local type = type
|
||||
local sub, byte, format = string.sub, string.byte, string.format
|
||||
local match, gmatch, gsub = string.match, string.gmatch, string.gsub
|
||||
local byte, format = string.byte, string.format
|
||||
local match, gmatch = string.match, string.gmatch
|
||||
local concat = table.concat
|
||||
local bit = require("bit")
|
||||
local band, bor, tohex = bit.band, bit.bor, bit.tohex
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
----------------------------------------------------------------------------
|
||||
-- LuaJIT MIPSEL disassembler wrapper module.
|
||||
--
|
||||
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
-- Copyright (C) 2005-2017 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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
----------------------------------------------------------------------------
|
||||
-- LuaJIT PPC disassembler module.
|
||||
--
|
||||
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
-- Copyright (C) 2005-2017 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.
|
||||
|
@ -13,7 +13,7 @@
|
|||
------------------------------------------------------------------------------
|
||||
|
||||
local type = type
|
||||
local sub, byte, format = string.sub, string.byte, string.format
|
||||
local byte, format = string.byte, string.format
|
||||
local match, gmatch, gsub = string.match, string.gmatch, string.gsub
|
||||
local concat = table.concat
|
||||
local bit = require("bit")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
----------------------------------------------------------------------------
|
||||
-- LuaJIT x64 disassembler wrapper module.
|
||||
--
|
||||
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
-- Copyright (C) 2005-2017 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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
----------------------------------------------------------------------------
|
||||
-- LuaJIT x86/x64 disassembler module.
|
||||
--
|
||||
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
-- Copyright (C) 2005-2017 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.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
----------------------------------------------------------------------------
|
||||
-- LuaJIT compiler dump module.
|
||||
--
|
||||
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
-- Copyright (C) 2005-2017 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 == 20004, "LuaJIT core/library version mismatch")
|
||||
assert(jit.version_num == 20005, "LuaJIT core/library version mismatch")
|
||||
local jutil = require("jit.util")
|
||||
local vmdef = require("jit.vmdef")
|
||||
local funcinfo, funcbc = jutil.funcinfo, jutil.funcbc
|
||||
|
@ -63,9 +63,9 @@ local traceinfo, traceir, tracek = jutil.traceinfo, jutil.traceir, jutil.tracek
|
|||
local tracemc, tracesnap = jutil.tracemc, jutil.tracesnap
|
||||
local traceexitstub, ircalladdr = jutil.traceexitstub, jutil.ircalladdr
|
||||
local bit = require("bit")
|
||||
local band, shl, shr = bit.band, bit.lshift, bit.rshift
|
||||
local band, shr = bit.band, bit.rshift
|
||||
local sub, gsub, format = string.sub, string.gsub, string.format
|
||||
local byte, char, rep = string.byte, string.char, string.rep
|
||||
local byte, rep = string.byte, string.rep
|
||||
local type, tostring = type, tostring
|
||||
local stdout, stderr = io.stdout, io.stderr
|
||||
|
||||
|
@ -207,7 +207,7 @@ local colortype_ansi = {
|
|||
"\027[35m%s\027[m",
|
||||
}
|
||||
|
||||
local function colorize_text(s, t)
|
||||
local function colorize_text(s)
|
||||
return s
|
||||
end
|
||||
|
||||
|
@ -324,7 +324,7 @@ local function formatk(tr, idx)
|
|||
s = format("userdata:%p", k)
|
||||
else
|
||||
s = format("[%p]", k)
|
||||
if s == "[0x00000000]" then s = "NULL" end
|
||||
if s == "[NULL]" then s = "NULL" end
|
||||
end
|
||||
elseif t == 21 then -- int64_t
|
||||
s = sub(tostring(k), 1, -3)
|
||||
|
@ -564,6 +564,7 @@ local function dump_trace(what, tr, func, pc, otr, oex)
|
|||
end
|
||||
if dumpmode.H then out:write("</pre>\n\n") else out:write("\n") end
|
||||
else
|
||||
if what == "flush" then symtab, nexitsym = {}, 0 end
|
||||
out:write("---- TRACE ", what, "\n\n")
|
||||
end
|
||||
out:flush()
|
||||
|
@ -643,7 +644,8 @@ end
|
|||
local function dumpon(opt, outfile)
|
||||
if active then dumpoff() end
|
||||
|
||||
local colormode = os.getenv("COLORTERM") and "A" or "T"
|
||||
local term = os.getenv("TERM")
|
||||
local colormode = (term and term:match("color") or os.getenv("COLORTERM")) and "A" or "T"
|
||||
if opt then
|
||||
opt = gsub(opt, "[TAH]", function(mode) colormode = mode; return ""; end)
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
----------------------------------------------------------------------------
|
||||
-- Verbose mode of the LuaJIT compiler.
|
||||
--
|
||||
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
||||
-- Copyright (C) 2005-2017 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 == 20004, "LuaJIT core/library version mismatch")
|
||||
assert(jit.version_num == 20005, "LuaJIT core/library version mismatch")
|
||||
local jutil = require("jit.util")
|
||||
local vmdef = require("jit.vmdef")
|
||||
local funcinfo, traceinfo = jutil.funcinfo, jutil.traceinfo
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Auxiliary library for the Lua/C API.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Base and coroutine library.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Bit manipulation library.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#define lib_bit_c
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Debug library.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** FFI library.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#define lib_ffi_c
|
||||
|
@ -811,7 +811,7 @@ static GCtab *ffi_finalizer(lua_State *L)
|
|||
settabV(L, L->top++, t);
|
||||
setgcref(t->metatable, obj2gco(t));
|
||||
setstrV(L, lj_tab_setstr(L, t, lj_str_newlit(L, "__mode")),
|
||||
lj_str_newlit(L, "K"));
|
||||
lj_str_newlit(L, "k"));
|
||||
t->nomm = (uint8_t)(~(1u<<MM_mode));
|
||||
return t;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Library initialization.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** I/O library.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 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 <windows.h>
|
||||
|
||||
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;
|
||||
|
@ -296,6 +278,15 @@ static int io_file_iter(lua_State *L)
|
|||
return n;
|
||||
}
|
||||
|
||||
static int io_file_lines(lua_State *L)
|
||||
{
|
||||
int n = (int)(L->top - L->base);
|
||||
if (n > LJ_MAX_UPVAL)
|
||||
lj_err_caller(L, LJ_ERR_UNPACK);
|
||||
lua_pushcclosure(L, io_file_iter, n);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* -- I/O file methods ---------------------------------------------------- */
|
||||
|
||||
#define LJLIB_MODULE_io_method
|
||||
|
@ -379,8 +370,7 @@ LJLIB_CF(io_method_setvbuf)
|
|||
LJLIB_CF(io_method_lines)
|
||||
{
|
||||
io_tofile(L);
|
||||
lua_pushcclosure(L, io_file_iter, (int)(L->top - L->base));
|
||||
return 1;
|
||||
return io_file_lines(L);
|
||||
}
|
||||
|
||||
LJLIB_CF(io_method___gc)
|
||||
|
@ -417,14 +407,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 +423,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
|
||||
|
@ -520,8 +500,7 @@ LJLIB_CF(io_lines)
|
|||
} else { /* io.lines() iterates over stdin. */
|
||||
setudataV(L, L->base, IOSTDF_UD(L, GCROOT_IO_INPUT));
|
||||
}
|
||||
lua_pushcclosure(L, io_file_iter, (int)(L->top - L->base));
|
||||
return 1;
|
||||
return io_file_lines(L);
|
||||
}
|
||||
|
||||
LJLIB_CF(io_type)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** JIT library.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#define lib_jit_c
|
||||
|
@ -199,6 +199,7 @@ LJLIB_CF(jit_util_funcinfo)
|
|||
lua_setfield(L, -2, "source");
|
||||
lj_debug_pushloc(L, pt, pc);
|
||||
lua_setfield(L, -2, "loc");
|
||||
setprotoV(L, lj_tab_setstr(L, t, lj_str_newlit(L, "proto")), pt);
|
||||
} else {
|
||||
GCfunc *fn = funcV(L->base);
|
||||
GCtab *t;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Math library.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** OS library.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 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
|
||||
|
@ -32,28 +32,11 @@
|
|||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#if LJ_TARGET_WINDOWS
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
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))
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#define LJLIB_MODULE_os
|
||||
|
||||
LJLIB_CF(os_execute)
|
||||
{
|
||||
#if LJ_TARGET_CONSOLE
|
||||
#if LJ_NO_SYSTEM
|
||||
#if LJ_52
|
||||
errno = ENOSYS;
|
||||
return luaL_fileresult(L, 0, NULL);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Package library.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** String library.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Table library.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 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
|
||||
|
|
|
@ -24,3 +24,18 @@
|
|||
Memcheck:Cond
|
||||
fun:lj_str_new
|
||||
}
|
||||
{
|
||||
Optimized string compare
|
||||
Memcheck:Addr4
|
||||
fun:str_fastcmp
|
||||
}
|
||||
{
|
||||
Optimized string compare
|
||||
Memcheck:Addr1
|
||||
fun:str_fastcmp
|
||||
}
|
||||
{
|
||||
Optimized string compare
|
||||
Memcheck:Cond
|
||||
fun:str_fastcmp
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ static LJ_AINLINE void *CALL_MMAP(size_t size)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
#elif LJ_TARGET_OSX || LJ_TARGET_PS4 || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun__)
|
||||
#elif LJ_TARGET_OSX || LJ_TARGET_PS4 || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun__) || LJ_TARGET_CYGWIN
|
||||
|
||||
/* 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,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Public Lua/C API.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Target architecture selection.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_ARCH_H
|
||||
|
@ -70,7 +70,10 @@
|
|||
defined(__NetBSD__) || defined(__OpenBSD__) || \
|
||||
defined(__DragonFly__)) && !defined(__ORBIS__)
|
||||
#define LUAJIT_OS LUAJIT_OS_BSD
|
||||
#elif (defined(__sun__) && defined(__svr4__)) || defined(__CYGWIN__)
|
||||
#elif (defined(__sun__) && defined(__svr4__))
|
||||
#define LUAJIT_OS LUAJIT_OS_POSIX
|
||||
#elif defined(__CYGWIN__)
|
||||
#define LJ_TARGET_CYGWIN 1
|
||||
#define LUAJIT_OS LUAJIT_OS_POSIX
|
||||
#else
|
||||
#define LUAJIT_OS LUAJIT_OS_OTHER
|
||||
|
@ -133,7 +136,7 @@
|
|||
#define LJ_ARCH_NAME "x86"
|
||||
#define LJ_ARCH_BITS 32
|
||||
#define LJ_ARCH_ENDIAN LUAJIT_LE
|
||||
#if LJ_TARGET_WINDOWS || __CYGWIN__
|
||||
#if LJ_TARGET_WINDOWS || LJ_TARGET_CYGWIN
|
||||
#define LJ_ABI_WIN 1
|
||||
#else
|
||||
#define LJ_ABI_WIN 0
|
||||
|
@ -151,7 +154,11 @@
|
|||
#define LJ_ARCH_NAME "x64"
|
||||
#define LJ_ARCH_BITS 64
|
||||
#define LJ_ARCH_ENDIAN LUAJIT_LE
|
||||
#define LJ_ABI_WIN LJ_TARGET_WINDOWS
|
||||
#if LJ_TARGET_WINDOWS || LJ_TARGET_CYGWIN
|
||||
#define LJ_ABI_WIN 1
|
||||
#else
|
||||
#define LJ_ABI_WIN 0
|
||||
#endif
|
||||
#define LJ_TARGET_X64 1
|
||||
#define LJ_TARGET_X86ORX64 1
|
||||
#define LJ_TARGET_EHRETREG 0
|
||||
|
@ -422,8 +429,16 @@
|
|||
#if defined(__symbian__)
|
||||
#define LUAJIT_NO_EXP2
|
||||
#endif
|
||||
#if LJ_TARGET_CONSOLE || (LJ_TARGET_IOS && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0)
|
||||
#define LJ_NO_SYSTEM 1
|
||||
#endif
|
||||
|
||||
#if defined(LUAJIT_NO_UNWIND) || defined(__symbian__) || LJ_TARGET_IOS || LJ_TARGET_PS3
|
||||
#if !defined(LUAJIT_NO_UNWIND) && __GNU_COMPACT_EH__
|
||||
/* NYI: no support for compact unwind specification, yet. */
|
||||
#define LUAJIT_NO_UNWIND 1
|
||||
#endif
|
||||
|
||||
#if defined(LUAJIT_NO_UNWIND) || defined(__symbian__) || LJ_TARGET_IOS || LJ_TARGET_PS3 || LJ_TARGET_PS4
|
||||
#define LJ_NO_UNWIND 1
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** IR assembler (SSA IR -> machine code).
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#define lj_asm_c
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** IR assembler (SSA IR -> machine code).
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_ASM_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** ARM IR assembler (SSA IR -> machine code).
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
/* -- Register allocator extensions --------------------------------------- */
|
||||
|
@ -426,7 +426,7 @@ static void asm_gencall(ASMState *as, const CCallInfo *ci, IRRef *args)
|
|||
static void asm_setupresult(ASMState *as, IRIns *ir, const CCallInfo *ci)
|
||||
{
|
||||
RegSet drop = RSET_SCRATCH;
|
||||
int hiop = ((ir+1)->o == IR_HIOP);
|
||||
int hiop = ((ir+1)->o == IR_HIOP && !irt_isnil((ir+1)->t));
|
||||
if (ra_hasreg(ir->r))
|
||||
rset_clear(drop, ir->r); /* Dest reg handled below. */
|
||||
if (hiop && ra_hasreg((ir+1)->r))
|
||||
|
@ -976,7 +976,6 @@ static void asm_newref(ASMState *as, IRIns *ir)
|
|||
|
||||
static void asm_uref(ASMState *as, IRIns *ir)
|
||||
{
|
||||
/* NYI: Check that UREFO is still open and not aliasing a slot. */
|
||||
Reg dest = ra_dest(as, ir, RSET_GPR);
|
||||
if (irref_isk(ir->op1)) {
|
||||
GCfunc *fn = ir_kfunc(IR(ir->op1));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** MIPS IR assembler (SSA IR -> machine code).
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
/* -- Register allocator extensions --------------------------------------- */
|
||||
|
@ -291,7 +291,7 @@ static void asm_gencall(ASMState *as, const CCallInfo *ci, IRRef *args)
|
|||
static void asm_setupresult(ASMState *as, IRIns *ir, const CCallInfo *ci)
|
||||
{
|
||||
RegSet drop = RSET_SCRATCH;
|
||||
int hiop = ((ir+1)->o == IR_HIOP);
|
||||
int hiop = ((ir+1)->o == IR_HIOP && !irt_isnil((ir+1)->t));
|
||||
if ((ci->flags & CCI_NOFPRCLOBBER))
|
||||
drop &= ~RSET_FPR;
|
||||
if (ra_hasreg(ir->r))
|
||||
|
@ -443,18 +443,14 @@ static void asm_conv(ASMState *as, IRIns *ir)
|
|||
/* y = (x ^ 0x8000000) + 2147483648.0 */
|
||||
Reg left = ra_alloc1(as, lref, RSET_GPR);
|
||||
Reg tmp = ra_scratch(as, rset_exclude(RSET_FPR, dest));
|
||||
emit_fgh(as, irt_isfloat(ir->t) ? MIPSI_ADD_S : MIPSI_ADD_D,
|
||||
dest, dest, tmp);
|
||||
emit_fg(as, irt_isfloat(ir->t) ? MIPSI_CVT_S_W : MIPSI_CVT_D_W,
|
||||
dest, dest);
|
||||
if (irt_isfloat(ir->t))
|
||||
emit_lsptr(as, MIPSI_LWC1, (tmp & 31),
|
||||
(void *)lj_ir_k64_find(as->J, U64x(4f000000,4f000000)),
|
||||
RSET_GPR);
|
||||
else
|
||||
emit_lsptr(as, MIPSI_LDC1, (tmp & 31),
|
||||
(void *)lj_ir_k64_find(as->J, U64x(41e00000,00000000)),
|
||||
RSET_GPR);
|
||||
emit_fg(as, MIPSI_CVT_S_D, dest, dest);
|
||||
/* Must perform arithmetic with doubles to keep the precision. */
|
||||
emit_fgh(as, MIPSI_ADD_D, dest, dest, tmp);
|
||||
emit_fg(as, MIPSI_CVT_D_W, dest, dest);
|
||||
emit_lsptr(as, MIPSI_LDC1, (tmp & 31),
|
||||
(void *)lj_ir_k64_find(as->J, U64x(41e00000,00000000)),
|
||||
RSET_GPR);
|
||||
emit_tg(as, MIPSI_MTC1, RID_TMP, dest);
|
||||
emit_dst(as, MIPSI_XOR, RID_TMP, RID_TMP, left);
|
||||
emit_ti(as, MIPSI_LUI, RID_TMP, 0x8000);
|
||||
|
@ -793,7 +789,6 @@ static void asm_newref(ASMState *as, IRIns *ir)
|
|||
|
||||
static void asm_uref(ASMState *as, IRIns *ir)
|
||||
{
|
||||
/* NYI: Check that UREFO is still open and not aliasing a slot. */
|
||||
Reg dest = ra_dest(as, ir, RSET_GPR);
|
||||
if (irref_isk(ir->op1)) {
|
||||
GCfunc *fn = ir_kfunc(IR(ir->op1));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** PPC IR assembler (SSA IR -> machine code).
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
/* -- Register allocator extensions --------------------------------------- */
|
||||
|
@ -298,7 +298,7 @@ static void asm_gencall(ASMState *as, const CCallInfo *ci, IRRef *args)
|
|||
static void asm_setupresult(ASMState *as, IRIns *ir, const CCallInfo *ci)
|
||||
{
|
||||
RegSet drop = RSET_SCRATCH;
|
||||
int hiop = ((ir+1)->o == IR_HIOP);
|
||||
int hiop = ((ir+1)->o == IR_HIOP && !irt_isnil((ir+1)->t));
|
||||
if ((ci->flags & CCI_NOFPRCLOBBER))
|
||||
drop &= ~RSET_FPR;
|
||||
if (ra_hasreg(ir->r))
|
||||
|
@ -789,7 +789,6 @@ static void asm_newref(ASMState *as, IRIns *ir)
|
|||
|
||||
static void asm_uref(ASMState *as, IRIns *ir)
|
||||
{
|
||||
/* NYI: Check that UREFO is still open and not aliasing a slot. */
|
||||
Reg dest = ra_dest(as, ir, RSET_GPR);
|
||||
if (irref_isk(ir->op1)) {
|
||||
GCfunc *fn = ir_kfunc(IR(ir->op1));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** x86/x64 IR assembler (SSA IR -> machine code).
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
/* -- Guard handling ------------------------------------------------------ */
|
||||
|
@ -325,11 +325,11 @@ 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) {
|
||||
} else if (ref == REF_BASE || 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.ofs = ptr2addr(ref == REF_BASE ? (void *)&J2G(as->J)->jit_base : (void *)ir_kint64(ir));
|
||||
as->mrm.base = as->mrm.idx = RID_NONE;
|
||||
return RID_MRM;
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ static Reg asm_fuseload(ASMState *as, IRRef ref, RegSet allow)
|
|||
return RID_MRM;
|
||||
}
|
||||
}
|
||||
if (!(as->freeset & allow) && !irref_isk(ref) &&
|
||||
if (!(as->freeset & allow) && !emit_canremat(ref) &&
|
||||
(allow == RSET_EMPTY || ra_hasspill(ir->s) || iscrossref(as, ref)))
|
||||
goto fusespill;
|
||||
return ra_allocref(as, ref, allow);
|
||||
|
@ -531,7 +531,7 @@ static void asm_gencall(ASMState *as, const CCallInfo *ci, IRRef *args)
|
|||
static void asm_setupresult(ASMState *as, IRIns *ir, const CCallInfo *ci)
|
||||
{
|
||||
RegSet drop = RSET_SCRATCH;
|
||||
int hiop = (LJ_32 && (ir+1)->o == IR_HIOP);
|
||||
int hiop = (LJ_32 && (ir+1)->o == IR_HIOP && !irt_isnil((ir+1)->t));
|
||||
if ((ci->flags & CCI_NOFPRCLOBBER))
|
||||
drop &= ~RSET_FPR;
|
||||
if (ra_hasreg(ir->r))
|
||||
|
@ -1215,7 +1215,6 @@ static void asm_newref(ASMState *as, IRIns *ir)
|
|||
|
||||
static void asm_uref(ASMState *as, IRIns *ir)
|
||||
{
|
||||
/* NYI: Check that UREFO is still open and not aliasing a slot. */
|
||||
Reg dest = ra_dest(as, ir, RSET_GPR);
|
||||
if (irref_isk(ir->op1)) {
|
||||
GCfunc *fn = ir_kfunc(IR(ir->op1));
|
||||
|
@ -2776,6 +2775,106 @@ static void asm_setup_target(ASMState *as)
|
|||
|
||||
/* -- Trace patching ------------------------------------------------------ */
|
||||
|
||||
static const uint8_t map_op1[256] = {
|
||||
0x92,0x92,0x92,0x92,0x52,0x45,0x51,0x51,0x92,0x92,0x92,0x92,0x52,0x45,0x51,0x20,
|
||||
0x92,0x92,0x92,0x92,0x52,0x45,0x51,0x51,0x92,0x92,0x92,0x92,0x52,0x45,0x51,0x51,
|
||||
0x92,0x92,0x92,0x92,0x52,0x45,0x10,0x51,0x92,0x92,0x92,0x92,0x52,0x45,0x10,0x51,
|
||||
0x92,0x92,0x92,0x92,0x52,0x45,0x10,0x51,0x92,0x92,0x92,0x92,0x52,0x45,0x10,0x51,
|
||||
#if LJ_64
|
||||
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,
|
||||
#else
|
||||
0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,
|
||||
#endif
|
||||
0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,
|
||||
0x51,0x51,0x92,0x92,0x10,0x10,0x12,0x11,0x45,0x86,0x52,0x93,0x51,0x51,0x51,0x51,
|
||||
0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,
|
||||
0x93,0x86,0x93,0x93,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,
|
||||
0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x47,0x51,0x51,0x51,0x51,0x51,
|
||||
#if LJ_64
|
||||
0x59,0x59,0x59,0x59,0x51,0x51,0x51,0x51,0x52,0x45,0x51,0x51,0x51,0x51,0x51,0x51,
|
||||
#else
|
||||
0x55,0x55,0x55,0x55,0x51,0x51,0x51,0x51,0x52,0x45,0x51,0x51,0x51,0x51,0x51,0x51,
|
||||
#endif
|
||||
0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,
|
||||
0x93,0x93,0x53,0x51,0x70,0x71,0x93,0x86,0x54,0x51,0x53,0x51,0x51,0x52,0x51,0x51,
|
||||
0x92,0x92,0x92,0x92,0x52,0x52,0x51,0x51,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,
|
||||
0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x45,0x45,0x47,0x52,0x51,0x51,0x51,0x51,
|
||||
0x10,0x51,0x10,0x10,0x51,0x51,0x63,0x66,0x51,0x51,0x51,0x51,0x51,0x51,0x92,0x92
|
||||
};
|
||||
|
||||
static const uint8_t map_op2[256] = {
|
||||
0x93,0x93,0x93,0x93,0x52,0x52,0x52,0x52,0x52,0x52,0x51,0x52,0x51,0x93,0x52,0x94,
|
||||
0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,
|
||||
0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,
|
||||
0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x34,0x51,0x35,0x51,0x51,0x51,0x51,0x51,
|
||||
0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,
|
||||
0x53,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,
|
||||
0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,
|
||||
0x94,0x54,0x54,0x54,0x93,0x93,0x93,0x52,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,
|
||||
0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,
|
||||
0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,
|
||||
0x52,0x52,0x52,0x93,0x94,0x93,0x51,0x51,0x52,0x52,0x52,0x93,0x94,0x93,0x93,0x93,
|
||||
0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x94,0x93,0x93,0x93,0x93,0x93,
|
||||
0x93,0x93,0x94,0x93,0x94,0x94,0x94,0x93,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,
|
||||
0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,
|
||||
0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,
|
||||
0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x52
|
||||
};
|
||||
|
||||
static uint32_t asm_x86_inslen(const uint8_t* p)
|
||||
{
|
||||
uint32_t result = 0;
|
||||
uint32_t prefixes = 0;
|
||||
uint32_t x = map_op1[*p];
|
||||
for (;;) {
|
||||
switch (x >> 4) {
|
||||
case 0: return result + x + (prefixes & 4);
|
||||
case 1: prefixes |= x; x = map_op1[*++p]; result++; break;
|
||||
case 2: x = map_op2[*++p]; break;
|
||||
case 3: p++; goto mrm;
|
||||
case 4: result -= (prefixes & 2); /* fallthrough */
|
||||
case 5: return result + (x & 15);
|
||||
case 6: /* Group 3. */
|
||||
if (p[1] & 0x38) x = 2;
|
||||
else if ((prefixes & 2) && (x == 0x66)) x = 4;
|
||||
goto mrm;
|
||||
case 7: /* VEX c4/c5. */
|
||||
if (LJ_32 && p[1] < 0xc0) {
|
||||
x = 2;
|
||||
goto mrm;
|
||||
}
|
||||
if (x == 0x70) {
|
||||
x = *++p & 0x1f;
|
||||
result++;
|
||||
if (x >= 2) {
|
||||
p += 2;
|
||||
result += 2;
|
||||
goto mrm;
|
||||
}
|
||||
}
|
||||
p++;
|
||||
result++;
|
||||
x = map_op2[*++p];
|
||||
break;
|
||||
case 8: result -= (prefixes & 2); /* fallthrough */
|
||||
case 9: mrm: /* ModR/M and possibly SIB. */
|
||||
result += (x & 15);
|
||||
x = *++p;
|
||||
switch (x >> 6) {
|
||||
case 0: if ((x & 7) == 5) return result + 4; break;
|
||||
case 1: result++; break;
|
||||
case 2: result += 4; break;
|
||||
case 3: return result;
|
||||
}
|
||||
if ((x & 7) == 4) {
|
||||
result++;
|
||||
if (x < 0x40 && (p[1] & 7) == 5) result += 4;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Patch exit jumps of existing machine code to a new target. */
|
||||
void lj_asm_patchexit(jit_State *J, GCtrace *T, ExitNo exitno, MCode *target)
|
||||
{
|
||||
|
@ -2788,18 +2887,13 @@ void lj_asm_patchexit(jit_State *J, GCtrace *T, ExitNo exitno, MCode *target)
|
|||
if (len > 5 && p[len-5] == XI_JMP && p+len-6 + *(int32_t *)(p+len-4) == px)
|
||||
*(int32_t *)(p+len-4) = jmprel(p+len, target);
|
||||
/* Do not patch parent exit for a stack check. Skip beyond vmstate update. */
|
||||
for (; p < pe; p++)
|
||||
if (*(uint32_t *)(p+(LJ_64 ? 3 : 2)) == stateaddr && p[0] == XI_MOVmi) {
|
||||
p += LJ_64 ? 11 : 10;
|
||||
for (; p < pe; p += asm_x86_inslen(p))
|
||||
if (*(uint32_t *)(p+(LJ_64 ? 3 : 2)) == stateaddr && p[0] == XI_MOVmi)
|
||||
break;
|
||||
}
|
||||
lua_assert(p < pe);
|
||||
for (; p < pe; p++) {
|
||||
if ((*(uint16_t *)p & 0xf0ff) == 0x800f && p + *(int32_t *)(p+2) == px) {
|
||||
for (; p < pe; p += asm_x86_inslen(p))
|
||||
if ((*(uint16_t *)p & 0xf0ff) == 0x800f && p + *(int32_t *)(p+2) == px)
|
||||
*(int32_t *)(p+2) = jmprel(p+6, target);
|
||||
p += 5;
|
||||
}
|
||||
}
|
||||
lj_mcode_sync(T->mcode, T->mcode + T->szmcode);
|
||||
lj_mcode_patch(J, mcarea, 1);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Bytecode instruction modes.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#define lj_bc_c
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Bytecode instruction format.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_BC_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Bytecode dump definitions.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_BCDUMP_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Bytecode reader.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#define lj_bcread_c
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Bytecode writer.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#define lj_bcwrite_c
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** C data arithmetic.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#include "lj_obj.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** C data arithmetic.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_CARITH_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** FFI C call handling.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#include "lj_obj.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** FFI C call handling.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_CCALL_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** FFI C callback handling.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#include "lj_obj.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** FFI C callback handling.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_CCALLBACK_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** C type conversions.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#include "lj_obj.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** C type conversions.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_CCONV_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** C data management.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#include "lj_obj.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** C data management.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_CDATA_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** FFI C library loader.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#include "lj_obj.h"
|
||||
|
@ -39,7 +39,7 @@ LJ_NORET LJ_NOINLINE static void clib_error_(lua_State *L)
|
|||
|
||||
#define clib_error(L, fmt, name) clib_error_(L)
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
#if LJ_TARGET_CYGWIN
|
||||
#define CLIB_SOPREFIX "cyg"
|
||||
#else
|
||||
#define CLIB_SOPREFIX "lib"
|
||||
|
@ -47,7 +47,7 @@ LJ_NORET LJ_NOINLINE static void clib_error_(lua_State *L)
|
|||
|
||||
#if LJ_TARGET_OSX
|
||||
#define CLIB_SOEXT "%s.dylib"
|
||||
#elif defined(__CYGWIN__)
|
||||
#elif LJ_TARGET_CYGWIN
|
||||
#define CLIB_SOEXT "%s.dll"
|
||||
#else
|
||||
#define CLIB_SOEXT "%s.so"
|
||||
|
@ -56,14 +56,14 @@ LJ_NORET LJ_NOINLINE static void clib_error_(lua_State *L)
|
|||
static const char *clib_extname(lua_State *L, const char *name)
|
||||
{
|
||||
if (!strchr(name, '/')
|
||||
#ifdef __CYGWIN__
|
||||
#if LJ_TARGET_CYGWIN
|
||||
&& !strchr(name, '\\')
|
||||
#endif
|
||||
) {
|
||||
if (!strchr(name, '.')) {
|
||||
name = lj_str_pushf(L, CLIB_SOEXT, name);
|
||||
L->top--;
|
||||
#ifdef __CYGWIN__
|
||||
#if LJ_TARGET_CYGWIN
|
||||
} else {
|
||||
return name;
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** FFI C library loader.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_CLIB_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** C declaration parser.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#include "lj_obj.h"
|
||||
|
@ -310,13 +310,17 @@ static CPToken cp_next_(CPState *cp)
|
|||
else return '/';
|
||||
break;
|
||||
case '|':
|
||||
if (cp_get(cp) != '|') return '|'; cp_get(cp); return CTOK_OROR;
|
||||
if (cp_get(cp) != '|') return '|';
|
||||
cp_get(cp); return CTOK_OROR;
|
||||
case '&':
|
||||
if (cp_get(cp) != '&') return '&'; cp_get(cp); return CTOK_ANDAND;
|
||||
if (cp_get(cp) != '&') return '&';
|
||||
cp_get(cp); return CTOK_ANDAND;
|
||||
case '=':
|
||||
if (cp_get(cp) != '=') return '='; cp_get(cp); return CTOK_EQ;
|
||||
if (cp_get(cp) != '=') return '=';
|
||||
cp_get(cp); return CTOK_EQ;
|
||||
case '!':
|
||||
if (cp_get(cp) != '=') return '!'; cp_get(cp); return CTOK_NE;
|
||||
if (cp_get(cp) != '=') return '!';
|
||||
cp_get(cp); return CTOK_NE;
|
||||
case '<':
|
||||
if (cp_get(cp) == '=') { cp_get(cp); return CTOK_LE; }
|
||||
else if (cp->c == '<') { cp_get(cp); return CTOK_SHL; }
|
||||
|
@ -326,7 +330,8 @@ static CPToken cp_next_(CPState *cp)
|
|||
else if (cp->c == '>') { cp_get(cp); return CTOK_SHR; }
|
||||
return '>';
|
||||
case '-':
|
||||
if (cp_get(cp) != '>') return '-'; cp_get(cp); return CTOK_DEREF;
|
||||
if (cp_get(cp) != '>') return '-';
|
||||
cp_get(cp); return CTOK_DEREF;
|
||||
case '$':
|
||||
return cp_param(cp);
|
||||
case '\0': return CTOK_EOF;
|
||||
|
@ -798,6 +803,10 @@ static void cp_push_type(CPDecl *decl, CTypeID id)
|
|||
cp_push(decl, info & ~CTMASK_CID, size); /* Copy type. */
|
||||
break;
|
||||
case CT_ARRAY:
|
||||
if ((ct->info & (CTF_VECTOR|CTF_COMPLEX))) {
|
||||
info |= (decl->attr & CTF_QUAL);
|
||||
decl->attr &= ~CTF_QUAL;
|
||||
}
|
||||
cp_push_type(decl, ctype_cid(info)); /* Unroll. */
|
||||
cp_push(decl, info & ~CTMASK_CID, size); /* Copy type. */
|
||||
decl->stack[decl->pos].sib = 1; /* Mark as already checked and sized. */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** C declaration parser.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_CPARSE_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Trace recorder for C data operations.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#define lj_ffrecord_c
|
||||
|
@ -1205,7 +1205,7 @@ void LJ_FASTCALL recff_cdata_call(jit_State *J, RecordFFData *rd)
|
|||
|
||||
static TRef crec_arith_int64(jit_State *J, TRef *sp, CType **s, MMS mm)
|
||||
{
|
||||
if (ctype_isnum(s[0]->info) && ctype_isnum(s[1]->info)) {
|
||||
if (sp[0] && sp[1] && ctype_isnum(s[0]->info) && ctype_isnum(s[1]->info)) {
|
||||
IRType dt;
|
||||
CTypeID id;
|
||||
TRef tr;
|
||||
|
@ -1263,6 +1263,7 @@ static TRef crec_arith_ptr(jit_State *J, TRef *sp, CType **s, MMS mm)
|
|||
{
|
||||
CTState *cts = ctype_ctsG(J2G(J));
|
||||
CType *ctp = s[0];
|
||||
if (!(sp[0] && sp[1])) return 0;
|
||||
if (ctype_isptr(ctp->info) || ctype_isrefarray(ctp->info)) {
|
||||
if ((mm == MM_sub || mm == MM_eq || mm == MM_lt || mm == MM_le) &&
|
||||
(ctype_isptr(s[1]->info) || ctype_isrefarray(s[1]->info))) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Trace recorder for C data operations.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_CRECORD_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** C type management.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#include "lj_obj.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** C type management.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_CTYPE_H
|
||||
|
@ -42,18 +42,18 @@ LJ_STATIC_ASSERT(((int)CT_STRUCT & (int)CT_ARRAY) == CT_STRUCT);
|
|||
** ---------- info ------------
|
||||
** |type flags... A cid | size | sib | next | name |
|
||||
** +----------------------------+--------+-------+-------+-------+--
|
||||
** |NUM BFvcUL.. A | size | | type | |
|
||||
** |STRUCT ..vcU..V A | size | field | name? | name? |
|
||||
** |PTR ..vcR... A cid | size | | type | |
|
||||
** |ARRAY VCvc...V A cid | size | | type | |
|
||||
** |VOID ..vc.... A | size | | type | |
|
||||
** |NUM BFcvUL.. A | size | | type | |
|
||||
** |STRUCT ..cvU..V A | size | field | name? | name? |
|
||||
** |PTR ..cvR... A cid | size | | type | |
|
||||
** |ARRAY VCcv...V A cid | size | | type | |
|
||||
** |VOID ..cv.... A | size | | type | |
|
||||
** |ENUM A cid | size | const | name? | name? |
|
||||
** |FUNC ....VS.. cc cid | nargs | field | name? | name? |
|
||||
** |TYPEDEF cid | | | name | name |
|
||||
** |ATTRIB attrnum cid | attr | sib? | type? | |
|
||||
** |FIELD cid | offset | field | | name? |
|
||||
** |BITFIELD B.vcU csz bsz pos | offset | field | | name? |
|
||||
** |CONSTVAL c cid | value | const | name | name |
|
||||
** |BITFIELD B.cvU csz bsz pos | offset | field | | name? |
|
||||
** |CONSTVAL c cid | value | const | name | name |
|
||||
** |EXTERN cid | | sib? | name | name |
|
||||
** |KW tok | size | | name | name |
|
||||
** +----------------------------+--------+-------+-------+-------+--
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Debugging and introspection.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#define lj_debug_c
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Debugging and introspection.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_DEBUG_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** LuaJIT common internal definitions.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_DEF_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Instruction dispatch handling.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#define lj_dispatch_c
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Instruction dispatch handling.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_DISPATCH_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** ARM instruction emitter.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
/* -- Constant encoding --------------------------------------------------- */
|
||||
|
@ -273,7 +273,7 @@ static void emit_call(ASMState *as, void *target)
|
|||
ptrdiff_t delta = ((char *)target - (char *)p) - 8;
|
||||
if ((((delta>>2) + 0x00800000) >> 24) == 0) {
|
||||
if ((delta & 1))
|
||||
*p = ARMI_BLX | ((uint32_t)(delta>>2) & 0x00ffffffu) | ((delta&2) << 27);
|
||||
*p = ARMI_BLX | ((uint32_t)(delta>>2) & 0x00ffffffu) | ((delta&2) << 23);
|
||||
else
|
||||
*p = ARMI_BL | ((uint32_t)(delta>>2) & 0x00ffffffu);
|
||||
} else { /* Target out of range: need indirect call. But don't use R0-R3. */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** MIPS instruction emitter.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
/* -- Emit basic instructions --------------------------------------------- */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** PPC instruction emitter.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
/* -- Emit basic instructions --------------------------------------------- */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** x86/x64 instruction emitter.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
/* -- Emit basic instructions --------------------------------------------- */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Error handling.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#define lj_err_c
|
||||
|
@ -57,10 +57,10 @@
|
|||
** EXT cannot be enabled on WIN32 since system exceptions use code-driven SEH.
|
||||
** EXT is mandatory on WIN64 since the calling convention has an abundance
|
||||
** of callee-saved registers (rbx, rbp, rsi, rdi, r12-r15, xmm6-xmm15).
|
||||
** EXT is mandatory on POSIX/x64 since the interpreter doesn't save r12/r13.
|
||||
** The POSIX/x64 interpreter only saves r12/r13 for INT (e.g. PS4).
|
||||
*/
|
||||
|
||||
#if defined(__GNUC__) && (LJ_TARGET_X64 || defined(LUAJIT_UNWIND_EXTERNAL))
|
||||
#if defined(__GNUC__) && (LJ_TARGET_X64 || defined(LUAJIT_UNWIND_EXTERNAL)) && !LJ_NO_UNWIND
|
||||
#define LJ_UNWIND_EXT 1
|
||||
#elif LJ_TARGET_X64 && LJ_TARGET_WINDOWS
|
||||
#define LJ_UNWIND_EXT 1
|
||||
|
@ -186,7 +186,7 @@ static void *err_unwind(lua_State *L, void *stopcf, int errcode)
|
|||
|
||||
/* -- External frame unwinding -------------------------------------------- */
|
||||
|
||||
#if defined(__GNUC__) && !LJ_NO_UNWIND && !LJ_TARGET_WINDOWS
|
||||
#if defined(__GNUC__) && !LJ_NO_UNWIND && !LJ_ABI_WIN
|
||||
|
||||
/*
|
||||
** We have to use our own definitions instead of the mandatory (!) unwind.h,
|
||||
|
@ -352,7 +352,7 @@ LJ_FUNCA int lj_err_unwind_arm(int state, void *ucb, _Unwind_Context *ctx)
|
|||
|
||||
#endif
|
||||
|
||||
#elif LJ_TARGET_X64 && LJ_TARGET_WINDOWS
|
||||
#elif LJ_TARGET_X64 && LJ_ABI_WIN
|
||||
|
||||
/*
|
||||
** Someone in Redmond owes me several days of my life. A lot of this is
|
||||
|
@ -417,7 +417,9 @@ LJ_FUNCA EXCEPTION_DISPOSITION lj_err_unwind_win64(EXCEPTION_RECORD *rec,
|
|||
if (cf2) { /* We catch it, so start unwinding the upper frames. */
|
||||
if (rec->ExceptionCode == LJ_MSVC_EXCODE ||
|
||||
rec->ExceptionCode == LJ_GCC_EXCODE) {
|
||||
#if LJ_TARGET_WINDOWS
|
||||
__DestructExceptionObject(rec, 1);
|
||||
#endif
|
||||
setstrV(L, L->top++, lj_err_str(L, LJ_ERR_ERRCPP));
|
||||
} else if (!LJ_EXCODE_CHECK(rec->ExceptionCode)) {
|
||||
/* Don't catch access violations etc. */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Error handling.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_ERR_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** VM error messages.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
/* This file may be included multiple times with different ERRDEF macros. */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Fast function IDs.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_FF_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Fast function call recorder.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#define lj_ffrecord_c
|
||||
|
@ -366,11 +366,12 @@ static void LJ_FASTCALL recff_ipairs_aux(jit_State *J, RecordFFData *rd)
|
|||
|
||||
static void LJ_FASTCALL recff_ipairs(jit_State *J, RecordFFData *rd)
|
||||
{
|
||||
if (!(LJ_52 && recff_metacall(J, rd, MM_ipairs))) {
|
||||
TRef tab = J->base[0];
|
||||
if (tref_istab(tab)) {
|
||||
TRef tr = J->base[0];
|
||||
if (!((LJ_52 || (LJ_HASFFI && tref_iscdata(tr))) &&
|
||||
recff_metacall(J, rd, MM_ipairs))) {
|
||||
if (tref_istab(tr)) {
|
||||
J->base[0] = lj_ir_kfunc(J, funcV(&J->fn->c.upvalue[0]));
|
||||
J->base[1] = tab;
|
||||
J->base[1] = tr;
|
||||
J->base[2] = lj_ir_kint(J, 0);
|
||||
rd->nres = 3;
|
||||
} /* else: Interpreter will throw. */
|
||||
|
@ -538,10 +539,8 @@ static void LJ_FASTCALL recff_math_degrad(jit_State *J, RecordFFData *rd)
|
|||
|
||||
static void LJ_FASTCALL recff_math_pow(jit_State *J, RecordFFData *rd)
|
||||
{
|
||||
TRef tr = lj_ir_tonum(J, J->base[0]);
|
||||
if (!tref_isnumber_str(J->base[1]))
|
||||
lj_trace_err(J, LJ_TRERR_BADTYPE);
|
||||
J->base[0] = lj_opt_narrow_pow(J, tr, J->base[1], &rd->argv[1]);
|
||||
J->base[0] = lj_opt_narrow_pow(J, J->base[0], J->base[1],
|
||||
&rd->argv[0], &rd->argv[1]);
|
||||
UNUSED(rd);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Fast function call recorder.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_FFRECORD_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Stack frames.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_FRAME_H
|
||||
|
@ -86,7 +86,11 @@ enum {
|
|||
#define CFRAME_OFS_ERRF (5*4)
|
||||
#define CFRAME_OFS_NRES (4*4)
|
||||
#define CFRAME_OFS_MULTRES (1*4)
|
||||
#if LJ_NO_UNWIND
|
||||
#define CFRAME_SIZE (12*8)
|
||||
#else
|
||||
#define CFRAME_SIZE (10*8)
|
||||
#endif
|
||||
#define CFRAME_SIZE_JIT (CFRAME_SIZE + 16)
|
||||
#define CFRAME_SHIFT_MULTRES 0
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Function handling (prototypes, functions and upvalues).
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 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
|
||||
|
@ -140,7 +140,9 @@ GCfunc *lj_func_newL_empty(lua_State *L, GCproto *pt, GCtab *env)
|
|||
/* NOBARRIER: The GCfunc is new (marked white). */
|
||||
for (i = 0; i < nuv; i++) {
|
||||
GCupval *uv = func_emptyuv(L);
|
||||
uv->dhash = (uint32_t)(uintptr_t)pt ^ ((uint32_t)proto_uv(pt)[i] << 24);
|
||||
int32_t v = proto_uv(pt)[i];
|
||||
uv->immutable = ((v / PROTO_UV_IMMUTABLE) & 1);
|
||||
uv->dhash = (uint32_t)(uintptr_t)pt ^ (v << 24);
|
||||
setgcref(fn->l.uvptr[i], obj2gco(uv));
|
||||
}
|
||||
fn->l.nupvalues = (uint8_t)nuv;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Function handling (prototypes, functions and upvalues).
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_FUNC_H
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Garbage collector.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 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
|
||||
|
@ -168,12 +168,19 @@ static int gc_traverse_tab(global_State *g, GCtab *t)
|
|||
while ((c = *modestr++)) {
|
||||
if (c == 'k') weak |= LJ_GC_WEAKKEY;
|
||||
else if (c == 'v') weak |= LJ_GC_WEAKVAL;
|
||||
else if (c == 'K') weak = (int)(~0u & ~LJ_GC_WEAKVAL);
|
||||
}
|
||||
if (weak > 0) { /* Weak tables are cleared in the atomic phase. */
|
||||
t->marked = (uint8_t)((t->marked & ~LJ_GC_WEAK) | weak);
|
||||
setgcrefr(t->gclist, g->gc.weak);
|
||||
setgcref(g->gc.weak, obj2gco(t));
|
||||
if (weak) { /* Weak tables are cleared in the atomic phase. */
|
||||
#if LJ_HASFFI
|
||||
CTState *cts = ctype_ctsG(g);
|
||||
if (cts && cts->finalizer == t) {
|
||||
weak = (int)(~0u & ~LJ_GC_WEAKVAL);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
t->marked = (uint8_t)((t->marked & ~LJ_GC_WEAK) | weak);
|
||||
setgcrefr(t->gclist, g->gc.weak);
|
||||
setgcref(g->gc.weak, obj2gco(t));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (weak == LJ_GC_WEAK) /* Nothing to mark if both keys/values are weak. */
|
||||
|
@ -307,7 +314,7 @@ static size_t propagatemark(global_State *g)
|
|||
if (gc_traverse_tab(g, t) > 0)
|
||||
black2gray(o); /* Keep weak tables gray. */
|
||||
return sizeof(GCtab) + sizeof(TValue) * t->asize +
|
||||
sizeof(Node) * (t->hmask + 1);
|
||||
(t->hmask ? sizeof(Node) * (t->hmask + 1) : 0);
|
||||
} else if (LJ_LIKELY(gct == ~LJ_TFUNC)) {
|
||||
GCfunc *fn = gco2func(o);
|
||||
gc_traverse_func(g, fn);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
** Garbage collector.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#ifndef _LJ_GC_H
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue