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.
- [1] Android Has Been Ported to a RISC-V Board. Retrieved from https://www.xda-developers.com/android-risc-v-port/.Google Scholar
- [2] Android Runtime (ART) and Dalvik. Retrieved from https://source.android.com/devices/tech/dalvik.Google Scholar
- [3] Clang: A C Language Family Frontend for LLVM. Retrieved from https://clang.llvm.org/.Google Scholar
- [4] Dalvik bytecode. Retrieved from https://source.android.com/devices/tech/dalvik/dalvik-bytecode.Google Scholar
- [5] FFmpeg: A Cross-platform Solution to Record, Convert and Stream Audio and Video. Retrieved from https://github.com/FFmpeg/FFmpeg.Google Scholar
- [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 Scholar
- [7] Kissdb: Keep It Simple Stupid Database. Retrieved from https://github.com/adamierymenko/kissdb.Google Scholar
- [8] POWER Instruction Set Architecture (ISA). Retrieved from https://openpowerfoundation.org/tag/microwatt/.Google Scholar
- [9] THead Android RISC-V Port. Retrieved from https://github.com/T-head-Semi/aosp-riscv.Google Scholar
- [10] WebAssembly Exception Handling Proposal. Retrieved from https://github.com/WebAssembly/exception-handling.Google Scholar
- [11] WebAssembly SIMD proposal. Retrieved from https://v8.dev/features/simd.Google Scholar
- [12] WebAssembly Stack Switching Proposal. Retrieved from https://github.com/WebAssembly/stack-switching.Google Scholar
- [13] The WebAssembly System Interface. Retrieved from https://wasi.dev/.Google Scholar
- [14] Xilinx Virtex-7 FPGA VC707 Evaluation Kit. Retrieved from https://www.xilinx.com/products/boards-and-kits/ek-v7-vc707-g.html.Google Scholar
- [15] . 2005. QEMU, a fast and portable dynamic translator. In Proceedings of the USENIX Annual Technical Conference, FREENIX Track, Vol. 41. 46.Google Scholar
- [16] . 2014. Beginners guide to reverse engineering android apps. In Proceedings of the RSA Conference. 21–22.Google Scholar
- [17] . 2014. GNU Libmicrohttpd: A Library for Creating an Embedded http Server. Retrieved from https://www.gnu.org/software/libmicrohttpd/.Google Scholar
- [18] . 2017. Bringing the web up to speed with WebAssembly. In ACM SIGPLAN Notices, Vol. 52. ACM, 185–200.Google Scholar
- [19] . 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.Google ScholarDigital Library
- [20] . 2019. Towards verified binary raising. In Workshop on Instruction Set Architecture Specification (co-located with ITP 2019). 6.Google Scholar
- [21] . 2006. SPEC CPU2006 benchmark descriptions. ACM SIGARCH Comput. Arch. News 34, 4 (2006), 1–17.Google ScholarDigital Library
- [22] . 2006. Programming in Lua. Roberto Ierusalimschy.Google Scholar
- [23] . 2018. Virtual machine execution for wearables based on WebAssembly. In Proceedings of the 13th EAI International Conference on Body Area Networks (BodyNets’18).Google Scholar
- [24] . 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.Google Scholar
- [25] . 2015. Obfuscator-LLVM–software protection for the masses. In Proceedings of the IEEE/ACM 1st International Workshop on Software Protection. IEEE, 3–9.Google ScholarDigital Library
- [26] . 2017. Data Flow Analysis: Theory and Practice. CRC Press.Google ScholarCross Ref
- [27] . 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.Google Scholar
- [28] . 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.Google ScholarDigital Library
- [29] . 2008. LLVM and Clang: Next generation compiler technology. In Proceedings of the BSD Conference, Vol. 5.Google Scholar
- [30] . 2009. Flex & Bison: Text Processing Tools. O’Reilly Media, Inc.Google Scholar
- [31] . 2019. An empirical study on quality of Android applications written in Kotlin language. Emp. Softw. Eng. 24, 6 (2019), 3356–3393.Google ScholarCross Ref
- [32] . 2016. A graph-based iterative compiler pass selection and phase ordering approach. ACM SIGPLAN Not. 51, 5 (2016), 21–30.Google ScholarDigital Library
- [33] . 2006. The Definitive Guide to SQLite. Apress.Google Scholar
- [34] . 2015. Android NDK: Beginner’s Guide. Packt Publishing Ltd.Google ScholarDigital Library
- [35] . 2014. A retargetable static binary translator for the ARM architecture. ACM Trans. Arch. Code Optim. 11, 2 (2014), 1–25.Google ScholarDigital Library
- [36] . 2018. OpenCV. js: Computer vision processing for the open Web platform. In Proceedings of the 9th ACM Multimedia Systems Conference. ACM, 478–483.Google ScholarDigital Library
- [37] . 2011. The openrisc processor: Open hardware and linux. Linux J. 2011, 212 (2011), 6.Google ScholarDigital Library
- [38] . 2016. Design of the RISC-V Instruction Set Architecture. Ph.D. Dissertation. UC Berkeley.Google Scholar
- [39] . 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.Google ScholarDigital Library
- [40] . 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.Google ScholarCross Ref
- [41] . 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.Google ScholarCross Ref
- [42] . 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.Google ScholarDigital Library
- [43] . 2012. Android–apktool: A tool for reverse engineering android apk files. https://ibotpeaches.github.io/Apktool/.Google Scholar
- [44] . 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.Google ScholarDigital Library
- [45] . 2018. Fast physics on the web using C++, JavaScript, and emscripten. Comput. Sci. Eng. 20, 1 (2018), 11–19.Google ScholarDigital Library
Index Terms
- WasmAndroid: A Cross-Platform Runtime for Native Programming Languages on Android
Recommendations
WasmAndroid: a cross-platform runtime for native programming languages on Android (WIP paper)
LCTES 2021: Proceedings of the 22nd ACM SIGPLAN/SIGBED International Conference on Languages, Compilers, and Tools for Embedded SystemsOpen-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 ...
Cross-Compiling Android Applications to iOS and Windows Phone 7
Android is currently leading the smartphone segment in terms of market share since its introduction in 2007. Android applications are written in Java using an API designed for mobile apps. Other smartphone platforms, such as Apple's iOS or Microsoft's ...
Benchmark Dalvik and Native Code for Android System
IBICA '11: Proceedings of the 2011 Second International Conference on Innovations in Bio-inspired Computing and ApplicationsGoogle's Android Native Development Kit (NDK) is a toolset that lets you embed components to use of native code in your Android applications. It makes possible for developers to easily compile in C/C++ for the Android development platform. Generally, ...
Comments