Commit Graph

536 Commits

Author SHA1 Message Date
Alexander Aprelev e3fb81af38 [vm/debugger] Include vars into async activation frame json.
Before this change async activation frames didn't have local variables included into service json response, so user didn't see those local variables when paused at breakpoint in those frames.

Bug: b/159433735
Change-Id: Icdec6c8c0ef17541ef89e113d2f75718e4b35a0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152103
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-24 19:31:09 +00:00
Ryan Macnak 16253c0a54 [vm] Fix LSAN when used without ASAN.
Mostly interesting on Mac, where ASAN does not include LSAN.

Bug: https://github.com/dart-lang/sdk/issues/41811
Change-Id: Icbbe57946a6d3b3406a9e3a6541b6c4958cbfa91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147685
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-12 17:38:19 +00:00
Ryan Macnak 6fe15f6df9 [vm] Represent tagged pointers as C++ value types instead of C++ pointer types.
This works around bugs in UndefinedBehaviorSanitizer and Clang.

Bug: b/28638298
Change-Id: I6be595f9664516019d28017d24559583a1ae3a21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144354
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-04-25 05:21:27 +00:00
Vyacheslav Egorov a41a1dc917 [vm/compiler] Split compiler sources out of normal VM sources.
Make them form its own source set (libdart_compiler) and completely exclude
them from AOT runtime targets.

Previously we had some inconsistencies, with some files were using
DART_PRECOMPILED_RUNTIME to fully or partially exclude either contents
from their headers or from implementation, while other files did nothing
and relied on linker to throw their contents away.

This change tries to address this inconsistency.

A follow up change would include a check in most compiler headers which
would prohibit to use them while building AOT runtime.

Change-Id: Ief11b11cbc518b301d3e93fce80580a31bbad151
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142993
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-04-16 22:59:03 +00:00
Régis Crelier 5701c4fd3b [VM/nnbd] Remove propagation of library mode to runtime after spec change.
On 1/27/20, the nnbd specification changed weak and strong mode instance checks
to make them behave uniformly across legacy and opted-in libraries.
Therefore, it is not necessary anymore to propagate the library mode in
generated code to the runtime.

Change-Id: I42d3ddc6e9a921899aeac21be6374c7893a6d27c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138111
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2020-03-03 20:30:32 +00:00
Régis Crelier fd20c7b92b [VM/nnbd] Print nullability of types by default.
Only '?' is shown by default.
To print '*' and '%', use debugging flag --show-internal-names.
Fix expectations in tests.

Change-Id: Idc60fbfb4d477602eb0c713f4bdcc1e573a3328a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135790
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2020-02-20 21:43:25 +00:00
Jens Johansen c6aa3a22a7 [vm] [debugger] Fix for not breaking in library with mixin
In the VM, a single script can belong to several libraries because of
mixins.

Previously, when setting a breakpoint, it found the function to set the
breakpoint in by taking the "scripts library" (script.FindLibrary) and
then tried to find a function in that library that matched.
Sometimes it found the "wrong" library and the breakpoint thus wasn't
set.

This CL changes that so it goes though all libraries, finds all maching
libraries and tries all of them.

This solves the issue at hand, but might not solve all corner-cases.

This added test demonstrates the resolved case where before it would
just say that it couldn't add the breakpoint on line 13.

Change-Id: Ie44b0dfb4ea3e8de767d1867ec432b2aef429b76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133592
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-02-04 08:43:21 +00:00
Ryan Macnak a067265272 [vm] Scrub and qualify names without allocating on the Dart heap.
Sometimes we needs to produce these names in a NoSafepointScope, such as when generating a snapshot.

Bug: https://github.com/dart-lang/sdk/issues/40143
Change-Id: I0d66134c936313b16c38f8699b33a7c7bd443e75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133153
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-01-24 20:36:18 +00:00
Clement Skau e047ece7e7 [SDK] Fixes stack trace service API tests.
Fixes an issue where stack['asyncCausalFrames'] would be populated in
if --lazy-async-stacks was set.
The field should be filled iff the stack contains an async function -
regardless of whether it's sync-async.

Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: Ia68f113402962c07a1e9a38ea9320b44140241e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132820
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-01-22 15:14:58 +00:00
Martin Kustermann 9520235bfe [vm/async] Ensure all service tests run with both, --causal-async-stacks/--lazy-async-stacks
Running all existing tests with/without lazy async stacks ensures that
the existing functionality for --lazy-async-stacks does not regress.

There are still a few smaller things to be done in the debugger for lazy
async stacks.

