diff options
| author | Mike Pall <mike> | 2010-02-28 21:45:38 +0100 |
|---|---|---|
| committer | Mike Pall <mike> | 2010-02-28 21:51:01 +0100 |
| commit | 2e22d33d9d256e9a1551229f1b51e2a6f02da2f6 (patch) | |
| tree | 55c51dd77b08afd7044a046cb3b037106285000c | |
| parent | 956065fd047de66aab31cd4336f3e663e87db3e3 (diff) | |
| download | luajit-2e22d33d9d256e9a1551229f1b51e2a6f02da2f6.tar.gz luajit-2e22d33d9d256e9a1551229f1b51e2a6f02da2f6.tar.bz2 luajit-2e22d33d9d256e9a1551229f1b51e2a6f02da2f6.zip | |
Enable JIT compiler for x64.
Only works on Linux/x64 and Windows/x64 right now.
Force an x64 build on Linux/x64 with: make CC="gcc -m64"
NYI: handle on-trace OOM errors.
NYI: improve register allocation for x64.
| -rw-r--r-- | doc/changes.html | 3 | ||||
| -rw-r--r-- | doc/faq.html | 5 | ||||
| -rw-r--r-- | doc/install.html | 19 | ||||
| -rw-r--r-- | doc/luajit.html | 5 | ||||
| -rw-r--r-- | doc/status.html | 7 | ||||
| -rw-r--r-- | src/Makefile | 16 | ||||
| -rw-r--r-- | src/lj_arch.h | 1 |
7 files changed, 25 insertions, 31 deletions
diff --git a/doc/changes.html b/doc/changes.html index 7f2da0a8..33c3f317 100644 --- a/doc/changes.html +++ b/doc/changes.html | |||
| @@ -58,7 +58,7 @@ to see whether newer versions are available. | |||
| 58 | <li>CPU support: | 58 | <li>CPU support: |
| 59 | <ul> | 59 | <ul> |
| 60 | <li>Port integrated memory allocator to Linux/x64 and Windows/x64.</li> | 60 | <li>Port integrated memory allocator to Linux/x64 and Windows/x64.</li> |
| 61 | <li>Port the interpreter to x64.</li> | 61 | <li>Port interpreter and JIT compiler to x64.</li> |
| 62 | <li>Port DynASM to x64.</li> | 62 | <li>Port DynASM to x64.</li> |
| 63 | <li>Many 32/64 bit cleanups in the VM.</li> | 63 | <li>Many 32/64 bit cleanups in the VM.</li> |
| 64 | <li>Allow building the interpreter with either x87 or SSE2 arithmetics.</li> | 64 | <li>Allow building the interpreter with either x87 or SSE2 arithmetics.</li> |
| @@ -80,6 +80,7 @@ to see whether newer versions are available. | |||
| 80 | </ul></li> | 80 | </ul></li> |
| 81 | <li>Structural and performance enhancements: | 81 | <li>Structural and performance enhancements: |
| 82 | <ul> | 82 | <ul> |
| 83 | <li>Improve heuristics for bytecode penalties and blacklisting.</li> | ||
| 83 | <li>Split CALL/FUNC recording and clean up fast function call semantics.</li> | 84 | <li>Split CALL/FUNC recording and clean up fast function call semantics.</li> |
| 84 | <li>Major redesign of internal function call handling.</li> | 85 | <li>Major redesign of internal function call handling.</li> |
| 85 | <li>Improve FOR loop const specialization and integerness checks.</li> | 86 | <li>Improve FOR loop const specialization and integerness checks.</li> |
diff --git a/doc/faq.html b/doc/faq.html index 15632eae..6d724325 100644 --- a/doc/faq.html +++ b/doc/faq.html | |||
| @@ -137,9 +137,8 @@ The compiler will happily optimize away such indirections.</dd> | |||
| 137 | machine code. This means the code generator must be ported to each | 137 | machine code. This means the code generator must be ported to each |
| 138 | architecture. And the fast interpreter is written in assembler and | 138 | architecture. And the fast interpreter is written in assembler and |
| 139 | must be ported, too. This is quite an undertaking.<br> Currently only | 139 | must be ported, too. This is quite an undertaking.<br> Currently only |
| 140 | x86 CPUs are supported. x64 support is in the works. Other | 140 | x86 and x64 CPUs are supported. Other architectures will follow based |
| 141 | architectures will follow with sufficient demand and/or | 141 | on sufficient user demand and/or sponsoring.</dd> |
| 142 | sponsoring.</dd> | ||
| 143 | </dl> | 142 | </dl> |
| 144 | 143 | ||
| 145 | <dl> | 144 | <dl> |
diff --git a/doc/install.html b/doc/install.html index 605f954d..102f3417 100644 --- a/doc/install.html +++ b/doc/install.html | |||
| @@ -54,16 +54,10 @@ LuaJIT currently builds out-of-the box on all popular x86 systems | |||
| 54 | (Linux, Windows, OSX etc.). It builds and runs fine as a 32 bit | 54 | (Linux, Windows, OSX etc.). It builds and runs fine as a 32 bit |
| 55 | application under x64-based systems, too. | 55 | application under x64-based systems, too. |
| 56 | </p> | 56 | </p> |
| 57 | <p class="indent" style="color: #00a000;"> | 57 | <p style="color: #00a000;"> |
| 58 | The x64 port of LuaJIT is still experimental and not enabled by default. | 58 | The x64 port of LuaJIT is still preliminary and not enabled by default. |
| 59 | It only contains the interpreter and only builds on Linux/x64 and WIN64 | 59 | It only builds on Linux/x64 and Windows/x64 right now. If you want to |
| 60 | right now. If you want to give it a try, follow the special build instructions | 60 | give it a try, please follow the special build instructions below. |
| 61 | below. | ||
| 62 | </p> | ||
| 63 | <p class="indent" style="color: #00a000;"> | ||
| 64 | Note that the pure interpreter is quite a bit faster than Lua, but of | ||
| 65 | course not as fast as the x86 JIT compiler. Work on the x64 JIT compiler | ||
| 66 | is still ongoing. | ||
| 67 | </p> | 61 | </p> |
| 68 | 62 | ||
| 69 | <h2>Configuring LuaJIT</h2> | 63 | <h2>Configuring LuaJIT</h2> |
| @@ -119,8 +113,7 @@ make | |||
| 119 | </pre> | 113 | </pre> |
| 120 | <div style="color: #00a000;"> | 114 | <div style="color: #00a000;"> |
| 121 | <p> | 115 | <p> |
| 122 | You can force a build of the x64 interpreter on Linux/x64 with the | 116 | You can force a native x64 build on Linux/x64 with the following command: |
| 123 | following command: | ||
| 124 | </p> | 117 | </p> |
| 125 | <pre class="code"> | 118 | <pre class="code"> |
| 126 | make CC="gcc -m64" | 119 | make CC="gcc -m64" |
| @@ -212,7 +205,7 @@ setenv /release /x86 | |||
| 212 | </pre> | 205 | </pre> |
| 213 | <div style="color: #00a000;"> | 206 | <div style="color: #00a000;"> |
| 214 | <p> | 207 | <p> |
| 215 | Or select the x64 compiler (this only builds the interpreter right now): | 208 | Or select the x64 compiler: |
| 216 | </p> | 209 | </p> |
| 217 | <pre class="code"> | 210 | <pre class="code"> |
| 218 | setenv /release /x64 | 211 | setenv /release /x64 |
diff --git a/doc/luajit.html b/doc/luajit.html index 58dfa32e..66032fdf 100644 --- a/doc/luajit.html +++ b/doc/luajit.html | |||
| @@ -63,8 +63,9 @@ standard Lua interpreter and can be deployed as a drop-in replacement. | |||
| 63 | <p> | 63 | <p> |
| 64 | LuaJIT offers more performance, at the expense of portability. It | 64 | LuaJIT offers more performance, at the expense of portability. It |
| 65 | currently runs on all popular operating systems based on <b>x86 CPUs</b> | 65 | currently runs on all popular operating systems based on <b>x86 CPUs</b> |
| 66 | (Linux, Windows, OSX etc.). A port to x64 CPUs is currently ongoing — | 66 | (Linux, Windows, OSX etc.). A preliminary port to Linux/x64 and Windows/x64 |
| 67 | you can follow its progress in the <a href="http://luajit.org/download.html"><span class="ext">»</span> git repository</a>. | 67 | is already available (follow the <a href="install.html">build instructions</a> |
| 68 | to enable it). | ||
| 68 | Other platforms will be supported in the future, based on user demand | 69 | Other platforms will be supported in the future, based on user demand |
| 69 | and sponsoring. | 70 | and sponsoring. |
| 70 | </p> | 71 | </p> |
diff --git a/doc/status.html b/doc/status.html index 23847da9..d7cdffb5 100644 --- a/doc/status.html +++ b/doc/status.html | |||
| @@ -148,9 +148,8 @@ trace linking heuristics prevent this, but in the worst case this | |||
| 148 | means the code always falls back to the interpreter. | 148 | means the code always falls back to the interpreter. |
| 149 | </li> | 149 | </li> |
| 150 | <li> | 150 | <li> |
| 151 | <b>Trace management</b> needs more tuning: better blacklisting of aborted | 151 | <b>Trace management</b> needs more tuning: less drastic countermeasures |
| 152 | traces, less drastic countermeasures against trace explosion and better | 152 | against trace explosion and better heuristics in general. |
| 153 | heuristics in general. | ||
| 154 | </li> | 153 | </li> |
| 155 | <li> | 154 | <li> |
| 156 | Some checks are missing in the JIT-compiled code for obscure situations | 155 | Some checks are missing in the JIT-compiled code for obscure situations |
| @@ -199,7 +198,7 @@ Nonetheless, it compiles to native code and needs to be adapted to each | |||
| 199 | architecture. Porting the compiler backend is probably the easier task, | 198 | architecture. Porting the compiler backend is probably the easier task, |
| 200 | but a key element of its design is the fast interpreter, written in | 199 | but a key element of its design is the fast interpreter, written in |
| 201 | machine-specific assembler.<br> | 200 | machine-specific assembler.<br> |
| 202 | An x64 port is already in the works, thanks to the | 201 | A preliminary x64 port is already available, thanks to the |
| 203 | <a href="sponsors.html">LuaJIT sponsorship program</a>. | 202 | <a href="sponsors.html">LuaJIT sponsorship program</a>. |
| 204 | Other ports will follow — companies which are | 203 | Other ports will follow — companies which are |
| 205 | interested in sponsoring a port to a particular architecture, please | 204 | interested in sponsoring a port to a particular architecture, please |
diff --git a/src/Makefile b/src/Makefile index 5fef367a..261e2049 100644 --- a/src/Makefile +++ b/src/Makefile | |||
| @@ -20,9 +20,6 @@ NODOTABIVER= 51 | |||
| 20 | # Turn any of the optional settings on by removing the '#' in front of them. | 20 | # Turn any of the optional settings on by removing the '#' in front of them. |
| 21 | # You need to 'make clean' and 'make' again, if you change any options. | 21 | # You need to 'make clean' and 'make' again, if you change any options. |
| 22 | # | 22 | # |
| 23 | # Note: LuaJIT can only be compiled for x86, and not for x64 (yet)! | ||
| 24 | # In the meantime, the x86 binary runs fine under a x64 OS. | ||
| 25 | # | ||
| 26 | # It's recommended to compile at least for i686. By default the assembler part | 23 | # It's recommended to compile at least for i686. By default the assembler part |
| 27 | # of the interpreter makes use of CMOV/FCOMI*/FUCOMI* instructions, anyway. | 24 | # of the interpreter makes use of CMOV/FCOMI*/FUCOMI* instructions, anyway. |
| 28 | CC= gcc -m32 -march=i686 | 25 | CC= gcc -m32 -march=i686 |
| @@ -30,10 +27,14 @@ CC= gcc -m32 -march=i686 | |||
| 30 | # binaries to a different machine: | 27 | # binaries to a different machine: |
| 31 | #CC= gcc -m32 -march=native | 28 | #CC= gcc -m32 -march=native |
| 32 | # | 29 | # |
| 30 | # Currently LuaJIT builds by default as a 32 bit binary. Use this to force | ||
| 31 | # a native x64 build on Linux/x64: | ||
| 32 | #CC= gcc -m64 | ||
| 33 | # | ||
| 33 | # Since the assembler part does NOT maintain a frame pointer, it's pointless | 34 | # Since the assembler part does NOT maintain a frame pointer, it's pointless |
| 34 | # to slow down the C part by not omitting it. Debugging and tracebacks are | 35 | # to slow down the C part by not omitting it. Debugging, tracebacks and |
| 35 | # not affected -- the assembler part has frame unwind information and GCC | 36 | # unwinding are not affected -- the assembler part has frame unwind |
| 36 | # emits it with -g (see CCDEBUG below). | 37 | # information and GCC emits it where needed (x64) or with -g (see CCDEBUG). |
| 37 | CCOPT= -O2 -fomit-frame-pointer | 38 | CCOPT= -O2 -fomit-frame-pointer |
| 38 | # Use this if you want to generate a smaller binary (but it's slower): | 39 | # Use this if you want to generate a smaller binary (but it's slower): |
| 39 | #CCOPT= -Os -fomit-frame-pointer | 40 | #CCOPT= -Os -fomit-frame-pointer |
| @@ -75,7 +76,8 @@ XCFLAGS= | |||
| 75 | # | 76 | # |
| 76 | # Use the system provided memory allocator (realloc) instead of the | 77 | # Use the system provided memory allocator (realloc) instead of the |
| 77 | # bundled memory allocator. This is slower, but sometimes helpful for | 78 | # bundled memory allocator. This is slower, but sometimes helpful for |
| 78 | # debugging. It's mandatory for Valgrind's memcheck tool, too. | 79 | # debugging. It's helpful for Valgrind's memcheck tool, too. This option |
| 80 | # cannot be enabled on x64, since the built-in allocator is mandatory. | ||
| 79 | #XCFLAGS+= -DLUAJIT_USE_SYSMALLOC | 81 | #XCFLAGS+= -DLUAJIT_USE_SYSMALLOC |
| 80 | # | 82 | # |
| 81 | # This define is required to run LuaJIT under Valgrind. The Valgrind | 83 | # This define is required to run LuaJIT under Valgrind. The Valgrind |
diff --git a/src/lj_arch.h b/src/lj_arch.h index 111ea8c1..86a2d5ed 100644 --- a/src/lj_arch.h +++ b/src/lj_arch.h | |||
| @@ -48,7 +48,6 @@ | |||
| 48 | #define LJ_TARGET_X64 1 | 48 | #define LJ_TARGET_X64 1 |
| 49 | #define LJ_TARGET_X86ORX64 1 | 49 | #define LJ_TARGET_X86ORX64 1 |
| 50 | #define LJ_PAGESIZE 4096 | 50 | #define LJ_PAGESIZE 4096 |
| 51 | #define LJ_ARCH_NOJIT 1 /* NYI */ | ||
| 52 | #else | 51 | #else |
| 53 | #error "No target architecture defined" | 52 | #error "No target architecture defined" |
| 54 | #endif | 53 | #endif |
