Treffer: The final Frontier: Coping With Immutable Data in a JVM for Embedded Real-Time Systems
Weitere Informationen
Managed, type-safe languages such as Java are becoming an increasingly competitive alternative for programming real-time and embedded applications, a field which has tradi-tionally been dominated by C. However, one peculiar issue in the use of Java is the insufficient way immutable data is handled. There are some important cases, such as primitive arrays, where the final keyword is not expressive enough to declare data as truly constant. This leads to an unnecessary increase in both code size and runtime memory footprint. Moreover, it prevents the compiler from applying its opti-misations as aggressively as would be possible. In this pa-per, we propose a set of compiler techniques to improve the handling of immutable data in embedded Java applications. Our approach includes (a) detecting constant program data that could not be declared as such by the programmer, (b) eliminating the overhead associated with it, and (c) provid-ing an automated way to allocate that data in flash memory in order to save RAM.