Mercurial > hg > truffle
comparison src/share/vm/code/nmethod.cpp @ 14505:524b54a7f1b5
8034839: jvm hangs with gc/gctests/LoadUnloadGC test
Summary: Provide fast lookup of checked dependencies via hashmap
Reviewed-by: kvn, roland
author | anoll |
---|---|
date | Wed, 26 Feb 2014 11:29:47 +0100 |
parents | abec000618bf |
children | b3fe59626fdc |
comparison
equal
deleted
inserted
replaced
14461:a13badbb8b8e | 14505:524b54a7f1b5 |
---|---|
2166 ResourceMark rm; | 2166 ResourceMark rm; |
2167 | 2167 |
2168 // Turn off dependency tracing while actually testing dependencies. | 2168 // Turn off dependency tracing while actually testing dependencies. |
2169 NOT_PRODUCT( FlagSetting fs(TraceDependencies, false) ); | 2169 NOT_PRODUCT( FlagSetting fs(TraceDependencies, false) ); |
2170 | 2170 |
2171 // 'dep_signature_buffers' caches already checked dependencies. | 2171 GenericHashtable<DependencySignature, ResourceObj>* table = new GenericHashtable<DependencySignature, ResourceObj>(11027); |
2172 DependencySignatureBuffer dep_signature_buffers; | |
2173 | |
2174 // Iterate over live nmethods and check dependencies of all nmethods that are not | 2172 // Iterate over live nmethods and check dependencies of all nmethods that are not |
2175 // marked for deoptimization. A particular dependency is only checked once. | 2173 // marked for deoptimization. A particular dependency is only checked once. |
2176 for(nmethod* nm = CodeCache::alive_nmethod(CodeCache::first()); nm != NULL; nm = CodeCache::alive_nmethod(CodeCache::next(nm))) { | 2174 for(nmethod* nm = CodeCache::alive_nmethod(CodeCache::first()); nm != NULL; nm = CodeCache::alive_nmethod(CodeCache::next(nm))) { |
2177 if (!nm->is_marked_for_deoptimization()) { | 2175 if (!nm->is_marked_for_deoptimization()) { |
2178 for (Dependencies::DepStream deps(nm); deps.next(); ) { | 2176 for (Dependencies::DepStream deps(nm); deps.next(); ) { |
2179 // Construct abstraction of a dependency. | 2177 // Construct abstraction of a dependency. |
2180 const DependencySignature* current_sig = new DependencySignature(deps); | 2178 DependencySignature* current_sig = new DependencySignature(deps); |
2181 // Determine if 'deps' is already checked. If it is not checked, | 2179 // Determine if 'deps' is already checked. table->add() returns |
2182 // 'add_if_missing()' adds the dependency signature and returns | 2180 // 'true' if the dependency was added (i.e., was not in the hashtable). |
2183 // false. | 2181 if (table->add(current_sig)) { |
2184 if (!dep_signature_buffers.add_if_missing(*current_sig)) { | |
2185 if (deps.check_dependency() != NULL) { | 2182 if (deps.check_dependency() != NULL) { |
2186 // Dependency checking failed. Print out information about the failed | 2183 // Dependency checking failed. Print out information about the failed |
2187 // dependency and finally fail with an assert. We can fail here, since | 2184 // dependency and finally fail with an assert. We can fail here, since |
2188 // dependency checking is never done in a product build. | 2185 // dependency checking is never done in a product build. |
2189 ResourceMark rm; | |
2190 changes.print(); | 2186 changes.print(); |
2191 nm->print(); | 2187 nm->print(); |
2192 nm->print_dependencies(); | 2188 nm->print_dependencies(); |
2193 assert(false, "Should have been marked for deoptimization"); | 2189 assert(false, "Should have been marked for deoptimization"); |
2194 } | 2190 } |