Mercurial > hg > truffle
comparison src/share/vm/code/nmethod.cpp @ 14660:3c6ae9109a86
8035946: Use ResourceHashtable for dependency checking
Summary: Use ResourceHashtable for dependency checking and delete GenericHashtable
Reviewed-by: kvn, coleenp
author | anoll |
---|---|
date | Mon, 03 Mar 2014 08:04:14 +0100 |
parents | b3fe59626fdc |
children | b51e29501f30 |
comparison
equal
deleted
inserted
replaced
14514:2328dac1da27 | 14660:3c6ae9109a86 |
---|---|
37 #include "oops/methodData.hpp" | 37 #include "oops/methodData.hpp" |
38 #include "prims/jvmtiRedefineClassesTrace.hpp" | 38 #include "prims/jvmtiRedefineClassesTrace.hpp" |
39 #include "prims/jvmtiImpl.hpp" | 39 #include "prims/jvmtiImpl.hpp" |
40 #include "runtime/sharedRuntime.hpp" | 40 #include "runtime/sharedRuntime.hpp" |
41 #include "runtime/sweeper.hpp" | 41 #include "runtime/sweeper.hpp" |
42 #include "utilities/resourceHash.hpp" | |
42 #include "utilities/dtrace.hpp" | 43 #include "utilities/dtrace.hpp" |
43 #include "utilities/events.hpp" | 44 #include "utilities/events.hpp" |
44 #include "utilities/xmlstream.hpp" | 45 #include "utilities/xmlstream.hpp" |
45 #ifdef SHARK | 46 #ifdef SHARK |
46 #include "shark/sharkCompiler.hpp" | 47 #include "shark/sharkCompiler.hpp" |
2133 ResourceMark rm; | 2134 ResourceMark rm; |
2134 | 2135 |
2135 // Turn off dependency tracing while actually testing dependencies. | 2136 // Turn off dependency tracing while actually testing dependencies. |
2136 NOT_PRODUCT( FlagSetting fs(TraceDependencies, false) ); | 2137 NOT_PRODUCT( FlagSetting fs(TraceDependencies, false) ); |
2137 | 2138 |
2138 GenericHashtable<DependencySignature, ResourceObj>* table = new GenericHashtable<DependencySignature, ResourceObj>(11027); | 2139 typedef ResourceHashtable<DependencySignature, int, &DependencySignature::hash, |
2140 &DependencySignature::equals, 11027> DepTable; | |
2141 | |
2142 DepTable* table = new DepTable(); | |
2143 | |
2139 // Iterate over live nmethods and check dependencies of all nmethods that are not | 2144 // Iterate over live nmethods and check dependencies of all nmethods that are not |
2140 // marked for deoptimization. A particular dependency is only checked once. | 2145 // marked for deoptimization. A particular dependency is only checked once. |
2141 for(nmethod* nm = CodeCache::alive_nmethod(CodeCache::first()); nm != NULL; nm = CodeCache::alive_nmethod(CodeCache::next(nm))) { | 2146 for(nmethod* nm = CodeCache::alive_nmethod(CodeCache::first()); nm != NULL; nm = CodeCache::alive_nmethod(CodeCache::next(nm))) { |
2142 if (!nm->is_marked_for_deoptimization()) { | 2147 if (!nm->is_marked_for_deoptimization()) { |
2143 for (Dependencies::DepStream deps(nm); deps.next(); ) { | 2148 for (Dependencies::DepStream deps(nm); deps.next(); ) { |
2144 // Construct abstraction of a dependency. | 2149 // Construct abstraction of a dependency. |
2145 DependencySignature* current_sig = new DependencySignature(deps); | 2150 DependencySignature* current_sig = new DependencySignature(deps); |
2146 // Determine if 'deps' is already checked. table->add() returns | 2151 |
2147 // 'true' if the dependency was added (i.e., was not in the hashtable). | 2152 // Determine if dependency is already checked. table->put(...) returns |
2148 if (table->add(current_sig)) { | 2153 // 'true' if the dependency is added (i.e., was not in the hashtable). |
2154 if (table->put(*current_sig, 1)) { | |
2149 if (deps.check_dependency() != NULL) { | 2155 if (deps.check_dependency() != NULL) { |
2150 // Dependency checking failed. Print out information about the failed | 2156 // Dependency checking failed. Print out information about the failed |
2151 // dependency and finally fail with an assert. We can fail here, since | 2157 // dependency and finally fail with an assert. We can fail here, since |
2152 // dependency checking is never done in a product build. | 2158 // dependency checking is never done in a product build. |
2153 changes.print(); | 2159 changes.print(); |