Scoping the stack allocation prototype for C2
Nikola Grcevski
Nikola.Grcevski at microsoft.com
Thu Jul 16 21:31:58 UTC 2020
Hello hotspot-dev,
We recently posted a proposal [1] to implement stack allocation in C2 on the hotspot-compiler dev mailing list.
Vladimir Ivanov [2] asked that we broaden the discussion by posting here as it is more than a compiler optimization!
That is, enabling object allocations on thread stacks will impact other JVM subsystems now and in future designs.
If the proposal moves forward the current webrev [3] would need to be reviewed by multiple groups. This is a
clear sign the wider OpenJDK community needs to provide input. An example of this proposal impacting future
work, is Project Loom. Allocating objects on the stack would have to be limited in some scenarios. The implementation
of stack allocated objects referencing other stack allocated objects would need to be changed *or* how Project Loom
handles copying stacks would have to be modified.
While all the various solutions for Project Loom would be a net win at the end, they all come with drawbacks and
possible losses in performance compared to our current measured performance improvements. These decisions
would need to be discussed at length to decide what was best for Hotspot and the OpenJDK community.
The benefits of allocating objects on the stack, based on our proposal [1], need to be weighed against the costs on
current and future features in components that will be impacted. These decisions will need to be discussed at length
to decide what was best for Hotspot and the OpenJDK community.
We are optimistic that this work can provide benefits to the JVM without restricting future designs to heavily.
We are looking forward to receiving all feedback on this proposal.
Thanks!
Nikola and Charlie
[1] https://github.com/microsoft/openjdk-proposals/blob/master/stack_allocation/Stack_Allocation_JEP.md
[2] https://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2020-July/038969.html
[3] https://cr.openjdk.java.net/~adityam/charlie/stack_alloc/
More information about the hotspot-dev
mailing list