Changes between Initial Version and Version 1 of FTLJIT


Ignore:
Timestamp:
Sep 12, 2013 11:43:00 AM (11 years ago)
Author:
fpizlo@apple.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FTLJIT

    v1 v1  
     1JavaScriptCore is experimenting with adopting the LLVM for a top-tier high-throughput optimizing JIT, which we call the FTL (Fourth Tier LLVM).  See https://bugs.webkit.org/show_bug.cgi?id=112840 for the bug tracking this work.  It is still experimental, and still disabled by default.
     2
     3= Overview
     4
     5The FTL is integrated as an alternative backend for the DFG JIT but largely reuses existing DFG functionality.  The FTL differs from the DFG as follows:
     6
     7- Instead of generating machine code directly from the DFG IR, the DFG IR is lowered to LLVM IR and then the LLVM optimization pipeline and backend are invoked to generate machine code.  That machine code is then managed by the JSC executable memory manager no differently than if it were generated by our own backends.
     8- Additional DFG phases are used.  Running in FTL mode causes the DFG to lower to SSA even before lowering to LLVM IR.  Additional optimizations like LICM are performed on the DFG-SSA IR.
     9
     10The FTL JIT already supports key DFG concepts like OSR entry, OSR exit, and concurrent compilation.
     11
     12= Try it out
     13
     14You can try out the FTL JIT on the Mac port by doing:
     15
     16Tools/Scripts/build-jsc --ftl-jit --debug
     17
     18or:
     19
     20Tools/Scripts/build-jsc --ftl-jit --release
     21
     22The FTL JIT is runtime-disabled even when it is buildtime-enabled.  Hence to run a program with the FTL JIT you also need:
     23
     24DYLD_FRAMEWORK_PATH=WebKitBuild/Debug WebKitBuild/Debug/jsc --useExperimentalFTL=true <my JS program>
     25
     26= Testing
     27
     28You can run the test suite including the FTL JIT by doing:
     29
     30Tools/Scripts/run-javascriptcore-tests --debug --ftl-jit
     31
     32or:
     33
     34Tools/Scripts/run-javascriptcore-tests --release --ftl-jit
     35
     36= Looking at IR
     37
     38Additional options allow for inspecting the IR that the FTL generates.
     39
     40=== See if LLVM is being used to compile a function
     41
     42{{{
     43DYLD_FRAMEWORK_PATH=WebKitBuild/Debug WebKitBuild/Debug/jsc --useExperimentalFTL=true --reportCompileTimes=true <my JS program>
     44}}}
     45
     46=== Dump all LLVM IR
     47
     48{{{
     49DYLD_FRAMEWORK_PATH=WebKitBuild/Debug WebKitBuild/Debug/jsc --useExperimentalFTL=true --dumpLLVMIR=true <my JS program>
     50}}}
     51
     52=== Dump DFG IR and LLVM IR before and after LLVM optimization
     53
     54{{{
     55DYLD_FRAMEWORK_PATH=WebKitBuild/Debug WebKitBuild/Debug/jsc --useExperimentalFTL=true --verboseCompilation=true <my JS program>
     56}}}
     57
     58This will also tell if why some functions don't get FTL compiled.  The FTL doesn't have full coverage over DFG IR yet.  If JSC chooses not to use the FTL JIT for a code block, you will see a dump explaining why.
     59
     60=== Dump all machine code
     61
     62{{{
     63DYLD_FRAMEWORK_PATH=WebKitBuild/Debug WebKitBuild/Debug/jsc --useExperimentalFTL=true --showDFGDisassembly=true <my JS program>
     64}}}
     65
     66This will also dump FTL disassembly, using the LLVM disassembler.