RFR(S): 8028107: Kitchensink crashed with EAV

Vladimir Kozlov vladimir.kozlov at oracle.com
Tue Dec 3 20:55:59 PST 2013


On 12/3/13 8:17 PM, John Rose wrote:
> On Dec 3, 2013, at 6:25 PM, Vladimir Kozlov <vladimir.kozlov at oracle.com <mailto:vladimir.kozlov at oracle.com>> wrote:
>
>> Note, we have strange/swapped names for functions which check nmethod state:
>>
>>  bool  is_in_use() const { return _state == alive; }
>>  bool  is_alive() const  { return _state == alive || _state == not_entrant; }
>
> If you can do so in a few more diff lines, I suggest fixing this by changing the enum value 'alive' to be 'in_use'.

Yes, it is only 7 lines in nmethod.cpp and nmethod.hpp. I will do that.

>
> If CompiledIC_lock causes a safepoint, and then the callee nmethod is unloaded, what guarantees that the callee nmethod
> will not be reallocated to some unrelated code blob in the code cache?
>
> The logic of your fix assumes that even after an unload, it is still valid to query callee_nm->is_in_use().  Could that
> be a dangling pointer?

Sweeper NMethodSweeper::process_nmethod() will not transition locked (nmethodLocker) nmethods to zombie:

   // Skip methods that are currently referenced by the VM
   if (nm->is_locked_by_vm()) {
     // But still remember to clean-up inline caches for alive nmethods
     if (nm->is_alive()) {
       // Clean-up all inline caches that points to zombie/non-reentrant methods
       MutexLocker cl(CompiledIC_lock);
       nm->cleanup_inline_caches();
       SWEEP(nm);
     } else {
       _locked_seen++;
       SWEEP(nm);
     }
     return;
   }

Note, SWEEP is logging macro.

nm->make_zombie() are also guarded by nm->can_not_entrant_be_converted() check which also checks locking:

   return stack_traversal_mark()+1 < NMethodSweeper::traversal_count() &&
          !is_locked_by_vm();

The main purpose of nmethodLocker is to not allow removing nmethods:

   // Make sure the callee nmethod does not get deoptimized and removed before
   // we are done patching the code.
   nmethod* callee_nm = callee_method->code();
   nmethodLocker nl_callee(callee_nm);

>
> — John

thanks,
Vladimir


More information about the hotspot-compiler-dev mailing list