From c94b921f924c1b37fea52e34f4e01ba8b37d77d0 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Tue, 17 Jan 2017 12:21:12 +0100 Subject: [PATCH] LJ_GC64: Add build options and install instructions. --- doc/extensions.html | 3 ++- doc/install.html | 15 ++++++++++----- src/Makefile | 3 +++ src/msvcbuild.bat | 8 +++++++- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/doc/extensions.html b/doc/extensions.html index b048f137..cb9be3f4 100644 --- a/doc/extensions.html +++ b/doc/extensions.html @@ -210,7 +210,8 @@ bytecode (e.g. from Lua 5.1) is incompatible and cannot be loaded.

Note: LJ_GC64 mode requires a different frame layout, which implies a different, incompatible bytecode format for ports that use this mode (e.g. -ARM64). This may be rectified in the future. +ARM64 or MIPS64) or when explicitly enabled for x64. This may be rectified +in the future.

table.new(narray, nhash) allocates a pre-sized table

diff --git a/doc/install.html b/doc/install.html index efeda33c..230e9386 100644 --- a/doc/install.html +++ b/doc/install.html @@ -175,6 +175,14 @@ MSVC or WinSDK. Please read the instructions given in these files, before changing any settings.

+

+LuaJIT on x64 currently uses 32 bit GC objects by default. +LJ_GC64 mode may be explicitly enabled: +add XCFLAGS=-DLUAJIT_ENABLE_GC64 to the make command or run +msvcbuild gc64 for MSVC/WinSDK. Please check the note +about the bytecode format +differences, too. +

POSIX Systems (Linux, OSX, *BSD etc.)

Prerequisites

@@ -584,14 +592,11 @@ intend to load Lua/C modules at runtime.
  • If you're building a 64 bit application on OSX which links directly or -indirectly against LuaJIT, you need to link your main executable -with these flags: +indirectly against LuaJIT which is not built for LJ_GC64 mode, +you need to link your main executable with these flags:
     -pagezero_size 10000 -image_base 100000000
     
    -Also, it's recommended to rebase all (self-compiled) shared libraries -which are loaded at runtime on OSX/x64 (e.g. C extension modules for Lua). -See: man rebase
  • Additional hints for initializing LuaJIT using the C API functions:

    diff --git a/src/Makefile b/src/Makefile index 4e479ae5..21e16a22 100644 --- a/src/Makefile +++ b/src/Makefile @@ -110,6 +110,9 @@ XCFLAGS= #XCFLAGS+= -DLUAJIT_NUMMODE=1 #XCFLAGS+= -DLUAJIT_NUMMODE=2 # +# Enable GC64 mode for x64. +#XCFLAGS+= -DLUAJIT_ENABLE_GC64 +# ############################################################################## ############################################################################## diff --git a/src/msvcbuild.bat b/src/msvcbuild.bat index 4334bbde..f7a1addc 100644 --- a/src/msvcbuild.bat +++ b/src/msvcbuild.bat @@ -20,6 +20,7 @@ @set LJLIB=lib /nologo /nodefaultlib @set DASMDIR=..\dynasm @set DASM=%DASMDIR%\dynasm.lua +@set DASC=vm_x86.dasc @set LJDLLNAME=lua51.dll @set LJLIBNAME=lua51.lib @set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c @@ -39,7 +40,12 @@ if exist minilua.exe.manifest^ @set LJARCH=x86 @set LJCOMPILE=%LJCOMPILE% /arch:SSE2 :X64 -minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h vm_x86.dasc +@if "%1" neq "gc64" goto :NOGC64 +@shift +@set DASC=vm_x64.dasc +@set LJCOMPILE=%LJCOMPILE% /DLUAJIT_ENABLE_GC64 +:NOGC64 +minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h %DASC% @if errorlevel 1 goto :BAD %LJCOMPILE% /I "." /I %DASMDIR% host\buildvm*.c