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

Unified Diff: src/IceTranslator.cpp

Issue 1834473002: Allow Subzero to parse function blocks in parallel. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Clean up code. Created 4 years, 9 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
Index: src/IceTranslator.cpp
diff --git a/src/IceTranslator.cpp b/src/IceTranslator.cpp
index ce54c218405d6c7466715f73b76ed27096728b75..238663aacd7bd5ae851ec3269b5eee1e57b053f3 100644
--- a/src/IceTranslator.cpp
+++ b/src/IceTranslator.cpp
@@ -22,6 +22,24 @@
#include <utility>
+namespace {
John 2016/03/24 17:32:35 enclose this namespace in Ice, and then remove the
Karl 2016/03/24 22:35:25 Done.
+
+class CfgOptWorkItem : public Ice::OptWorkItem {
+ CfgOptWorkItem() = delete;
+ CfgOptWorkItem(const CfgOptWorkItem &) = delete;
+ CfgOptWorkItem &operator=(const CfgOptWorkItem &) = delete;
+
+public:
+ CfgOptWorkItem(std::unique_ptr<Ice::Cfg> Func) : Func(std::move(Func)) {}
+ std::unique_ptr<Ice::Cfg> getParsedCfg() final { return std::move(Func); }
John 2016/03/24 17:32:34 final is better off when used in the class declara
Karl 2016/03/24 22:35:25 On 2016/03/24 17:32:34, John wrote: > final is bet
+ ~CfgOptWorkItem() final {}
John 2016/03/24 17:32:35 ~CfgOptWorkItem() override = default;
Karl 2016/03/24 22:35:25 Done.
+
+private:
+ std::unique_ptr<Ice::Cfg> Func;
+};
+
+} // end of anonymous namespace
+
namespace Ice {
Translator::Translator(GlobalContext *Ctx)
@@ -55,7 +73,7 @@ bool Translator::checkIfUnnamedNameSafe(const IceString &Name, const char *Kind,
}
void Translator::translateFcn(std::unique_ptr<Cfg> Func) {
- Ctx->optQueueBlockingPush(std::move(Func));
+ Ctx->optQueueBlockingPush(makeUnique<CfgOptWorkItem>(std::move(Func)));
}
void Translator::lowerGlobals(

Powered by Google App Engine
This is Rietveld 408576698