1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[ORC] Pass symbol name to discard by const reference.

This saves some unnecessary atomic ref-counting operations.

llvm-svn: 343927
This commit is contained in:
Lang Hames 2018-10-06 23:02:06 +00:00
parent 8ce9858079
commit 6780b3c29d
9 changed files with 17 additions and 15 deletions

View File

@ -255,7 +255,7 @@ public:
/// Called by JITDylibs to notify MaterializationUnits that the given symbol
/// has been overridden.
void doDiscard(const JITDylib &JD, SymbolStringPtr Name) {
void doDiscard(const JITDylib &JD, const SymbolStringPtr &Name) {
SymbolFlags.erase(Name);
discard(JD, std::move(Name));
}
@ -275,7 +275,7 @@ private:
/// from the source (e.g. if the source is an LLVM IR Module and the
/// symbol is a function, delete the function body or mark it available
/// externally).
virtual void discard(const JITDylib &JD, SymbolStringPtr Name) = 0;
virtual void discard(const JITDylib &JD, const SymbolStringPtr &Name) = 0;
};
using MaterializationUnitList =
@ -293,7 +293,7 @@ public:
private:
void materialize(MaterializationResponsibility R) override;
void discard(const JITDylib &JD, SymbolStringPtr Name) override;
void discard(const JITDylib &JD, const SymbolStringPtr &Name) override;
static SymbolFlagsMap extractFlags(const SymbolMap &Symbols);
SymbolMap Symbols;
@ -344,7 +344,7 @@ public:
private:
void materialize(MaterializationResponsibility R) override;
void discard(const JITDylib &JD, SymbolStringPtr Name) override;
void discard(const JITDylib &JD, const SymbolStringPtr &Name) override;
static SymbolFlagsMap extractFlags(const SymbolAliasMap &Aliases);
JITDylib *SourceJD = nullptr;

View File

@ -96,7 +96,7 @@ protected:
SymbolNameToDefinitionMap SymbolToDefinition;
private:
void discard(const JITDylib &JD, SymbolStringPtr Name) override;
void discard(const JITDylib &JD, const SymbolStringPtr &Name) override;
};
/// MaterializationUnit that materializes modules by calling the 'emit' method
@ -158,7 +158,7 @@ public:
private:
void materialize(MaterializationResponsibility R) override;
void discard(const JITDylib &JD, SymbolStringPtr Name) override;
void discard(const JITDylib &JD, const SymbolStringPtr &Name) override;
ObjectLayer &L;
VModuleKey K;

View File

@ -165,7 +165,7 @@ public:
private:
void materialize(MaterializationResponsibility R) override;
void discard(const JITDylib &JD, SymbolStringPtr Name) override;
void discard(const JITDylib &JD, const SymbolStringPtr &Name) override;
static SymbolFlagsMap extractFlags(const SymbolAliasMap &Aliases);
LazyCallThroughManager &LCTManager;

View File

@ -85,7 +85,7 @@ private:
std::move(SymbolToDefinition));
}
void discard(const JITDylib &V, SymbolStringPtr Name) override {
void discard(const JITDylib &V, const SymbolStringPtr &Name) override {
// All original symbols were materialized by the CODLayer and should be
// final. The function bodies provided by M should never be overridden.
llvm_unreachable("Discard should never be called on an "

View File

@ -489,7 +489,7 @@ void AbsoluteSymbolsMaterializationUnit::materialize(
}
void AbsoluteSymbolsMaterializationUnit::discard(const JITDylib &JD,
SymbolStringPtr Name) {
const SymbolStringPtr &Name) {
assert(Symbols.count(Name) && "Symbol is not part of this MU");
Symbols.erase(Name);
}
@ -637,7 +637,7 @@ void ReExportsMaterializationUnit::materialize(
}
void ReExportsMaterializationUnit::discard(const JITDylib &JD,
SymbolStringPtr Name) {
const SymbolStringPtr &Name) {
assert(Aliases.count(Name) &&
"Symbol not covered by this MaterializationUnit");
Aliases.erase(Name);

View File

@ -41,7 +41,7 @@ private:
R.emit();
}
void discard(const JITDylib &JD, SymbolStringPtr Name) override {
void discard(const JITDylib &JD, const SymbolStringPtr &Name) override {
llvm_unreachable("Discard should never occur on a LMU?");
}

View File

@ -53,7 +53,8 @@ StringRef IRMaterializationUnit::getName() const {
return "<null module>";
}
void IRMaterializationUnit::discard(const JITDylib &JD, SymbolStringPtr Name) {
void IRMaterializationUnit::discard(const JITDylib &JD,
const SymbolStringPtr &Name) {
LLVM_DEBUG(JD.getExecutionSession().runSessionLocked([&]() {
dbgs() << "In " << JD.getName() << " discarding " << *Name << " from MU@"
<< this << " (" << getName() << ")\n";
@ -145,7 +146,7 @@ void BasicObjectLayerMaterializationUnit::materialize(
}
void BasicObjectLayerMaterializationUnit::discard(const JITDylib &JD,
SymbolStringPtr Name) {
const SymbolStringPtr &Name) {
// FIXME: Support object file level discard. This could be done by building a
// filter to pass to the object layer along with the object itself.
}

View File

@ -187,7 +187,7 @@ void LazyReexportsMaterializationUnit::materialize(
}
void LazyReexportsMaterializationUnit::discard(const JITDylib &JD,
SymbolStringPtr Name) {
const SymbolStringPtr &Name) {
assert(CallableAliases.count(Name) &&
"Symbol not covered by this MaterializationUnit");
CallableAliases.erase(Name);

View File

@ -112,7 +112,8 @@ public:
Materialize(std::move(R));
}
void discard(const orc::JITDylib &JD, orc::SymbolStringPtr Name) override {
void discard(const orc::JITDylib &JD,
const orc::SymbolStringPtr &Name) override {
if (Discard)
Discard(JD, std::move(Name));
else