Skip to content

coverage reports with forceCompile are broken in Dart 2 mode #32282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mraleph opened this issue Feb 22, 2018 · 3 comments
Closed

coverage reports with forceCompile are broken in Dart 2 mode #32282

mraleph opened this issue Feb 22, 2018 · 3 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. front-end-kernel legacy-area-front-end Legacy: Use area-dart-model instead. P0 A serious issue requiring immediate resolution
Milestone

Comments

@mraleph
Copy link
Member

mraleph commented Feb 22, 2018

Underlying issue is that compiler breaks when it tries to force-compile redirecting factory because they have a "special" representation instead of a real body.

Note: this completely breaks Flutter --coverage flag.

There is a workaround we can apply to temporary unbreak things - we can replace UNREACHABLE() with ReportError. But I am hesitant to apply it because it just hides underlying issue and might lead to other confusing situations down the road.

Add a test case testing this:

diff --git a/runtime/observatory/tests/service/get_source_report_test.dart b/runtime/observatory/tests/service/get_source_report_test.dart
index 75f1e06331..9b2fa15522 100644
--- a/runtime/observatory/tests/service/get_source_report_test.dart
+++ b/runtime/observatory/tests/service/get_source_report_test.dart
@@ -119,6 +119,17 @@ var tests = <IsolateTest>[
     expect(coverage['ranges'].length, greaterThan(1));
     expect(coverage['scripts'].length, greaterThan(1));

+    // Full isolate
+    params = {
+      'reports': ['Coverage'],
+      'forceCompile': true
+    };
+    coverage = await isolate.invokeRpcNoUpgrade('getSourceReport', params);
+    expect(coverage['type'], equals('SourceReport'));
+    expect(coverage['ranges'].length, greaterThan(1));
+    expect(coverage['scripts'].length, greaterThan(1));
+
+
     // Multiple reports (make sure enum list parameter parsing works).
     params = {
       'reports': ['_CallSites', 'Coverage', 'PossibleBreakpoints'],

Run it

╰─$ tools/test.py -c dartk -m release -a x64 --strong service/get_source_report_test
Test configuration: dartk_vm_release_x64_strong

FAILED: dartk-vm release_x64 service/get_source_report_test
Expected: Pass
Actual: RuntimeError

--- Command "vm" (took 03.000145s):
DART_CONFIGURATION=ReleaseX64 pkg/vm/tool/dart2 --error_on_bad_type --error_on_bad_override --ignore-unrecognized-flags --packages=/usr/local/google/home/vegorov/src/dart/sdk/.packages /usr/local/google/home/vegorov/src/dart/sdk/runtime/observatory/tests/service/get_source_report_test.dart

exit code:
255

stdout:
** Launching SERVICE_TEST_TESTEE=true /usr/local/google/home/vegorov/src/dart/sdk/pkg/vm/tool/../../../out/ReleaseX64/dart -DDART_SERVICE_USE_AUTH=false --profiler --preview_dart_2 --strong --reify-generic-functions --limit-ints-to-64-bits --error_on_bad_type --error_on_bad_override --ignore-unrecognized-flags --packages=/usr/local/google/home/vegorov/s
rc/dart/sdk/.packages --enable-vm-service:0 /usr/local/google/home/vegorov/src/dart/sdk/runtime/observatory/tests/service/get_source_report_test.dart
>testee>out> Observatory listening on http://127.0.0.1:39819/
** Signaled to run test queries on http://127.0.0.1:39819/
>testee>out>
Loading VM...
>testee>out> otherFunction <
>testee>out> positive
Done loading VM
Running get_source_report_test.dart [1/2]
Paused with PauseBreakpoint
Running get_source_report_test.dart [2/2]
>testee>err> ../../runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc: 6763: error: unimplemented code
>testee>err> Dumping native stack trace for thread 32d3f
>testee>err>   [0x00000000009ea897] dart::Profiler::DumpStackTrace(bool)
>testee>err>   [0x00000000009ea897] dart::Profiler::DumpStackTrace(bool)
>testee>err>   [0x0000000000c140b9] dart::DynamicAssertionHelper::Fail(char const*, ...)
>testee>err>   [0x0000000000b743be] dart::kernel::StreamingFlowGraphBuilder::BuildStaticGet(dart::TokenPosition*)
>testee>err>   [0x0000000000b6c577] dart::kernel::StreamingFlowGraphBuilder::BuildExpression(dart::TokenPosition*)
>testee>err>   [0x0000000000b7f5c6] dart::kernel::StreamingFlowGraphBuilder::BuildVariableDeclaration()
>testee>err>   [0x0000000000b6c829] dart::kernel::StreamingFlowGraphBuilder::BuildExpression(dart::TokenPosition*)
>testee>err>   [0x0000000000b6e862] dart::kernel::StreamingFlowGraphBuilder::BuildStatement()
>testee>err>   [0x0000000000b710b2] dart::kernel::StreamingFlowGraphBuilder::BuildGraphOfFunction(bool)
>testee>err>   [0x0000000000b71e47] dart::kernel::StreamingFlowGraphBuilder::BuildGraph(long)
>testee>err>   [0x0000000000b93d8b] dart::kernel::FlowGraphBuilder::BuildGraph()
>testee>err>   [0x0000000000bbb2ca] dart::DartCompilationPipeline::BuildFlowGraph(dart::Zone*, dart::ParsedFunction*, dart::ZoneGrowableArray<dart::ICData const*> const&, long, bool)
>testee>err>   [0x0000000000bbdddb] dart::CompileParsedFunctionHelper::Compile(dart::CompilationPipeline*)
>testee>err>   [0x0000000000bbf796] Unknown symbol
>testee>err>   [0x0000000000bc0338] dart::Compiler::EnsureUnoptimizedCode(dart::Thread*, dart::Function const&)
>testee>err>   [0x0000000000a701a8] dart::SourceReport::VisitFunction(dart::JSONArray*, dart::Function const&)
>testee>err>   [0x0000000000a706e7] dart::SourceReport::VisitLibrary(dart::JSONArray*, dart::Library const&)
>testee>err>   [0x0000000000a70d0f] dart::SourceReport::PrintJSON(dart::JSONStream*, dart::Script const&, dart::TokenPosition, dart::TokenPosition)
>testee>err>   [0x0000000000a5e25b] Unknown symbol
>testee>err>   [0x0000000000a57638] dart::Service::InvokeMethod(dart::Isolate*, dart::Array const&, bool)
>testee>err>   [0x0000000000a57d07] dart::Service::HandleIsolateMessage(dart::Isolate*, dart::Array const&)
>testee>err>   [0x00000000008cdec0] dart::IsolateMessageHandler::HandleMessage(dart::Message*)
>testee>err>   [0x00000000008f683e] dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool)
>testee>err>   [0x00000000008f6ac0] dart::MessageHandler::HandleOOBMessages()
>testee>err>   [0x0000000000be6e28] Dart_HandleServiceMessages
>testee>err>   [0x00000000008d4a80] dart::Isolate::PauseEventHandler()
>testee>err>   [0x00000000008a3777] dart::Debugger::Pause(dart::ServiceEvent*)
>testee>err>   [0x00000000008af396] dart::Debugger::PauseStepping()
>testee>err>   [0x0000000000a434ab] dart::DRT_SingleStepHandler(dart::NativeArguments)
>testee>err>   [0x00007fc641d8063b] Unknown symbol
>testee>err>   [0x00007fc641d80b1b] Unknown symbol
>testee>err>   [0x00007fc62ef80495] Unknown symbol
>testee>err>   [0x00007fc63c53ff57] Unknown symbol
>testee>err>   [0x00007fc62ef80177] Unknown symbol
>testee>err>   [0x00007fc63c531a92] Unknown symbol
>testee>err>   [0x00007fc63c53f181] Unknown symbol
>testee>err>   [0x00007fc63c531a92] Unknown symbol
>testee>err>   [0x00007fc63c532640] Unknown symbol
>testee>err>   [0x00007fc63c531a92] Unknown symbol
>testee>err>   [0x00007fc63c5322df] Unknown symbol
>testee>err>   [0x00007fc63c531d7c] Unknown symbol
>testee>err>   [0x00007fc63c531bf7] Unknown symbol
>testee>err>   [0x00007fc63c531a92] Unknown symbol
>testee>err>   [0x00007fc63c531993] Unknown symbol
>testee>err>   [0x00007fc63c52c8d4] Unknown symbol
>testee>err>   [0x00007fc641d80a83] Unknown symbol
>testee>err>   [0x000000000089cff3] dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long)
>testee>err>   [0x00000000008a068a] dart::DartLibraryCalls::HandleMessage(dart::Object const&, dart::Instance const&)
>testee>err>   [0x00000000008cdca0] dart::IsolateMessageHandler::HandleMessage(dart::Message*)
>testee>err>   [0x00000000008f676a] dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool)
>testee>err>   [0x00000000008f6eec] dart::MessageHandler::TaskCallback()
>testee>err>   [0x0000000000a85d9d] dart::ThreadPool::Worker::Loop()
>testee>err>   [0x0000000000a85c26] dart::ThreadPool::Worker::Main(unsigned long)
@mraleph mraleph added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. P0 A serious issue requiring immediate resolution area-kernel legacy-area-front-end Legacy: Use area-dart-model instead. labels Feb 22, 2018
@a-siva
Copy link
Contributor

