RESOLVED FIXED 120998
[Win] Compile errors when enabling DFG JIT.
https://bugs.webkit.org/show_bug.cgi?id=120998
Summary [Win] Compile errors when enabling DFG JIT.
peavo
Reported 2013-09-08 00:54:40 PDT
When enabling DFG JIT on Windows, I get some compile errors.
Attachments
Patch (46.83 KB, patch)
2013-09-08 01:10 PDT, peavo
no flags
Patch (46.92 KB, patch)
2013-09-14 06:17 PDT, peavo
no flags
Patch (49.37 KB, patch)
2013-10-03 04:10 PDT, peavo
no flags
Patch (47.17 KB, patch)
2013-10-03 04:29 PDT, peavo
no flags
Patch (47.18 KB, patch)
2013-10-03 05:18 PDT, peavo
no flags
Patch (51.94 KB, patch)
2013-10-17 06:08 PDT, peavo
no flags
Patch (48.67 KB, patch)
2013-10-17 07:44 PDT, peavo
no flags
Patch (48.14 KB, patch)
2013-10-19 04:57 PDT, peavo
no flags
Patch (51.13 KB, patch)
2013-10-22 05:45 PDT, peavo
no flags
Patch (51.00 KB, patch)
2013-10-22 06:04 PDT, peavo
no flags
Patch (51.05 KB, patch)
2013-10-22 07:43 PDT, peavo
no flags
Patch (50.98 KB, patch)
2013-10-22 09:23 PDT, peavo
no flags
peavo
Comment 1 2013-09-08 01:10:22 PDT
peavo
Comment 2 2013-09-14 06:17:28 PDT
peavo
Comment 3 2013-09-14 06:21:13 PDT
Modified previous patch slightly by including a crash fix. Added __declspec(naked) attribute to definition of function getHostCallReturnValue(), and modified the assembler code according to its gcc x86 counterpart.
peavo
Comment 4 2013-10-03 04:10:24 PDT
peavo
Comment 5 2013-10-03 04:29:27 PDT
peavo
Comment 6 2013-10-03 05:18:51 PDT
peavo
Comment 7 2013-10-03 05:36:22 PDT
Updated patch with changes in trunk.
Brent Fulgham
Comment 8 2013-10-16 11:43:06 PDT
Comment on attachment 213241 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=213241&action=review Looks good! I'll try it locally. I notice you don't activate DFG -- is that because the implementation is still not right? > Source/JavaScriptCore/jit/JITOperationWrappers.h:310 > +#elif COMPILER(MSVC) && CPU(X86) Unfortunately, none of this can be easily used for 64-bit builds because MSVC does not allow in-line assembly code. We are going to have to move this code to an *.asm file at some point.
peavo
Comment 9 2013-10-17 06:08:48 PDT
peavo
Comment 10 2013-10-17 06:10:29 PDT
Updated patch with changes in trunk.
peavo
Comment 11 2013-10-17 06:48:44 PDT
(In reply to comment #8) > (From update of attachment 213241 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=213241&action=review > > Looks good! I'll try it locally. I notice you don't activate DFG -- is that because the implementation is still not right? > > > Source/JavaScriptCore/jit/JITOperationWrappers.h:310 > > +#elif COMPILER(MSVC) && CPU(X86) > > Unfortunately, none of this can be easily used for 64-bit builds because MSVC does not allow in-line assembly code. We are going to have to move this code to an *.asm file at some point. Thanks for looking into this :) I believe there are a couple of issues which needs to be fixed before DFG can be activated. There is bug 121001, which should fix a crash with generated code. Also the file wtf/CompilationThread.cpp needs to add code for platforms which doesn't use pthreads. I guess we can quickly whip up something there :) When I tested it, I enabled pthreads locally, so I didn't have to change this code. With those two changes in place, it seemed to work well, I got another JSC related crash after leaving the computer idle for awhile, but this was a simple NULL pointer crash, which we should be able to sort out :)
peavo
Comment 12 2013-10-17 06:50:25 PDT
(In reply to comment #10) > Updated patch with changes in trunk. The patch doesn't seem to apply, probably because of some line ending issues.
peavo
Comment 13 2013-10-17 07:44:38 PDT
peavo
Comment 14 2013-10-19 04:57:27 PDT
peavo
Comment 15 2013-10-19 05:01:13 PDT
Updated patch with changes in trunk. I also implemented needed functionality in wtf/CompilationThread.cpp for platforms which doesn't use pthreads. Together with the patch in bug 121001, and DFG enabled, this seems to run fine in debug mode with "normal" browsing. I guess there still might be problems with applying the patch, I think this is because of mixed line ending style in the project files.
Brent Fulgham
Comment 16 2013-10-21 10:17:29 PDT
Comment on attachment 214649 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=214649&action=review I think this looks fine. I had a couple of questions I wanted to check with you about before approving it. > Source/JavaScriptCore/dfg/DFGAllocator.h:81 > + void startBumpingIn(Region*); I don't understand why we are removing the scoping here. Is this to silence a warning in Visual Studio? > Source/JavaScriptCore/jit/JITOperationWrappers.h:332 > +__declspec(naked) EncodedJSValue JIT_OPERATION function(ExecState*, EncodedJSValue, StringImpl*) \ These macros are going to be hard to replicate for 64-bit with Visual Studio since it prohibits inline assembly. > Source/WTF/wtf/CompilationThread.cpp:55 > + initializeCompilationThreadsMutex.unlock(); We should probably create a WTF/ThreadingOnce.h/.cpp that encapsulates this pattern. We use the pthread_once logic in a number of places, and it would be useful to only do this one way throughout our code base. You don't need to do that in this bug, of course :-)
peavo
Comment 17 2013-10-21 10:43:59 PDT
> I think this looks fine. I had a couple of questions I wanted to check with you about before approving it. > > > Source/JavaScriptCore/dfg/DFGAllocator.h:81 > > + void startBumpingIn(Region*); > > I don't understand why we are removing the scoping here. Is this to silence a warning in Visual Studio? > It was actually a compiler error. I don't remember the exact error right now, but can look it up :) > > Source/JavaScriptCore/jit/JITOperationWrappers.h:332 > > +__declspec(naked) EncodedJSValue JIT_OPERATION function(ExecState*, EncodedJSValue, StringImpl*) \ > > These macros are going to be hard to replicate for 64-bit with Visual Studio since it prohibits inline assembly. > > > Source/WTF/wtf/CompilationThread.cpp:55 > > + initializeCompilationThreadsMutex.unlock(); > Ok, I see, so we need to create an .asm file for this for 64-bit? > We should probably create a WTF/ThreadingOnce.h/.cpp that encapsulates this pattern. We use the pthread_once logic in a number of places, and it would be useful to only do this one way throughout our code base. > > You don't need to do that in this bug, of course :-) Good point, I can look into this in a separate bug :)
peavo
Comment 18 2013-10-21 12:42:10 PDT
(In reply to comment #17) > > > > > Source/JavaScriptCore/dfg/DFGAllocator.h:81 > > > + void startBumpingIn(Region*); > > > > I don't understand why we are removing the scoping here. Is this to silence a warning in Visual Studio? > > > > It was actually a compiler error. I don't remember the exact error right now, but can look it up :) This is the error I was getting: c:\webkit\source\javascriptcore\dfg\DFGAllocator.h(80): warning C4346: 'JSC::DFG::Allocator::Region' : dependent name is not a type prefix with 'typename' to indicate a type c:\webkit\source\javascriptcore\dfg\DFGAllocator.h(87) : see reference to class template instantiation 'JSC::DFG::Allocator' being compiled c:\webkit\source\javascriptcore\dfg\DFGAllocator.h(80): error C2061: syntax error : identifier 'Region'
peavo
Comment 19 2013-10-22 05:45:57 PDT
peavo
Comment 20 2013-10-22 06:04:53 PDT
Build Bot
Comment 21 2013-10-22 06:31:40 PDT
Build Bot
Comment 22 2013-10-22 06:48:45 PDT
peavo
Comment 23 2013-10-22 07:43:29 PDT
Build Bot
Comment 24 2013-10-22 08:11:56 PDT
Build Bot
Comment 25 2013-10-22 08:26:43 PDT
peavo
Comment 26 2013-10-22 09:23:35 PDT
peavo
Comment 27 2013-10-22 09:59:30 PDT
(In reply to comment #16) > > We should probably create a WTF/ThreadingOnce.h/.cpp that encapsulates this pattern. We use the pthread_once logic in a number of places, and it would be useful to only do this one way throughout our code base. > Updated patch with a ThreadingOnce class, since the functionality was needed in two places.
Brent Fulgham
Comment 28 2013-10-30 10:11:16 PDT
Comment on attachment 214863 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=214863&action=review Thanks for resolving those issues. This looks fine to me. r=me > Source/WTF/wtf/ThreadingOnce.h:68 > + bool m_calledOnce; It's a shame that Windows doesn't provide this functionality. A future improvement might be to base this on whatever Windows uses to handle "do this once" functionality. Perhaps that is just a mutex and a flag, but when we move to 64-bit, we will have access to more modern OS features, which might be helpful here.
WebKit Commit Bot
Comment 29 2013-10-30 10:48:09 PDT
Comment on attachment 214863 [details] Patch Clearing flags on attachment: 214863 Committed r158282: <http://trac.webkit.org/changeset/158282>
WebKit Commit Bot
Comment 30 2013-10-30 10:48:12 PDT
All reviewed patches have been landed. Closing bug.
peavo
Comment 31 2013-10-30 10:52:57 PDT
(In reply to comment #28) > (From update of attachment 214863 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=214863&action=review > > Thanks for resolving those issues. This looks fine to me. > > r=me > Thanks for helping me out with this one :)
Note You need to log in before you can comment on or make changes to this bug.