object allocation in JITted method

Krystal Mok rednaxelafx at gmail.com
Thu May 3 22:26:36 UTC 2012

Hi Xin,

HotSpot uses the fast-path/slow-path idiom in a lot of places. Object allocation is one of them.
The common slow-path fallbacks are GC routines written in C++. There's separate implementation of the fast-path in the interpreter and the two JIT compilers; they do object allocations directly, and only fallback to the slow-path if they fail.

By default, HotSpot uses TLAB (thread-local allocation buffer), similar to the thread-local heap you had in mind: a simple unsynchronized pointer bump works in the common case. But I wouldn't call that "thread-local heap", because the term TLH tends to imply that the area can be collected independently of other threads, which is not (yet) true for HotSpot.

- Kris

On 2012-5-4, at 2:57, Xin Tong <xerox.time.tech at gmail.com> wrote:

> I am new to hotspot. I am wondering how object allocation is done in
> JITed method ? is it done by calling out to GC runtines or every Java
> thread has a thread local heap in which a simple increment of a
> pointer in the thread local heap is all that is needed ( and the heap
> is replenished by calling out to GC runtines if exhausted ).
> Thanks
> Xin

More information about the hotspot-gc-dev mailing list