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

Improved Ahead-of-time Compilation of Stack-based JVM Bytecode on Resource-constrained Devices

Published: 13 August 2019 Publication History

Abstract

Many virtual machines exist for sensor nodes with only a few kB  RAM and tens- to a few hundred kB Flash memory. They pack an impressive set of features but suffer from a slowdown of one to two orders of magnitude compared to optimised native code, reducing throughput and increasing power consumption.
Compiling bytecode to native code to improve performance has been studied extensively for larger devices, but the restricted resources on sensor nodes mean most modern techniques cannot be applied. Simply replacing bytecode instructions with predefined sequences of native instructions is known to improve performance but produces code several times larger than the optimised C equivalent, limiting the size of programmes that can fit onto a device.
This article identifies the major sources of overhead resulting from this basic approach and presents optimisations to remove most of the remaining performance overhead, and over half the size overhead, reducing them to 67% and 77%, respectively. While this increases the size of the VM, the break-even point at which this fixed cost is compensated for by the smaller code it generates, is well within the range of memory available on a sensor device, allowing us to both improve performance and load more code on a device.

References

[1]
Bowen Alpern et al.1999. Implementing Jalapeño in Java. In Proceedings of the ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA’99).
[2]
Anon. 2015. Heap sort at Rosetta Code. Retrieved October 24, 2017 from https://rosettacode.org/mw/index.php?title=Sorting_algorithms/Heapsort8oldid=214878.
[3]
Faisal Aslam. 2011. Challenges and Solutions in the Design of a Java Virtual Machine for Resource Constrained Microcontrollers. Ph.D. Dissertation. University of Freiburg.
[4]
Faisal Aslam et al. 2008. Introducing TakaTuka—A java virtualmachine for motes. In Proceedings of the ACM Conference on Embedded Networked Sensor Systems (SENSYS’08).
[5]
Rahul Balani et al. 2006. Multi-level software reconfiguration for sensor networks. In Proceedings of the ACM SIGBED International Conference on Embedded Software (EMSOFT’09).
[6]
Niels Brouwers, Koen Langendoen, and Peter Corke. 2009. Darjeeling, a feature-rich VM for the resource poor. In Proceedings of the ACM Conference on Embedded Networked Sensor Systems (SENSYS’09).
[7]
Chipcon. 2004. 2.4 GHz IEEE 802.15.4 / ZigBee-ready RF Transceiver datasheet. http://www.ti.com/lit/ds/symlink/cc2420.pdf.
[8]
The Embedded Microprocessor Benchmark Consortium. 2017. CoreMark 1.0. Retrieved October 24, 2017 from http://www.eembc.org/coremark.
[9]
Alexandre Courbot, Gilles Grimaud, and Jean-Jacques Vandewalle. 2010. Efficient off-board deployment and customization of virtual machine-based embedded systems. ACM Trans. Embed. Comput. Syst. 9, 3 (2 2010).
[10]
Joshua Ellul. 2012. Run-time Compilation Techniques for Wireless Sensor Networks. Ph.D. Dissertation. University of Southampton.
[11]
Joshua Ellul and Kirk Martinez. 2010. Run-time compilation of bytecode in sensor networks. In Proceedings of the International Conference on Sensor Technologies and Applications (SENSORCOMM’10).
[12]
M. Anton Ertl. 1995. Stack caching for interpreters. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’95).
[13]
Leon Evers. 2010. Concise and Flexible Programming of Wireless Sensor Networks. Ph.D. Dissertation. University of Twente.
[14]
Andreas Gal, Christian W. Probst, and Michael Franz. 2006. HotpathVM: An effective JIT compiler for resource-constrained devices. In Proceedings of the ACM SIGPLAN/SIGOPS International Conference on Virtual Execution Environments (VEE’06).
[15]
David Gay, Philip Levis, Robert von Behren, Matt Welsh, Eric Brewer, and David Culler. 2003. The nesC language: A holistic approach to networked embedded systems. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’03).
[16]
James Gosling et al. 2015. The Java Language Specification, Java SE 8 Edition.
[17]
Till Harbaum. 2006. NanoVM. Retrieved October 24, 2017 from http://harbaum.org/till/nanovm/index.shtml.
[18]
Josiah Hester, Travis Peters, Tianlong Yun, Ronald Peterson, Joseph Skinner, Bhargav Golla, Kevin Storer, Steven Hearndon, Kevin Freeman, Sarah Lord, Ryan Halter, David Kotz, and Jacob Sorber. 2016. Amulet: An energy-efficient, multi-application wearable platform. In Proceedings of the 14th International Conference on Embedded Networked Sensor Systems (SENSYS’16).
[19]
Kirak Hong, Jiin Park, Sungho Kim, Taekhoon Kim, Hwangho Kim, Bernd Burgstaller, and Bernhard Scholz. 2012. TinyVM: An energy-efficient execution infrastructure for sensor networks. Softw. Pract. Exp. 42, 10 (Oct. 2012), 1193--1209.
[20]
Kirak Hong, Jiin Park, Taekhoon Kim, Sungho Kim, Hwangho Kim, Yousun Ko, Jongtae Park, Bernd Burgstaller, and Bernhard Scholz. 2009. TinyVM, an efficient virtual machine infrastructure for sensor networks. In Proceedings of the ACM Conference on Embedded Networked Sensor Systems (SENSYS’09).
[21]
Cheng-Hsueh A. Hsieh, John C. Gyllenhaal, and Wen-mei W. Hwu. 1996. Java bytecode to native code translation: The caffeine prototype and preliminary results. In Proceedings of the IEEE/ACM International Symposium on Microarchitecture (MICRO’96).
[22]
Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes. 2005. The implementation of Lua 5.0. J. Univ. Comput. Sci. 11, 7 (2005).
[23]
Joel Koshy and Raju Pandey. 2005. VM*: Synthesizing scalable runtime environments for sensor networks. In ACM Conference on Embedded Networked Sensor Systems (SENSYS’05).
[24]
Andreas Krall. 1998. Efficient JavaVM just-in-time compilation. In Proceedings of the International Conference on Parallel Architectures and Complilation Techniques (PACT’98).
[25]
Ram Kumar, Eddie Kohler, and Mani Srivastava. 2007. Harbor: Software-based memory protection for sensor nodes. In Proceedings of the 6th International Symposium on Information Processing in Sensor Networks (IPSN’07).
[26]
Benoît Latré, Pieter De Mil, Ingrid Moerman, Bart Dhoedt, Piet Demeester, and Niek Van Dierdonck. 2006. Throughput and delay analysis of unslotted IEEE 802.15.4. J. Netw. 1, 1 (May 2006), 20--28.
[27]
Philip Levis and David Culler. 2002. Maté: A tiny virtual machine for sensor networks. In Proceedings of the ACM International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS’02).
[28]
Philip Levis, David Gay, and David Culler. 2005. Active sensor networks. In Proceedings of the USENIX Symposium on Networked Systems Design and Implementation (NSDI’05).
[29]
Team libtom. 2017. LibTomCrypt. Retrieved October 24, 2017 from http://www.libtom.net/LibTomCrypt.
[30]
Konrad Lorincz and Matt Welsh. 2006. MoteTrack: A Robust, Decentralized Approach to RF-Based Location Tracking. Retrieved from http://www.eecs.harvard.edu/ konrad/projects/motetrack.
[31]
Konrad Lorincz and Matt Welsh. 2007. MoteTrack: A robust, decentralized approach to RF-based location tracking. Pers. Ubiq. Comput. 11, 6 (Aug. 2007).
[32]
Konrad Lorincz et al. 2009. Mercury: A wearable sensor network platform for high-fidelity motion analysis. In Proceedings of the ACM Conference on Embedded Networked Sensor Systems (SENSYS’09).
[33]
F. Marcelloni and M. Vecchio. 2009. An efficient lossless compression algorithm for tiny nodes of monitoring wireless sensor networks. Comput. J. 52, 8 (Nov. 2009).
[34]
Microchip Technology. 2011. 8-bit Atmel Microcontroller with 128KBytes In-System Programmable Flash ATmega128/ATmega128L datasheet. http://ww1.microchip.com/downloads/en/DeviceDoc/doc2467.pdf.
[35]
René Müller, Gustavo Alonso, and Donald Kossmann. 2007. A virtual machine for sensor networks. In Proceedings of the European Conference on Computer Systems (EuroSys’07).
[36]
Gilles Muller et al. 1997. Harissa: A flexible and efficient java environment mixing bytecode and compiled code. In Proceedings of the Conference on Object-Oriented Technologies and Systems (COOTS’97).
[37]
Oracle. 2005. Connected Limited Device Configuration. Retrieved October 24, 2017 from http://www.oracle.com/technetwork/java/cldc-141990.html.
[38]
PhysioNet. 2018. PTB Diagnostic ECG Database ptbdb. First 256 samples from the following dataset. Database: PTB Diagnostic ECG Database ptbdb, Record: patient001 s0010 re, Signals: i, Length: 10s, Time format: samples, Data format: raw ADC units. Retrieved from https://www.physionet.org/cgi-bin/atm/ATM.
[39]
Yunhe Shi et al. 2005. Virtual machine showdown: Stack versus registers. In Proceedings of the ACM SIGPLAN/SIGOPS International Conference on Virtual Execution Environments (VEE’05).
[40]
Guard Square. 2016. ProGuard 5.3.2. Retrieved Oct 24, 2017 from https://sourceforge.net/projects/proguard/.
[41]
Ben L. Titzer, Daniel K. Lee, and Jens Palsberg. 2005. Avrora: Scalable sensor network simulation with precise timing. In Proceedings of the International Symposium on Information Processing in Sensor Networks (IPSN’05).
[42]
UCLA Networked 8 Embedded Systems Laboratory. 2009. SOS operating system. Retrieved from https://github.com/nesl/sos-2x.
[43]
David Wheeler and Roger Needham. 1998. XXTEA: Correction to XTEA. Technical Report. Computer Laboratory, University of Cambridge.
[44]
Ingwar Wirjawan et al. 2008. Balancing computation and communication costs: The case for hybrid execution in sensor networks. Ad Hoc Netw. 6, 8 (Nov. 2008).
[45]
Yuan Zhang et al. 2012. Swift: A register-based JIT compiler for embedded JVMs. ACM SIGPLAN Not. 47, 7 (Jan 2012).

