Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
The CodeHeap State Analytics framework walks over all code blobs, including dead code blobs, and then uses CompiledMethod::nmethod_access_is_safe(nmethod* nm) to figure out if an nmethod "is safe to access" or not. There is a bunch of different problems with this function. 1) The member function is declared on CompiledMethod, but passes in an nmethod, and its name is prefixed with nmethod. This makes no sense. 2) Reading the method->signature() is not safe, unless the method is guaranteed to be a live method. Because it pointer chases through constMethod, which could be garbage memory. 3) The is_zombie() member function is virtual. Therefore, calling it on something that is "not safe to access" may crash due to using vtables. 4) Its use of safe fetch may have false negatives. We should stop walking freed memory and reporting things on it. It is a criminal act to do so. Instead, we should take the CodeCache_lock and always walk over the live code blobs. If live code blobs sometimes have uninitialized fields, we should make sure to initialize those fields. I don't want functions that try to determine if freed memory is still okay to access or not. It is bound to become a pain to maintain, and I have already run into problems with this code.
|