< prev index next >

src/hotspot/share/code/compiledMethod.cpp

Print this page

        

*** 67,76 **** --- 67,83 ---- { 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; }
*** 690,714 **** } return true; } - // 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()); - } - address CompiledMethod::continuation_for_implicit_exception(address pc, bool for_div0_check) { // Exception happened outside inline-cache check code => we are inside // an active nmethod => use cpc to determine a return address int exception_offset = pc - code_begin(); int cont_offset = ImplicitExceptionTable(this).continuation_offset( exception_offset ); --- 697,706 ----
< prev index next >