| 1401 | } |
| 1402 | |
| 1403 | Status LlvmCodeGen::FinalizeModuleAsync(RuntimeProfile::EventSequence* event_sequence) { |
| 1404 | DCHECK(event_sequence != nullptr); |
| 1405 | Status thread_start_status = Thread::Create("async-codegen", "async-codegen", |
| 1406 | [this, event_sequence]() { |
| 1407 | SCOPED_THREAD_COUNTER_MEASUREMENT(compile_thread_counters_); |
| 1408 | VLOG(2) << "Starting async code generation."; |
| 1409 | |
| 1410 | Status status = DebugAction(state_->query_options(), |
| 1411 | "BEFORE_CODEGEN_IN_ASYNC_CODEGEN_THREAD"); |
| 1412 | if (status.ok()) { |
| 1413 | status = this->FinalizeModule(); |
| 1414 | } |
| 1415 | |
| 1416 | const std::string status_msg = status.ok() ? "OK." : status.msg().msg(); |
| 1417 | auto log_level = status.ok() ? 2 : 1; |
| 1418 | event_sequence->MarkEvent("AsyncCodegenFinished"); |
| 1419 | VLOG(log_level) << "Finished async code generation with result: " << status; |
| 1420 | }, &async_compile_thread_); |
| 1421 | |
| 1422 | event_sequence->MarkEvent("AsyncCodegenStarted"); |
| 1423 | |
| 1424 | RETURN_IF_ERROR(DebugAction(state_->query_options(), |
| 1425 | "AFTER_STARTING_ASYNC_CODEGEN_IN_FRAGMENT_THREAD")); |
| 1426 | return thread_start_status; |
| 1427 | } |
| 1428 | |
| 1429 | /// TODO: In asynchronous mode, return early if the query is cancelled or finished. |
| 1430 | Status LlvmCodeGen::OptimizeModule() { |
no test coverage detected