a-siva commented Feb 22, 2018

@kmillikin it might be a good idea to have somebody in your team run 'out/DebugX64/dart --preview-dart-2 --compile-all tests/language_2/first_test.dart' and shake out any crashes they see.

I found another stack trace running the --compile-all on first_test.dart which might be related

`../../runtime/vm/compiler/frontend/kernel_to_il.cc: 469: error: expected: IsProcedure(procedure)
Dumping native stack trace for thread 88a8
  [0x0000000000b18de7] dart::Profiler::DumpStackTrace(bool)
  [0x0000000000b18de7] dart::Profiler::DumpStackTrace(bool)
  [0x0000000000ded839] dart::DynamicAssertionHelper::Fail(char const*, ...)
  [0x0000000000d431ca] dart::kernel::TranslationHelper::DartProcedureName(dart::kernel::NameIndex)
  [0x0000000000d43afb] dart::kernel::TranslationHelper::LookupStaticMethodByKernelProcedure(dart::kernel::NameIndex)
  [0x0000000000d2d642] dart::kernel::StreamingFlowGraphBuilder::BuildStaticGet(dart::TokenPosition*)
  [0x0000000000d25b04] dart::kernel::StreamingFlowGraphBuilder::BuildExpression(dart::TokenPosition*)
  [0x0000000000d37e4d] dart::kernel::StreamingFlowGraphBuilder::BuildVariableDeclaration()
  [0x0000000000d25d3b] dart::kernel::StreamingFlowGraphBuilder::BuildExpression(dart::TokenPosition*)
  [0x0000000000d27b7d] dart::kernel::StreamingFlowGraphBuilder::BuildStatement()
  [0x0000000000d2a017] dart::kernel::StreamingFlowGraphBuilder::BuildGraphOfFunction(bool)
  [0x0000000000d2b2ff] dart::kernel::StreamingFlowGraphBuilder::BuildGraph(long)
  [0x0000000000d4ec07] dart::kernel::FlowGraphBuilder::BuildGraph()
  [0x0000000000d857c4] dart::DartCompilationPipeline::BuildFlowGraph(dart::Zone*, dart::ParsedFunction*, dart::ZoneGrowableArray<dart::ICData const*> const&, long, bool)
  [0x0000000000d88eb4] dart::CompileParsedFunctionHelper::Compile(dart::CompilationPipeline*)
  [0x0000000000d8b91c] Unknown symbol
  [0x0000000000d8b268] dart::Compiler::CompileFunction(dart::Thread*, dart::Function const&)
`

@mraleph
Copy link
Member Author

mraleph commented Feb 22, 2018

This failure is the same one. Compile-all was crashing ever since we started to use this "invalid-expression" representation for redirecting factories.

@kmillikin
Copy link

There are things in the Kernel file that are not intended to be compiled, so "compile all" isn't ever what you want.

We will solve this by adding a bit that allows you to skip them.

@JekCharlsonYu JekCharlsonYu added this to the I/O Beta 2 milestone Feb 23, 2018
@kmillikin kmillikin added legacy-area-front-end Legacy: Use area-dart-model instead. front-end-kernel and removed legacy-area-front-end Legacy: Use area-dart-model instead. labels Sep 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. front-end-kernel legacy-area-front-end Legacy: Use area-dart-model instead. P0 A serious issue requiring immediate resolution
Projects
None yet
Development

No branches or pull requests

5 participants