| OLD | NEW |
| 1 //===- subzero/src/IceBrowserCompileServer.cpp - Browser compile server ---===// | 1 //===- subzero/src/IceBrowserCompileServer.cpp - Browser compile server ---===// |
| 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 // This file defines the browser-based compile server. | 10 // This file defines the browser-based compile server. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 if (FD <= 0) | 94 if (FD <= 0) |
| 95 llvm::report_fatal_error("Invalid output FD"); | 95 llvm::report_fatal_error("Invalid output FD"); |
| 96 const bool CloseOnDtor = true; | 96 const bool CloseOnDtor = true; |
| 97 const bool Unbuffered = false; | 97 const bool Unbuffered = false; |
| 98 return std::unique_ptr<llvm::raw_fd_ostream>( | 98 return std::unique_ptr<llvm::raw_fd_ostream>( |
| 99 new llvm::raw_fd_ostream(FD, CloseOnDtor, Unbuffered)); | 99 new llvm::raw_fd_ostream(FD, CloseOnDtor, Unbuffered)); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void fatalErrorHandler(void *UserData, const std::string &Reason, | 102 void fatalErrorHandler(void *UserData, const std::string &Reason, |
| 103 bool GenCrashDialog) { | 103 bool GenCrashDialog) { |
| 104 (void)GenCrashDialog; |
| 104 BrowserCompileServer *Server = | 105 BrowserCompileServer *Server = |
| 105 reinterpret_cast<BrowserCompileServer *>(UserData); | 106 reinterpret_cast<BrowserCompileServer *>(UserData); |
| 106 Server->setFatalError(Reason); | 107 Server->setFatalError(Reason); |
| 107 // Only kill the current thread instead of the whole process. | 108 // Only kill the current thread instead of the whole process. |
| 108 // We need the server thread to remain alive in order to respond with the | 109 // We need the server thread to remain alive in order to respond with the |
| 109 // error message. | 110 // error message. |
| 110 // We could also try to pthread_kill all other worker threads, but | 111 // We could also try to pthread_kill all other worker threads, but |
| 111 // pthread_kill / raising signals is not supported by NaCl. | 112 // pthread_kill / raising signals is not supported by NaCl. |
| 112 // We'll have to assume that the worker/emitter threads will be well behaved | 113 // We'll have to assume that the worker/emitter threads will be well behaved |
| 113 // after a fatal error in other threads, and either get stuck waiting | 114 // after a fatal error in other threads, and either get stuck waiting |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 this->getCompiler().run(ExtraFlags, *Ctx.get(), | 189 this->getCompiler().run(ExtraFlags, *Ctx.get(), |
| 189 // Retain original reference, but the compiler | 190 // Retain original reference, but the compiler |
| 190 // (LLVM's MemoryObject) wants to handle deletion. | 191 // (LLVM's MemoryObject) wants to handle deletion. |
| 191 std::unique_ptr<llvm::DataStreamer>(InputStream)); | 192 std::unique_ptr<llvm::DataStreamer>(InputStream)); |
| 192 }); | 193 }); |
| 193 } | 194 } |
| 194 | 195 |
| 195 } // end of namespace Ice | 196 } // end of namespace Ice |
| 196 | 197 |
| 197 #endif // PNACL_BROWSER_TRANSLATOR | 198 #endif // PNACL_BROWSER_TRANSLATOR |
| OLD | NEW |