Creating a compressed heap graph
Abhinav Jangda
abhijangda at gmail.com
Fri Apr 15 16:36:34 UTC 2022
Hi everyone,
I am a PhD student at UMass Amherst. I am working on Hotspot in a research
project. I have to create a compressed graph representation of the heap
graph, where
1. each vertex in the compressed graph is a Java object (or array)
allocated on heap, and
2. a directed edge between vertex v to u represents that u is the value of
one of the fields (or element) of v.
To create such a compressed graph on the fly, I need to look for two events
happening in Hotspot: when a new object is created, and when a field of an
object or an array element is set.
I want to patch the generated code for these events, where a global counter
declared in Hotspot is incremented and a new object address and field
address are set to a memory location allocated in C heap.
I have two questions regarding these:
1. Is it correct that InstanceKlass::allocate_instance is the function that
allocates a new object in all compiler levels (Interpreter to most
aggressive opt compiler)?
2. I have found that MacroAssembler::store_heap_oop is the function that
generates code to store an object field to an object for the Interpreter.
Is this correct and is this the case for all compiler levels?
I understand that going through different cases is a lot of work and the
final patched code might be un-optimized.
Is there a way I can patch the bytecode in hotspot and add the code for
global counter and setting values on C heap inside the bytecode? Is there a
standardized way to write a pass over bytecode?
Thanks a lot for the help. Please let me know about this.
Thank You,
Abhinav Jangda
More information about the hotspot-dev
mailing list