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

Issue 2531273002: android: Realign stack pointer on JNI entry. (Closed)

Created:
4 years ago by Torne
Modified:
4 years ago
CC:
chromium-reviews, vmpstr+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

android: Realign stack pointer on JNI entry. Dalvik JIT generated code doesn't always align the stack to a 16 byte boundary when calling into native, causing crashes in code that expects 16 byte alignment. Force the compiler to realign the stack when entering native from Java, so that other code can assume 16 byte alignment as expected by the ABI. Move the function attributes into a macro so that the generated header file is less repetitive (this also makes the generator less repetitive as a bonus). Also, to stop presubmit complaining about golden_sample_for_tests_jni.h not being correctly clang-formatted, rename it to .golden like the other test files. BUG=655248 Committed: https://crrev.com/7be1137994eecca6c54831e4c3d3d4f934ea8602 Cr-Commit-Position: refs/heads/master@{#435632}

Patch Set 1 #

Total comments: 2

Patch Set 2 : rebase #

Patch Set 3 : Move the attributes into a macro #

Patch Set 4 : Rename golden test file to satisfy presubmit #

Unified diffs Side-by-side diffs Delta from patch set Stats (+96 lines, -649 lines) Patch
M base/android/jni_generator/BUILD.gn View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
A + base/android/jni_generator/SampleForTests_jni.golden View 1 2 3 10 chunks +19 lines, -36 lines 0 comments Download
M base/android/jni_generator/golden_sample_for_tests_jni.h View 1 2 3 1 chunk +0 lines, -531 lines 0 comments Download
M base/android/jni_generator/jni_generator.py View 1 2 2 chunks +2 lines, -5 lines 0 comments Download
M base/android/jni_generator/jni_generator_helper.h View 1 2 2 chunks +21 lines, -11 lines 0 comments Download
M base/android/jni_generator/jni_generator_tests.py View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M base/android/jni_generator/testInnerClassNatives.golden View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M base/android/jni_generator/testInnerClassNativesBothInnerAndOuter.golden View 1 2 1 chunk +4 lines, -4 lines 0 comments Download
M base/android/jni_generator/testInnerClassNativesMultiple.golden View 1 2 2 chunks +4 lines, -4 lines 0 comments Download
M base/android/jni_generator/testMultipleJNIAdditionalImport.golden View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M base/android/jni_generator/testNativeExportsOnlyOption.golden View 1 2 4 chunks +6 lines, -12 lines 0 comments Download
M base/android/jni_generator/testNatives.golden View 1 2 12 chunks +31 lines, -36 lines 0 comments Download
M base/android/jni_generator/testNativesLong.golden View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M base/android/jni_generator/testSingleJNIAdditionalImport.golden View 1 2 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 25 (14 generated)
Torne
I've verified that the x86 code generated has appropriate stack alignment code with this change, ...
4 years ago (2016-11-28 14:22:17 UTC) #2
Primiano Tucci (use gerrit)
LGTM thanks https://codereview.chromium.org/2531273002/diff/1/base/android/jni_generator/golden_sample_for_tests_jni.h File base/android/jni_generator/golden_sample_for_tests_jni.h (right): https://codereview.chromium.org/2531273002/diff/1/base/android/jni_generator/golden_sample_for_tests_jni.h#newcode54 base/android/jni_generator/golden_sample_for_tests_jni.h:54: #if defined(ARCH_CPU_X86) maybe just #define ALIGN_STACK_X86 ...
4 years ago (2016-11-28 14:39:28 UTC) #3
rmcilroy
LGTM https://codereview.chromium.org/2531273002/diff/1/base/android/jni_generator/golden_sample_for_tests_jni.h File base/android/jni_generator/golden_sample_for_tests_jni.h (right): https://codereview.chromium.org/2531273002/diff/1/base/android/jni_generator/golden_sample_for_tests_jni.h#newcode54 base/android/jni_generator/golden_sample_for_tests_jni.h:54: #if defined(ARCH_CPU_X86) On 2016/11/28 14:39:28, Primiano Tucci wrote: ...
4 years ago (2016-11-28 15:21:56 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2531273002/1
4 years ago (2016-12-01 14:42:19 UTC) #6
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/316357)
4 years ago (2016-12-01 14:50:08 UTC) #8
Torne
Bleugh, forgot that the presubmit warns because the generated golden test file doesn't pass clang-format. ...
4 years ago (2016-12-01 14:57:02 UTC) #9
Torne
Can one of you take another look? I moved the function attributes and declspec entirely ...
4 years ago (2016-12-01 15:29:13 UTC) #13
Primiano Tucci (use gerrit)
still lgtm
4 years ago (2016-12-01 16:06:42 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2531273002/60001
4 years ago (2016-12-01 16:40:53 UTC) #20
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years ago (2016-12-01 17:12:26 UTC) #23
commit-bot: I haz the power
4 years ago (2016-12-01 17:15:55 UTC) #25
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/7be1137994eecca6c54831e4c3d3d4f934ea8602
Cr-Commit-Position: refs/heads/master@{#435632}

Powered by Google App Engine
This is Rietveld 408576698