| Index: src/IceGlobalContext.h
|
| diff --git a/src/IceGlobalContext.h b/src/IceGlobalContext.h
|
| index 6c6c22248c6fafd2cf5490c0c82cc545f9060484..1f7376a514b605506c6a69820404672cf698d1a5 100644
|
| --- a/src/IceGlobalContext.h
|
| +++ b/src/IceGlobalContext.h
|
| @@ -77,6 +77,21 @@ private:
|
| GlobalLockType *Lock;
|
| };
|
|
|
| +/// OptWorkItem is a simple wrapper used to pass parse information on a function
|
| +/// block, to a translator thread.
|
| +class OptWorkItem {
|
| + OptWorkItem(const OptWorkItem &) = delete;
|
| + OptWorkItem &operator=(const OptWorkItem &) = delete;
|
| +
|
| +public:
|
| + // Get the Cfg for the funtion to translate.
|
| + virtual std::unique_ptr<Cfg> getParsedCfg() = 0;
|
| + virtual ~OptWorkItem() {}
|
| +
|
| +protected:
|
| + OptWorkItem() {}
|
| +};
|
| +
|
| class GlobalContext {
|
| GlobalContext() = delete;
|
| GlobalContext(const GlobalContext &) = delete;
|
| @@ -378,12 +393,12 @@ public:
|
| /// Notifies any idle workers that a new function is available for
|
| /// translating. May block if the work queue is too large, in order to control
|
| /// memory footprint.
|
| - void optQueueBlockingPush(std::unique_ptr<Cfg> Func);
|
| + void optQueueBlockingPush(std::unique_ptr<OptWorkItem> Item);
|
| /// Takes a Cfg from the work queue for translating. May block if the work
|
| /// queue is currently empty. Returns nullptr if there is no more work - the
|
| /// queue is empty and either end() has been called or the Sequential flag was
|
| /// set.
|
| - std::unique_ptr<Cfg> optQueueBlockingPop();
|
| + std::unique_ptr<OptWorkItem> optQueueBlockingPop();
|
| /// Notifies that no more work will be added to the work queue.
|
| void optQueueNotifyEnd() { OptQ.notifyEnd(); }
|
|
|
| @@ -563,7 +578,8 @@ private:
|
| Intrinsics IntrinsicsInfo;
|
| // TODO(jpp): move to EmitterContext.
|
| std::unique_ptr<ELFObjectWriter> ObjectWriter;
|
| - BoundedProducerConsumerQueue<Cfg> OptQ;
|
| + static constexpr size_t MaxOptQSize = 1 << 16;
|
| + BoundedProducerConsumerQueue<OptWorkItem, MaxOptQSize> OptQ;
|
| BoundedProducerConsumerQueue<EmitterWorkItem> EmitQ;
|
| // DataLowering is only ever used by a single thread at a time (either in
|
| // emitItems(), or in IceCompiler::run before the compilation is over.)
|
|
|