Instead of switching over each of the different callback types and duplicating the call-dart-spill-call-runtime-restore in the stub, have the initial runtime call return a function pointer for the runtime call to end that kind of callback. A separate case for tail calls is still needed.
TEST=ci
Change-Id: I691487ca12337ddef1adaeec4c163c56e2feb09e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/488261
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
When running without concurrent marking, the growth policy sets an allocation limit that triggers a blocking GC. When running with concurrent marking, the growth policy sets an allocation limit that triggers the start of concurrent marking, but the mutator will continue to allocate until marking completes. By itself, this would allow the heap to grow far beyond its working set size, so back pressure is applied to the mutator by making it do some incremental marking work in proportion to the amount it allocates. A similar race between mutator and GC exists for concurrent sweep, so make the mutator do some incremental sweeping too.
Cf. 305c3e30c6.
TEST=golem
Bug: https://github.com/dart-lang/sdk/issues/62762
Change-Id: I6f882e6893e1cd3b3591db8cd03b61eb06bfa02f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/486828
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Previously, it would always call the ResumeInterpreter runtime entry
passing null as the value to return to the resumed code. Instead,
appropriately retrieve the to-be-returned value from the stack.
Also fixes IL printing to print constants in non-SSA flow graphs and
adds Interpreter::TraceStackFrames, which prints the top frames of the
current stack, so calls to it can be added for easier debugging in the
future.
TEST=pkg/vm_service/test/async_star_step_out_test.dart
(still fails, but the failure changes due to no longer spuriously
calling get:current after the generator finishes)
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try
Change-Id: Ibb3524d32c8c4e1320f4f9dfd35947eda7d6ca68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/488181
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
With new semispace max size set to 4, active mutators count is limited to 2(from standard 16), which puts significantly less stress on sanitizer infrastructure. Reducing isolates count from 20 to 4 still exercises isolate/thread management in the vm.
Fixes https://github.com/dart-lang/sdk/issues/62845
TEST=ci
Change-Id: Ibec809625719d5f7ab6525b6b0fa29df4c521b3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/487887
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This CL adds a new `can-be-used-as-type` section in the dynamic
interface to expose the type of a class or extension type, without
making them callable or exposing their members.
Details:
* add the new section to the documentation
* add support in the TFA transformation to annotate kernel nodes
* add support to the validator to check for proper usage from dynamic modules
* add CFE, transformation, and end2end tests.
The CL ignores DDC and Dart2wasm at the moment and we intend to approve
any failures. It's possible that DDC works due to its modular nature.
BUG=b/488343137
TEST=cfe, annotator, and e2e tests
Change-Id: I900b22b85950f8ac379eabaa2ef58f075e18519c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/486340
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This change adds initial support for working with isolates in the Dart
Runtime Service and its backends.
The new `IsolateManager` base class tracks the set of active isolates
and their lifecycle events. The `VmIsolateManager` extends this class,
adding support specific to interacting with isolates within the Dart VM.
TEST=vm/cc/DartAPI_InvokeVMServiceMethod*_Exp
Change-Id: I3dfa298722c40dbdfdd58105cc78f31d058dd7a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/486560
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jessy Yameogo <yjessy@google.com>
This change includes an initial implementation of the new VM service
implementation based on `package:dart_runtime_service`, along with the
necessary plumbing to start it in place of the legacy VM service
implementation.
The entrypoint for the new VM service implementation is located in
dart_runtime_service_vm/bin/vm_service_entrypoint.dart, which is
compiled into AppJIT and AOT snapshots when the
`--include-experimental-vm-service` flag is provided to `build.py`. To run
the VM with the new VM service implementation, the
`--experimental-vm-service` flag must be provided.
Currently, the experimental VM service implementation supports:
- User specified ports
- Authentication code flags
- Enabling the HTTP server via SIGQUIT
- Some service protocol RPCs that don't require an isolate ID (e.g.,
`getVM`)
See go/dart-runtime-services-unification for more details.
TEST=Manual
CoreLibraryReviewExempt: dart:_vmservice is private
Change-Id: I4a58cd1fa0a386313baa3d5c5345720231279123
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/484820
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
This lets bloaty attribute the data symbol to its source file, allowing the binary size visualization to nest it appropriately.
TEST=runtime/tools/binary_size
Change-Id: I683ad6729d2fe2e1730dd3be70c6cce15bdf0003
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/486524
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
* Live ranges of non-fixed register temporaries should interfere both
with live ranges of inputs and outputs.
* When serializing a two-byte (non-Latin1) strings, ensure that
characters in the data section are aligned by 2.
However, already written data in the serialization buffer
may be misaligned (as we're writing to a series of buffers), so
write each code unit as separate bytes instead of writing them as
Uint16List.
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Ia9919218e473979529c8af48480a09adc1659b1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/486540
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Adds a new isInvisible flag for both FunctionDeclarations and
ClosureDeclarations and sets it if the function or closure declaration
is annotated with @pragma('vm:invisible'). This way, function visibility
is appropriately recorded even if options.emitAnnotations is false.
The bytecode reader checks for the isInvisible flag when reading
FunctionDeclarations and ClosureDeclarations and appropriately
sets the is_visible flag for the Function object accordingly.
TEST=pkg/dart2bytecode/test/bytecode_generator_test
vm/dart/invisible_function_pragma_test
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try
Change-Id: If435afbe5e74adc022ce064784b6b3e5e8a88164
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/486381
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This adds isRedirectingInitializer and isSuperInitializer to the Initializer hierarchy and adds flags to InvalidInitializer to signal when the InvalidInitializer should be taking as a redirecting or super initializer. This allows us to avoid miscatergorizing such declarations when they are erroneous.
Part of #61700
TEST=existing
Change-Id: If0fabbda10b72304999a5380fce74f9e8fa91ca4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/486180
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
RegExp compiler produces bytecode which might issue PushRegister
before SetRegister - which leads to a use of uninitialized value
under MSAN if these registers are not initialized.
TEST=ci
Change-Id: I011545cf05de62490d71503ea5a60a656a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/485000
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
When using the --dump-kernel-bytecode flag, also print the line and
number of the source position encoded by a synthetic token position.
Also use the decoded value for a synthetic token position when
converting it as a C string for printing, which also makes it easier to
correlate real and synthetic token positions encoding the same source
position.
Also change the long outdated comment about synthetic token positions
not encoding a real source offset, as most if not all uses of them
do actually encode a real source offset.
TEST=manual use during debugging
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try
Change-Id: Ic16e320e9a10d8343e8a37c8270c7076bb7052c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/484943
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
The unique IDs are assigned during VM-specific lowering transformation
and recomputed during TFA tree shaking.
The IDs are not assigned when local function AST nodes are created
as it makes certain AST transformations very fragile (e.g. moving
a sub-tree to another parent, cloning a tree to insert into another
member).
The IDs will be used to identify local functions within a member by
the VM and different compilers (dart2bytecode, modular AOT).
TEST=ci
Change-Id: Ifa5dc007322a0137776961d364bbf8565137b318
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483840
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Add __VA_OPT__ to guard the trailing comma, since we use
the /Zc:preprocessor flag.
Remove the conditional guard, since __VA_OPT__ is the
portable way of doing this in C++20, and we target that
version of the language standard when compiling.
TEST=build on vm-msvc-win-x64,vm-msvc-win-arm64
Cq-Include-Trybots: luci.dart.try:vm-msvc-win-arm64-try,vm-msvc-win-x64-try
Change-Id: I5b718858300d72679e9c8bced5f1419e206a2e94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/484621
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Simplify isolate group enter-exit logic in EmitModuleSymbolsFor: always
call it without an active isolate group. Make sure that we
destroy StackZone before trying to exit the isolate.
Skip unit test with deferred units on Mac OS: as we don't support
deferred units when writing out Mach-O files currently.
TEST=ci
Change-Id: I8a8615f045781f263c92c45eecf955366a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483760
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Current implementation of profile data streaming inherited its
approach to symbolization from the implementation of vm-service's
get{,Perfetto}CpuSamples methods. These methods rather expensive
as they rely on CodeLookupTable to symbolize collected samples, and
constructing CodeLookupTable requires bringing all threads to safepoint
and iterating over old-space to collect code objects. This can take
significant amount of time - especially when old-space is large (e.g.
consider 1Gb+ heaps of Dart Analysis Server).
This CL rewrites profile data streaming to use a completely different
approach in AOT mode where Dart frames are not symbolized eagerly
and instead stored in the timeline in their raw form: a pair of
an isolate group specific Mapping and a PC value relative to the start
of that mapping. At the end of streaming (or when isolate group
exits) an additional ModuleSymbols packet is emitted which provides
symbolization information for all collected frames. ModuleSymbols
mappings can be cheaply constructed from collected PCs using
ReversePc lookup tables.
TEST=expanded existing tests
Change-Id: I56ef1dd4c9a17fb0d2e9c24e51f2e4656a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482782
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
This allows a great deal of linker GC resulting in a much smaller binary. The benefit multiplies for Flutter development because the Flutter tool downloads many variant copies of gen_snapshot.
out/ReleaseX64/exe.stripped/gen_snapshot -1.55M (-23.4%)
TEST=ci
Change-Id: I9f6e650f78ea52c9c6953320a669b71019403236
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482965
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Drop libprotobuf dependency and update compile_perfetto_protos
to rely on externally provided protoc and protozero_plugin.
This is done because protoc does not build with our current
toolchain and fixing this build requires rolling new protobuf,
protobuf_gn and perfetto. Which also pulls more external dependencies
like abseil.
Regenerate Perfetto *.pbzero{.cc,.h}, *.dart files
TEST=ci
Change-Id: I11a32aa07e810b48ac12502e526bbaee6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482781
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>