This CL also ensures:

   * The inner closure, i.e. AsyncClosure/AsyncGenClosure, is not
     inlined if FLAG_lazy_async_stacks is on.

   * Fixes a crash in dartkb mode, when the function of the Bytecode
     object is null.

   * Does a simple integration of the lazy async stacks in debugger.cc -
     to ensure a stack is returned via vm-service.

Issue https://github.com/dart-lang/sdk/issues/37668

Change-Id: Ibc1e887a457e2c456ae65d9ed5fa92434f122a32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131825
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-01-16 12:47:03 +00:00
Martin Kustermann 72f4a831aa Revert "[SDK] Switch to is_sync to identify sync/async running."
This reverts commit 886615d0f9.

Reason for revert:

There was an unexpected slowdown in some async benchmarks, e.g. Calls.AwaitAsyncCall.

Will revert for now and investigate next year.


Original change's description:
> [SDK] Switch to is_sync to identify sync/async running.
> 
> This should address the regression introduced by https://dart-review.googlesource.com/c/sdk/+/124988
> 
> Bug: https://github.com/dart-lang/sdk/issues/39525
> Change-Id: Id163b649bdd0363297c186559fa84ff87f908e4b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129062
> Reviewed-by: Clement Skau <cskau@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Clement Skau <cskau@google.com>

TBR=kustermann@google.com,cskau@google.com

Change-Id: I5cda795cbccc01f22e0f8192473c171a4e9fca4b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/39525
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129285
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-12-20 19:06:54 +00:00
Clement Skau 886615d0f9 [SDK] Switch to is_sync to identify sync/async running.
This should address the regression introduced by https://dart-review.googlesource.com/c/sdk/+/124988

Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: Id163b649bdd0363297c186559fa84ff87f908e4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129062
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2019-12-20 11:07:10 +00:00
Régis Crelier b92fefdfe9 [VM/nnbd] Pass nnbd mode from compiler via generated code or bytecode to runtime functions performing type checks or type reification.
This continues the work started in https://dart-review.googlesource.com/c/sdk/+/124105
The nnbd mode is now part of the type arguments instantiation cache,
since the resulting vector depends on the mode.

Change-Id: I803c07fa9473024557db8585e87286f16681169a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128307
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2019-12-20 03:26:29 +00:00
Jens Johansen 8d11c1dce6 [kernel][vm] Add uris only from mixins to libraries sourceReferences
index to fix VMs coverage issue

This CL fixes the VM not always reporting coverage for mixin usages
properly.

* When asking the VM for coverage you can do it in one of two ways
  * Ask the VM for coverage for everything; or
  * Ask the VM for coverage for a specific script
* Asking the VM for coverage for everything works perfectly fine.
  The VM goes through everything and reports coverage correctly.
* Asking the VM for coverage for a specific script (which is, at least
  now, what the flutter tools does) doesn't work in the simple mixin
  case described at http://dartbug.com/39779: The VM goes through the
  libraries, asking for the list of scripts they "know about",
  and checks for matches against what you asked for.
  In this case, when asking for 'master.dart', the library for
  'lib.dart' says no when it shouldn't --- because of the way the mixin
  transformation works the content is actually in lib.dart.

This CL updates the content of the field 'sourceReferences' on Library
to fix the issue.


Fixes #39779

Change-Id: I0c38a323c81d1784ade704837b67ece549fc95d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128585
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-12-19 06:59:28 +00:00
Zichang Guo 11b35c166b [vm/debugger] --trace-debugger-stacktrace prints async causal stack trace
Allow --trace-debugger-stacktrace to print frames in async causal stack trace.

Change-Id: I52bcbcbb22ed939074b682ce18e328df775ea0b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128282
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-12-12 23:05:51 +00:00
Ryan Macnak f4e44dd705 [vm] Make kernel buffers live exactly as long as their derived views.
When creating a KernelProgramInfo, we create several logical views into the kernel buffer. These are fresh ExternalTypedDatas, rather than proper TypedDataViews, so they do not automically keep the original ExternalTypedData alive. Create an explicit reference to the orginal ExternalTypedData in the KernelProgramInfo. When creating snapshots, this reference is ignored/null'd and the views are turned into copies, effectively dropping the parts of the original buffer that do not have views.

Fixes a leak with reload and a use-after-free with eval.

Bug: https://github.com/dart-lang/sdk/issues/33973
Bug: https://github.com/dart-lang/sdk/issues/39610
Change-Id: I09d3830133314ccbaa0341d904127c2b6925c4ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126825
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-03 22:00:48 +00:00
Martin Kustermann aceeba7567 [vm/async] Encode the yield index -> token position in PcDescriptors.
Right now `Script::yield_positions()` is an array mapping function start
token positions to arrays. Those arrays contain token positions and are
indexed by yield index.
  => This `Script::yield_positions()` is not available in AOT mode.

