Commit e6407eea authored by Marius Wachtler's avatar Marius Wachtler

Generate better module names to make the object cache more effective

one of the problems were that depending on if all files were all ready parsed we JITed more or less functions,
this changed the total number of jited functions which changed all the module names.
This lead to the result that in order to have all entries inside the cache we needed at least 3runs if the pyc files were old.

The whole name scheme should add some point get improved but for now it should be enough.
parent 7eec7fa2
......@@ -17,7 +17,6 @@
#include <cstdio>
#include <iostream>
#include <set>
#include <sstream>
#include <stdint.h>
#include "llvm/Analysis/Passes.h"
......@@ -30,6 +29,7 @@
#include "llvm/IR/LegacyPassManager.h"
#endif
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetSubtargetInfo.h"
#include "llvm/Transforms/Instrumentation.h"
......@@ -960,16 +960,16 @@ static llvm::MDNode* setupDebugInfo(SourceInfo* source, llvm::Function* f, std::
}
static std::string getUniqueFunctionName(std::string nameprefix, EffortLevel effort, const OSREntryDescriptor* entry) {
static int num_functions = 0;
std::ostringstream os;
static llvm::StringMap<int> used_module_names;
std::string name;
llvm::raw_string_ostream os(name);
os << nameprefix;
os << "_e" << (int)effort;
if (entry) {
if (entry)
os << "_osr" << entry->backedge->target->idx;
}
os << '_' << num_functions;
num_functions++;
// in order to generate a unique id add the number of times we encountered this name to end of the string.
auto& times = used_module_names[os.str()];
os << '_' << ++times;
return os.str();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment