Insert Special Code Sequence After Object allocation

Krystal Mo krystal.mo at oracle.com
Tue Nov 27 20:23:49 PST 2012


Hi Xin,

Depends on what the code sequence is and what it does.

If the code sequence you're inserting can be represented in C2's IR 
nodes, then you can try to add those nodes in either 
PhaseMacroExpand::expand_allocate_common() or 
PhaseMacroExpand::initialize_object(), or somewhere else around.

If your code sequence cannot be represented in C2's IR, well, that will 
take some effort. The AllocateNode is lost after PhaseMacroExpand, so 
you can't use it as a mark to insert your code. You might want to use 
prefetchAlloc in the AD files as a place to insert code, if that works 
for your purpose.

That said, though, if the code sequence could be written in Java 
bytecode, that'll be the easiest solution: don't have to touch the VM, 
just do bytecode instrumentation.

- Kris

On 2012/11/28 10:36, Xin Tong wrote:
> I would like to insert a special binary code sequence after the
> allocation of a java object in the opto JIT code. can anyone tell me
> how to do that ?
>
> Xin


More information about the hotspot-compiler-dev mailing list