The fast async stack implementation will need to be able to find out
where an async closure was suspended. It does so by looking at the
":await_jump_var", which contains the yield index. It then needs to
associate the yield index to token position of the yield.

This CL adds an entry into the PcDescriptors for every yield in a
async/async* function and removes `Script::yield_positions()`.
The entry will associate the yield index with the token position.

Flutter gallery total size impact for flutter-release:

  - armv7: +0.016%
  - armv8: +0.045%

Issue https://github.com/dart-lang/sdk/issues/37668

Change-Id: I0b2ce41e85d8f5d590201bf2fb091578d7379890
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125408
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-11-18 11:50:13 +00:00
Régis Crelier 8617da2bf0 [VM/nnbd] Pass NNBD mode to runtime functions whose semantics depend on it.
Runtime functions do not yet implement the NNBD semantics.
In a next change, generated code will pass NNBD mode to the runtime.
Declare one new VM flags: --strong-non-nullable-type-checks

Change-Id: I050a468e4a6b665ce46c345bafba04a947cf7cb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124105
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-11-16 02:49:48 +00:00
Ryan Macnak b39ab2e6ac [vm] Don't unroll initialization code based on macro lists.
-47k (-0.20%) out/ProductX64/exe.stripped/dart
 -8k (-0.17%) out/ProductX64/exe.stripped/dart_precompiled_runtime

Change-Id: Id3f6c451acf69ba7965ae51a0a3c4a8aa9ab1d73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115775
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-14 19:11:38 +00:00
Samir Jindel 6c5033acac Re-land "[vm/async] Don't add an <asynchronous gap> marker along sync-async calls."
Original change is in patchset 1.

The issue was that the expected "_Closure.call" frame is not always present.

Change-Id: I91116861e785a72536dde300f4771de4f6fa9d3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124988
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-14 15:29:16 +00:00
Régis Crelier b5110a59a9 Revert "[vm/async] Don't add an <asynchronous suspension> marker along sync-async calls."
This reverts commit f4d930997b.

Reason for revert: Different tests are failing on different bots.

Original change's description:
> [vm/async] Don't add an <asynchronous suspension> marker along sync-async calls.
> 
> This fixes `package:stack_trace` in the sync-start case of async/async* calls.
> 
> Change-Id: I5c41a35283439f533ab19c9fd1cc542931de4b43
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124560
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,sjindel@google.com

Change-Id: Ib3e1b303613f0393dac6b1b81e8d1ffb322052b8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124800
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-11-11 19:03:54 +00:00
Samir Jindel f4d930997b [vm/async] Don't add an <asynchronous suspension> marker along sync-async calls.
This fixes `package:stack_trace` in the sync-start case of async/async* calls.

Change-Id: I5c41a35283439f533ab19c9fd1cc542931de4b43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124560
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-11 16:36:43 +00:00
Liam Appelbe c154677699 [vm] Handle trivial initializers for late fields
Bug: https://github.com/dart-lang/sdk/issues/38841
Change-Id: I9db9d4815ad27f3f97d43a7a9f1fb74f08673528
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124201
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-11-06 17:46:32 +00:00
Alexander Markov 8b67fcbbd1 [vm] Cleanup script tags
VM creates Script objects with kKernelTag only, so this CL cleans up
all uses of script tags and Script::kind() along with code
which is no longer reachable.

Change-Id: Ia765e7757264aa614e18eddd16d21937f855c129
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123889
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-11-01 19:08:42 +00:00
Samir Jindel c885bdde1d [vm] DBC is obsolete. Remove dead code.
Change-Id: Ica33af158cca53c8e951e4b2582de83660e8a60d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121851
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-27 18:18:29 +00:00
Zichang Guo 418b646749 [vm/debugger] not pausing exceptions on implicit throw
Ignoring exceptions that coming from implicit throw. For example, try finally block will generate an implicit throw inside finally block to rethrow the exception.

Bug: https://github.com/dart-lang/sdk/issues/37645
Change-Id: I5c4f90ec3c9aa92bb670d4bb9a8edb332f7b32fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118911
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2019-10-05 00:33:32 +00:00
Ryan Macnak e6574a7964 [vm] Add --show-invisible-isolates.
Useful for profiling the vm-service and kernel-service isolates.

