Skip to content

Commit

Permalink
LJ_GC64: Add build options and install instructions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Pall committed Jan 17, 2017
1 parent c198167 commit c94b921
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
3 changes: 2 additions & 1 deletion doc/extensions.html
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ <h3 id="string_dump"><tt>string.dump(f [,strip])</tt> generates portable bytecod
<p>
Note: <tt>LJ_GC64</tt> 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.
</p>

<h3 id="table_new"><tt>table.new(narray, nhash)</tt> allocates a pre-sized table</h3>
Expand Down
15 changes: 10 additions & 5 deletions doc/install.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ <h2>Configuring LuaJIT</h2>
Please read the instructions given in these files, before changing
any settings.
</p>
<p>
LuaJIT on x64 currently uses 32 bit GC objects by default.
<tt>LJ_GC64</tt> mode may be explicitly enabled:
add <tt>XCFLAGS=-DLUAJIT_ENABLE_GC64</tt> to the make command or run
<tt>msvcbuild gc64</tt> for MSVC/WinSDK. Please check the note
about the <a href="extensions.html#string_dump">bytecode format</a>
differences, too.
</p>

<h2 id="posix">POSIX Systems (Linux, OSX, *BSD etc.)</h2>
<h3>Prerequisites</h3>
Expand Down Expand Up @@ -584,14 +592,11 @@ <h2 id="embed">Embedding LuaJIT</h2>
</li>
<li>
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 <tt>LJ_GC64</tt> mode,
you need to link your main executable with these flags:
<pre class="code">
-pagezero_size 10000 -image_base 100000000
</pre>
Also, it's recommended to <tt>rebase</tt> all (self-compiled) shared libraries
which are loaded at runtime on OSX/x64 (e.g. C extension modules for Lua).
See: <tt>man rebase</tt>
</li>
</ul>
<p>Additional hints for initializing LuaJIT using the C API functions:</p>
Expand Down
3 changes: 3 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ XCFLAGS=
#XCFLAGS+= -DLUAJIT_NUMMODE=1
#XCFLAGS+= -DLUAJIT_NUMMODE=2
#
# Enable GC64 mode for x64.
#XCFLAGS+= -DLUAJIT_ENABLE_GC64
#
##############################################################################

##############################################################################
Expand Down
8 changes: 7 additions & 1 deletion src/msvcbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit c94b921

Please sign in to comment.