The DartRuntimeService based VM service implementation now has support
for launching DDS instances and responding to _yieldControlToDDS RPC
invocations from DDS instances.
package:vm_service test suite is ~97% passing with this change.
TEST=Local testing.
Change-Id: I2f2f1b0926845134578f08d073ed7606f1fc4173
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490320
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
This is a reland of commit 88496ba1c3
Fixes on top of the original change:
* Closure layout is changed to avoid gap between fixed fields and
variable-length elements on compressed pointers architecture.
This gap was causing crashes in the GC when scanning closure
objects.
* pkg/vm_snapshot_analysis/test/instruction_sizes_test is fixed
on arm64 by decreasing threshold for detecting size changes.
Original change's description:
> [vm,dart2bytecode,modular_aot] Variable-length closure objects
>
> Extend closure objects with variable number of elements to capture.
> This is needed to support capturing multiple independent contexts
> after capturing is computed in the front-end.
>
> The following fixed Closure fields are moved into variable-length
> elements:
> - delayed type arguments;
> - instantiator type arguments;
> - function type arguments;
> - context.
>
> Number of elements and presence/indices of various type arguments
> are encoded into the new length_and_flags field in the Closure.
>
> Most closure objects don't need any of the type arguments so this
> change will reduce average Closure object size.
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/61572
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I8685e632e2d0832766ecdc470f3cf9a6b880de48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494243
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
The handling of entry frame in PrintStackFrames was broken, now it's
fixed.
In addition, the stack printer now print various info about the static
slots in stack frames, as well as printing out the objects in slots.
Now that entry frames are handled properly, printing with no limit
prints _all_ stack frames on the interpreter stack, noting call
boundaries as they are passed, instead of stopping at the closest
entry frame.
Move the separator between frame from the stack pointer for a frame
to the frame pointer for a frame, meaning that the metadata before
the frame pointer is printed as part of the previous frame, not the
current one.
TEST=ci (manual testing while debugging)
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try
Change-Id: Ia2ad07c832b791f0c2ce2bbdfbfc32d5d8968476
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493402
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Extend closure objects with variable number of elements to capture.
This is needed to support capturing multiple independent contexts
after capturing is computed in the front-end.
The following fixed Closure fields are moved into variable-length
elements:
- delayed type arguments;
- instantiator type arguments;
- function type arguments;
- context.
Number of elements and presence/indices of various type arguments
are encoded into the new length_and_flags field in the Closure.
Most closure objects don't need any of the type arguments so this
change will reduce average Closure object size.
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/61572
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: I7ca5cec0fd8725c432a01d51781fb14e803997dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489482
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Fix the following cases of incorrect optimizations:
* In TFA, when anlyzing a dynamic call with unknown receiver type,
do not assume that all possible targets can be computed at compile
time (if there can be dynamically loaded classes).
* In the AOT, disable optimizations for dynamic calls with unique
selectors (if there can be dynamically loaded classes).
TEST=pkg/dynamic_modules/test/data/dyn_call_from_host
Change-Id: I39d620aae3c116de03d4a2a3fd61864d88c48c8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493960
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Remove special case for null in message snapshots; snapshots are sometimes read or written with no current isolate group.
Currently still all copies pointing into the VM isolate.
TEST=ci
Change-Id: I4d2e35a01880885d4e92e1c623c0f39a35e06065
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493866
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Remove special case for null in message snapshots; snapshots are sometimes read or written with no current isolate group.
Currently still all copies pointing into the VM isolate.
TEST=ci
Change-Id: I6fa47b2c04b0abaae74210c86f9fdf17ec932db7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493222
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Instead of using the Function String-creating methods, use the
Function CString-creating methods which avoids allocation that
causes issues when called from within the interpreter (especially
in debug mode, where asserts are triggered).
TEST=ci
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try
Change-Id: Ic43a831a6ec1ee4327e1fdf4dfc64bd09af5c04a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493801
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Tess Strickland <sstrickl@google.com>
Serializing the object stored in a handle may require allocation, so
serialization of the current (weak) persistent handles should not be
done under a no safepoint scope.
Instead, retrieve the stored objects and any needed metadata for the
current (weak) persistent handles under a no safepoint scope, and then
separately serialize the retrieved information outside of that scope.
Fixes https://github.com/dart-lang/sdk/issues/62978.
TEST=vm/cc/Service_PersistentHandles on vm-dyn-*, which revealed this
issue.
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try
Change-Id: Ie9e32c758140aaebc7bd87a704119a8b82d0f8a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/491300
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This is an internal header file of the ICU4C library and should not be
included directly (it gets transitively included by the public header
files of the library).
TEST=ci
Bug: cl/891754607
Change-Id: I5ece920c7ced706fa32912cf23518e46c8c68b92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/491900
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This change fixes the following problems when parsing DART_VM_OPTIONS
environment variable:
* Resize vm_options to accomodate for extra flags from
DART_VM_OPTIONS.
* Prepend executable name to the argv to be compatible with
implementation of Platform.executableArguments.
* Use strchr instead of strtok_r to avoid modifying value of
DART_VM_OPTIONS environment variable in place.
TEST=pkg/dartdev/test/commands/compile_test.dart
Fixes https://github.com/dart-lang/sdk/issues/62957
Fixes https://github.com/dart-lang/sdk/issues/62958
Change-Id: I86e0ece20844888333b2a0765c82a5ad1fba54b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/491001
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
When instantiating a closure, allocate a new closure object in
the same boostrap native method as checking bounds.
This simplifies code generation and prepares for variable-length
closure objects by removing the only place where closure of unknown
length was allocated in the generated code.
TEST=ci
Change-Id: I9ac51c862081612bca2160699ebe24526d4fc915
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490360
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Prior to this change, the VM service isolate was configured to execute
`main` directly. This resulted in unexpected behavior around exceptions
thrown after the first asynchronous gap, which were unhandled but caused
the service isolate to exit silently with no error.
This change updates how the service isolate starts execution by
invoking `main` via `dart:isolate`'s `_runMainIsolate` method, similar
to how user isolates and the DartDev isolate start execution. This
results in the message handler being triggered, meaning the microtask
queue will be processed correctly and unhandled exceptions in
asynchronous contexts being reported.
TEST=Local testing with exceptions explicitly thrown from within the VM
service
Change-Id: I69475a86d923489fa216bc8e939a2726cf3ff2e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490220
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Target process and the recorder might be running in different working
directories so request to start recording should always use absolute
path.
This also cleans up how file recorders are created: it does not make
sense to create the recorder and the check if we can open the file
(in fact: creating recorder and failing to open file will cause
deadlocks). Thus this CL changes the code to first open the file
and only if we succeeded creates the recorder.
Fixes https://github.com/dart-lang/sdk/issues/62959
TEST=extended existing tests to cover this
Change-Id: Ib9d88ce23d93bcc5d6335ba1daebad2e6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490160
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
The `Match.operator[]` does the same thing and is
generally recommended (and shorter).
(I want to deprecate `group` and `groups`)
Tested: Refactoring.
CoreLibraryReviewExempt: Calling equivalent function.
Change-Id: I4c758968ae622fe16b7322be1b29b05b91e7fcd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489021
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
In AOT mode, when call site is transitioned from monomorphic state
(with receiver cid1) to polymorphic (with receiver cid2),
there is an optimization which checks if all _allocated_ classes
in the class id range cid1..cid2 have the same dispatch target.
If so, a specialized SingleTargetCall stub is used.
The problem is that 'allocated' bit is only set during precompilation,
and dynamically loaded classes were not considered as valid receiver
classes by this optimization.
As a result, the following situation could happen:
cid1 < cid3 < cid2,
cid1 dispatches to target1
cid2 dispatches to target1
cid3 should dispatch to target2, but it is still in range cid1..cid2 and
SingleTargetCall stub would incorrectly dispatch it to target1.
The fix is to treat all dynamically loaded classes as allocated when
checking for single target optimization.
TEST=pkg/dynamic_modules/test/data/single_target_cid_range_dispatch
Fixes b/493677699
Change-Id: I42e407385a5d9b0a4a1017f713b47587c3c6a818
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/488920
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>