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

Side by Side Diff: src/IceBrowserCompileServer.cpp

Issue 1766233002: Subzero: Fix symbol name mangling. Make flags global. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes 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.h » ('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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 158
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); 169 ClFlags::getParsedClFlagsExtra(*ExtraFlags);
170 // Set some defaults which aren't specified via the argv string. 170 // Set some defaults which aren't specified via the argv string.
171 Flags.setNumTranslationThreads(NumThreads); 171 Flags->setNumTranslationThreads(NumThreads);
172 Flags.setUseSandboxing(true); 172 Flags->setUseSandboxing(true);
173 Flags.setOutFileType(FT_Elf); 173 Flags->setOutFileType(FT_Elf);
174 Flags.setTargetArch(getTargetArch()); 174 Flags->setTargetArch(getTargetArch());
175 ExtraFlags.setBuildOnRead(true); 175 ExtraFlags->setBuildOnRead(true);
176 ExtraFlags.setInputFileFormat(llvm::PNaClFormat); 176 ExtraFlags->setInputFileFormat(llvm::PNaClFormat);
177 } 177 }
178 178
179 bool BrowserCompileServer::pushInputBytes(const void *Data, size_t NumBytes) { 179 bool BrowserCompileServer::pushInputBytes(const void *Data, size_t NumBytes) {
180 // If there was an earlier error, do not attempt to push bytes to the 180 // If there was an earlier error, do not attempt to push bytes to the
181 // QueueStreamer. Otherwise the thread could become blocked. 181 // QueueStreamer. Otherwise the thread could become blocked.
182 if (HadError.load()) 182 if (HadError.load())
183 return true; 183 return true;
184 return InputStream->PutBytes( 184 return InputStream->PutBytes(
185 const_cast<unsigned char *>( 185 const_cast<unsigned char *>(
186 reinterpret_cast<const unsigned char *>(Data)), 186 reinterpret_cast<const unsigned char *>(Data)),
(...skipping 22 matching lines...) Expand all
209 void BrowserCompileServer::startCompileThread(int ObjFD) { 209 void BrowserCompileServer::startCompileThread(int ObjFD) {
210 InputStream = new llvm::QueueStreamer(); 210 InputStream = new llvm::QueueStreamer();
211 LogStream = getOutputStream(STDOUT_FILENO); 211 LogStream = getOutputStream(STDOUT_FILENO);
212 LogStream->SetUnbuffered(); 212 LogStream->SetUnbuffered();
213 EmitStream = getOutputStream(ObjFD); 213 EmitStream = getOutputStream(ObjFD);
214 EmitStream->SetBufferSize(1 << 14); 214 EmitStream->SetBufferSize(1 << 14);
215 std::unique_ptr<StringStream> ErrStrm(new StringStream()); 215 std::unique_ptr<StringStream> ErrStrm(new StringStream());
216 ErrorStream = std::move(ErrStrm); 216 ErrorStream = std::move(ErrStrm);
217 ELFStream.reset(new ELFStreamer(*EmitStream.get())); 217 ELFStream.reset(new ELFStreamer(*EmitStream.get()));
218 Ctx.reset(new GlobalContext(LogStream.get(), EmitStream.get(), 218 Ctx.reset(new GlobalContext(LogStream.get(), EmitStream.get(),
219 &ErrorStream->getStream(), ELFStream.get(), 219 &ErrorStream->getStream(), ELFStream.get()));
220 Flags));
221 CompileThread = std::thread([this]() { 220 CompileThread = std::thread([this]() {
222 llvm::install_fatal_error_handler(fatalErrorHandler, this); 221 llvm::install_fatal_error_handler(fatalErrorHandler, this);
223 Ctx->initParserThread(); 222 Ctx->initParserThread();
224 this->getCompiler().run(ExtraFlags, *Ctx.get(), 223 this->getCompiler().run(*ExtraFlags, *Ctx.get(),
225 // Retain original reference, but the compiler 224 // Retain original reference, but the compiler
226 // (LLVM's MemoryObject) wants to handle deletion. 225 // (LLVM's MemoryObject) wants to handle deletion.
227 std::unique_ptr<llvm::DataStreamer>(InputStream)); 226 std::unique_ptr<llvm::DataStreamer>(InputStream));
228 }); 227 });
229 } 228 }
230 229
231 } // end of namespace Ice 230 } // end of namespace Ice
232 231
233 #else // !PNACL_BROWSER_TRANSLATOR 232 #else // !PNACL_BROWSER_TRANSLATOR
234 233
235 #include "llvm/Support/ErrorHandling.h" 234 #include "llvm/Support/ErrorHandling.h"
236 235
237 namespace Ice { 236 namespace Ice {
238 237
239 BrowserCompileServer::~BrowserCompileServer() {} 238 BrowserCompileServer::~BrowserCompileServer() {}
240 239
241 void BrowserCompileServer::run() { 240 void BrowserCompileServer::run() {
242 llvm::report_fatal_error("no browser hookups"); 241 llvm::report_fatal_error("no browser hookups");
243 } 242 }
244 243
245 ErrorCode &BrowserCompileServer::getErrorCode() { 244 ErrorCode &BrowserCompileServer::getErrorCode() {
246 llvm::report_fatal_error("no browser hookups"); 245 llvm::report_fatal_error("no browser hookups");
247 } 246 }
248 247
249 } // end of namespace Ice 248 } // end of namespace Ice
250 249
251 #endif // PNACL_BROWSER_TRANSLATOR 250 #endif // PNACL_BROWSER_TRANSLATOR
OLDNEW
« no previous file with comments | « src/IceBrowserCompileServer.h ('k') | src/IceCfg.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698