Stack allocation of objects in the CACAO virtual machine

Peter Molnar, Andreas Krall, Florian Brandner

Research output: Contribution to journalConference articleResearchpeer-review


Stack allocation of objects reduces the cost of object allocation and garbage collection and can thus lead to large reductions in runtime. Escape analysis can statically determine which objects are eligible to stack allocation by examining the escape behavior of allocation sites. If objects created at a particular allocation site do not escape, i.e., are guaranteed not to leave the scope of the allocation site, stack allocation instead of expensive heap allocation can be applied.We have implemented a lightweight and fast escape analysis within the CACAO Java Virtual Machine to enable stack allocation. The analysis proceeds in two stages: an intraprocedural analysis computes escape information for each allocation site within a single method and builds call-context agnostic summary information for the method. The summary information is then used during interprocedural analysis to capture the escape behavior of method arguments. The computed escape information is finally used to allocate a subset of thread-local Java objects on the call stack.

The implementation has been evaluated using the SPEC JVM98 and the dacapo benchmark suites. For the SPEC benchmarks up to 90% of all objects allocated at runtime can be allocated on the call stack, leading to a speed up of up to 69%. The more complex dacapo benchmarks still show speedups of up to 10%, with up to 20% of all objects being allocated on the stack.

Keyword: object allocation on stack,just-in-time compiler,escape analysis
Original languageEnglish
Pages (from-to)153-161
Publication statusPublished - 2009
Externally publishedYes
EventPrinciples and Practice of Programming in Java -
Duration: 1 Jan 2009 → …
Conference number: 7


ConferencePrinciples and Practice of Programming in Java
Period01/01/2009 → …


Dive into the research topics of 'Stack allocation of objects in the CACAO virtual machine'. Together they form a unique fingerprint.

Cite this