MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / getFunctionAotHash

Function getFunctionAotHash

src/simulate/simulate_fn_hash.cpp:228–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226 }
227
228 uint64_t getFunctionAotHash ( Function * fun ) {
229 if ( fun->aotHash != 0 ) return fun->aotHash; // cached
230 DependencyCollector collector;
231 collector.collect(fun);
232 auto vec = collector.getStableDependencies();
233 vector<uint64_t> uvec;
234 uvec.reserve(vec.size() + 1);
235 debug_aot_hash("HASH %s %" PRIx64 "\n", fun->getMangledName().c_str(), fun->hash);
236 uvec.push_back(fun->hash);
237 for ( const auto & fn : vec ) {
238 if ( !fn.first->noAot &&!fn.first->builtIn ) {
239 DAS_ASSERTF(fn.first->hash,"%s has dependency on %s, which hash hash of 0",
240 fun->getMangledName().c_str(), fn.first->getMangledName().c_str());
241 uvec.push_back(fn.first->hash);
242 debug_aot_hash("\t%s %" PRIx64 "\n", fn.second.c_str(), fn.first->hash);
243 }
244 }
245 uint64_t res = hash_block64((const uint8_t *)uvec.data(), uint32_t(uvec.size()*sizeof(uint64_t)));
246 debug_aot_hash("AOT HASH %" PRIx64 "\n", res);
247 fun->aotHash = res;
248 return res;
249 }
250
251 string getAotHashComment ( const Function * fun ) {
252 DependencyCollector collector;

Callers 1

linkCppAotMethod · 0.85

Calls 9

hash_block64Function · 0.85
getStableDependenciesMethod · 0.80
collectMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
c_strMethod · 0.45
getMangledNameMethod · 0.45
push_backMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected