Question about nmethod flushing
Albert
albert.noll at oracle.com
Wed Aug 13 05:26:30 UTC 2014
Hi,
the code cache sweeper is not very aggressive in removing nmethods from
the code cache, if there is enough
free space in the code cache. I.e., the sweeper runs only if we (1)
compile methods and (2) there is 'enough' state
change in the code cache (e.g., 1% of the methods change the state from
'alive' -> 'not-entrant'). The reason
behind this is that sweeping is done by compiler threads and we do not
want to spend time sweeping the code
cache (if there is enough free space) if we can use the compiler threads
to compile methods.
We could adapt the code cache sweeper to do more aggressive sweeping, if
a nmethod is made not entrant due
to class redefinition.
I can look into this. Is there a particular benchmark you are using?
Best,
Albert
On 08/13/2014 01:58 AM, Vladimir Kozlov wrote:
> nmethods are alive when there are corresponding stack frames on java
> execution stacks. We can't make them zombie until we 100% sure they
> are not used.
> Is it possible that we are reaching a nmethod even if it is not
> present on call stack? The main method for marking is
> nmethod::mark_as_seen_on_stack() and it is called from a lot of
> places. May be with class redefinition there is some kind of a loop -
> we can't unload metadata <-> nmethod is reachable.
>
> Also I thought that we keep the original class when do redefinition
> (at least Serguei Spitsyn told me that, I think).
>
> Thanks,
> Vladimir
>
> On 8/12/14 3:12 PM, Coleen Phillimore wrote:
>>
>> I have a question about nmethod flushing wrt to RedefineClasses (no, no,
>> no, please keep reading!)
>>
>> When we redefine a class, there is code to deoptimize the methods, and
>> make them non-entrant. Non-entrant methods are still considered alive,
>> so for class redefinition we walk the code cache so that we don't delete
>> the metadata for any methods while some nmethod is still referring to
>> it. Eventually the sweeper will come along and mark the methods as
>> zombies so we don't have to deal with them anymore, but for class
>> redefinition, can we force methods to go to zombie's earlier? Or make
>> the sweeper more aggressive after a class redefinition?
>>
>> This code cache walking isn't that expensive, but we keep around a lot
>> of metadata as a result that could be more eagerly deleted.
>>
>> Thanks,
>> Coleen
More information about the hotspot-compiler-dev
mailing list