< prev index next >

src/hotspot/share/code/compiledMethod.cpp

Print this page
rev 54099 : 8219586: CodeHeap State Analytics processes dead nmethods
Reviewed-by: thartmann, eosterlund

*** 48,57 **** --- 48,64 ---- _method(method), _mark_for_deoptimization_status(not_marked) { init_defaults(); } void CompiledMethod::init_defaults() { + { // avoid uninitialized fields, even for short time periods + _is_far_code = false; + _scopes_data_begin = NULL; + _deopt_handler_begin = NULL; + _deopt_mh_handler_begin = NULL; + _exception_cache = NULL; + } _has_unsafe_access = 0; _has_method_handle_invokes = 0; _lazy_critical_native = 0; _has_wide_vectors = 0; _unloading_clock = 0;
*** 619,637 **** break; } } } - // Iterating over all nmethods, e.g. with the help of CodeCache::nmethods_do(fun) was found - // to not be inherently safe. There is a chance that fields are seen which are not properly - // initialized. This happens despite the fact that nmethods_do() asserts the CodeCache_lock - // to be held. - // To bundle knowledge about necessary checks in one place, this function was introduced. - // It is not claimed that these checks are sufficient, but they were found to be necessary. - bool CompiledMethod::nmethod_access_is_safe(nmethod* nm) { - Method* method = (nm == NULL) ? NULL : nm->method(); // nm->method() may be uninitialized, i.e. != NULL, but invalid - return (nm != NULL) && (method != NULL) && (method->signature() != NULL) && - !nm->is_zombie() && !nm->is_not_installed() && - os::is_readable_pointer(method) && - os::is_readable_pointer(method->constants()) && - os::is_readable_pointer(method->signature()); - } --- 626,630 ----
< prev index next >