[jmm-dev] Java thread dynamic memory allocation

Jeremy Manson jeremymanson at google.com
Fri Sep 11 19:31:45 UTC 2020


Hi Manavjeet,

In general, the Hotspot GC dev mailing list
<https://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-dev> might be a
better place for this sort of question. This is a list for discussing how
threads interact in Java.

Typically, the new operator in Java code is compiled into a new bytecode.
The new bytecode is either interpreted or compiled at runtime.  There is
therefore not necessarily a single place it is implemented.  In Hotspot (if
that's what you are looking at),  it's defined separately for each
interpreter and compiler.  The engineers take care to make sure that all of
the implementations do the same thing.  Here's the one for the interpreter
for x86
<https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/templateTable_x86.cpp#L4000>.
All
of the implementations fall through to a common slow path in
oops/instanceKlass.cpp.

If you have more questions, the experts at gc dev can help you.

Jeremy

On Fri, Sep 11, 2020 at 11:24 AM Manavjeet Singh <manavjeet18295 at iiitd.ac.in>
wrote:

> Hi!
> I am currently studying GC and java memory model. From the code, I
> understand that GC provides a TLAB to each thread for unsynchronized
> allocation of the non-humongous objects. But I am not able to understand
> what happens when a "new" operator is called in java code. Is the function
> that tackles this "new" operator defined in JavaThread class or some other
> routine is called.
> Can you please correct me if I am assuming something wrong, and point me to
> relevant functions so that I can understand better.
> Thanks and regards
> Manavjeet Singh
> CSD Undergraduate | 2018295
> Indraprastha Institute of Information Technology (IIITD)
>


More information about the jmm-dev mailing list