Cited By

View all
  • (2024)Code Clone Detection Based on Bytecode and Twin Neural NetworksApplied Mathematics and Nonlinear Sciences10.2478/amns-2024-11729:1Online publication date: 22-May-2024
  • (2022)ATOM: Architectural Support and Optimization Mechanism for Smart Contract Fast Update and Execution in Blockchain-Based IoTIEEE Internet of Things Journal10.1109/JIOT.2021.31069429:11(7959-7971)Online publication date: 1-Jun-2022
  • (2022)Technology and Application of Electric Energy Meter with Embedded JVM2022 9th International Forum on Electrical Engineering and Automation (IFEEA)10.1109/IFEEA57288.2022.10038201(641-647)Online publication date: 4-Nov-2022
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Sensor Networks
ACM Transactions on Sensor Networks  Volume 15, Issue 3
August 2019
324 pages
ISSN:1550-4859
EISSN:1550-4867
DOI:10.1145/3335317
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 the author(s) 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

Journal Family

Publication History

Published: 13 August 2019
Accepted: 01 May 2019
Revised: 01 July 2018
Received: 01 November 2017
Published in TOSN Volume 15, Issue 3

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. JVM
  2. Wireless sensor networks
  3. ahead-of-time compilation
  4. bytecode
  5. compilers
  6. resource-constrained
  7. virtual machines

