NEW 213757
[Win] Stub out bmalloc implementation
https://bugs.webkit.org/show_bug.cgi?id=213757
Summary [Win] Stub out bmalloc implementation
Don Olmstead
Reported 2020-06-29 15:28:06 PDT
Prepare bmalloc to be cross platform
Attachments
WIP Patch (23.32 KB, patch)
2020-06-29 16:37 PDT, Don Olmstead
no flags
WIP Patch (25.15 KB, patch)
2020-06-29 16:42 PDT, Don Olmstead
no flags
WIP Patch (25.14 KB, patch)
2020-06-29 16:59 PDT, Don Olmstead
no flags
xcode (10.23 KB, patch)
2020-06-29 18:09 PDT, Don Olmstead
no flags
Patch (39.23 KB, patch)
2020-06-29 18:18 PDT, Don Olmstead
ysuzuki: review+
Don Olmstead
Comment 1 2020-06-29 16:37:28 PDT Comment hidden (obsolete)
Don Olmstead
Comment 2 2020-06-29 16:42:12 PDT Comment hidden (obsolete)
Don Olmstead
Comment 3 2020-06-29 16:59:07 PDT Comment hidden (obsolete)
Don Olmstead
Comment 4 2020-06-29 18:09:55 PDT Comment hidden (obsolete)
Don Olmstead
Comment 5 2020-06-29 18:18:13 PDT
Yusuke Suzuki
Comment 6 2020-06-30 14:09:51 PDT
Comment on attachment 403150 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=403150&action=review r=me, but I think we should get Geoff's review too. > Source/bmalloc/ChangeLog:13 > + Add stubs for an implementation of bmalloc on Windows. Split the CryptoRandom > + implementation into a Unix and Windows definition. Add a small abstraction around > + threads to allow a Windows definition. Add the Builtins.h file which will contain > + any GCC compatible __builtin implementations on Windows. > + > + The actual implementations will be coming in subsequent patches. It is not enabled in Windows yet, right? Then, it is OK. > Source/bmalloc/bmalloc/BAssert.h:70 > + *(int *)(uintptr_t)0xbbadbeef = 0; \ Let's remove this change. > Source/bmalloc/bmalloc/Builtins.h:41 > +{ > + return 0; > +} > + > +BINLINE int __builtin_usub_overflow(unsigned int a, unsigned int b, unsigned int *res) > +{ > + return 0; > +} Can you add FIXME? > Source/bmalloc/bmalloc/DebugHeap.cpp:112 > +#if BOS(WINDOWS) > + result = _aligned_malloc(size, alignment); > + RELEASE_BASSERT(action == FailureAction::ReturnNull || result); > +#else > if (posix_memalign(&result, alignment, size)) > RELEASE_BASSERT(action == FailureAction::ReturnNull || result); > +#endif We should have FIXME to call _aligned_free since Windows requires paired calls of this instead of using free. > Source/bmalloc/bmalloc/IsoTLS.cpp:38 > +#if BOS(WINDOWS) > +#define strcasecmp _stricmp > +#else > #include <stdio.h> > +#endif I think we can include `stdio.h` regardless of whether this is Windows or not. > Source/bmalloc/bmalloc/VMAllocate.h:65 > + // @TODO Can you put FIXME comment with bugzilla URL about cache size retrieval? > Source/bmalloc/bmalloc/VMAllocate.h:135 > + // @TODO Can you add FIXME comment with bugzilla URL about it? > Source/bmalloc/bmalloc/VMAllocate.h:156 > + // @TODO Ditto. > Source/bmalloc/bmalloc/VMAllocate.h:166 > + // @TODO Ditto. > Source/bmalloc/bmalloc/VMAllocate.h:176 > + // @TODO Ditto. > Source/bmalloc/bmalloc/VMAllocate.h:231 > + // @TODO Ditto. > Source/bmalloc/bmalloc/VMAllocate.h:246 > + // @TODO Ditto. > Source/bmalloc/bmalloc/win/CryptoRandomWin.cpp:31 > +{ Can you add a comment with FIXME?
Geoffrey Garen
Comment 7 2020-06-30 14:15:32 PDT
Comment on attachment 403150 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=403150&action=review > Source/bmalloc/bmalloc/DebugHeap.cpp:108 > +#if BOS(WINDOWS) > + result = _aligned_malloc(size, alignment); > + RELEASE_BASSERT(action == FailureAction::ReturnNull || result); This is incorrect because it does not pair with _aligned_free. I think Windows just shouldn't use the debug heap.
Geoffrey Garen
Comment 8 2020-06-30 14:17:22 PDT
Generally, I don't love the idea of landing non-functional pieces of a port without testing. Is there a way to do this development locally or on a branch until it's more complete? Alternatively, do you have a complete patch that you can post for reference?
Note You need to log in before you can comment on or make changes to this bug.