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
Better fix for ARM64 native calls #5183
Conversation
This pull request has been imported into Phabricator, and discussion and review of the diff will take place at https://reviews.facebook.net/D37299 |
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks! |
Note with “test/run --mode 'interp' all”: Which is much better than any other patch. |
… signed char. This most likely has been fixed upstream but I did not check and libmagic here has many changes compared o what upstream would have.
Since JIT does not work for ARM64, disable it by default.
External timezone info does not really use a zero ending string for the country code.
Please see my comments on https://reviews.facebook.net/D37299 |
isn't char signed by default? Here is what the C standard says (C++ is similar): GCC has this to say (https://gcc.gnu.org/onlinedocs/gcc/Characters-implementation.html#Characters-implementation): The AARCH64 ABI (http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf) says this: So it is not about ARM GCC but rather all ARM compilers.
That is correct all AARCH64 treats char as unsigned char as referenced above and all the code needs to be audited for this as C says it is an implemented defined if char is signed or unsigned (as referenced above). PowerPC ABI says the same as AARCH64. x86 is really the old man out here :). |
Also I can't figure out how to comment on https://reviews.facebook.net/D37299
This change is not related to char being unsigned but rather just a different implementation of memcmp which returns 0x80 rather than 0x1 when the difference between the bytes are 1. The C standard is clear that positive values should be treated all the same here. |
Actually that code can be removed as callFuncPODImpl (which really should be called callFuncNonPODImpl but I was too quick in getting the fix in) is the place which is handling the return value "correctly" for both AARCH64 and x86 ABIs rather than inside native.cpp. |
The correct fix is most likely a sign extend issue, I will look into that today. I would rather see 8bit tags rather than 16bit tags and not remove them for AARCH64. Also the VA might be extended in future versions of ARMv8 to greater than 48bit so 16bit tags are going to break but 8bit tags won't break as that is now part of the ABI and architecture. |
Ok, I agree we should do the necessary auditing work then, and the fix for different memcmp() results makes sense. We often prefer the <stdint.h> types (e.g. int8_t) when the signed-ness and bit-size need to be explicit, but "signed char" should be ok.
What happens when you click the link and try to reply to a comment inline? do you get an error? there might be a setup step that we missed, to associate your github account with phabricator.
I think everywhere we use CompactTaggedPtr, we either use no tag at all, or a tag that would fit in 8 bits. It should be possible to specialize the template class as follows:
I think case 2 is the least amount of work for now, we could pursue case 3 and 4 as an optimization later. |
Hi, to comment on the phabricator diffs, please just register your github username at reviews.facebook.net. then we can use phabricator for review feedback (our preferred workflow). |
This redos tagged pointer support but disables for now the generic implementation. For ARMv8, 8bit tags can be supported without anding them out. For right now armv8 supports up to 48bit virtual address space but in the future it will support larger space. This builds for arm64 without any new bugs, it should work for x86_64 but I have not tried it. For PowerPC, you need to do specializations just as what was done for x86_64 and arm64 or just use the generic versions.
I should have done this first but I was just trying to get this working. The variables and functions are now correctly using NonPOD so really says what is different between x86_64 and ARM64.
On ARM64, the boost thread library is required to be linked against. Revert the wait hack too.
Also use yield as wfe is more than a sleep. It stops waiting for an event and there are no events happening.
The fix up was only so that it would disable the code rather than have the stubs in translator-asm-helpers.S like there was there for other functions already.
Correctly put the callee-save registers in the list of clobbers for inline-asm.
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
@apinski-cavium Normally we have a week timeout when changes are requested on a pull request where we close the pull request if there has been no action. Do you plan on addressing the comments of @edwinsmith in order to continue to move this pull request forward? |
@apinski-cavium I am going to close this pull request out due to lack of activity, per our timeout policy. That said, at any time, you can re-open this pull request (or start a new one) that provides the changes requested. Thanks! |
This patch is a duplicate of a change posted in a PR facebook#5183 by apinski-cavium. That pull request was abandoned due to other unresolved conflicts, but these changes to handle variant return types work and test well.
I am new to this pull request so I might have messed this up.