Fast Path allocation

Reingruber, Richard richard.reingruber at sap.com
Mon Mar 29 10:11:42 UTC 2021


Hi Manavjeet,

> I am studying C2 compiler in java. In the file
> jdk/src/hotspot/share/opto/runtime.cpp, in the allocation section a comment
> says, "We failed the fast-path allocation. Now we need to do a scavenge or
> GC and try allocation again."
> I assume the fast path allocation means directly allocating from a TLAB.

Fast path allocations are either from per thread TLABs or from shared eden
depending on the option UseTLAB. By default TLABs are used. Threads allocating
from shared eden use a CAS instruction to modify the top pointer. In both cases
the runtime method you found is called if the fast path allocation fails.

> Please correct me if I am wrong; also can someone please point out the code
> for fast-path allocation to understand it better.

I'd suggest to start by looking at PhaseMacroExpand::expand_allocate_common() in
src/hotspot/share/opto/macro.cpp. You can also grep for UseTLAB in
src/hotspot/share/opto.

Best regards,
Richard.

-----Original Message-----
From: hotspot-gc-dev <hotspot-gc-dev-retn at openjdk.java.net> On Behalf Of Manavjeet Singh
Sent: Samstag, 27. März 2021 11:17
To: hotspot-gc-dev at openjdk.java.net
Subject: Fast Path allocation

Hi,
I am studying C2 compiler in java. In the file
jdk/src/hotspot/share/opto/runtime.cpp, in the allocation section a comment
says, "We failed the fast-path allocation. Now we need to do a scavenge or
GC and try allocation again."
I assume the fast path allocation means directly allocating from a TLAB.
Please correct me if I am wrong; also can someone please point out the code
for fast-path allocation to understand it better.
Thanks,
Manavjeet Singh


More information about the hotspot-gc-dev mailing list