Fix imprecision in Zone::SizeInBytes that was finally noticed by vm/cc/AllocateZone because the size of the initial inline buffer changed.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/47399
Change-Id: I152d24d03a59b21267a9a24e5d929b51af57af71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215980
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This reverts commit b5922e6db4.
Reason for revert: vm/cc/AllocateZone fails on Mac
Original change's description:
> [vm] Streamline Zones.
>
> - Don't put a HANDLESCOPE right after a StackZone, as there's no state worth restoring
> - Remove remaining zone bookkeeping dead since e3a9d70591.
> - Remove unnecessary resetting of handle blocks before zone deletion.
> - Shrink initial chunk size to make Zone's overall size fit in a faster malloc size class.
>
> TEST=ci
> Change-Id: I920e12f5af93aa71fb876435764c60df485215f9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212261
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
TBR=rmacnak@google.com,asiva@google.com
Change-Id: Id23dcebb781791616e48e54d2dcd7e58159178bc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215943
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
- Don't put a HANDLESCOPE right after a StackZone, as there's no state worth restoring
- Remove remaining zone bookkeeping dead since e3a9d70591.
- Remove unnecessary resetting of handle blocks before zone deletion.
- Shrink initial chunk size to make Zone's overall size fit in a faster malloc size class.
TEST=ci
Change-Id: I920e12f5af93aa71fb876435764c60df485215f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212261
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Since bbefc05748, both serialization formats in the VM are based on clustering. The distinguishing feature of the older clustered serializer is that it represents apps/programs rather than messages.
TEST=ci
Change-Id: If3185c21c6aadeec61a940b12ba23d17f2752761
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211501
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
As part of deprecating support for native extensions we are also
migrating away from legacy VM-specific `native 'name'` syntax
towards metadata based encoding which does not require any special
syntax.
This CL is a step 1 in migration:
- introduces support for `@pragma('vm:external-name', 'name')`
which serves as a direct replacement for `native 'name'`;
- all core libraries and tests are migrated to use the annotation;
Once this CL lands and rolls we will edit internal and external embedders
to eliminate uses of the native keyword (step 2) and finally remove
support for native keyword across our parsers (step 3).
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/28791
Change-Id: Id6dea878db82dd4fd81149243c425b5c5dc6df86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212461
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Add missing checks for FFI types disallowed in isolate messages.
Align error messages with the other serializer and test expectations.
TEST=ci
Change-Id: I3813dd8f26e5122524bdf41f9ce6e0785fdd260b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209840
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This flag allows dumping timings of various precompiler passes.
TEST=precompiled dart2js with --print-precompiler-timings
Change-Id: I54d6fdf26c25a0e43ae4f2717e833e09e9321d81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198407
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Changes Dart_NewWeakPersistentHandle to no longer auto delete the
weak persistent handle.
Changes the signatures of WeakPersistentHandleFinalizers to no longer
have access to the handle.
Flutter PR: https://github.com/flutter/engine/pull/19843
g3 presubmit: cl/318028238
Issue: https://github.com/dart-lang/sdk/issues/42312
TEST=runtime/vm/dart_api_impl_test.cc
Change-Id: I3f77db9954d9486759f903b78c03a494f73c68ba
Cq-Include-Trybots:dart/try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-linux-debug-x64-try,analyzer-nnbd-linux-release-try,front-end-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151525
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Core snapshots should be agnostic to the sound null safety mode
(so they can be used both in weak and strong modes), and snapshot
writer verifies that.
Snapshot::kFull was previously used both for core snapshots and
app snapshots on ia32. However, app snapshots are not guaranteed to
be agnostic, which appeared as failures on a few test on ia32.
Also, VM should be able to detect null safety mode from app snapshots,
even if they do not contain code, but null safety mode was not
written into features string of kFull snapshots.
In order to disambiguate core snapshots, a new Snapshot::Kind is
added. Snapshot::kFullCore works exactly as Snapshot::kFull, except
for verification of agnostic null safety and snapshot features string
omitting null safety mode. All snapshots except kFullCore now have
null safety mode included into their features string.
Fixes https://github.com/dart-lang/sdk/issues/43626
Issue https://github.com/dart-lang/sdk/issues/43613
Change-Id: I8cd3b049ef4e428dd5e1ce666d4c7aa3b596d70c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166308
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
All *WriteStream classes are now part of the same hierarchy:
class BaseWriteStream : ValueObject;
Base class for all *WriteStreams. Provides all the methods from
the old WriteStream except for buffer() and SetPosition()
(relegated to NonStreamingWriteStreams). Has one pure virtual
method Realloc that must be overridden by concrete subclasses.
class NonStreamingWriteStream : BaseWriteStream;
Base class for all *WriteStreams where the entire stream is available
at all times (i.e., no flushing to an external sink). Extends the
public BaseWriteStream API with buffer() (for accessing the stream
contents) and SetPosition() (for changing the current stream pointer
to the given absolute position in the stream).
class MallocWriteStream : NonStreamingWriteStream;
Uses realloc to reallocate the internal buffer. Almost the same as
the old WriteStream, except that it only takes an initial size. Adds
one public method Steal() for taking ownership of the current buffer
contents (after which the buffer is reset to an empty state). Instead
of passing a pointer to a buffer, the internal buffer must be accessed
via either Steal() or buffer(), which allows access to the current
stream contents without changing ownership or resetting the stream.
The internal buffer is freed on stream destruction.
class ZoneWriteStream: NonStreamingWriteStream;
Takes a zone and reallocates the internal buffer in that zone. No
additional public methods beyond those available from
NonStreamingWriteStream.
class StreamingWriteStream : BaseWriteStream;
Uses realloc to reallocate the internal buffer. Generally same as
before, where the contents of the stream are periodically flushed
using Dart_StreamingWriteCallback. Since it extends BaseWriteStream,
there are now more methods available for writing data to the stream
than just Print/VPrint/WriteBytes. Since portions of the stream may be
flushed and thus no longer in the internal buffer, does not provide
access to the contents of the stream or a way to reposition the
current stream pointer. Flushes any unflushed data and frees the
internal buffer on stream destruction.
Also refactor things so that write streams are passed to appropriate
recipients, instead of the recipients taking arguments they only used to
create a WriteStream internally. Thus, recipients now can just specify
the appropriate base class for the public API used:
* BaseWriteStream for just writing to the stream, or
* NonStreamingWriteStream if re-positioning or the stream contents are
needed.
Change-Id: I419096ecd9331483d168b079fca55b69ef397f15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164080
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
It relies on flutter copy of clang distribution, same one that is used to build flutter/engine.
It addressed several deprecated warnings from clang compiler for functions like strdup, unlink, etc.
It allows few warnings still since they are triggered in third_party sources.
Change-Id: Ieb13792c011438d46dbbc0fa030e1b5e4ea14315
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142704
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Allows an embedder (or native extension) to inform the VM when external memory is released before a weak handle is finalized.
Bug: https://github.com/dart-lang/sdk/issues/42078
Change-Id: Ifffd0c160e5305bc6e6752207a2315139f245e2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149245
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
We no longer generate kernel files containing both AST and bytecode, so we don't need a flag to choose between them.
Change-Id: I1a4f7df507c649019c9fe254fa18a5826e2006aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122402
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This reverts commit c8f3f132ad.
Revert "[vm] Fix CoreSnapshotSize and StandaloneSnapshotSize to account for the image page size."
This reverts commit 1d6ab52f38.
Bug: b/140791872
Change-Id: I34c42310e3ec4a09048967f34a0e1ddc6a67ea93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116688
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Should have been part of c8f3f132ad.
Change-Id: I2a346f66490e6e97d846d4646ca7042be0b19cb2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116101
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Apparently these tests finalize everything which would trigger
loading of vm_service and fail with error
../../runtime/vm/benchmark_test.cc: 156: error: expected 'result' to be a valid handle but found an error handle:
'error: native function 'VMServiceIO_NotifyServerState' (1 arguments) cannot be found'
Change-Id: Ibb280d103c4bfe3020d43887df0d2307a4a10fff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113274
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
The Dart2JSCompileAll test has not been working for a while due to
- issues with package config
- issues with getting the sources compiled with CFE after the switch to
kernel pipeline.
Revised this benchmark/test to instead load the kernel_service dill file and do a CompileAll of CFE.
Should fix
https://github.com/dart-lang/sdk/issues/36630https://github.com/dart-lang/sdk/issues/27369
Change-Id: I07f5c81fc6938d318b84fa9ea2fa033ec30a05e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103406
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Message is a C++ type with a simple ownership model appropriate for
std::unique_ptr. This CL applies the following changes:
1. All uses of "new Message(...)" are replaced with
"Message::New(...)", which is effectively
"std::make_unique<Message>(...)". (The latter was only added in C++14,
but Dart still compiles in C++11 mode.)
2. All owning Message* are replaced with std::unique_ptr<Message>. The
notable exception is MessageQueue, which still uses raw Message*
internally to simplify the linked list handling.
3. All "delete message;" statements are removed.
4. Uses of "NULL" replaced with "nullptr" as necessary.
Change-Id: I05b5804289f2a225bfa05d3c1631129358fed373
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101222
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Matthew Dempsky <mdempsky@google.com>
vm/cc/GenKernelKernel* tests enabled interpreter by setting
FLAG_enable_interpreter in order to benchmark bytecode reading.
As a side effect, this enables interpretation of special functions
(like implicit getters) on other isolates such as kernel-service isolate.
They may even reach compilation threshold and unoptimized background
compilation is triggered. However, as isolate was created with
FLAG_enable_interpreter == false, unoptimized BackgroundCompiler was not
created, so it causes flaky crashes.
A less intrusive way to enable bytecode reading is to set
FLAG_use_bytecode_compiler.
Change-Id: Ie0601d43816b29c62fb0278ed4666d38fc4328c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100788
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Use DART_CHECK_VALID has been incorrect since the introduction of Isolate.kill and Dart_Cleanup because it crashes when given an unwind error.
Remove long-broken FullSnapshot1 test.
Change-Id: I1427249349e8138427bc7833980b5eff6ac466db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98263
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
This API does not work in CFE world because CFE does not see classes
created dynamically.
Fix UseDartAPI benchmark that was using this API and was broken as a result.
Change-Id: If691373d32ac5b8ff23e350ce2eb5ed44045b1f1
Reviewed-on: https://dart-review.googlesource.com/c/87183
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Auto-Submit: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Allow pc_marker slot to hold a Code object or a new Bytecode object.
Change-Id: If11c1df6dafc5b1cfcce6f0322c36d1d68e86df9
Reviewed-on: https://dart-review.googlesource.com/c/82526
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Threads in the native or blocked states don't prevent safepoints, so they may run concurrently with a safepoint operation like GC. It is not safe for handles to be allocated while the GC is visiting them, so these threads must not allocate handles. Assert only threads in the VM or generated states, which prevent safepoints until they check in, may allocate handles. (Generated code does not allocate handles, but leaf runtime entries remain in the generated state.)
Bug: https://github.com/dart-lang/sdk/issues/34883
Change-Id: I1a211778f7ef96b53a2405f0ee9dde7871b122b6
Reviewed-on: https://dart-review.googlesource.com/c/81540
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
One that measures the two existing benchmarks together, and one that
measures max RSS.
Change-Id: I2c8e383c1e7f38ea8010f3bd6a4bcbcacb999069
Reviewed-on: https://dart-review.googlesource.com/c/79822
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
(CompilerStats timers have been replaced with the timeline events.)
Change-Id: Iddcb752c085de9762eb802371b6d2905fa608a76
Reviewed-on: https://dart-review.googlesource.com/c/79086
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
- use core snapshot when initializing an isolate (CorelibIsolateStartup benchmark moves from 39s to 2s)
- remove use_dart_frontend flag from the isolate specific flags
- the script snapshot API functions now return an error
Change-Id: Ia562e007fdbfd1d3ebd8e1a0c8feee238bada00b
Reviewed-on: https://dart-review.googlesource.com/76709
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Mostly tests; 1 non-test bug in propagating an error through Dart_SetReturnValue.
This is progress towards asserting thread->excution_state() == kThreadInVM in Object::Allocate.
Change-Id: I6a59549868ab317b3c0d32aa42f3661289cbf456
Reviewed-on: https://dart-review.googlesource.com/71720
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
- Remove a level of indirection when accessing code units.
- Require a finalizer when constructing an external string.
Change-Id: I3f65246bf0ac50ffad900e2c338623a7684a9d3d
Reviewed-on: https://dart-review.googlesource.com/54300
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Previously there were places in the code where an API accepted a
`bool validate_frames` and call sites passed an enum value (which
implicitly got converted to a bool).
By changing the APIs to require an enum, the compiler will tell us if a
caller doesn't pass one.
Change-Id: I29fcd0b018e6cdd7e00b5bb03e83b9636d1345d4
Reviewed-on: https://dart-review.googlesource.com/57823
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
This is take 2 with appropriate status files updates or fixes to the
tests.
This reverts commit 4925ed38ac.
Change-Id: I133b9ae307f0feed1b72ec5a0131facdc51ad4e9
Reviewed-on: https://dart-review.googlesource.com/41600
Commit-Queue: Siva Chandra <sivachandra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Remove unused special case in ApiMessageWriter for lists of int.
This is in preparation for ensuring we always free any external data that ends up in an isolate message.
Bug: https://github.com/dart-lang/sdk/issues/31959
Change-Id: I999656fc11d2aee9aebe70852be5bb075f234b4d
Reviewed-on: https://dart-review.googlesource.com/41020
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This is a reland of https://dart-review.googlesource.com/#/c/sdk/+/28920/
with the following changes:
- It creates a new library dart:cli
- waitFor(Future) goes in dart:cli instead of dart:io
- Removes a flaky test, and adds a missing precompiler entrypoint
- Adds waitFor(Future)
- Improves doc comments
fixes#31102
Change-Id: I04d2c46fd0afac049dd4fd1353905dc20da18f90
Reviewed-on: https://dart-review.googlesource.com/29449
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Natalie Weizenbaum <nweiz@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>