RFR (XS): 8023037 : Race between ciEnv::register_method and nmethod::make_not_entrant_or_zombie

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Tue Nov 5 07:40:32 PST 2013

>> Calling corresponding Java method will lead to infinite loop: VEP of the compiled method calls handle_wrong_method and call site resolution returns the very same compiled method.
> Does that mean StressNonEntrant is broken?
Good point. Yes, StressNonEntrant is also broken.

>> The fix is to grab a lock after nmethod is allocated in the code cache and check that it hasn't been already invalidated by the sweeper before proceeding. Sweeper already synchronizes on a nmethod before invalidating it.
> Would another fix be to have the sweeper check that the method was made ready to execute before it attempts to make it not entrant?
> i.e. nmethod->method()->code() == nmethod
I don't see any reason why it shouldn't work as well. But it means that 
marking method as non-entrant is not reliable - doesn't necessarily 
perform state transition. I don't think we want that.

Best regards,
Vladimir Ivanov

More information about the hotspot-compiler-dev mailing list