Mercurial > hg > truffle
comparison src/share/vm/code/nmethod.cpp @ 1206:87684f1a88b5
6614597: Performance variability in jvm2008 xml.validation
Summary: Fix incorrect marking of methods as not compilable.
Reviewed-by: never
author | kvn |
---|---|
date | Mon, 01 Feb 2010 16:49:49 -0800 |
parents | 18a389214829 |
children | 3f5b7efb9642 |
comparison
equal
deleted
inserted
replaced
1205:5fcfaa1ad96f | 1206:87684f1a88b5 |
---|---|
1115 // OSR methods point to the methodOop, but the methodOop does not | 1115 // OSR methods point to the methodOop, but the methodOop does not |
1116 // point back! | 1116 // point back! |
1117 if (_method->code() == this) { | 1117 if (_method->code() == this) { |
1118 _method->clear_code(); // Break a cycle | 1118 _method->clear_code(); // Break a cycle |
1119 } | 1119 } |
1120 inc_decompile_count(); // Last chance to make a mark on the MDO | |
1121 _method = NULL; // Clear the method of this dead nmethod | 1120 _method = NULL; // Clear the method of this dead nmethod |
1122 } | 1121 } |
1123 // Make the class unloaded - i.e., change state and notify sweeper | 1122 // Make the class unloaded - i.e., change state and notify sweeper |
1124 check_safepoint(); | 1123 check_safepoint(); |
1125 if (is_in_use()) { | 1124 if (is_in_use()) { |
1175 | 1174 |
1176 // Common functionality for both make_not_entrant and make_zombie | 1175 // Common functionality for both make_not_entrant and make_zombie |
1177 bool nmethod::make_not_entrant_or_zombie(unsigned int state) { | 1176 bool nmethod::make_not_entrant_or_zombie(unsigned int state) { |
1178 assert(state == zombie || state == not_entrant, "must be zombie or not_entrant"); | 1177 assert(state == zombie || state == not_entrant, "must be zombie or not_entrant"); |
1179 | 1178 |
1180 // If the method is already zombie there is nothing to do | 1179 bool was_alive = false; |
1181 if (is_zombie()) { | |
1182 return false; | |
1183 } | |
1184 | 1180 |
1185 // Make sure the nmethod is not flushed in case of a safepoint in code below. | 1181 // Make sure the nmethod is not flushed in case of a safepoint in code below. |
1186 nmethodLocker nml(this); | 1182 nmethodLocker nml(this); |
1187 | 1183 |
1188 { | 1184 { |
1185 // If the method is already zombie there is nothing to do | |
1186 if (is_zombie()) { | |
1187 return false; | |
1188 } | |
1189 | |
1189 // invalidate osr nmethod before acquiring the patching lock since | 1190 // invalidate osr nmethod before acquiring the patching lock since |
1190 // they both acquire leaf locks and we don't want a deadlock. | 1191 // they both acquire leaf locks and we don't want a deadlock. |
1191 // This logic is equivalent to the logic below for patching the | 1192 // This logic is equivalent to the logic below for patching the |
1192 // verified entry point of regular methods. | 1193 // verified entry point of regular methods. |
1193 if (is_osr_method()) { | 1194 if (is_osr_method()) { |
1221 flush_dependencies(NULL); | 1222 flush_dependencies(NULL); |
1222 } else { | 1223 } else { |
1223 assert(state == not_entrant, "other cases may need to be handled differently"); | 1224 assert(state == not_entrant, "other cases may need to be handled differently"); |
1224 } | 1225 } |
1225 | 1226 |
1227 was_alive = is_in_use(); // Read state under lock | |
1228 | |
1226 // Change state | 1229 // Change state |
1227 flags.state = state; | 1230 flags.state = state; |
1228 | 1231 |
1229 // Log the transition once | 1232 // Log the transition once |
1230 log_state_change(); | 1233 log_state_change(); |
1247 // not_entrant only stuff | 1250 // not_entrant only stuff |
1248 if (state == not_entrant) { | 1251 if (state == not_entrant) { |
1249 mark_as_seen_on_stack(); | 1252 mark_as_seen_on_stack(); |
1250 } | 1253 } |
1251 | 1254 |
1252 // It's a true state change, so mark the method as decompiled. | 1255 if (was_alive) { |
1253 inc_decompile_count(); | 1256 // It's a true state change, so mark the method as decompiled. |
1257 // Do it only for transition from alive. | |
1258 inc_decompile_count(); | |
1259 } | |
1254 | 1260 |
1255 // zombie only - if a JVMTI agent has enabled the CompiledMethodUnload event | 1261 // zombie only - if a JVMTI agent has enabled the CompiledMethodUnload event |
1256 // and it hasn't already been reported for this nmethod then report it now. | 1262 // and it hasn't already been reported for this nmethod then report it now. |
1257 // (the event may have been reported earilier if the GC marked it for unloading). | 1263 // (the event may have been reported earilier if the GC marked it for unloading). |
1258 if (state == zombie) { | 1264 if (state == zombie) { |