Qualifiers

  • Research-article
  • Research
  • Refereed

Funding Sources

  • Intel Corporation, and Delta Electronics
  • National Taiwan University
  • Ministry of Science and Technology of Taiwan

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)11
  • Downloads (Last 6 weeks)1
Reflects downloads up to 03 Oct 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Code Clone Detection Based on Bytecode and Twin Neural NetworksApplied Mathematics and Nonlinear Sciences10.2478/amns-2024-11729:1Online publication date: 22-May-2024
  • (2022)ATOM: Architectural Support and Optimization Mechanism for Smart Contract Fast Update and Execution in Blockchain-Based IoTIEEE Internet of Things Journal10.1109/JIOT.2021.31069429:11(7959-7971)Online publication date: 1-Jun-2022
  • (2022)Technology and Application of Electric Energy Meter with Embedded JVM2022 9th International Forum on Electrical Engineering and Automation (IFEEA)10.1109/IFEEA57288.2022.10038201(641-647)Online publication date: 4-Nov-2022
  • (2021)Design and Realization of Mini Programs for Children’s Playfulness English Enlightenment LearningSoftware Engineering and Applications10.12677/SEA.2021.10201510:02(122-137)Online publication date: 2021
  • (2021)Distributed Symbolic Network Quality Assessment for Resource-constrained Devices2021 26th IEEE International Conference on Emerging Technologies and Factory Automation (ETFA )10.1109/ETFA45728.2021.9613584(1-4)Online publication date: 7-Sep-2021
  • (2020)Valent-Blocks: Scalable High-Performance Compilation of WebAssembly Bytecode For Embedded Systems2020 International Conference on Computing, Electronics & Communications Engineering (iCCECE)10.1109/iCCECE49321.2020.9231154(119-124)Online publication date: 17-Aug-2020

View Options

Get Access

Login options

Full Access

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

HTML Format

View this article in HTML Format.

HTML Format

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media