Changeset 171391 in webkit for trunk/Source/JavaScriptCore/llvm


Ignore:
Timestamp:
Jul 22, 2014, 9:33:37 PM (11 years ago)
Author:
[email protected]
Message:

Merge r169628 from ftlopt.

2014-06-04 Matthew Mirman <[email protected]>


Added system for inlining native functions via the FTL.
https://bugs.webkit.org/show_bug.cgi?id=131515


Reviewed by Filip Pizlo.


Also fixed the build to not compress the bitcode and to
include all of the relevant runtime. With GCC_GENERATE_DEBUGGING_SYMBOLS = NO,
the produced bitcode files are a 100th the size they were before.
Now we can include all of the relevant runtime files with only a 3mb overhead.
This is the same overhead as for two compressed files before,
but done more efficiently (on both ends) and with less code.


Deciding whether to inline native functions is left up to LLVM.
The entire module containing the function is linked into the current
compiled JS so that inlining the native functions shouldn't make them smaller.


Rather than loading Runtime.symtbl at runtime FTLState.cpp now generates a file
InlineRuntimeSymbolTable.h which statically builds the symbol table hash table.


  • JavaScriptCore.xcodeproj/project.pbxproj: Added back runtime files to compile.
  • build-symbol-table-index.py: Changed bitcode suffix. Added inclusion of only tested symbols. Added output to InlineRuntimeSymbolTable.h.
  • build-symbol-table-index.sh: Changed bitcode suffix.
  • copy-llvm-ir-to-derived-sources.sh: Removed gzip compression.
  • tested-symbols.symlst: Added.
  • dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleCall): Now sets the knownFunction of the call node if such a function exists and emits a check that during runtime the callee is in fact known.
  • dfg/DFGNode.h: Added functions to set the known function of a call node. (JSC::DFG::Node::canBeKnownFunction): Added. (JSC::DFG::Node::hasKnownFunction): Added. (JSC::DFG::Node::knownFunction): Added. (JSC::DFG::Node::giveKnownFunction): Added.
  • ftl/FTLAbbreviatedTypes.h: Added a typedef for LLVMMemoryBufferRef
  • ftl/FTLAbbreviations.h: Added some abbreviations.
  • ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::isInlinableSize): Added. Hardcoded threshold to 275. (JSC::FTL::LowerDFGToLLVM::getModuleByPathForSymbol): Added. (JSC::FTL::LowerDFGToLLVM::getFunctionBySymbol): Added. (JSC::FTL::LowerDFGToLLVM::possiblyCompileInlineableNativeCall): Added. (JSC::FTL::LowerDFGToLLVM::compileCallOrConstruct): Added call to possiblyCompileInlineableNativeCall
  • ftl/FTLOutput.h: (JSC::FTL::Output::allocaName): Added. Useful for debugging.
  • ftl/FTLState.cpp: (JSC::FTL::State::State): Added an include for InlineRuntimeSymbolTable.h
  • ftl/FTLState.h: Added symbol table hash table.
  • ftl/FTLCompile.cpp: (JSC::FTL::compile): Added inlining and dead function elimination passes.
  • heap/HandleStack.h: Added JS_EXPORT_PRIVATE to a few functions to get inlining to compile.
  • llvm/InitializeLLVMMac.mm: Deleted.
  • llvm/InitializeLLVMMac.cpp: Added.
  • llvm/LLVMAPIFunctions.h: Added macros to include Bitcode parsing and linking functions.
  • llvm/LLVMHeaders.h: Added includes for Bitcode parsing and linking.
  • runtime/BundlePath.h: Added.
  • runtime/BundlePath.mm: Added.
  • runtime/DateInstance.h: Added JS_EXPORT_PRIVATE to a few functions to get inlining to compile.
  • runtime/DateInstance.h: ditto.
  • runtime/DateConversion.h: ditto.
  • runtime/ExceptionHelpers.h: ditto.
  • runtime/JSCJSValue.h: ditto.
  • runtime/JSArray.h: ditto.
  • runtime/JSDateMath.h: ditto.
  • runtime/JSObject.h: ditto.
  • runtime/JSObject.h: ditto.
  • runtime/RegExp.h: ditto.
  • runtime/Structure.h: ditto.
  • runtime/Options.h: Added maximumLLVMInstructionCountForNativeInlining.
