--- old/src/share/vm/ci/ciEnv.cpp 2014-03-17 11:39:22.000000000 -0700 +++ new/src/share/vm/ci/ciEnv.cpp 2014-03-17 11:39:22.000000000 -0700 @@ -961,7 +961,8 @@ AbstractCompiler* compiler, int comp_level, bool has_unsafe_access, - bool has_wide_vectors) { + bool has_wide_vectors, + RTMState rtm_state) { VM_ENTRY_MARK; nmethod* nm = NULL; { @@ -1002,6 +1003,15 @@ methodHandle method(THREAD, target->get_Method()); +#if INCLUDE_RTM_OPT + if (!failing() && (rtm_state != NoRTM) && + (method()->method_data() != NULL) && + (method()->method_data()->rtm_state() != rtm_state)) { + // Preemptive decompile if rtm state was changed. + record_failure("RTM state change invalidated rtm code"); + } +#endif + if (failing()) { // While not a true deoptimization, it is a preemptive decompile. MethodData* mdo = method()->method_data(); @@ -1029,6 +1039,8 @@ handler_table, inc_table, compiler, comp_level); + nm->set_rtm_state(rtm_state); + // Free codeBlobs code_buffer->free_blob();