-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix MacOS build #7009
Fix MacOS build #7009
Conversation
It looks like |
@ppenzin This code snippet exists since the "First Commit" and caused some build issues before (See 11a6851 and 4398657). I don't understand why it exists in the first place because according to this gcc docs:
|
These declarations do look like a kludge, for sure. @ShortDevelopment, do you have an idea why wasm spec test failed with this change? I wonder if there is more to this story, @rhuanjl, do you have any recollection on whether or not it is really needed for debugging? There are better methods to get placement new and delete operators if that is what this was supposed to achieve.. |
It definitely looks like a fudge - I'm afraid I don't know its intent. I may be misunderstanding- but I think the comment is actually saying this is Not Needed for the debugger extension (a different compile target?) but, implicitly, is needed for a normal CC build. The test fail at first glance seems to be a real error of some kind, though would need to dig to understand it. |
Chakracore has never compiled with GCC, it's always needed clang on Linux/macos - I don't know if that's relevant to this issue but could be. (Thought prompted by your ref to the GCC docs) |
If I correctly understand this PR on clang a custom declaration of the inline placement new operator could lead to (slightly) lower build / debug times because the stl |
These macros aid compiler in various ways, in libcxx PR they are defining one that tells compiler placement new has been defined, the one Allocator.h has seems to imply inlining of the operator (though I don't know which compiler that is for). I think deleting custom placement operator and using a standard one is OK as long as the rest of the CI is passing. |
All checks are passing now although I did only add a comment and move the Might this be an existing bug in the codebase? |
Placement of include can have some effect, though this might be just a spurious failure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be fine. @rhuanjl what do you think?
Poking a bit more, |
Sorry we should have resolved this by now; I'd really like to know why this definition existed in the first place before going along with deleting it; are we sure its identical to the version in the std lib? |
Thanks for the extra explanation and thank you for looking into this I'm happy that this needs to go on mac; but without checking further I'd like to keep it on windows. Please could you update to leave the old code #ifdef _WIN32 and #else include the header then I'll merge it. |
cc0574e
to
7161fa3
Compare
7161fa3
to
8d7950b
Compare
@rhuanjl Good idea! I checked for ChakraCore/test/typedarray/allocation.js Lines 6 to 12 in e26c81f
|
I re-ran the pipeline and the test passed, that specific test has been flaky before as it uses a very high level of ram - near the limit on the test VM I think. Hence merged. Thanks for this contribution. (The checks showed as a fail because publishing artefacts on a re-run results in a naming clash and hence always fails.) |
Nice, thanks @rhuanjl I'll try to add a fix for the artifacts and finally finish the optional chaining (has been partially blocked by this) once I got more time in a view weeks. @ppenzin Also just out of curiosity: Is there a particular reason why we don't use GitHub Actions instead of 3rd party CI providers? |
Sorry we let this sit so long; my life is busier these days than it used to be; I'm going to try and be a bit more active again from now but we'll see - I'd certainly be happy to review the optional chaining PR when you progress it. RE:pipeline providers:
I note that both have usage limits and using two providers actually means the tests complete faster than if they were on the same provider. |
No problem, by "partially blocked" I honestly mean the failing pipeline gave me a good excuse to work on something else 🙈. Thank you for all your work!
Good point! |
TL;DR
MacOs builds using latest
icu4c
fail because the "placement new operator" is defined in the standard-library and inAllocator.h
.Issue
As far as I understand the issue (might be wrong)
new
operator that used an already existing allocation (previousAllocation
)ChakraCore/lib/Common/Memory/Allocator.h
Lines 451 to 474 in e26c81f
new
header for every compilation unit that uses the custom CCAllocator.h
._LIBCPP_PLACEMENT_NEW_DEFINED
macro to allow for user defined placement new operators llvm/llvm-project#70538Std lib
MSVC
The
__PLACEMENT_NEW_INLINE
flag can be used to disable placement new declaration in MSVC (v14.43.34808)See
vcruntime_new.h
(imported bynew
):MacOs
This is from the MacOSX14.5 sdk (There seems no way to disable it llvm/llvm-project/pull/70538)Why did it work before?
__PLACEMENT_NEW_INLINE
solved the problem for MSVCnew
and CCAllocator.h
at the same time.NO_EXPORT
macroChakraCore/lib/Common/Memory/Allocator.h
Lines 443 to 449 in e26c81f
What's different now?
new
into a compilation unit that also usesAllocator.h
⇒ Error
StackTrace
Potential Solution
As this specific
new
overload is part of the standard-library it might be okay to just remove the custom declaration in CC and always#include <new>
instead.Risks
As the implementation is identical there should be no immediate risks, but...
I don't think these 2 are true but we need prove for that
⇒ Additional function call might reduce runtime performance
new
could have side-effectsFixes #7007