Hook for all newly created objects

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Hook for all newly created objects

Christian Hagedorn
I have added a private field to the oopDesc class inside
share/vm/oops/oop.hpp. Now I wanted to initialize it properly. How can I do
that?

I tried to do it inside the share/vm/runtime/InterpreterRuntime.cpp _new,
newarray, anewarray and multianewarray. But then I miss some objects.

So I looked further and found share/vm/gc_interface/collectedHeap.inline.hpp
and additionally tried to initialize it inside post_allocation_notify. But I
think I still miss some objects.

What can I do to catch all new objects and initialize my field only once?

 

- Christian

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Hook for all newly created objects

Roman Kennke-6


Am 30. März 2017 02:13:34 MESZ schrieb Christian Hagedorn <[hidden email]>:

>I have added a private field to the oopDesc class inside
>share/vm/oops/oop.hpp. Now I wanted to initialize it properly. How can
>I do
>that?
>
>I tried to do it inside the share/vm/runtime/InterpreterRuntime.cpp
>_new,
>newarray, anewarray and multianewarray. But then I miss some objects.
>
>So I looked further and found
>share/vm/gc_interface/collectedHeap.inline.hpp
>and additionally tried to initialize it inside post_allocation_notify.
>But I
>think I still miss some objects.
>
>What can I do to catch all new objects and initialize my field only
>once?

You need to implementiert the same hook in the interpreter, c1 and c2. There are fast inlined allocation routines ... Alternatively, disable TLABs -XX:-UseTLAB, but this will make allocations *much* slower.

Roman

>
>
>
>- Christian

--
Sent from my FairPhone
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Hook for all newly created objects

Christian Hagedorn
Alright, thank you.

-- Christian

Am 30. März 2017 02:13:34 MESZ schrieb Christian Hagedorn <[hidden email]>:

>I have added a private field to the oopDesc class inside
>share/vm/oops/oop.hpp. Now I wanted to initialize it properly. How can
>I do that?
>
>I tried to do it inside the share/vm/runtime/InterpreterRuntime.cpp
>_new,
>newarray, anewarray and multianewarray. But then I miss some objects.
>
>So I looked further and found
>share/vm/gc_interface/collectedHeap.inline.hpp
>and additionally tried to initialize it inside post_allocation_notify.
>But I
>think I still miss some objects.
>
>What can I do to catch all new objects and initialize my field only
>once?

You need to implementiert the same hook in the interpreter, c1 and c2. There are fast inlined allocation routines ... Alternatively, disable TLABs -XX:-UseTLAB, but this will make allocations *much* slower.

Roman

>
>
>
>- Christian

--
Sent from my FairPhone

Loading...