Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Unified Diff: src/IceGlobalContext.cpp

Issue 2896133003: Do not inline GlobalContext TLS methods. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceGlobalContext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceGlobalContext.cpp
diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp
index 45fb999aec667b8bc7c7bc4d26ea3e4a7ce1427a..7aa36d99136a8efe61f7834ff83ccce69398bc1c 100644
--- a/src/IceGlobalContext.cpp
+++ b/src/IceGlobalContext.cpp
@@ -372,6 +372,11 @@ GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit, Ostream *OsError,
}
}
+void GlobalContext::translateFunctionsWrapper(ThreadContext *MyTLS) {
+ ICE_TLS_SET_FIELD(TLS, MyTLS);
+ translateFunctions();
+}
+
void GlobalContext::translateFunctions() {
TimerMarker Timer(TimerStack::TT_translateFunctions, this);
while (std::unique_ptr<OptWorkItem> OptItem = optQueueBlockingPop()) {
@@ -454,6 +459,11 @@ void resizePending(std::vector<std::unique_ptr<EmitterWorkItem>> *Pending,
} // end of anonymous namespace
+// static
+void GlobalContext::TlsInit() {
+ ICE_TLS_INIT_FIELD(TLS);
+}
+
void GlobalContext::emitFileHeader() {
TimerMarker T1(Ice::TimerStack::TT_emitAsm, this);
if (getFlags().getOutFileType() == FT_Elf) {
@@ -556,6 +566,11 @@ void GlobalContext::lowerProfileData() {
lowerGlobals(ProfileDataSection);
}
+void GlobalContext::emitterWrapper(ThreadContext *MyTLS) {
+ ICE_TLS_SET_FIELD(TLS, MyTLS);
+ emitItems();
+}
+
void GlobalContext::emitItems() {
const bool Threaded = !getFlags().isSequential();
// Pending is a vector containing the reassembled, ordered list of
@@ -987,6 +1002,38 @@ std::unique_ptr<EmitterWorkItem> GlobalContext::emitQueueBlockingPop() {
return EmitQ.blockingPop();
}
+void GlobalContext::initParserThread() {
+ ThreadContext *Tls = new ThreadContext();
+ auto Timers = getTimers();
+ Timers->initInto(Tls->Timers);
+ AllThreadContexts.push_back(Tls);
+ ICE_TLS_SET_FIELD(TLS, Tls);
+}
+
+void GlobalContext::startWorkerThreads() {
+ size_t NumWorkers = getFlags().getNumTranslationThreads();
+ auto Timers = getTimers();
+ for (size_t i = 0; i < NumWorkers; ++i) {
+ ThreadContext *WorkerTLS = new ThreadContext();
+ Timers->initInto(WorkerTLS->Timers);
+ AllThreadContexts.push_back(WorkerTLS);
+ TranslationThreads.push_back(std::thread(
+ &GlobalContext::translateFunctionsWrapper, this, WorkerTLS));
+ }
+ if (NumWorkers) {
+ ThreadContext *WorkerTLS = new ThreadContext();
+ Timers->initInto(WorkerTLS->Timers);
+ AllThreadContexts.push_back(WorkerTLS);
+ EmitterThreads.push_back(
+ std::thread(&GlobalContext::emitterWrapper, this, WorkerTLS));
+ }
+}
+
+void GlobalContext::resetStats() {
+ if (BuildDefs::dump())
+ ICE_TLS_GET_FIELD(TLS)->StatsFunction.reset();
+}
+
void GlobalContext::dumpStats(const Cfg *Func) {
if (!getFlags().getDumpStats())
return;
@@ -997,6 +1044,54 @@ void GlobalContext::dumpStats(const Cfg *Func) {
}
}
+void GlobalContext::statsUpdateEmitted(uint32_t InstCount) {
+ if (!getFlags().getDumpStats())
+ return;
+ ThreadContext *Tls = ICE_TLS_GET_FIELD(TLS);
+ Tls->StatsFunction.update(CodeStats::CS_InstCount, InstCount);
+ Tls->StatsCumulative.update(CodeStats::CS_InstCount, InstCount);
+}
+
+void GlobalContext::statsUpdateRegistersSaved(uint32_t Num) {
+ if (!getFlags().getDumpStats())
+ return;
+ ThreadContext *Tls = ICE_TLS_GET_FIELD(TLS);
+ Tls->StatsFunction.update(CodeStats::CS_RegsSaved, Num);
+ Tls->StatsCumulative.update(CodeStats::CS_RegsSaved, Num);
+}
+
+void GlobalContext::statsUpdateFrameBytes(uint32_t Bytes) {
+ if (!getFlags().getDumpStats())
+ return;
+ ThreadContext *Tls = ICE_TLS_GET_FIELD(TLS);
+ Tls->StatsFunction.update(CodeStats::CS_FrameByte, Bytes);
+ Tls->StatsCumulative.update(CodeStats::CS_FrameByte, Bytes);
+}
+
+void GlobalContext::statsUpdateSpills() {
+ if (!getFlags().getDumpStats())
+ return;
+ ThreadContext *Tls = ICE_TLS_GET_FIELD(TLS);
+ Tls->StatsFunction.update(CodeStats::CS_NumSpills);
+ Tls->StatsCumulative.update(CodeStats::CS_NumSpills);
+}
+
+void GlobalContext::statsUpdateFills() {
+ if (!getFlags().getDumpStats())
+ return;
+ ThreadContext *Tls = ICE_TLS_GET_FIELD(TLS);
+ Tls->StatsFunction.update(CodeStats::CS_NumFills);
+ Tls->StatsCumulative.update(CodeStats::CS_NumFills);
+}
+
+void GlobalContext::statsUpdateRPImms() {
+ if (!getFlags().getDumpStats())
+ return;
+ ThreadContext *Tls = ICE_TLS_GET_FIELD(TLS);
+ Tls->StatsFunction.update(CodeStats::CS_NumRPImms);
+ Tls->StatsCumulative.update(CodeStats::CS_NumRPImms);
+}
+
void GlobalContext::dumpTimers(TimerStackIdT StackID, bool DumpCumulative) {
if (!BuildDefs::timers())
return;
« no previous file with comments | « src/IceGlobalContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698