Insert Special Code Sequence After Object allocation

Xin Tong xerox.time.tech at gmail.com
Tue Nov 27 21:58:12 PST 2012


On Tue, Nov 27, 2012 at 11:23 PM, Krystal Mo <krystal.mo at oracle.com> wrote:
> 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.
>

It is a few assembly instructions. can i wrap the assemblies in a
function that hasa prologue and epilogue to save everything. and does
the IR has any way of calling a function ?

Xin

> 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