skip to main content
research-article

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

Published:29 October 2022Publication History
Skip Abstract Section

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

Index Terms

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

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • 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

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 29 October 2022
      • Online AM: 14 April 2022
      • Accepted: 3 April 2022
      • Revised: 13 February 2022
      • Received: 8 October 2021
      Published in tecs Volume 22, Issue 1

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article
      • Refereed
    • Article Metrics

      • Downloads (Last 12 months)198
      • Downloads (Last 6 weeks)7

      Other Metrics

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Full Text

    View this article in Full Text.

    View Full Text

    HTML Format

    View this article in HTML Format .

    View HTML Format