Bug: https://github.com/dart-lang/sdk/issues/38553
Change-Id: I9cc562b5089ad01a5f797799d1105a4a8cf910e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118650
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-09-25 21:41:55 +00:00
Zichang Guo 77ff89b223 [vm] disallow breakpoint on non-debuggable library
There is no clear defination on setLibraryDebuggable in rpc. But obviously breakpoint should be not set and hit if library is not debuggable. Correct this behavior.

Bug: https://github.com/dart-lang/sdk/issues/36914
Change-Id: Ic75f89055eeb69279a504366fe35f3e98b173abf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118340
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-09-23 15:31:28 +00:00
Régis Crelier c1d0ca7518 [vm/bytecode] Minor cleanup.
Print more information after detecting a fatal context mismatch in the debugger.

When generating the line start of a script, first resolve scripts marked for
'lazy lookup' before looking up dart:* scripts.

Delete redundant ifdef/endif pair.

Change-Id: Icd7bd44bf8367fbc306b298246783e22e526be38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117380
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-09-16 20:37:11 +00:00
Alexander Markov 7ee192e7c7 [vm/bytecode] Do not create bytecode CodeBreakpoint if interpreter is not enabled
In configurations like simdbc, where interpreter is not available
creation of bytecode CodeBreakPoint causes crash when Interpreter::Current() is
called from CodeBreakpoint::SetBytecodeBreakpoint().

This change fixes vm/cc/FunctionWithBreakpointNotInlined with bytecode in
dartk-reload-mac-release-simdbc64 configuration.

Change-Id: I776d4b93d78fcb38cbefab66629afa528e904d54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117206
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-09-13 21:47:45 +00:00
Zichang Guo 59bcc4ea1e [vm/kernel] record yield positions at streaming flow graph builder
Collect yield positions inside StreamFlowGraphBuilder. BuildGraph() when yield_positions() are required. All yield positions will be stored into script as a hashmap. Key of hashmap is the starting token position of function, value is an array containing all yield positions.

Bug: https://github.com/dart-lang/sdk/issues/37635
Change-Id: I6d301d1cb0f74c432f855c9dbc20ac2c13acb07f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116743
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2019-09-12 16:37:16 +00:00
Ben Konyi e6887536aa [ VM ] Ignore contexts which have been optimized out during stack overflow checks
Fixes https://github.com/dart-lang/sdk/issues/38182

Change-Id: I2b042b9a320e16fc88bee6ea2c0c93598e574c00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115880
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-09-12 01:20:05 +00:00
Régis Crelier 596a4ab14d [vm/bytecode] No need to set breakpoints in bytecode if interpreter is not used.
Breakpoints are still set in compiled bytecode.
When the interpreter is used, breakpoints are set in both interpreted and
compiled bytecode, as before.
This fixes service/breakpoint_async_break_test in app-jit mode.

Change-Id: Ia60f6f99497821b476b664fe8b86ee4aa15748a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116840
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-09-12 01:01:35 +00:00
Régis Crelier 64360e9f1a [vm/bytecode] Do not expect _ClosureCall in interpreted async stack traces.
In interpreteted bytecode mode, _AsyncAwaitCompleterStart does not use
_ClosureCall to invoke the async_op function. Adjust expectations in debugger
when collecting async stack trace.
Refactor computation of try_index in interpreted mode.

Fixes service/pause_on_unhandled_async_exceptions_test in interpreted mode.

Change-Id: Id13c36e2616e55911f77eb4db2591861d337d24a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116556
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-09-10 21:52:38 +00:00
Régis Crelier 9fccb5120b [vm/bytecode] Fix clobbering of exception handler types in bytecode reader.
This fixes service/pause_on_unhandled_async_exceptions_test in compiled bytecode
mode, but not yet in interpreted bytecode mode.
Improve debugger verbosity.

Change-Id: I89e32179b0a3f043716d5117f958bf6a0de3ccac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116483
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-09-10 02:03:39 +00:00
Régis Crelier c0f49b05dd [vm/debugger] Pick the correct context async variable in bytecode frames.
Variable descriptors constructed from bytecode have all variables of
enclosing functions, even shadowed by the current function.
Pick the variable with the highest context level.

This fixes service/regress_28443_test.dart failure in bytecode mode.

Change-Id: Ifd0db566b5e74d29075ed17e91810ffe6953af77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116140
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-09-07 01:08:19 +00:00
Martin Kustermann a64b06ec83 [gardening] Migrate most files to be implicit-bool-conversion free
Issue https://dart-review.googlesource.com/c/sdk/+/115701

