From bd00094c3b50e193fb32aad79b7ea8ea6b78ed25 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Sun, 8 Dec 2019 21:21:30 +0100 Subject: [PATCH] x64: Enable LJ_GC64 mode by default. --- doc/extensions.html | 5 ++--- doc/install.html | 11 +++++------ src/Makefile | 4 ++-- src/lj_arch.h | 2 +- src/msvcbuild.bat | 12 +++++++----- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/doc/extensions.html b/doc/extensions.html index 6d3518ea7e..35bd6c9200 100644 --- a/doc/extensions.html +++ b/doc/extensions.html @@ -208,9 +208,8 @@

string.dump(f [,strip]) generates portable bytecod

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 or MIPS64) or when explicitly enabled for x64. This may be rectified -in the future. +a different, incompatible bytecode format for all 64 bit ports. 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 49d6e9edee..9e00b231ee 100644 --- a/doc/install.html +++ b/doc/install.html @@ -175,12 +175,11 @@

Configuring LuaJIT

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. +All LuaJIT 64 bit ports use 64 bit GC objects by default (LJ_GC64). +For x64, you can select the old 32-on-64 bit mode by adding +XCFLAGS=-DLUAJIT_DISABLE_GC64 to the make command. +Please check the note about the +bytecode format differences, too.

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

diff --git a/src/Makefile b/src/Makefile index 71c284e221..ad80642b34 100644 --- a/src/Makefile +++ b/src/Makefile @@ -110,8 +110,8 @@ XCFLAGS= #XCFLAGS+= -DLUAJIT_NUMMODE=1 #XCFLAGS+= -DLUAJIT_NUMMODE=2 # -# Enable GC64 mode for x64. -#XCFLAGS+= -DLUAJIT_ENABLE_GC64 +# Disable LJ_GC64 mode for x64. +#XCFLAGS+= -DLUAJIT_DISABLE_GC64 # ############################################################################## diff --git a/src/lj_arch.h b/src/lj_arch.h index 31a11593fb..903d6c64d0 100644 --- a/src/lj_arch.h +++ b/src/lj_arch.h @@ -184,7 +184,7 @@ #define LJ_TARGET_MASKROT 1 #define LJ_TARGET_UNALIGNED 1 #define LJ_ARCH_NUMMODE LJ_NUMMODE_SINGLE_DUAL -#ifdef LUAJIT_ENABLE_GC64 +#ifndef LUAJIT_DISABLE_GC64 #define LJ_TARGET_GC64 1 #endif diff --git a/src/msvcbuild.bat b/src/msvcbuild.bat index 4abc461a4b..91de2b5279 100644 --- a/src/msvcbuild.bat +++ b/src/msvcbuild.bat @@ -5,6 +5,7 @@ @rem Then cd to this directory and run this script. Use the following @rem options (in order), if needed. The default is a dynamic release build. @rem +@rem nogc64 disable LJ_GC64 mode for x64 @rem debug emit debug symbols @rem amalg amalgamated build @rem static static linkage @@ -20,7 +21,7 @@ @set LJLIB=lib /nologo /nodefaultlib @set DASMDIR=..\dynasm @set DASM=%DASMDIR%\dynasm.lua -@set DASC=vm_x86.dasc +@set DASC=vm_x64.dasc @set LJDLLNAME=lua51.dll @set LJLIBNAME=lua51.lib @set BUILDTYPE=release @@ -37,15 +38,16 @@ if exist minilua.exe.manifest^ @set LJARCH=x64 @minilua @if errorlevel 8 goto :X64 +@set DASC=vm_x86.dasc @set DASMFLAGS=-D WIN -D JIT -D FFI @set LJARCH=x86 @set LJCOMPILE=%LJCOMPILE% /arch:SSE2 :X64 -@if "%1" neq "gc64" goto :NOGC64 +@if "%1" neq "nogc64" goto :GC64 @shift -@set DASC=vm_x64.dasc -@set LJCOMPILE=%LJCOMPILE% /DLUAJIT_ENABLE_GC64 -:NOGC64 +@set DASC=vm_x86.dasc +@set LJCOMPILE=%LJCOMPILE% /DLUAJIT_DISABLE_GC64 +:GC64 minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h %DASC% @if errorlevel 1 goto :BAD