RESOLVED FIXED 120326
CodeBlock compilation and installation should be simplified and rationalized
https://bugs.webkit.org/show_bug.cgi?id=120326
Summary CodeBlock compilation and installation should be simplified and rationalized
Filip Pizlo
Reported 2013-08-26 14:56:49 PDT
We currently do a really bizarre dance when creating code blocks. When compiling, we typically install the compiled code in Executable first and then in the CodeBlock - that's messed up. We establish the Executable<->CodeBlock relationship at random times depending on code path. We have duplicated code between the LLInt initialization path, the baseline JIT compilation path, and the DFG/FTL compilation paths. It's incredibly confusing. This confusion makes it hard to do things like creating a custom temporary CodeBlock just for DFG->FTL OSR entry, or having the DFG trigger its own replacement compilation (i.e. DFG->FTL tier-up). It also means that the DFG::Plan and DFG::Worklist have super-special knowledge of the CodeBlock<->Executable relationship. That makes it hard to establish new such relationships, for example for FTL code. Instead we should have a simplified system of rules: 1) You can always ask an Executable for a new code block. It will give you one, and you will own it for now. You can hold onto it for as long as you like. 2) You can always ask an Executable to install a CodeBlock. It will do all of the things needed to ensure that calls are redirected from the old one to the new one, and that the GC knows about the increased costs. 3) You can always ask a CodeBlock to prepare itself for execution - i.e. go from being just a thing that holds bytecode to being a thing that has proper entrypoints. When you make such a request, you should be able to specify which execution engine to use, and the CodeBlock should figure it out. 4) Asking a CodeBlock to prepare for execution should have an optional asynchronous mode, in which case you should pass a callback describing what to do when compilation finishes.
Attachments
work in progress (30.63 KB, patch)
2013-08-26 14:57 PDT, Filip Pizlo
no flags
almost there (58.68 KB, patch)
2013-08-27 13:48 PDT, Filip Pizlo
no flags
more (81.77 KB, patch)
2013-08-27 13:54 PDT, Filip Pizlo
no flags
almost compiles (103.30 KB, patch)
2013-08-27 18:53 PDT, Filip Pizlo
no flags
almost (113.87 KB, patch)
2013-08-27 19:43 PDT, Filip Pizlo
webkit-ews: commit-queue-
the patch (118.83 KB, patch)
2013-08-27 21:46 PDT, Filip Pizlo
no flags
the patch (118.93 KB, patch)
2013-08-27 21:48 PDT, Filip Pizlo
oliver: review+
Filip Pizlo
Comment 1 2013-08-26 14:57:41 PDT
Created attachment 209681 [details] work in progress
Filip Pizlo
Comment 2 2013-08-27 13:48:09 PDT
Created attachment 209794 [details] almost there
Filip Pizlo
Comment 3 2013-08-27 13:54:29 PDT
Filip Pizlo
Comment 4 2013-08-27 18:53:43 PDT
Created attachment 209834 [details] almost compiles
Filip Pizlo
Comment 5 2013-08-27 19:43:38 PDT
Created attachment 209837 [details] almost Almost done. I think I just need to write some FTL glue to keep FTL builds working and then I'll be done.
WebKit Commit Bot
Comment 6 2013-08-27 19:45:49 PDT
Attachment 209837 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/ChangeLog', u'Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj', u'Source/JavaScriptCore/bytecode/CodeBlock.cpp', u'Source/JavaScriptCore/bytecode/CodeBlock.h', u'Source/JavaScriptCore/bytecode/DeferredCompilationCallback.cpp', u'Source/JavaScriptCore/bytecode/DeferredCompilationCallback.h', u'Source/JavaScriptCore/dfg/DFGDriver.cpp', u'Source/JavaScriptCore/dfg/DFGDriver.h', u'Source/JavaScriptCore/dfg/DFGFailedFinalizer.cpp', u'Source/JavaScriptCore/dfg/DFGFailedFinalizer.h', u'Source/JavaScriptCore/dfg/DFGFinalizer.h', u'Source/JavaScriptCore/dfg/DFGJITFinalizer.cpp', u'Source/JavaScriptCore/dfg/DFGJITFinalizer.h', u'Source/JavaScriptCore/dfg/DFGOSRExitPreparation.cpp', u'Source/JavaScriptCore/dfg/DFGOperations.cpp', u'Source/JavaScriptCore/dfg/DFGPlan.cpp', u'Source/JavaScriptCore/dfg/DFGPlan.h', u'Source/JavaScriptCore/dfg/DFGWorklist.cpp', u'Source/JavaScriptCore/heap/Heap.h', u'Source/JavaScriptCore/interpreter/Interpreter.cpp', u'Source/JavaScriptCore/jit/JITDriver.h', u'Source/JavaScriptCore/jit/JITStubs.cpp', u'Source/JavaScriptCore/jit/JITToDFGDeferredCompilationCallback.cpp', u'Source/JavaScriptCore/jit/JITToDFGDeferredCompilationCallback.h', u'Source/JavaScriptCore/llint/LLIntEntrypoints.cpp', u'Source/JavaScriptCore/llint/LLIntEntrypoints.h', u'Source/JavaScriptCore/llint/LLIntSlowPaths.cpp', u'Source/JavaScriptCore/runtime/ArrayPrototype.cpp', u'Source/JavaScriptCore/runtime/CommonSlowPaths.cpp', u'Source/JavaScriptCore/runtime/CompilationResult.cpp', u'Source/JavaScriptCore/runtime/CompilationResult.h', u'Source/JavaScriptCore/runtime/Executable.cpp', u'Source/JavaScriptCore/runtime/Executable.h', u'Source/JavaScriptCore/runtime/ExecutionHarness.h']" exit_code: 1 Source/JavaScriptCore/jit/JITStubs.cpp:1058: The return type should use PassRefPtr instead of RefPtr. [readability/pass_ptr] [5] Source/JavaScriptCore/dfg/DFGPlan.h:56: The parameter name "codeBlock" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 2 in 30 files If any of these errors are false positives, please file a bug against check-webkit-style.
Filip Pizlo
Comment 7 2013-08-27 19:49:56 PDT
(In reply to comment #6) > Attachment 209837 [details] did not pass style-queue: > > Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/ChangeLog', u'Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj', u'Source/JavaScriptCore/bytecode/CodeBlock.cpp', u'Source/JavaScriptCore/bytecode/CodeBlock.h', u'Source/JavaScriptCore/bytecode/DeferredCompilationCallback.cpp', u'Source/JavaScriptCore/bytecode/DeferredCompilationCallback.h', u'Source/JavaScriptCore/dfg/DFGDriver.cpp', u'Source/JavaScriptCore/dfg/DFGDriver.h', u'Source/JavaScriptCore/dfg/DFGFailedFinalizer.cpp', u'Source/JavaScriptCore/dfg/DFGFailedFinalizer.h', u'Source/JavaScriptCore/dfg/DFGFinalizer.h', u'Source/JavaScriptCore/dfg/DFGJITFinalizer.cpp', u'Source/JavaScriptCore/dfg/DFGJITFinalizer.h', u'Source/JavaScriptCore/dfg/DFGOSRExitPreparation.cpp', u'Source/JavaScriptCore/dfg/DFGOperations.cpp', u'Source/JavaScriptCore/dfg/DFGPlan.cpp', u'Source/JavaScriptCore/dfg/DFGPlan.h', u'Source/JavaScriptCore/dfg/DFGWorklist.cpp', u'Source/JavaScriptCore/heap/Heap.h', u'Source/JavaScriptCore/interpreter/Interpreter.cpp', u'Source/JavaScriptCore/jit/JITDriver.h', u'Source/JavaScriptCore/jit/JITStubs.cpp', u'Source/JavaScriptCore/jit/JITToDFGDeferredCompilationCallback.cpp', u'Source/JavaScriptCore/jit/JITToDFGDeferredCompilationCallback.h', u'Source/JavaScriptCore/llint/LLIntEntrypoints.cpp', u'Source/JavaScriptCore/llint/LLIntEntrypoints.h', u'Source/JavaScriptCore/llint/LLIntSlowPaths.cpp', u'Source/JavaScriptCore/runtime/ArrayPrototype.cpp', u'Source/JavaScriptCore/runtime/CommonSlowPaths.cpp', u'Source/JavaScriptCore/runtime/CompilationResult.cpp', u'Source/JavaScriptCore/runtime/CompilationResult.h', u'Source/JavaScriptCore/runtime/Executable.cpp', u'Source/JavaScriptCore/runtime/Executable.h', u'Source/JavaScriptCore/runtime/ExecutionHarness.h']" exit_code: 1 > Source/JavaScriptCore/jit/JITStubs.cpp:1058: The return type should use PassRefPtr instead of RefPtr. [readability/pass_ptr] [5] False. > Source/JavaScriptCore/dfg/DFGPlan.h:56: The parameter name "codeBlock" adds no information, so it should be removed. [readability/parameter_name] [5] Fixed. > Total errors found: 2 in 30 files > > > If any of these errors are false positives, please file a bug against check-webkit-style.
Early Warning System Bot
Comment 8 2013-08-27 19:51:19 PDT
Early Warning System Bot
Comment 9 2013-08-27 19:53:10 PDT
EFL EWS Bot
Comment 10 2013-08-27 20:02:29 PDT
EFL EWS Bot
Comment 11 2013-08-27 20:07:08 PDT
kov's GTK+ EWS bot
Comment 12 2013-08-27 20:47:23 PDT
Build Bot
Comment 13 2013-08-27 21:29:56 PDT
Filip Pizlo
Comment 14 2013-08-27 21:46:03 PDT
Created attachment 209845 [details] the patch
WebKit Commit Bot
Comment 15 2013-08-27 21:48:03 PDT
Attachment 209845 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/CMakeLists.txt', u'Source/JavaScriptCore/ChangeLog', u'Source/JavaScriptCore/GNUmakefile.list.am', u'Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj', u'Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj', u'Source/JavaScriptCore/Target.pri', u'Source/JavaScriptCore/bytecode/CodeBlock.cpp', u'Source/JavaScriptCore/bytecode/CodeBlock.h', u'Source/JavaScriptCore/bytecode/DeferredCompilationCallback.cpp', u'Source/JavaScriptCore/bytecode/DeferredCompilationCallback.h', u'Source/JavaScriptCore/dfg/DFGDriver.cpp', u'Source/JavaScriptCore/dfg/DFGDriver.h', u'Source/JavaScriptCore/dfg/DFGFailedFinalizer.cpp', u'Source/JavaScriptCore/dfg/DFGFailedFinalizer.h', u'Source/JavaScriptCore/dfg/DFGFinalizer.h', u'Source/JavaScriptCore/dfg/DFGJITFinalizer.cpp', u'Source/JavaScriptCore/dfg/DFGJITFinalizer.h', u'Source/JavaScriptCore/dfg/DFGOSRExitPreparation.cpp', u'Source/JavaScriptCore/dfg/DFGOperations.cpp', u'Source/JavaScriptCore/dfg/DFGPlan.cpp', u'Source/JavaScriptCore/dfg/DFGPlan.h', u'Source/JavaScriptCore/dfg/DFGWorklist.cpp', u'Source/JavaScriptCore/heap/Heap.h', u'Source/JavaScriptCore/interpreter/Interpreter.cpp', u'Source/JavaScriptCore/jit/JITDriver.h', u'Source/JavaScriptCore/jit/JITStubs.cpp', u'Source/JavaScriptCore/jit/JITToDFGDeferredCompilationCallback.cpp', u'Source/JavaScriptCore/jit/JITToDFGDeferredCompilationCallback.h', u'Source/JavaScriptCore/llint/LLIntEntrypoints.cpp', u'Source/JavaScriptCore/llint/LLIntEntrypoints.h', u'Source/JavaScriptCore/llint/LLIntSlowPaths.cpp', u'Source/JavaScriptCore/runtime/ArrayPrototype.cpp', u'Source/JavaScriptCore/runtime/CommonSlowPaths.cpp', u'Source/JavaScriptCore/runtime/CompilationResult.cpp', u'Source/JavaScriptCore/runtime/CompilationResult.h', u'Source/JavaScriptCore/runtime/Executable.cpp', u'Source/JavaScriptCore/runtime/Executable.h', u'Source/JavaScriptCore/runtime/ExecutionHarness.h']" exit_code: 1 Source/JavaScriptCore/jit/JITStubs.cpp:1058: The return type should use PassRefPtr instead of RefPtr. [readability/pass_ptr] [5] Total errors found: 1 in 34 files If any of these errors are false positives, please file a bug against check-webkit-style.
Filip Pizlo
Comment 16 2013-08-27 21:48:33 PDT
Created attachment 209846 [details] the patch
WebKit Commit Bot
Comment 17 2013-08-27 21:51:35 PDT
Attachment 209846 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/CMakeLists.txt', u'Source/JavaScriptCore/ChangeLog', u'Source/JavaScriptCore/GNUmakefile.list.am', u'Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj', u'Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj', u'Source/JavaScriptCore/Target.pri', u'Source/JavaScriptCore/bytecode/CodeBlock.cpp', u'Source/JavaScriptCore/bytecode/CodeBlock.h', u'Source/JavaScriptCore/bytecode/DeferredCompilationCallback.cpp', u'Source/JavaScriptCore/bytecode/DeferredCompilationCallback.h', u'Source/JavaScriptCore/dfg/DFGDriver.cpp', u'Source/JavaScriptCore/dfg/DFGDriver.h', u'Source/JavaScriptCore/dfg/DFGFailedFinalizer.cpp', u'Source/JavaScriptCore/dfg/DFGFailedFinalizer.h', u'Source/JavaScriptCore/dfg/DFGFinalizer.h', u'Source/JavaScriptCore/dfg/DFGJITFinalizer.cpp', u'Source/JavaScriptCore/dfg/DFGJITFinalizer.h', u'Source/JavaScriptCore/dfg/DFGOSRExitPreparation.cpp', u'Source/JavaScriptCore/dfg/DFGOperations.cpp', u'Source/JavaScriptCore/dfg/DFGPlan.cpp', u'Source/JavaScriptCore/dfg/DFGPlan.h', u'Source/JavaScriptCore/dfg/DFGWorklist.cpp', u'Source/JavaScriptCore/heap/Heap.h', u'Source/JavaScriptCore/interpreter/Interpreter.cpp', u'Source/JavaScriptCore/jit/JITDriver.h', u'Source/JavaScriptCore/jit/JITStubs.cpp', u'Source/JavaScriptCore/jit/JITToDFGDeferredCompilationCallback.cpp', u'Source/JavaScriptCore/jit/JITToDFGDeferredCompilationCallback.h', u'Source/JavaScriptCore/llint/LLIntEntrypoints.cpp', u'Source/JavaScriptCore/llint/LLIntEntrypoints.h', u'Source/JavaScriptCore/llint/LLIntSlowPaths.cpp', u'Source/JavaScriptCore/runtime/ArrayPrototype.cpp', u'Source/JavaScriptCore/runtime/CommonSlowPaths.cpp', u'Source/JavaScriptCore/runtime/CompilationResult.cpp', u'Source/JavaScriptCore/runtime/CompilationResult.h', u'Source/JavaScriptCore/runtime/Executable.cpp', u'Source/JavaScriptCore/runtime/Executable.h', u'Source/JavaScriptCore/runtime/ExecutionHarness.h']" exit_code: 1 Source/JavaScriptCore/jit/JITStubs.cpp:1058: The return type should use PassRefPtr instead of RefPtr. [readability/pass_ptr] [5] Total errors found: 1 in 34 files If any of these errors are false positives, please file a bug against check-webkit-style.
Oliver Hunt
Comment 18 2013-08-28 08:39:47 PDT
Comment on attachment 209846 [details] the patch View in context: https://bugs.webkit.org/attachment.cgi?id=209846&action=review r=me if you switch to having create methods for the new refcounted classes > Source/JavaScriptCore/bytecode/DeferredCompilationCallback.h:38 > +public: > + DeferredCompilationCallback(); Can we give this a protected constructor and a public create method? > Source/JavaScriptCore/jit/JITToDFGDeferredCompilationCallback.h:37 > +public: > + JITToDFGDeferredCompilationCallback(); can we make the constructor private, and give this a PassRefPtr returning create() method?
Filip Pizlo
Comment 19 2013-08-28 13:21:59 PDT
(In reply to comment #18) > (From update of attachment 209846 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=209846&action=review > > r=me if you switch to having create methods for the new refcounted classes > > > Source/JavaScriptCore/bytecode/DeferredCompilationCallback.h:38 > > +public: > > + DeferredCompilationCallback(); > > Can we give this a protected constructor and a public create method? Protected constructor yes - but no need for a create method since it's an abstract base class. > > > Source/JavaScriptCore/jit/JITToDFGDeferredCompilationCallback.h:37 > > +public: > > + JITToDFGDeferredCompilationCallback(); > > can we make the constructor private, and give this a PassRefPtr returning create() method? Fixed.
Filip Pizlo
Comment 20 2013-08-28 21:02:22 PDT
WebKit Commit Bot
Comment 21 2013-08-29 09:35:52 PDT
Re-opened since this is blocked by bug 120477
Filip Pizlo
Comment 22 2013-08-29 11:24:55 PDT
Note You need to log in before you can comment on or make changes to this bug.