Location:
trunk/Source/JavaScriptCore/llvm
Files:
1 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/llvm/InitializeLLVM.h

    r166948 r171391  
    2929#if HAVE(LLVM)
    3030
     31#include <string>
     32#include <wtf/text/CString.h>
     33
    3134namespace JSC {
    3235
    3336void initializeLLVMImpl();
     37
     38extern const CString* llvmBitcodeLibraryForInliningPath;
    3439
    3540// You msut call this before using JSC::llvm. It's safe to call this multiple times.
  • trunk/Source/JavaScriptCore/llvm/LLVMAPIFunctions.h

    r159545 r171391  
    3030
    3131#define FOR_EACH_LLVM_API_FUNCTION(macro) \
     32    macro(LLVMBool, ParseBitcode, (LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutModule, char **OutMessage)) \
     33    macro(LLVMBool, ParseBitcodeInContext, (LLVMContextRef ContextRef, LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutModule, char **OutMessage)) \
     34    macro(LLVMBool, GetBitcodeModuleInContext, (LLVMContextRef ContextRef, LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM, char **OutMessage)) \
     35    macro(LLVMBool, GetBitcodeModule, (LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM, char **OutMessage)) \
     36    macro(LLVMBool, GetBitcodeModuleProviderInContext, (LLVMContextRef ContextRef, LLVMMemoryBufferRef MemBuf, LLVMModuleProviderRef *OutMP, char **OutMessage)) \
     37    macro(LLVMBool, GetBitcodeModuleProvider, (LLVMMemoryBufferRef MemBuf, LLVMModuleProviderRef *OutMP, char **OutMessage)) \
     38    macro(LLVMBool, LinkModules, (LLVMModuleRef Dest, LLVMModuleRef Str, LLVMLinkerMode Mode, char **OutMessage)) \
    3239    macro(void, InitializeCore, (LLVMPassRegistryRef R)) \
    3340    macro(void, Shutdown, ()) \
     
    5259    macro(LLVMContextRef, GetModuleContext, (LLVMModuleRef M)) \
    5360    macro(LLVMTypeRef, GetTypeByName, (LLVMModuleRef M, const char *Name)) \
     61    macro(void, DumpType, (LLVMTypeRef Val)) \
    5462    macro(unsigned, GetNamedMetadataNumOperands, (LLVMModuleRef M, const char* name)) \
    5563    macro(void, GetNamedMetadataOperands, (LLVMModuleRef M, const char* name, LLVMValueRef *Dest)) \
     
    576584    macro(void *, RecompileAndRelinkFunction, (LLVMExecutionEngineRef EE, LLVMValueRef Fn)) \
    577585    macro(LLVMTargetDataRef, GetExecutionEngineTargetData, (LLVMExecutionEngineRef EE)) \
     586    macro(LLVMTargetMachineRef, GetExecutionEngineTargetMachine, (LLVMExecutionEngineRef EE)) \
    578587    macro(void, AddGlobalMapping, (LLVMExecutionEngineRef EE, LLVMValueRef Global, void* Addr)) \
    579588    macro(void *, GetPointerToGlobal, (LLVMExecutionEngineRef EE, LLVMValueRef Global)) \
     
    602611    macro(void, PassManagerBuilderPopulateModulePassManager, (LLVMPassManagerBuilderRef PMB, LLVMPassManagerRef PM)) \
    603612    macro(void, PassManagerBuilderPopulateLTOPassManager, (LLVMPassManagerBuilderRef PMB, LLVMPassManagerRef PM, LLVMBool Internalize, LLVMBool RunInliner)) \
     613    macro(void, AddAnalysisPasses, (LLVMTargetMachineRef T, LLVMPassManagerRef PM)) \
     614    macro(void, AddInternalizePass, (LLVMPassManagerRef PM, unsigned AllButMain)) \
    604615    macro(void, AddAggressiveDCEPass, (LLVMPassManagerRef PM)) \
    605616    macro(void, AddCFGSimplificationPass, (LLVMPassManagerRef PM)) \
    606617    macro(void, AddDeadStoreEliminationPass, (LLVMPassManagerRef PM)) \
     618    macro(void, AddFunctionInliningPass, (LLVMPassManagerRef PM)) \
     619    macro(void, AddGlobalDCEPass, (LLVMPassManagerRef PM)) \
     620    macro(void, AddPruneEHPass, (LLVMPassManagerRef PM)) \
     621    macro(void, AddIPSCCPPass, (LLVMPassManagerRef PM)) \
     622    macro(void, AddDeadArgEliminationPass, (LLVMPassManagerRef PM)) \
     623    macro(void, AddConstantMergePass, (LLVMPassManagerRef PM)) \
     624    macro(void, AddGlobalOptimizerPass, (LLVMPassManagerRef PM)) \
    607625    macro(void, AddGVNPass, (LLVMPassManagerRef PM)) \
    608626    macro(void, AddIndVarSimplifyPass, (LLVMPassManagerRef PM)) \
  • trunk/Source/JavaScriptCore/llvm/LLVMHeaders.h

    r157260 r171391  
    4444
    4545#include <llvm-c/Analysis.h>
     46#include <llvm-c/BitReader.h>
    4647#include <llvm-c/Core.h>
    4748#include <llvm-c/Disassembler.h>
    4849#include <llvm-c/ExecutionEngine.h>
     50#include <llvm-c/Initialization.h>
     51#include <llvm-c/Linker.h>
    4952#include <llvm-c/Target.h>
     53#include <llvm-c/TargetMachine.h>
     54#include <llvm-c/Transforms/IPO.h>
    5055#include <llvm-c/Transforms/PassManagerBuilder.h>
    5156#include <llvm-c/Transforms/Scalar.h>
Note: See TracChangeset for help on using the changeset viewer.