Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1504)

Unified Diff: base/android/jni_generator/jni_generator.py

Issue 2531273002: android: Realign stack pointer on JNI entry. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/android/jni_generator/jni_generator.py
diff --git a/base/android/jni_generator/jni_generator.py b/base/android/jni_generator/jni_generator.py
index 428c4939ae82c879dcf8f4c146c1deab21c33a9e..f115b45f33ff467aa77486c4a964855aa0c6da29 100755
--- a/base/android/jni_generator/jni_generator.py
+++ b/base/android/jni_generator/jni_generator.py
@@ -1030,8 +1030,14 @@ ${NATIVES}
'PARAM0_NAME': native.params[0].name,
'P0_TYPE': native.p0_type,
})
+ # Dalvik JIT generated code doesn't guarantee 16-byte stack alignment on
+ # x86 - use force_align_arg_pointer to realign the stack at the JNI
+ # boundary. crbug.com/655248
template = Template("""\
extern "C" __attribute__((visibility("default")))
+#if defined(ARCH_CPU_X86)
+__attribute__((force_align_arg_pointer))
+#endif
${RETURN} ${STUB_NAME}(JNIEnv* env,
${PARAMS_IN_STUB}) {
${PROFILING_ENTERED_NATIVE}
@@ -1045,6 +1051,9 @@ ${RETURN} ${STUB_NAME}(JNIEnv* env,
static ${RETURN_DECLARATION} ${NAME}(JNIEnv* env, ${PARAMS});
extern "C" __attribute__((visibility("default")))
+#if defined(ARCH_CPU_X86)
+__attribute__((force_align_arg_pointer))
+#endif
${RETURN} ${STUB_NAME}(JNIEnv* env, ${PARAMS_IN_STUB}) {
${PROFILING_ENTERED_NATIVE}
return ${NAME}(${PARAMS_IN_CALL})${POST_CALL};

Powered by Google App Engine
This is Rietveld 408576698