Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article

WasmAndroid: A Cross-Platform Runtime for Native Programming Languages on Android

Published: 29 October 2022 Publication History

Abstract

Open source hardware such as RISC-V has been gaining substantial momentum. Recently, they have begun to embrace Google’s Android operating system to leverage its software ecosystem. Despite the encouraging progress, a challenging issue arises: a majority of Android applications are written in native languages and need to be recompiled to target new hardware platforms. Unfortunately, this recompilation process is not scalable because of the explosion of new hardware platforms. To address this issue, we present WasmAndroid, a high-performance cross-platform runtime for native Android applications. With WasmAndroid, developers can compile their source code to WebAssembly, an efficient and portable bytecode format that can be executed everywhere without additional reconfiguration. Developers can also transpile existing application binaries to WebAssembly when source code is not available. WebAssembly’s language model is very different from other common languages. This mismatch leads to many unique implementation challenges. In this article, we provide workable solutions and conduct a thorough system evaluation. We show that WasmAndroid provides acceptable performance to execute native applications in a cross-platform manner.

References

[1]
Android Has Been Ported to a RISC-V Board. Retrieved from https://www.xda-developers.com/android-risc-v-port/.
[2]
Android Runtime (ART) and Dalvik. Retrieved from https://source.android.com/devices/tech/dalvik.
[3]
Clang: A C Language Family Frontend for LLVM. Retrieved from https://clang.llvm.org/.
[5]
FFmpeg: A Cross-platform Solution to Record, Convert and Stream Audio and Video. Retrieved from https://github.com/FFmpeg/FFmpeg.
[7]
Kissdb: Keep It Simple Stupid Database. Retrieved from https://github.com/adamierymenko/kissdb.
[8]
POWER Instruction Set Architecture (ISA). Retrieved from https://openpowerfoundation.org/tag/microwatt/.
[9]
THead Android RISC-V Port. Retrieved from https://github.com/T-head-Semi/aosp-riscv.
[10]
WebAssembly Exception Handling Proposal. Retrieved from https://github.com/WebAssembly/exception-handling.
[11]
WebAssembly SIMD proposal. Retrieved from https://v8.dev/features/simd.
[12]
WebAssembly Stack Switching Proposal. Retrieved from https://github.com/WebAssembly/stack-switching.
[13]
The WebAssembly System Interface. Retrieved from https://wasi.dev/.
[14]
Xilinx Virtex-7 FPGA VC707 Evaluation Kit. Retrieved from https://www.xilinx.com/products/boards-and-kits/ek-v7-vc707-g.html.
[15]
Fabrice Bellard. 2005. QEMU, a fast and portable dynamic translator. In Proceedings of the USENIX Annual Technical Conference, FREENIX Track, Vol. 41. 46.
[16]
Pau Oliva Fora. 2014. Beginners guide to reverse engineering android apps. In Proceedings of the RSA Conference. 21–22.
[17]
C. Grothoff. 2014. GNU Libmicrohttpd: A Library for Creating an Embedded http Server. Retrieved from https://www.gnu.org/software/libmicrohttpd/.
[18]
Andreas Haas, Andreas Rossberg, Derek L. Schuff, Ben L. Titzer, Michael Holman, Dan Gohman, Luke Wagner, Alon Zakai, and J. F. Bastien. 2017. Bringing the web up to speed with WebAssembly. In ACM SIGPLAN Notices, Vol. 52. ACM, 185–200.
[19]
Adam Hall and Umakishore Ramachandran. 2019. An execution model for serverless functions at the edge. In Proceedings of the International Conference on Internet of Things Design and Implementation. ACM, 225–236.
[20]
Joe Hendrix, Guannan Wei, and Simon Winwood. 2019. Towards verified binary raising. In Workshop on Instruction Set Architecture Specification (co-located with ITP 2019). 6.
[21]
John L. Henning. 2006. SPEC CPU2006 benchmark descriptions. ACM SIGARCH Comput. Arch. News 34, 4 (2006), 1–17.
[22]
Roberto Ierusalimschy. 2006. Programming in Lua. Roberto Ierusalimschy.
[23]
Martin Jacobsson and Jonas Wåhslén. 2018. Virtual machine execution for wearables based on WebAssembly. In Proceedings of the 13th EAI International Conference on Body Area Networks (BodyNets’18).
[24]
Abhinav Jangda, Bobby Powers, Emery D. Berger, and Arjun Guha. 2019. Not so fast: Analyzing the Performance of WebAssembly vs. native code. In Proceedings of the USENIX Annual Technical Conference (USENIX ATC’19). 107–120.
[25]
Pascal Junod, Julien Rinaldini, Johan Wehrli, and Julie Michielin. 2015. Obfuscator-LLVM–software protection for the masses. In Proceedings of the IEEE/ACM 1st International Workshop on Software Protection. IEEE, 3–9.
[26]
Uday P. Khedker, Amitabha Sanyal, and Bageshri Karkare. 2017. Data Flow Analysis: Theory and Practice. CRC Press.
[27]
Yeong-Jun Kim, Seong-Jin Cho, Kil-Jae Kim, Eun-Hye Hwang, Seung-Hyun Yoon, and Jae-Wook Jeon. 2012. Benchmarking Java application using JNI and native C application on Android. In Proceedings of the 12th International Conference on Control, Automation and Systems. IEEE, 284–288.
[28]
Radhesh Krishnan Konoth, Emanuele Vineti, Veelasha Moonsamy, Martina Lindorfer, Christopher Kruegel, Herbert Bos, and Giovanni Vigna. 2018. Minesweeper: An in-depth look into drive-by cryptocurrency mining and its defense. In Proceedings of the ACM SIGSAC Conference on Computer and Communications Security. ACM, 1714–1730.
[29]
Chris Lattner. 2008. LLVM and Clang: Next generation compiler technology. In Proceedings of the BSD Conference, Vol. 5.
[30]
John Levine. 2009. Flex & Bison: Text Processing Tools. O’Reilly Media, Inc.
[31]
Bruno Gois Mateus and Matias Martinez. 2019. An empirical study on quality of Android applications written in Kotlin language. Emp. Softw. Eng. 24, 6 (2019), 3356–3393.
[32]
Ricardo Nobre, Luiz G. A. Martins, and João M. P. Cardoso. 2016. A graph-based iterative compiler pass selection and phase ordering approach. ACM SIGPLAN Not. 51, 5 (2016), 21–30.
[33]
Mike Owens. 2006. The Definitive Guide to SQLite. Apress.
[34]
Sylvain Ratabouil. 2015. Android NDK: Beginner’s Guide. Packt Publishing Ltd.
[35]
Bor-Yeh Shen, Wei-Chung Hsu, and Wuu Yang. 2014. A retargetable static binary translator for the ARM architecture. ACM Trans. Arch. Code Optim. 11, 2 (2014), 1–25.
[36]
Sajjad Taheri, Alexander Vedienbaum, Alexandru Nicolau, Ningxin Hu, and Mohammad R. Haghighat. 2018. OpenCV. js: Computer vision processing for the open Web platform. In Proceedings of the 9th ACM Multimedia Systems Conference. ACM, 478–483.
[37]
James Tandon. 2011. The openrisc processor: Open hardware and linux. Linux J. 2011, 212 (2011), 6.
[38]
Andrew Shell Waterman. 2016. Design of the RISC-V Instruction Set Architecture. Ph.D. Dissertation. UC Berkeley.
[39]
Fengguo Wei, Xingwei Lin, Xinming Ou, Ting Chen, and Xiaosong Zhang. 2018. Jn-saf: Precise and efficient ndk/jni-aware inter-language static analysis framework for security vetting of android applications with native code. In Proceedings of the ACM SIGSAC Conference on Computer and Communications Security. 1137–1150.
[40]
Elliott Wen, Jim Warren, and Gerald Weber. 2020. BrowserVM: Running unmodified operating systems and applications in browsers. In Proceedings of the IEEE International Conference on Web Services (ICWS’20). IEEE, 473–480.
[41]
Elliott Wen and Gerald Weber. 2020. Wasmachine: Bring IoT up to speed with A WebAssembly OS. In Proceedings of the IEEE International Conference on Pervasive Computing and Communications Workshops (PerCom Workshops). IEEE, 1–4.
[42]
Elliott Wen, Gerald Weber, and Suranga Nanayakkara. 2021. WasmAndroid: A cross-platform runtime for native programming languages on Android (WIP paper). In Proceedings of the 22nd ACM SIGPLAN/SIGBED International Conference on Languages, Compilers, and Tools for Embedded Systems. 80–84.
[43]
R. Winsniewski. 2012. Android–apktool: A tool for reverse engineering android apk files. https://ibotpeaches.github.io/Apktool/.
[44]
S. Bharadwaj Yadavalli and Aaron Smith. 2019. Raising binaries to LLVM IR with MCTOLL (WIP paper). In Proceedings of the 20th ACM SIGPLAN/SIGBED International Conference on Languages, Compilers, and Tools for Embedded Systems. 213–218.
[45]
Alon Zakai. 2018. Fast physics on the web using C++, JavaScript, and emscripten. Comput. Sci. Eng. 20, 1 (2018), 11–19.

Index Terms

  1. WasmAndroid: A Cross-Platform Runtime for Native Programming Languages on Android

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Transactions on Embedded Computing Systems
    ACM Transactions on Embedded Computing Systems  Volume 22, Issue 1
    January 2023
    512 pages
    ISSN:1539-9087
    EISSN:1558-3465
    DOI:10.1145/3567467
    • Editor:
    • Tulika Mitra
    Issue’s Table of Contents

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Journal Family

    Publication History

    Published: 29 October 2022
    Online AM: 14 April 2022
    Accepted: 03 April 2022
    Revised: 13 February 2022
    Received: 08 October 2021
    Published in TECS Volume 22, Issue 1

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. Android
    2. WebAssembly
    3. cross-platform
    4. open source hardware

    Qualifiers

    • Research-article
    • Refereed

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • 0
      Total Citations
    • 596
      Total Downloads
    • Downloads (Last 12 months)96
    • Downloads (Last 6 weeks)4
    Reflects downloads up to 23 Dec 2024

    Other Metrics

    Citations

    View Options

    Login options

    Full Access

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Full Text

    View this article in Full Text.

    Full Text

    HTML Format

    View this article in HTML Format.

    HTML Format

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media