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

Side by Side Diff: src/IceBrowserCompileServer.cpp

Issue 1803403002: Subzero. Flags refactoring. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addresses comments. 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 unified diff | Download patch
« no previous file with comments | « src/IceBrowserCompileServer.h ('k') | src/IceCfg.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /// \file 10 /// \file
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 void BrowserCompileServer::run() { 159 void BrowserCompileServer::run() {
160 gCompileServer = this; 160 gCompileServer = this;
161 getIRTInterfaces(); 161 getIRTInterfaces();
162 gIRTFuncs.serve_translate_request(&SubzeroCallbacks); 162 gIRTFuncs.serve_translate_request(&SubzeroCallbacks);
163 } 163 }
164 164
165 void BrowserCompileServer::getParsedFlags(uint32_t NumThreads, int argc, 165 void BrowserCompileServer::getParsedFlags(uint32_t NumThreads, int argc,
166 char **argv) { 166 char **argv) {
167 ClFlags::parseFlags(argc, argv); 167 ClFlags::parseFlags(argc, argv);
168 ClFlags::getParsedClFlags(*Flags); 168 ClFlags::getParsedClFlags(*Flags);
169 ClFlags::getParsedClFlagsExtra(*ExtraFlags);
170 // Set some defaults which aren't specified via the argv string. 169 // Set some defaults which aren't specified via the argv string.
171 Flags->setNumTranslationThreads(NumThreads); 170 Flags->setNumTranslationThreads(NumThreads);
172 Flags->setUseSandboxing(true); 171 Flags->setUseSandboxing(true);
173 Flags->setOutFileType(FT_Elf); 172 Flags->setOutFileType(FT_Elf);
174 Flags->setTargetArch(getTargetArch()); 173 Flags->setTargetArch(getTargetArch());
175 ExtraFlags->setBuildOnRead(true); 174 Flags->setBuildOnRead(true);
176 ExtraFlags->setInputFileFormat(llvm::PNaClFormat); 175 Flags->setInputFileFormat(llvm::PNaClFormat);
177 } 176 }
178 177
179 bool BrowserCompileServer::pushInputBytes(const void *Data, size_t NumBytes) { 178 bool BrowserCompileServer::pushInputBytes(const void *Data, size_t NumBytes) {
180 // If there was an earlier error, do not attempt to push bytes to the 179 // If there was an earlier error, do not attempt to push bytes to the
181 // QueueStreamer. Otherwise the thread could become blocked. 180 // QueueStreamer. Otherwise the thread could become blocked.
182 if (HadError.load()) 181 if (HadError.load())
183 return true; 182 return true;
184 return InputStream->PutBytes( 183 return InputStream->PutBytes(
185 const_cast<unsigned char *>( 184 const_cast<unsigned char *>(
186 reinterpret_cast<const unsigned char *>(Data)), 185 reinterpret_cast<const unsigned char *>(Data)),
(...skipping 26 matching lines...) Expand all
213 EmitStream = getOutputStream(ObjFD); 212 EmitStream = getOutputStream(ObjFD);
214 EmitStream->SetBufferSize(1 << 14); 213 EmitStream->SetBufferSize(1 << 14);
215 std::unique_ptr<StringStream> ErrStrm(new StringStream()); 214 std::unique_ptr<StringStream> ErrStrm(new StringStream());
216 ErrorStream = std::move(ErrStrm); 215 ErrorStream = std::move(ErrStrm);
217 ELFStream.reset(new ELFStreamer(*EmitStream.get())); 216 ELFStream.reset(new ELFStreamer(*EmitStream.get()));
218 Ctx.reset(new GlobalContext(LogStream.get(), EmitStream.get(), 217 Ctx.reset(new GlobalContext(LogStream.get(), EmitStream.get(),
219 &ErrorStream->getStream(), ELFStream.get())); 218 &ErrorStream->getStream(), ELFStream.get()));
220 CompileThread = std::thread([this]() { 219 CompileThread = std::thread([this]() {
221 llvm::install_fatal_error_handler(fatalErrorHandler, this); 220 llvm::install_fatal_error_handler(fatalErrorHandler, this);
222 Ctx->initParserThread(); 221 Ctx->initParserThread();
223 this->getCompiler().run(*ExtraFlags, *Ctx.get(), 222 this->getCompiler().run(*Flags, *Ctx.get(),
224 // Retain original reference, but the compiler 223 // Retain original reference, but the compiler
225 // (LLVM's MemoryObject) wants to handle deletion. 224 // (LLVM's MemoryObject) wants to handle deletion.
226 std::unique_ptr<llvm::DataStreamer>(InputStream)); 225 std::unique_ptr<llvm::DataStreamer>(InputStream));
227 }); 226 });
228 } 227 }
229 228
230 } // end of namespace Ice 229 } // end of namespace Ice
231 230
232 #else // !PNACL_BROWSER_TRANSLATOR 231 #else // !PNACL_BROWSER_TRANSLATOR
233 232
234 #include "llvm/Support/ErrorHandling.h" 233 #include "llvm/Support/ErrorHandling.h"
235 234
236 namespace Ice { 235 namespace Ice {
237 236
238 BrowserCompileServer::~BrowserCompileServer() {} 237 BrowserCompileServer::~BrowserCompileServer() {}
239 238
240 void BrowserCompileServer::run() { 239 void BrowserCompileServer::run() {
241 llvm::report_fatal_error("no browser hookups"); 240 llvm::report_fatal_error("no browser hookups");
242 } 241 }
243 242
244 ErrorCode &BrowserCompileServer::getErrorCode() { 243 ErrorCode &BrowserCompileServer::getErrorCode() {
245 llvm::report_fatal_error("no browser hookups"); 244 llvm::report_fatal_error("no browser hookups");
246 } 245 }
247 246
248 } // end of namespace Ice 247 } // end of namespace Ice
249 248
250 #endif // PNACL_BROWSER_TRANSLATOR 249 #endif // PNACL_BROWSER_TRANSLATOR
OLDNEW
« no previous file with comments | « src/IceBrowserCompileServer.h ('k') | src/IceCfg.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698