fix(manganis): support 32-bit Android targets in JNI callback#5641
Open
costajohnt wants to merge 1 commit into
Open
fix(manganis): support 32-bit Android targets in JNI callback#5641costajohnt wants to merge 1 commit into
costajohnt wants to merge 1 commit into
Conversation
The rust_callback native function gated compilation behind target_pointer_width = "64" with a compile_error!, which broke building dioxus for armv7-linux-androideabi (and any other 32-bit Android target) starting with DioxusLabs#4842. The handler pointer is transmitted across the JNI boundary as two jlong halves. The existing reconstruction already produces a pointer-width usize: on 64-bit both halves are significant, and on 32-bit the pointer fits in the low half (high half zero) so the as usize cast drops the unused high bits and yields the original pointer. Removing the gate lets the same code compile and run correctly on both widths. Closes DioxusLabs#5637
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Building dioxus for
armv7-linux-androideabi(and any 32-bit Android target) fails since #4842 becauserust_callbackgates compilation behindtarget_pointer_width = "64"with acompile_error!.The handler pointer crosses the JNI boundary as two
jlonghalves. The existing reconstruction already yields a pointer-widthusize: on 64-bit both halves are significant; on 32-bit the pointer fits in the low half (high half zero), so theas usizecast drops the unused high bits and recovers the original pointer. Removing the gate lets the same code compile and run on both widths, per @ealmloff's suggestion in the issue.Verified with
cargo check --target armv7-linux-androideabi -p manganis(failed before, passes after) andcargo check --target aarch64-linux-android -p manganis(unchanged). The encode side that splits the pointer into the two halves lives in plugin-provided DEX bytecode, so this preserves the existing low-half wire contract rather than changing it.Closes #5637