-
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
android: ChakraCore compiles to Android ARMv7 #2224
Conversation
Things left to do;
|
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.
Generally, looks fine to me. Left some comments and didn't review the PAL changes in-depth. Can you also write up something on how to build CC on Android if anyone else wanted to try? Maybe just update our BUILDING file or add it to the wiki?
@@ -254,7 +254,7 @@ AutoSystemInfo::SSE2Available() const | |||
return false; // TODO: xplat support | |||
#endif | |||
#else | |||
#error Unsupported platform. | |||
return false; |
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'd leave the error here and add an explicit ifdef for ARMv7/Android here so that anyone adding new platform support is aware that this function is something they need to think about
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.
@digitalinfinity if it's not Intel, IMO SSE2Available()
should return false. What other possibilities here?
@@ -637,9 +648,9 @@ namespace PlatformAgnostic | |||
#endif | |||
} | |||
|
|||
__forceinline unsigned char _BitTest(const LONG *_BitBase, int _BitPos) | |||
__forceinline unsigned char _BitTest(LONG *_BitBase, int _BitPos) |
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.
Why was the const removed here? seems like allowing for const can result in better codegen by the compiler- if it's android specific, I'd prefer doing a const_cast when _bittest is called scoped to Android
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.
Clang intrinsic definition has no const.
@@ -621,7 +632,7 @@ namespace PlatformAgnostic | |||
{ | |||
__forceinline unsigned char _BitTestAndSet(LONG *_BitBase, int _BitPos) | |||
{ | |||
#if defined(__clang__) | |||
#if defined(__clang__) && !defined(_ARM_) |
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.
My ARM fu is weak, so a basic question here- is ARM the same for Windows ARM vs Android ARM v7? Should it be? I know that Windows supports Thumb2, which I don't know if Android supports so the Windows ARM code might end up being slightly different from the Android ARM- I'm not sure what the macro model here should look like. @pleath @satheeshravi thoughts?
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.
+1, also there are ARMv7 and ARMv8, 32-bit and 64-bit, we need to be careful to cover them correctly.
In reply to: 92870165 [](ancestors = 92870165)
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.
@digitalinfinity below code is for x86 (bts is an x86 instruction). and when read the comment, we use intrinsic here for ARM 32 bit instead.
@ThomsonTan intrinsic below should work for ARMv8 too.
// We use a custom calling convention to invoke JavascriptMethod based on | ||
// System V AMD64 ABI. At entry of JavascriptMethod the stack layout is: | ||
// System ABI. At entry of JavascriptMethod the stack layout is: |
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.
Interesting- are the calling conventions in the ABIs same for x86/AMD64/ARM on Linux?
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.
AddressOfReturnAddress
is intrinsic
@@ -75,6 +70,10 @@ inline int _count_args(const T1&, const T2&, const T3&, const T4&, Js::CallInfo | |||
#define CALL_ENTRYPOINT(entryPoint, function, callInfo, ...) \ | |||
entryPoint(function, callInfo, nullptr, nullptr, nullptr, nullptr, \ | |||
function, callInfo, ##__VA_ARGS__) | |||
#elif defined(_ARM_) | |||
// xplat-todo: fix me |
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.
Can you add some more description here? What needs to be fixed?
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.
This part is likely to fail for different targets. I will turn back to here (hence todo note)
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.
updated this to fix me ARM
@@ -371,7 +371,9 @@ namespace Js | |||
|
|||
if (FACILITY_CONTROL == HRESULT_FACILITY(hr) || FACILITY_JSCRIPT == HRESULT_FACILITY(hr)) | |||
{ | |||
#ifndef __ANDROID__ |
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.
What is this change for? Does this function work xplat? It looks like its mostly getting windows specific errors so perhaps the entire if condition shouldn't disabled for Android, no?
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.
argList != nullptr
is wrong. I'm not sure how this works or if it works at all. Clearly it doesn't work with Clang 3.8 abi-arm-android.
entire if condition shouldn't disabled for Android
Sounds Good. Thanks
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.
Actually, shouldn't we consider argList will never be null and keep it as is here?
@@ -1,3 +1,5 @@ | |||
if (NOT CC_TARGET_OS_ANDROID) |
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.
On this note- have we cleaned up this file to make sure that it's checking for stuff that ChakraCore actually needs? When I imported the PAL, I didn't bother to clean this up but if our PAL is diverging, can you make a note to clean up this file at some point?
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.
PAL uses this file to feature detect on target. This is not an option when cross-compiling the code.
can you make a note to clean up this file at some point?
Good idea, will do. Thanks
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.
added extra notes
@digitalinfinity we need #2224 (comment) steps are done for anyone to experience ChakraCore literally. |
dbb616d
to
1aa8826
Compare
Steps to compile:
After some updates to this PR, currently there are only few linker errors left. @digitalinfinity do you have any additional comments? |
3d50742
to
b95e5d9
Compare
Android ARMv7 linker issues are also fixed (along with the implementation of ChakraCore ASM files) |
7e01db0
to
467795c
Compare
Also targets RaspberryPI (see #2262 for additional requirements) |
6a6c50b
to
7e65d01
Compare
No more comments from my side- thanks @obastemur |
LGTM |
@digitalinfinity @ThomsonTan Thanks for the Reviews!! |
Merge pull request #2224 from obastemur:exp disclaimer: Android is not officially supported.
disclaimer: Android is not officially supported.