| OLD | NEW |
| 1 //===- subzero/src/IceBrowserCompileServer.h - Browser server ---*- C++ -*-===// | 1 //===- subzero/src/IceBrowserCompileServer.h - Browser server ---*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| 11 /// \brief Declares the browser-based compile server. | 11 /// \brief Declares the browser-based compile server. |
| 12 /// | 12 /// |
| 13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
| 14 | 14 |
| 15 #ifndef SUBZERO_SRC_ICEBROWSERCOMPILESERVER_H | 15 #ifndef SUBZERO_SRC_ICEBROWSERCOMPILESERVER_H |
| 16 #define SUBZERO_SRC_ICEBROWSERCOMPILESERVER_H | 16 #define SUBZERO_SRC_ICEBROWSERCOMPILESERVER_H |
| 17 | 17 |
| 18 #include "IceClFlags.h" | 18 #include "IceClFlags.h" |
| 19 #include "IceClFlagsExtra.h" | |
| 20 #include "IceCompileServer.h" | 19 #include "IceCompileServer.h" |
| 21 #include "IceDefs.h" | 20 #include "IceDefs.h" |
| 22 #include "IceELFStreamer.h" | 21 #include "IceELFStreamer.h" |
| 23 | 22 |
| 24 #include <atomic> | 23 #include <atomic> |
| 25 #include <thread> | 24 #include <thread> |
| 26 | 25 |
| 27 namespace llvm { | 26 namespace llvm { |
| 28 class QueueStreamer; | 27 class QueueStreamer; |
| 29 class raw_fd_ostream; | 28 class raw_fd_ostream; |
| 30 } // end of namespace llvm | 29 } // end of namespace llvm |
| 31 | 30 |
| 32 namespace Ice { | 31 namespace Ice { |
| 33 | 32 |
| 34 /// The browser variant of the compile server. Compared to the commandline | 33 /// The browser variant of the compile server. Compared to the commandline |
| 35 /// version, this version gets compile requests over IPC. Each compile request | 34 /// version, this version gets compile requests over IPC. Each compile request |
| 36 /// will have a slimmed down version of argc, argv while other flags are set to | 35 /// will have a slimmed down version of argc, argv while other flags are set to |
| 37 /// defaults that make sense in the browser case. The output file is specified | 36 /// defaults that make sense in the browser case. The output file is specified |
| 38 /// via a posix FD, and input bytes are pushed to the server. | 37 /// via a posix FD, and input bytes are pushed to the server. |
| 39 class BrowserCompileServer : public CompileServer { | 38 class BrowserCompileServer : public CompileServer { |
| 40 BrowserCompileServer(const BrowserCompileServer &) = delete; | 39 BrowserCompileServer(const BrowserCompileServer &) = delete; |
| 41 BrowserCompileServer &operator=(const BrowserCompileServer &) = delete; | 40 BrowserCompileServer &operator=(const BrowserCompileServer &) = delete; |
| 42 class StringStream; | 41 class StringStream; |
| 43 | 42 |
| 44 public: | 43 public: |
| 45 BrowserCompileServer() | 44 BrowserCompileServer() : Flags(&GlobalContext::Flags), HadError(false) {} |
| 46 : Flags(&GlobalContext::Flags), ExtraFlags(&GlobalContext::ExtraFlags), | |
| 47 HadError(false) {} | |
| 48 | 45 |
| 49 ~BrowserCompileServer() final; | 46 ~BrowserCompileServer() final; |
| 50 | 47 |
| 51 void run() final; | 48 void run() final; |
| 52 | 49 |
| 53 ErrorCode &getErrorCode() final; | 50 ErrorCode &getErrorCode() final; |
| 54 | 51 |
| 55 /// Parse and set up the flags for compile jobs. | 52 /// Parse and set up the flags for compile jobs. |
| 56 void getParsedFlags(uint32_t NumThreads, int argc, char **argv); | 53 void getParsedFlags(uint32_t NumThreads, int argc, char **argv); |
| 57 | 54 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 std::unique_ptr<GlobalContext> Ctx; | 95 std::unique_ptr<GlobalContext> Ctx; |
| 99 /// A borrowed reference to the current InputStream. The compiler owns the | 96 /// A borrowed reference to the current InputStream. The compiler owns the |
| 100 /// actual reference so the server must be careful not to access after the | 97 /// actual reference so the server must be careful not to access after the |
| 101 /// compiler is done. | 98 /// compiler is done. |
| 102 llvm::QueueStreamer *InputStream = nullptr; | 99 llvm::QueueStreamer *InputStream = nullptr; |
| 103 std::unique_ptr<Ostream> LogStream; | 100 std::unique_ptr<Ostream> LogStream; |
| 104 std::unique_ptr<llvm::raw_fd_ostream> EmitStream; | 101 std::unique_ptr<llvm::raw_fd_ostream> EmitStream; |
| 105 std::unique_ptr<StringStream> ErrorStream; | 102 std::unique_ptr<StringStream> ErrorStream; |
| 106 std::unique_ptr<ELFStreamer> ELFStream; | 103 std::unique_ptr<ELFStreamer> ELFStream; |
| 107 ClFlags *Flags; | 104 ClFlags *Flags; |
| 108 ClFlagsExtra *ExtraFlags; | |
| 109 std::thread CompileThread; | 105 std::thread CompileThread; |
| 110 std::atomic<bool> HadError; | 106 std::atomic<bool> HadError; |
| 111 }; | 107 }; |
| 112 | 108 |
| 113 } // end of namespace Ice | 109 } // end of namespace Ice |
| 114 | 110 |
| 115 #endif // SUBZERO_SRC_ICEBROWSERCOMPILESERVER_H | 111 #endif // SUBZERO_SRC_ICEBROWSERCOMPILESERVER_H |
| OLD | NEW |