Change-Id: Ib579f0bbc8d694aec74afd837217316a10baf910
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115707
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2019-09-05 21:41:42 +00:00
Régis Crelier 15c1487874 [vm/bytecode] Allow breakpoint on rethrow; mark closures as debuggable or not.
Generated rethrow statements do not require a 'DebugCheck', but explicit rethrow
statements do, so that user breakpoints can be set on rethrow.
Add a IsDebuggable flag on bytecode closures and set it properly.
Remove unused code in a service test.
Add verbosity to debugger.

Change-Id: Ia436cbe62e38cfaec6f9fdf7f8cc2ee5607228e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115602
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-09-04 23:56:16 +00:00
Régis Crelier 1f9ef866a5 [vm/debugger] Properly handle 'force-optimized' functions in debugger.
The debugger and runtime should not try to deoptimize 'force-optimized'
functions. This fixes #38108.

Change-Id: I74e24d8fb4793e4560267c2cb32ac40caa95bf35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115014
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-08-30 21:28:48 +00:00
Régis Crelier dda69953e2 [vm/bytecode] Debugger should not signal breakpoint resolution twice.
If the debugger has already signaled the resolution of a breakpoint in a
bytecode function, it should not signal its resolution in code again.

This fixes test service/breakpoint_async_break_test

Change-Id: I88743b65eb3049a1a9476cb67f17ebf4275f8455
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114923
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-08-29 00:51:35 +00:00
Régis Crelier 726762c4bd [vm/bytecode] Remove source information from setAsyncThreadStackTrace in prolog.
Removing source information for this call prevents the debugger to set a
breakpoint in compiled bytecode on this call which occurs prior to the first
DebugStepCheck in the function.

However, this change uncovered a bug in debugging interpreted bytecode:
The first source range of an async_op function gets split into 3 ranges, with
the middle range specifying a NoSource token position. The debugger does not
set a breakpoint in the first range, because DebugCheck is not yet encountered,
which is correct, but it failed to look for another range (the 3rd one) with the
same token position.

Change-Id: I11dcc75d115cb57b37f62afd83c783cf563b63e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114700
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-08-27 22:45:52 +00:00
Régis Crelier 4210112bfd [vm/debugger] Increase verbosity of --verbose-debug when setting breakpoints.
This helped investigate an async* issue.
Also rename 'BP' to 'breakpoint'.

Change-Id: Ie4f59c47b4282a4e19713e41afe996cfca55a16c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114462
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-08-26 17:27:04 +00:00
Samir Jindel 43417df9c7 [vm/ffi] Fix crashes on stacktraces and debugging with force-optimized frames.
Issue https://github.com/dart-lang/sdk/issues/37910

Change-Id: I76630fbc6733712c8709b782619a76190c70bfd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113999
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-08-26 10:18:34 +00:00
Régis Crelier 06d3769ac6 [vm/bytecode] Correctly resolve breakpoints in inner functions.
Also deoptimize before setting breakpoints into bytecode functions as they
may get compiled and optimized.

Change-Id: Ida049d2aafbe1a484f102b57c77c91d562adef76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114305
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-08-23 01:38:22 +00:00
Alexander Markov d5a9a732a5 [vm/bytecode] Register closure functions in the object store's list of closures
Change-Id: I3917c1725d51b70dcf84f358a588a6cf79c452b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114041
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-08-22 23:54:42 +00:00
Régis Crelier 223724fa76 [vm/bytecode] Lookup source and line starts for bytecode scripts specifying uri only.
Collect token positions of field declared in bytecode.
Improve debugger debugging: Disassemble both bytecode and code when applicable.

Change-Id: I56188cf24ef4bfe8a93cce11c2f4505152abdd02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112680
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-08-22 18:31:18 +00:00
Ryan Macnak 6e2b3f0326 [vm] Greatly reduce handle allocation during reload.
Saves 10ms from non-empty reloads of Flutter Gallery.

Change-Id: If9a1f9970d562f8fd7996de875dfe231350efaa9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113282
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-08-20 00:49:52 +00:00
Alexander Markov f87237c4e4 [vm/bytecode] Check context level when accessing await jump variable in debugger
Change-Id: I31250140d8410122c8358c16c4acf34833fe6852
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112982
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-14 16:31:19 +00:00
Alexander Markov e35e8833ee [vm/bytecode] Take context level into account when accessing async context vars
Previously this was done only for interpreted frames. However, this
adjustment should be done for both compiled and interpreted frames
coming from bytecode.

Change-Id: Ia832f1cc2d0cf8e2b4ed736257abfc501f928e3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112983
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-14 15:13:39 +00:00
Alexander Markov 449446571f [vm/bytecode] Collect context levels for compiled code generated from bytecode
Change-Id: Ia2047440e05fce3263f8feb38be4cedd4357ab10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112920
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-08-13 20:32:49 +00:00