Commit graph

538 commits

Author SHA1 Message Date
Martin Kustermann cfe45b6e3e [vm] Add opt-in flag to set priority for worker threads created by the VM
The newly added --worker-thread-priority can be used by users as an
opt-in to set the thread priority / nice value.

It is the responsibility of the user to ensure that the process has the
right to change the priority to the given value. Failure to set the
priority will be fatal.

See b/154918152

Change-Id: I3b3791e88b6ddf4fa6e39e4587f7fe1ab4d2312f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150560
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-06-10 19:57:02 +00:00
Tess Strickland f89d930e38 [vm/aot] Separate out stream methods from the Elf class.
Introduce an internal StreamingWriteStream wrapper and use that instead.

Also add more ELF-defined constants and use those appropriately.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-linux-product-x64-try
Change-Id: I2bd34ebac60e789aea82c8f064c59351e2c55dd3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149291
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-05-29 07:47:08 +00:00
Aske Simon Christensen 81ad24322c [vm/compiler] Check BoxInt64 overflow via the overflow flag on ARM64.
This saves one instruction for every BoxInt64 overflow check, reducing
the instructions size for Flutter benchmarks by between 0.26% and 1.03%
(0.26% for Flutter Gallery).

Also add OVERFLOW and NO_OVERFLOW condition aliases to arm and arm64.

Change-Id: I82990419b448f21a22ea2cc7a15a9497d3275943
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145860
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-20 14:05:40 +00:00
Ryan Macnak 40d876382a [vm] Fix various UBSan failures: AOT.
Bug: https://github.com/dart-lang/sdk/issues/39427
Change-Id: I2594e28a277f1d9f838aa93d546714d4f300b5b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147682
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-12 20:28:11 +00:00
Ryan Macnak 17f3bf9183 [vm] Fix various UBSan failures: ARM.
Bug: https://github.com/dart-lang/sdk/issues/39427
Change-Id: Ie6ba61d699c1ea51310e15b924fb58cb02cf6e1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146989
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-12 19:25:11 +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 2707880f1b [vm] Fix various UBSan failures.
Bug: https://github.com/dart-lang/sdk/issues/39427
Change-Id: I74e0eee623d88005fb2893d03e284a87daa09260
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146696
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-07 19:40:18 +00:00
Ryan Macnak 14dfa1b9ee [vm] Fix gcc build.
Change-Id: I6634dc10fdc8d7523562c0fcc20e3561eb580acf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146023
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-04 21:15:27 +00:00
Filip Filmar b161b52331 Use new call to get ComponentContext
Fuchsia OS is making a change in the serving sequence for component
startup, to avoid a race condition in which clients attempt to connect
to services that are not yet exposed but will be.

This change is needed for a smooth transition to that new API.  The
Fuchsia SDK change has already rolled to Dart.

See: https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=50758
Change-Id: Ib1249dcf771e99f542343328918ae55497ddaf71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145700
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Filip Filmar <fmil@google.com>
2020-05-04 17:35:24 +00:00
Filip Filmar 595cd384d3 Add dart::ComponentContext() for Fuchsia
This allows the program to get at the singleton component context
for the currently running component.  The component context can
be meaningfully instantiated only once; and since dart doesn't
have a predefined way to wire platform-specific values into
platform-specific code, we instantiate a singleton here, so all
code that is interested can use it.

The users of this functionality will be the dart and flutter
fuchsia runners.  See issue
https://github.com/dart-lang/sdk/issues/41523 for details.

Tested:
  manual compile for fuchsia, check behavior.

Change-Id: Ib4e15af376ecb932c2d2b28d6f099383d53ccc84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136524
Commit-Queue: Filip Filmar <fmil@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-04-21 19:09:25 +00:00
Victor Agnez Lima 76bff1e198 Fix undefined behavior in UnboxedFieldBitmap
UnboxedFieldBitmap was relying that shifting operations would
result in 0 if `position` is larger than the number of bits in the
bitmap, but this is UB.

Closes https://github.com/dart-lang/sdk/pull/41422
https://github.com/dart-lang/sdk/pull/41422

GitOrigin-RevId: 7b6db75ee9247cee54345add6d155f55a501e79e
Change-Id: I27c6fcadb2149826de86067c2378cef57ee3367c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143000
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-04-14 14:58:29 +00:00
Ryan Macnak 4978dcc928 Reland "[vm, gc] Parallel scavenge."
Fix ScavengeVisitorBase::HasWork to account for undone allocations.

Bug: b/153524644
Change-Id: Ifc30017a411c5b65716d4e38752f2edeeb80a77e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142908
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-04-10 19:27:04 +00:00
Martin Kustermann 13c84d8794 Revert "Reland "[vm, gc] Parallel scavenge.""
This reverts commit 898b080d09.

Reason for revert: Seems to cause crashes in g3, see b/153524644.

Original change's description:
> Reland "[vm, gc] Parallel scavenge."
> 
> Remove header access from typed data case in RawObject::HeapSizeFromClass.
> 
> Address data race between visiting remembered cards and allocating new large pages for promotion.
> 
> Change-Id: I92cc4604ed38ab8f42b87b140a26a8118e7030d4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142565
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=kustermann@google.com,aam@google.com,rmacnak@google.com,asiva@google.com

Change-Id: I3ef7bd5c3d0ca575f33cf5f712f58476037d2d90
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142861
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-04-08 14:21:32 +00:00
Ryan Macnak 898b080d09 Reland "[vm, gc] Parallel scavenge."
Remove header access from typed data case in RawObject::HeapSizeFromClass.

Address data race between visiting remembered cards and allocating new large pages for promotion.

Change-Id: I92cc4604ed38ab8f42b87b140a26a8118e7030d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142565
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-04-07 17:07:06 +00:00
Ryan Macnak bb95f88139 Revert "[vm, gc] Parallel scavenge."
This reverts commit 9209f522d6.

Reason for revert: Flaky analyzer crashes

Original change's description:
> [vm, gc] Parallel scavenge.
> 
> Run N tasks that compete to copy or promote survivors. Installation of the forwarding pointer uses a CAS.
> Tasks do not share the list of copied objects to be processed.
> Tasks do share the list of promoted objects to be processed.
> Divide the freelist in N copies. Each scavenger task uses one without locking. The sweeper inserts into the freelists round-robin.
> 
> Change-Id: I54c7839ac5f15829462b3be7cf8c9635c01b785f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135962
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,aam@google.com,rmacnak@google.com,asiva@google.com

Change-Id: I0d97b8d9148b2a81cabafde4602512e423eba223
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142554
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-04-06 22:51:08 +00:00
Ryan Macnak 9209f522d6 [vm, gc] Parallel scavenge.
Run N tasks that compete to copy or promote survivors. Installation of the forwarding pointer uses a CAS.
Tasks do not share the list of copied objects to be processed.
Tasks do share the list of promoted objects to be processed.
Divide the freelist in N copies. Each scavenger task uses one without locking. The sweeper inserts into the freelists round-robin.

Change-Id: I54c7839ac5f15829462b3be7cf8c9635c01b785f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135962
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-04-06 20:14:54 +00:00
Ryan Macnak 23792e7816 [vm] Require explicit loads and stores when using AcqRelAtomic.
Change-Id: I19d64667cea7dd735c3bf7194285383289019aaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139942
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-03-19 16:19:59 +00:00
Ryan Macnak 9a140bab87 [vm] Use acquire-release ordering to publish and consume the class table backing arrays.
Change-Id: I57a3109b3ba42e1addf97c15c5d8108cd0338266
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139860
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-03-18 17:18:55 +00:00
Ryan Macnak 95f87f321a [vm, io] Fix some MemorySanitizer issues.
Change-Id: Id6e085563b05861351c431a9c067387b4b01270b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137380
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-02-27 17:50:43 +00:00
Victor Lima 7eedaf192f [vm/aot] Fix broken benchmarks
This CL fix an assertion inside Serializer::WriteInstructions
that was always failing in debug mode AOT 32-bit platforms
which used to happen when Utils::IsUint was called with a
signed type value was being passed.

It also fixes a bug that happens on some architectures that do not
support atomic unaligned load operations of 64-bit values.

Change-Id: Ic26cdeabccb55fcda5257da00f13dc400fa37e9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136228
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-02-19 20:49:29 +00:00
Teagan Strickland bccd3f7aab [vm] Create an abstraction for updating object size info in tags for target.
Change-Id: I8661af9834f2ff97f036cf4f1612c20515148949
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135652
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-02-14 17:57:47 +00:00
Ben Konyi 6548694a82 Reland "[ VM / DartDev ] Added support for format and pub commands via standalone VM"
Fixes a malloc/delete[] mismatch.

This reverts commit b3396cbdca.

Change-Id: I18fe142bc60bedd8af4c588ba4039742e1d34606
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134570
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-02-06 00:04:09 +00:00
Daco Harkes 43fe0b35d8 [vm] Clean up Location templating
This commit undoes https://dart-review.googlesource.com/c/sdk/+/97312 because we removed DBC.

Fixes: https://github.com/dart-lang/sdk/issues/40458
Change-Id: I7e08544e4c57d34c6f4bfc10aeed8ab87ed31953
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134297
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-02-05 08:46:07 +00:00
Aske Simon Christensen 76c6282de6 [vm/aot] Use a global dispatch table for instance calls in AOT.
This is a Dart-tailored implementation of the "row-displacement
dispatch table" technique for closed-world instance calls:

All interface targets in the program are grouped into selectors such
that all targets that could potentially be called from the same call
site have the same selector (currently just grouped by name).

Each selector is assigned a selector offset such that offset + classid
is unique for all selector/classid combinations where the class
implements the selector.

At every instance call site that has an interface target (i.e. where
the static type of the receiver is not dynamic), the selector offset +
receiver classid is computed and used as index into a global table of
entry points.

If the receiver can be null (as determined by the front-end TFA and the
VM type propagation), a null check is inserted before the call.

An arguments descriptor is provided (only) for selectors that need it
(those which have type parameters or optional/named parameters).

The dispatch table calls don't need the monomorphic entry code, so for
functions that are only called via dispatch table calls (i.e. never
called dynamically), the monomorphic entry code is left out.


Some future improvements to the table dispatch implementation are
mentioned in https://github.com/dart-lang/sdk/issues/40188


The table dispatch flag is disabled by default in this commit. A
separate commit enables the flag.

Change-Id: Ic2911742b4a2c9a8d3bc7df60605454cbe4c0714
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126648
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-02-03 11:04:15 +00:00
Victor Lima b68d95ec9e [vm] Reland support for real unboxed floating point fields in AOT
Issue https://github.com/dart-lang/sdk/issues/40404

Change-Id: Icfa801ff0640a6b27bb3c13d0b737c40452cbf7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133983
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-01-31 12:56:31 +00:00
Zichang Guo 162d6c5634 Revert "[vm] Add support for real unboxed floating point fields in AOT"
This reverts commit 9eb531bde4.

Reason for revert: Bots are red. Some tests are failing.

https://ci.chromium.org/p/dart/builders/ci.sandbox/vm-kernel-precomp-obfuscate-linux-release-x64/6039

https://ci.chromium.org/p/dart/builders/ci.sandbox/vm-kernel-precomp-android-release-arm_x64/957

Original change's description:
> [vm] Add support for real unboxed floating point fields in AOT
> 
> Non-nullable floating point fields (double, Float32x4, Float64x2)
> are fully unboxed in their classes.
> 
> A bitmap for each class was added to the shared class table in order to keep
> track of the pointers of the classes. Since all classes in Flutter Gallery
> have less than 64 fields, the bitmap is represented by a 64 bit integer and
> fields whose offset is more than 64 words are not unboxed.
> 
> The instance sizes and field offsets might change between target and host
> in cross-compilation, since the number of words used to store unboxed fields
> may differ.
> 
> dart-aot Xeon
> 
>   SplayLatency               -4.62%
>   SplayHarderLatency         -4.17%
>   NavierStokes               -2.20%
>   Tracer                      8.72%
>   ParticleSystemPaint         2.90%
>   NBodySIMD                   8.35%
>   NBody                      25.59%
> 
> With hack TFA to make doubles in Rect/Offset/Size classes in flutter non-nullable:
> 
> flutter arm-v8:
> 
>   gallery total size: -1%
> 
>   matrix_utils_transform_rect_perspective   -16.70% (less is better)
>   matrix_utils_transform_rect_affine        -31.82% (less is better)
>   matrix_utils_transform_point_perspective  -24.90% (less is better)
>   matrix_utils_transform_point_affine)      -27.26% (less is better)
>   rrect_contains_bench                      -4.719% (less is better)
> 
> Change-Id: I9ae09c9c3167d99f9efd071a92937aa51093fd1d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131824
> Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Samir Jindel <sjindel@google.com>

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

Change-Id: Ic73858f6adb7f55c4129d4f46ff4731b378cb634
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134020
Reviewed-by: Zichang Guo <zichangguo@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-01-30 18:13:28 +00:00
Victor Lima 9eb531bde4 [vm] Add support for real unboxed floating point fields in AOT
Non-nullable floating point fields (double, Float32x4, Float64x2)
are fully unboxed in their classes.

A bitmap for each class was added to the shared class table in order to keep
track of the pointers of the classes. Since all classes in Flutter Gallery
have less than 64 fields, the bitmap is represented by a 64 bit integer and
fields whose offset is more than 64 words are not unboxed.

The instance sizes and field offsets might change between target and host
in cross-compilation, since the number of words used to store unboxed fields
may differ.

dart-aot Xeon

  SplayLatency               -4.62%
  SplayHarderLatency         -4.17%
  NavierStokes               -2.20%
  Tracer                      8.72%
  ParticleSystemPaint         2.90%
  NBodySIMD                   8.35%
  NBody                      25.59%

With hack TFA to make doubles in Rect/Offset/Size classes in flutter non-nullable:

flutter arm-v8:

  gallery total size: -1%

  matrix_utils_transform_rect_perspective   -16.70% (less is better)
  matrix_utils_transform_rect_affine        -31.82% (less is better)
  matrix_utils_transform_point_perspective  -24.90% (less is better)
  matrix_utils_transform_point_affine)      -27.26% (less is better)
  rrect_contains_bench                      -4.719% (less is better)

Change-Id: I9ae09c9c3167d99f9efd071a92937aa51093fd1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131824
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2020-01-30 13:45:08 +00:00
Samir Jindel d0909e068a Reland "[vm/aot] Only patch call-sites to monomorphic entry-points when the receiver is proven to be a heap object."
This reverts commit 5f81efb4a3.

Reason for revert: 3xH bot is green again.

Original change's description:
> Revert "[vm/aot] Only patch call-sites to monomorphic entry-points when the receiver is proven to be a heap object."
> 
> This reverts commit ab2026af45.
> 
> Reason for revert: Flutter 3xH is broken on Golem.
> 
> Original change's description:
> > [vm/aot] Only patch call-sites to monomorphic entry-points when the receiver is proven to be a heap object.
> > 
> > Flutter Gallery ARMv8: -0.8% total, -1.3% instructions
> > Flutter Gallery ARMv7: -0.7% total, -1.2% instructions
> > 
> > There are some performance regressions, in four categories:
> > 
> > 1. Arithmetic on num types (e.g. MinLib, MaxLib):
> >    We believe arithmetic on num types is rare in practice, and can be optimized later
> >    by specializing the call-sites.
> > 
> > 2. Lack of types (e.g. MeshDecompression, ImagingGaussianBlur, Crypto*):
> >    These (and similar benchmarks) are written in a very untyped style, which is not
> >    representative of Dart 2 style. We've confirmed that the regressions disappear if
> >    the benchmarks are annotated with appropriate types.
> > 
> > 3. Megamorphic calls which are specialized in the benchmark (e.g. DeltaBlue):
> >    DeltaBlue uses string interpolation in one place, so the toString() method in the
> >    string interpolation helper is monomorphic for _Smis. However, in a realistic programs,
> >    string interpolation is used much more frequently and with different types, so it's very
> >    unlikely that this call would be monomorphic. When string interpolation is removed, there's
> >    a remaining 1.3% regression on DeltaBlue which is not yet accounted for.
> > 
> > 4. Noisy benchmarks
> >    The remaining regressions are on benchmarks which show frequent jitter historically.
> > 
> > There are also 1-4% improvements on many benchmarks (Golem's "noise" analysis is hiding
> > many of them, look at the graphs).
> > 
> > For the reasons above, we believe the regressions justified by the code size improvement.
> > 
> > Change-Id: Ic9b281d4383a6111de9d6f44347976ffa61a6ca6
> > Cq-Include-Trybots:luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-bare-linux-release-simarm64-try
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128667
> > Commit-Queue: Samir Jindel <sjindel@google.com>
> > Reviewed-by: Ryan Macnak <rmacnak@google.com>
> > Reviewed-by: Martin Kustermann <kustermann@google.com>
> 
> TBR=kustermann@google.com,rmacnak@google.com,alexmarkov@google.com,sjindel@google.com
> 
> Change-Id: I411aae4b230f2a08146ad3bf3e7a10aa6592db0e
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-bare-linux-release-simarm64-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131660
> Reviewed-by: Samir Jindel <sjindel@google.com>
> Commit-Queue: Samir Jindel <sjindel@google.com>

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

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I36e4e9d598033fcc934c2cdf5b061aa11255d3b2
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-bare-linux-release-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131837
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2020-01-16 14:21:16 +00:00
Samir Jindel 5f81efb4a3 Revert "[vm/aot] Only patch call-sites to monomorphic entry-points when the receiver is proven to be a heap object."
This reverts commit ab2026af45.

Reason for revert: Flutter 3xH is broken on Golem.

Original change's description:
> [vm/aot] Only patch call-sites to monomorphic entry-points when the receiver is proven to be a heap object.
> 
> Flutter Gallery ARMv8: -0.8% total, -1.3% instructions
> Flutter Gallery ARMv7: -0.7% total, -1.2% instructions
> 
> There are some performance regressions, in four categories:
> 
> 1. Arithmetic on num types (e.g. MinLib, MaxLib):
>    We believe arithmetic on num types is rare in practice, and can be optimized later
>    by specializing the call-sites.
> 
> 2. Lack of types (e.g. MeshDecompression, ImagingGaussianBlur, Crypto*):
>    These (and similar benchmarks) are written in a very untyped style, which is not
>    representative of Dart 2 style. We've confirmed that the regressions disappear if
>    the benchmarks are annotated with appropriate types.
> 
> 3. Megamorphic calls which are specialized in the benchmark (e.g. DeltaBlue):
>    DeltaBlue uses string interpolation in one place, so the toString() method in the
>    string interpolation helper is monomorphic for _Smis. However, in a realistic programs,
>    string interpolation is used much more frequently and with different types, so it's very
>    unlikely that this call would be monomorphic. When string interpolation is removed, there's
>    a remaining 1.3% regression on DeltaBlue which is not yet accounted for.
> 
> 4. Noisy benchmarks
>    The remaining regressions are on benchmarks which show frequent jitter historically.
> 
> There are also 1-4% improvements on many benchmarks (Golem's "noise" analysis is hiding
> many of them, look at the graphs).
> 
> For the reasons above, we believe the regressions justified by the code size improvement.
> 
> Change-Id: Ic9b281d4383a6111de9d6f44347976ffa61a6ca6
> Cq-Include-Trybots:luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-bare-linux-release-simarm64-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128667
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

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

Change-Id: I411aae4b230f2a08146ad3bf3e7a10aa6592db0e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-bare-linux-release-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131660
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2020-01-14 14:58:45 +00:00
Samir Jindel ab2026af45 [vm/aot] Only patch call-sites to monomorphic entry-points when the receiver is proven to be a heap object.
Flutter Gallery ARMv8: -0.8% total, -1.3% instructions
Flutter Gallery ARMv7: -0.7% total, -1.2% instructions

There are some performance regressions, in four categories:

1. Arithmetic on num types (e.g. MinLib, MaxLib):
   We believe arithmetic on num types is rare in practice, and can be optimized later
   by specializing the call-sites.

2. Lack of types (e.g. MeshDecompression, ImagingGaussianBlur, Crypto*):
   These (and similar benchmarks) are written in a very untyped style, which is not
   representative of Dart 2 style. We've confirmed that the regressions disappear if
   the benchmarks are annotated with appropriate types.

3. Megamorphic calls which are specialized in the benchmark (e.g. DeltaBlue):
   DeltaBlue uses string interpolation in one place, so the toString() method in the
   string interpolation helper is monomorphic for _Smis. However, in a realistic programs,
   string interpolation is used much more frequently and with different types, so it's very
   unlikely that this call would be monomorphic. When string interpolation is removed, there's
   a remaining 1.3% regression on DeltaBlue which is not yet accounted for.

4. Noisy benchmarks
   The remaining regressions are on benchmarks which show frequent jitter historically.

There are also 1-4% improvements on many benchmarks (Golem's "noise" analysis is hiding
many of them, look at the graphs).

For the reasons above, we believe the regressions justified by the code size improvement.

Change-Id: Ic9b281d4383a6111de9d6f44347976ffa61a6ca6
Cq-Include-Trybots:luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-bare-linux-release-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128667
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-01-14 13:18:05 +00:00
Teagan Strickland 089aeedf56 [vm/compiler] Reland "Add --save-debugging-info flag to gen_snapshot."
Removes an unnecessary change to the names of type testing stubs that
allowed name collisions to happen.

Old commit message:

The flag can be used when creating AOT snapshots. The resulting file can be
used with package:vm/dwarf/convert.dart to convert DWARF-based stack traces
to stack traces with function, file, and line number information.

Currently the saved file will be an ELF file with DWARF debugging information,
but this is subject to change in the future. To avoid being affected by any
changes in format, read the DWARF information from the file using
Dwarf.fromFile() in package:vm/dwarf/dwarf.dart.

Also adds --dwarf-stack-traces to the VM global flag list, so its value at
compilation will be read out of snapshots by the precompiled runtime.

Fixes https://github.com/dart-lang/sdk/issues/39512, which was due to
a missing compiler::target:: prefix for Instructions::HeaderSize() in
BlobImageWriter::WriteText().

Exposes the information suggested in
https://github.com/dart-lang/sdk/issues/39490 so that package:vm/dwarf
can appropriately convert absolute PC addresses to the correct virtual
address for a given DWARF line number program.

Bug: https://github.com/dart-lang/sdk/issues/35851
Change-Id: I6723449dceb0b89c054a1f1e70e7acd7749baf14
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128730
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-18 14:14:41 +00:00
asiva 8a4cac1ddb Reverting a chain of commits related to debug info splitting.
REASON: the first commit in the chain contains a change that breaks internal
Flutter roll due to duplicated symbols for type testing stubs in assembly
snapshots.

Revert "[vm/compiler] Add --save-debugging-info flag to gen_snapshot."

This reverts commit c2b6c2e1db.

Revert "[vm] De-obfuscate function and file names in DWARF sections."

This reverts commit 4b8fd3c412.

Revert "[vm] Add docs for DWARF stack traces and related tools/libraries."

This reverts commit 5543e5ceb8.

Revert "[vm] Weaken dwarf_stack_trace expected stack trace."

This reverts commit 5824d3ed53.

Change-Id: I95ecd16fe493f61ae761dabfdd91a6ec0c2f0ca3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128776
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-12-18 01:02:05 +00:00
Ryan Macnak 9a43744f0e [vm, gc] Flatten promotion allocations.
Change-Id: I423885291aa17133c4409b265672792397387211
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127423
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-13 18:55:00 +00:00
Teagan Strickland c2b6c2e1db [vm/compiler] Add --save-debugging-info flag to gen_snapshot.
The flag can be used when creating AOT snapshots. The resulting file can be
used with package:vm/dwarf/convert.dart to convert DWARF-based stack traces
to stack traces with function, file, and line number information.

Currently the saved file will be an ELF file with DWARF debugging information,
but this is subject to change in the future. To avoid being affected by any
changes in format, read the DWARF information from the file using
Dwarf.fromFile() in package:vm/dwarf/dwarf.dart.

Also adds --dwarf-stack-traces to the VM global flag list, so its value at
compilation will be read out of snapshots by the precompiled runtime.

Fixes https://github.com/dart-lang/sdk/issues/39512, which was due to
a missing compiler::target:: prefix for Instructions::HeaderSize() in
BlobImageWriter::WriteText().

Exposes the information suggested in
https://github.com/dart-lang/sdk/issues/39490 so that package:vm/dwarf
can appropriately convert absolute PC addresses to the correct virtual
address for a given DWARF line number program.

Bug: https://github.com/dart-lang/sdk/issues/35851
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-mac-release-simarm_x64-try,vm-kernel-precomp-win-release-x64-try
Change-Id: I80d900fd9e5f1e2399ad3f2fd25c85131a7ea43c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121857
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-12 14:18:59 +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
Samir Jindel 36cd2e22d4 [vm/aot] Expose static symbols in directly-generated ELF snapshots.
Also use the function labels for Dwarf in Assembly snapshots to avoid creating
duplicate labels.

Fixes https://github.com/dart-lang/sdk/issues/38978
Issue https://github.com/dart-lang/sdk/issues/38526

Change-Id: Icafd3d3a86381990ec8097397a21b16ad4a7a766
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122150
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-10-25 11:53:14 +00:00
Martin Kustermann e82fedc345 [vm] Remove deprecated (and untested) ARMv5 support from the VM
Since we have no CQ/CI test coverage of ARMv5 and none of our customers
uses it, a breaking change request was made (see issue further down).

The breaking change has been approved and a corresponding email has been
sent out:

https://groups.google.com/a/dartlang.org/forum/?nomobile=true#!topic/announce/vRQja7di3FQ

This CL removes any armv5 related code from our codebase.

Closes https://github.com/dart-lang/sdk/issues/36666

Change-Id: I9abf32f1980ca19a9cf882b43c9966b2127f89e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122540
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-10-23 14:44:33 +00:00
Ryan Macnak 6c933a4488 [vm] Fix some TSAN failures. Migrate remaining uses of AtomicOperations to std::atomic.
Change-Id: I195232311a146248c601ef84640758db59083d12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121200
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-10-21 16:26:39 +00:00
Clement Skau 8d8faa7dea [SDK] Fixes loading appended snapshots when executed with PATH.
Loading of appended snapshots used to try read the executable itself
via arg[0] which holds the "path" to the executable.
However, when the executable is being invoked via PATH the "path"
can be just the name of the executable with no actual path.
This would cause the file reading to fail to find the file and
therefore fail to read.
This in turn caused standalone executables to fail to run when invoked
via PATH.

Bug: https://github.com/dart-lang/sdk/issues/38912
Change-Id: I08501661441db90ce6cff96a9337a5770ec3524d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121853
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-18 10:30:48 +00:00
Artem Serov 9ae7b10cea [vm] Fix a bug in Utils::NBitMask.
The function was broken on arm64 due to incorrect
mask calculation (based on the target ISA).

Change-Id: Ib5c26bf4c7b901ae27f2a0580c4f88b2b7952212
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121709
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-10-17 17:19:32 +00:00
Ryan Macnak 71ecb73a2b [vm] Fix one MSAN failure; add UBSAN configuration.
Change-Id: I5b1d43836f3eb09983195fc3792f369aa3f8079f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120750
Reviewed-by: Chinmay Garde <chinmaygarde@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-10-09 23:38:30 +00:00
Ryan Macnak f4f0831c69 [vm] Fix TSAN failures related to object headers and GC task phases.
Change-Id: I15078e845712e8e712e2cb0a044fc7550127ea36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120629
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-10-09 21:48:20 +00:00
Aart Bik c38e19cbbe [vm/compiler] bit utilities
Rationale:
Useful in the future when compiler wants to constant fold
operations related to leading/trailing/counting (non)zeros.

https://github.com/dart-lang/sdk/issues/38346

Change-Id: I158aca125d3a15019af20ca7c2a516b74e4d84c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119920
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-10-07 18:13:06 +00:00
Ryan Macnak d5feab0c53 [vm] Create builds for LeakSanitizer, MemorySanitizer and ThreadSanitizer.
Change-Id: I65905ec76fcde8b7f4063cb5b80a3d034b453153
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120323
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Chinmay Garde <chinmaygarde@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-10-07 16:24:22 +00:00
Aart Bik 7e99f49629 [vm/compiler] general rbit utilities
Rationale:
Useful to implement the simulator, but also useful
in the future when compiler wants to constant fold
operations related to bit reversal.

https://github.com/dart-lang/sdk/issues/38346

Change-Id: I2f09ba6b1897202b5c07a2cff771afd7bbc99495
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119703
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-10-02 20:37:10 +00:00
Ryan Macnak f0b2a46734 [vm, fuchsia, arm64] Restore the shadow call stack on exceptions.
Fuchsia is about to turn on ShadowCallStack for ARM64. Once this is enabled, we need to treat R18 like a preserved register. Generated Dart has not accessed this register because it is reserved on iOS, and in the absence of Dart exceptions this would be sufficient for us to be ShadowCallStack compatible. However, our exception handling mechanism jumps past all the C++ frames between the Dart exit frame and Exceptions::JumpToFrame, skipping code that would pop from R18.

Add save/restore of R18 in the invocation stubs, and restore of R18 in the jump stub. The latter prevents the ShadowCallStack from overflowing for code that has lots of exceptions without a native call.

Bug: https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=37449
Change-Id: I2ce6e46624c8d72507e7afa7a44839b1f0def556
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119481
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-10-02 05:33:29 +00:00
Samir Jindel 362ef8e67c [vm/aot] Add a custom ELF loader in dart_precompiled_runtime.
Also switch some CQ bots using blobs to ELF. Once all embedders have migrated, we will remove blobs
support entirely.

Change-Id: Ie5e8c1187ad6c1af362b5715daafd3641bc8cc0e
Cq-Include-Trybots:luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-bare-linux-release-simarm-try,vm-kernel-precomp-mac-debug-simarm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-precomp-android-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116620
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-09-24 15:03:19 +00:00
Clement Skau f546362691 [SDK] Adds dart2exe to create standalone executables.
Tested:
  ./tools/build.py --arch x64 --mode release --verbose create_sdk copy_gen_kernel_snapshot copy_dart2aot
  ./tools/build.py --arch x64 --mode product --verbose copy_gen_snapshot copy_dartaotruntime
  cp -r out/ProductX64/dart-sdk/bin/{dartaotruntime,utils/} out/ReleaseX64/dart-sdk/bin/
  out/ReleaseX64/dart-sdk/bin/dart2native ~/src/hello_world.dart
  ~/tmp/hello_world.exe

  dart tools/bots/aot_smoke_tests.dart

  python tools/test.py -n dartkp-linux-release-x64 vm/dart/run_appended_aot_snapshot_test

Change-Id: I149fcd18405cdf0a87b8f4b4072c0f0e8f98c067
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117140
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-09-23 12:00:08 +00:00
Liam Appelbe ed9e89ea38 Implement a basic WASM API using wasmer.
Currently this only supports functions that take and return numeric
types. Byte arrays, and callbacks will come later, in a separate
wrapper package.

Bug: https://github.com/dart-lang/sdk/issues/37882
Change-Id: I7bb82be83cbbb6062736b3e958f89d021f1af4bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114586
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-09-13 18:25:16 +00:00
Teagan Strickland ebf1f01ca5 [vm/compiler] Continued work on the IL deserializer.
Adds support for:
  AssertBoolean
  InstanceCall

Also handles deserializing of TypeRefs and
serialization/deserialization of non-megamorphic
ICData.

Results from compiling hello world program:

* Early round trip:
  * Contains unhandled instructions: 2469
  * Failed during deserialization: 9
  * Successful round trips: 1772
* Late round trip:
  * Contains unhandled instructions: 2892
  * Failed during deserialization: 11
  * Successful round trips: 1268

Deserialization failure reasons:
* Early round trip:
  * no handling for local functions: 9
* Late round trip:
  * no handling for local functions: 6
  * out of range index for pushed argument: 5
    (see https://github.com/dart-lang/sdk/issues/38354)

Bug: https://github.com/dart-lang/sdk/issues/36882
Change-Id: I7a3731d4cc3df0bfa1e270adbdfc2faddd110af0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115219
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-09-12 13:29:26 +00:00
Daco Harkes ec7ec4ecf7 [gardening] Fix import to fix Flutter build
How cmath is included changes whether the symbols are in the std:: namespace or not. This changes it back to how we have it everywhere in the codebase: math.h

Follow up of https://dart-review.googlesource.com/c/sdk/+/115707/

Change-Id: I383c1e9de0434d1367dfdb6302a8fb6db2c3062c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115920
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2019-09-06 09:08:49 +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
Aart Bik d1c9a2b06f [vm/compiler] Improve DIV and MOD performance
Rationale:
Mostly an AOT 64-bit improvement of DIV and MOV by constant
on X64_64. Also a few minor supporting optimizations
that were missed. With unit tests.

https://github.com/dart-lang/sdk/issues/37789

Change-Id: I2f12d6a24bbe983324521d7d4d778f20b34d18a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114901
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-08-29 20:32:10 +00:00
Siva Annamalai ec2d06d4b9 Use MAP_JIT when doing an mmap for executable pages (needed for macOS Catalina).
Please refer to https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_cs_allow-jit for more details.

This is the Dart VM part for https://github.com/flutter/flutter/issues/36714

Change-Id: Ifbc0ce82921d5f05421e01ce2d19423a5f3e32f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112849
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-08-14 16:51:49 +00:00
Teagan Strickland b87386da26 [vm/compiler] Add S-expression deserializer.
Bug: https://github.com/dart-lang/sdk/issues/36882
Change-Id: I991d160ecbde45a09e7533867f51f1ab72c3b215
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110220
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-07-30 11:08:06 +00:00
Zichang Guo 1509d9ad41 [vm] initialize sigaction for msan
msan didn't recognize instance initialized with memset or bzero. Initialize all the instances.

Bug: https://buganizer.corp.google.com/issues/137630695
Change-Id: I0f4adf90cd9d4daa2abe783b1e1ca892bdacb690
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109306
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2019-07-16 19:46:56 +00:00
Matthew Dempsky 527238e008 [vm] Cleanup C99 header includes
Now that MSVC 2013 is required (commit f4824d3), we can simply use C99
headers that are provided [1]. This means we can rely on <stdint.h> to
provide intXX_t and uintXX_t types, and <inttypes.h> to provide PRIxx
macros.

[1] https://devblogs.microsoft.com/cppblog/c99-library-support-in-visual-studio-2013/

Change-Id: I0cc707907f8aca05ae543188cc01e6c50d517f5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107839
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-07-03 10:54:24 +00:00
Matthew Dempsky c3c43689d5 [vm] Remove platform/math.h
It seems safe to assume that <math.h> works on all supported platforms
now.

Change-Id: Iffb6618f6035c8cc10657c55ccc3ca7cd5d9525c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107825
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Matthew Dempsky <mdempsky@google.com>
2019-07-02 18:22:58 +00:00
Matthew Dempsky f4824d332d [vm] Drop support for MSVC older than 2013
Google has required MSVC 2013 since Q2 2015, and Chromium has required
MSVC 2015 since Dec 2016. It seems safe for Dart to assume MSVC 2013.

Change-Id: I2ad2549d70b0a96085aa96e90ef15ad4c7b7acb8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107062
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Matthew Dempsky <mdempsky@google.com>
2019-07-01 23:38:10 +00:00
Lorenz Nickel 79e478e50e Fixed some links
**I fixed some links and some other minor flaws.**

I also found the following outdated links, which I didn't fix:

- [This link](https://github.com/dart-lang/pool/tree/zone.strong) in [this file](https://github.com/dart-lang/sdk/blob/master/docs/newsletter/20170728.md) (didn't fix because don't know new location and this is some sort of archive so the link should probably stay the original)
- [This link](https://www.dartlang.org/tools/analyzer) in [this file](https://github.com/dart-lang/sdk/blob/master/pkg/analyzer_cli/lib/src/options.dart) (didn't fix since the link is still working, it just gets redirected and the link is part of the programm, I don't want to break anything by changing it, all other links are in comments)
- [This link](https://github.com/domokit/mojo/issues/728) in [this file](https://github.com/dart-lang/sdk/blob/master/build/config/compiler/BUILD.gn) (didn't fix since probably has no new location and is part of TODO, which I don't want to change)

While doing all this I also noticed that [these tests](https://github.com/dart-lang/sdk/tree/master/tests/compiler/dart2js_extra) contain a lot of other inconsistencies in their comments and the location of the import-statements (I only fixed one which was not link-related), could be target of another PR.

Closes #36927
https://github.com/dart-lang/sdk/pull/36927

GitOrigin-RevId: 71d05d0b52d8ec5b92d077a070e066d1fdd4bbfa
Change-Id: Ide4b2424fccad8ae2e06c788efd4443dc0de997b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102222
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2019-07-01 16:21:41 +00:00
Liam Appelbe a6eb2cd309 [vm] Support for simarm_x64
Third sub-CL of https://dart-review.googlesource.com/c/sdk/+/100644
The first was here https://dart-review.googlesource.com/c/sdk/+/103487
The second was here https://dart-review.googlesource.com/c/sdk/+/104286

This is the last major CL to support simarm_x64. Now that the other two
CLs have put the required infrastructure in place, this CL actually
adds the new mode..

Bug: https://github.com/dart-lang/sdk/issues/36839
Change-Id: Ie2f850bf33544f2462f37854e762191c78b1bde6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105500
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-06-21 04:00:35 +00:00
Ryan Macnak 0739387b05 [vm] Account for DBC32 when deciding between 32-bit and 64-bit ELF.
Change-Id: I1e8479927bf1f311c9500244f171eda46f105863
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104180
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-05-29 23:59:12 +00:00
Aart Bik 98f67ff3d4 [dart/fuzzer] Mechanism for target functions
Rationale:
Runtime dispatch on various target functions.
Also adds new target function (which found an
issue) and prepares Dart VM setup.

https://github.com/dart-lang/sdk/issues/36818

Change-Id: I80e2d567087b435404331e2539f2cda19cadb04e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100989
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2019-05-02 18:12:19 +00:00
Aart Bik aceefaf846 [dart/vm]: fix bug in TextBuffer capacity
Rationale:
Ensuring capacity computation was off by one (due to trailing '\0')
if the initial buffer size was zero. Granted, this can only happen
after a Steal(), but since API did not exclude reuse after this
operation, it is better to just handle this than crash.

https://github.com/dart-lang/sdk/issues/36818

Change-Id: I4e404c4361da03e24364280fb01a308fbf7ace6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100991
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-05-01 22:26:41 +00:00
Ben Konyi 5fbf7720f8 [ VM ] Updated splay-tree licenses, added V8 project authors to AUTHORS
Change-Id: I02e38f3b80617d0d4ddf398cb94e8ee027d68e0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100889
Reviewed-by: Zach Anderson <zra@google.com>
2019-04-30 19:50:46 +00:00
Stevie Strickland 4028fec3b5 Reland "[vm] Finish adding support for ECMAScript 2018 features."
This work pulls in v8 support for these features with
appropriate changes for Dart and closes
https://github.com/dart-lang/sdk/issues/34935.

This adds support for the following features:

* Interpreting patterns as Unicode patterns instead of
  BMP patterns
* the dotAll flag (`/s`) for changing the behavior
  of '.' to also match line terminators
* Escapes for character classes described by Unicode
  property groups (e.g., \p{Greek} to match all Greek
  characters, or \P{Greek} for all non-Greek characters).

The following TC39 proposals describe some of the added features:

* https://github.com/tc39/proposal-regexp-dotall-flag
* https://github.com/tc39/proposal-regexp-unicode-property-escapes

These additional changes are included:

* Extends named capture group names to include the full
  range of identifier characters supported by ECMAScript,
  not just ASCII.
* Changing the RegExp interface to return RegExpMatch
  objects, not Match objects, so that downcasting is
  not necessary to use named capture groups from Dart

**Note**: The changes to the RegExp interface are a
breaking change for implementers of the RegExp interface.
Current users of the RegExp interface (i.e., code using Dart
RegExp objects) will not be affected.

Change-Id: Ie62e6082a0e2fedc1680ef2576ce0c6db80fc19a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100641
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Stevie Strickland <sstrickl@google.com>
2019-04-29 09:11:48 +00:00
Keerti Parthasarathy 9238e25305 Revert "[vm] Finish adding support for ECMAScript 2018 features."
This reverts commit 5ebb640a67.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> [vm] Finish adding support for ECMAScript 2018 features.
> 
> This work pulls in v8 support for these features with
> appropriate changes for Dart and closes
> https://github.com/dart-lang/sdk/issues/34935.
> 
> This adds support for the following features:
> 
> * Interpreting patterns as Unicode patterns instead of
>   BMP patterns
> * the dotAll flag (`/s`) for changing the behavior
>   of '.' to also match line terminators
> * Escapes for character classes described by Unicode
>   property groups (e.g., \p{Greek} to match all Greek
>   characters, or \P{Greek} for all non-Greek characters).
> 
> The following TC39 proposals describe some of the added features:
> 
> * https://github.com/tc39/proposal-regexp-dotall-flag
> * https://github.com/tc39/proposal-regexp-unicode-property-escapes
> 
> These additional changes are included:
> 
> * Extends named capture group names to include the full
>   range of identifier characters supported by ECMAScript,
>   not just ASCII.
> * Changing the RegExp interface to return RegExpMatch
>   objects, not Match objects, so that downcasting is
>   not necessary to use named capture groups from Dart
> 
> **Note**: The changes to the RegExp interface are a
> breaking change for implementers of the RegExp interface.
> Current users of the RegExp interface (i.e., code using Dart
> RegExp objects) will not be affected.
> 
> Change-Id: I0709ed0a8d5db36680e32bbad585594857b9ace4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95651
> Commit-Queue: Stevie Strickland <sstrickl@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=lrn@google.com,kustermann@google.com,jmesserly@google.com,johnniwinther@google.com,sstrickl@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I1eda0fee4fd9e94df095944049833a67b07277e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100560
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2019-04-25 14:29:51 +00:00
Stevie Strickland 5ebb640a67 [vm] Finish adding support for ECMAScript 2018 features.
This work pulls in v8 support for these features with
appropriate changes for Dart and closes
https://github.com/dart-lang/sdk/issues/34935.

This adds support for the following features:

* Interpreting patterns as Unicode patterns instead of
  BMP patterns
* the dotAll flag (`/s`) for changing the behavior
  of '.' to also match line terminators
* Escapes for character classes described by Unicode
  property groups (e.g., \p{Greek} to match all Greek
  characters, or \P{Greek} for all non-Greek characters).

The following TC39 proposals describe some of the added features:

* https://github.com/tc39/proposal-regexp-dotall-flag
* https://github.com/tc39/proposal-regexp-unicode-property-escapes

These additional changes are included:

* Extends named capture group names to include the full
  range of identifier characters supported by ECMAScript,
  not just ASCII.
* Changing the RegExp interface to return RegExpMatch
  objects, not Match objects, so that downcasting is
  not necessary to use named capture groups from Dart

**Note**: The changes to the RegExp interface are a
breaking change for implementers of the RegExp interface.
Current users of the RegExp interface (i.e., code using Dart
RegExp objects) will not be affected.

Change-Id: I0709ed0a8d5db36680e32bbad585594857b9ace4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95651
Commit-Queue: Stevie Strickland <sstrickl@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-04-24 09:24:16 +00:00
Ryan Macnak 971f4845d7 [build] Remove last platform -> vm and bin -> vm dependencies. Fix some ODR violations.
Change some static_libraries to source_sets to make ODR violations link-time errors.

This is needed to enable (stop suppressing) -fvisibility=hidden in Fuchsia product builds.

Change-Id: I699cec8d4b516beab9cebf9db0a522a7ff99e004
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99822
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-04-22 20:15:43 +00:00
Daco Harkes 462e03d01e Reland "[vm] Refactor Location to use either dart::Register or dart::host::Register"
Refactoring motivation: go/dart-simulated-ffi

* template Location and PairLocation with <dart::Register, dart::FpuRegister> or <dart::host::Register, dart::host::FpuRegister>
* move RegisterName and FpuRegisterName from assembler to constants
* move methods that are only implemented by Location and not HostLocation out of Location

Change-Id: Ie9aa2dae63380da0cbfb15eacc440537fbed48f8
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-bare-linux-release-simarm-try, vm-kernel-precomp-bare-linux-release-simarm64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-linux-debug-simdbc64-try, vm-kernel-precomp-win-release-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98845
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
2019-04-11 10:09:23 +00:00
Ryan Macnak 1685ac3683 [vm] Reimplement COMPILE_ASSERT with static_assert for nicer error messages from the C++ compiler.
Since COMPILE_ASSERT was originally authored, we have moved to requiring C++11 support.

Change-Id: I8cd5f720d2350cb28d0363fbd9399c4f864d66d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99104
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-04-11 00:47:13 +00:00
Daco Harkes 8e0a669e74 Revert "[vm] Refactor Location to use either dart::Register or dart::host::Register"
This reverts commit 60b3643e8e.

Reason for revert: Broke Windows+simulator builds. (Template instantiation checks are different on Windows than on Linux/MacOS)

Original change's description:
> [vm] Refactor Location to use either dart::Register or dart::host::Register
> 
> Refactoring motivation: go/dart-simulated-ffi
> 
> * template Location and PairLocation with <dart::Register, dart::FpuRegister> or <dart::host::Register, dart::host::FpuRegister>
> * move RegisterName and FpuRegisterName from assembler to constants
> 
> Change-Id: I266b97ef1f0493c184f4486c7a0482845d4ac644
> Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-bare-linux-release-simarm-try, vm-kernel-precomp-bare-linux-release-simarm64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-linux-debug-simdbc64-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97312
> Commit-Queue: Daco Harkes <dacoharkes@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> Reviewed-by: Samir Jindel <sjindel@google.com>

TBR=vegorov@google.com,sjindel@google.com,dacoharkes@google.com

Change-Id: I8b4721e3ddbe1d32c3b553555064868bce5ea089
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-bare-linux-release-simarm-try, vm-kernel-precomp-bare-linux-release-simarm64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-linux-debug-simdbc64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98843
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2019-04-08 10:28:12 +00:00
Daco Harkes 60b3643e8e [vm] Refactor Location to use either dart::Register or dart::host::Register
Refactoring motivation: go/dart-simulated-ffi

* template Location and PairLocation with <dart::Register, dart::FpuRegister> or <dart::host::Register, dart::host::FpuRegister>
* move RegisterName and FpuRegisterName from assembler to constants

Change-Id: I266b97ef1f0493c184f4486c7a0482845d4ac644
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-bare-linux-release-simarm-try, vm-kernel-precomp-bare-linux-release-simarm64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-linux-debug-simdbc64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97312
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2019-04-08 09:45:27 +00:00
Matthew Dempsky a0e0a7a150 [vm] Delete disallowed constructors/operators
This allows the compiler to emit better errors. It also allows the
compiler to detect when a class accidentally references its own
supposedly disallowed constructors/operators (e.g., see dartutils.cc).

Notably, this exposes a number of private member variables that are
unused, but some that are used only in certain build configurations.
It would arguably be better to only define the variables when they're
needed, but that's deferred to a subsequent CL.

Change-Id: I5d0e6697eebebc9321fae1ff49cc68caf557b903
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97175
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-03-23 00:52:41 +00:00
Régis Crelier 137171af71 [VM runtime] Disable dual mapping code in AOT runtime (fixes #36260).
Change-Id: I16058ab405536d94aafc169e6494c0a841fce3dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97347
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-03-20 19:23:38 +00:00
Régis Crelier e2a86d9081 [VM runtime] Use memfd_create instead of shm_open for dual mapping of code.
Detect both at compile time and runtime for memfd_create support and disable
dual code mapping if not available.

Change-Id: I6908e6c116a60218bb5002378470011dfe76a257
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96845
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-03-14 16:56:34 +00:00
Régis Crelier a39833d957 Reland "Reland "[VM runtime] Dual mapping of executable pages.""
This is a reland of 6da340bf76

Original change's description:
> Reland "[VM runtime] Dual mapping of executable pages."
> 
> This is a reland of 44186dfdcd
> 
> Original change's description:
> > [VM runtime] Dual mapping of executable pages.
> > 
> > Change-Id: Iaad78d324e25462ce951f4df26974a6a368c50b7
> > Reviewed-on: https://dart-review.googlesource.com/c/93377
> > Commit-Queue: Régis Crelier <regis@google.com>
> > Reviewed-by: Ryan Macnak <rmacnak@google.com>
> 
> Change-Id: I7a0caa078950637d9fe831732577fd2467061099
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95263
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

Change-Id: I3a01f0e67d733c5db41618f691431e72c1e1cb2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96422
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-03-12 20:45:45 +00:00
Vyacheslav Egorov 9ff0a654ca Revert "Reland "[VM runtime] Dual mapping of executable pages.""
This reverts commit 6da340bf76.

Reason for revert: almost all benchmarks are now failing on Golem linux-x64 target. Flutter Golem build is broken 

Original change's description:
> Reland "[VM runtime] Dual mapping of executable pages."
> 
> This is a reland of 44186dfdcd
> 
> Original change's description:
> > [VM runtime] Dual mapping of executable pages.
> > 
> > Change-Id: Iaad78d324e25462ce951f4df26974a6a368c50b7
> > Reviewed-on: https://dart-review.googlesource.com/c/93377
> > Commit-Queue: Régis Crelier <regis@google.com>
> > Reviewed-by: Ryan Macnak <rmacnak@google.com>
> 
> Change-Id: I7a0caa078950637d9fe831732577fd2467061099
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95263
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,regis@google.com

Change-Id: I3342de2584537269ffe9a53946bef27cb25a69fc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96161
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2019-03-09 14:15:39 +00:00
Régis Crelier 6da340bf76 Reland "[VM runtime] Dual mapping of executable pages."
This is a reland of 44186dfdcd

Original change's description:
> [VM runtime] Dual mapping of executable pages.
> 
> Change-Id: Iaad78d324e25462ce951f4df26974a6a368c50b7
> Reviewed-on: https://dart-review.googlesource.com/c/93377
> Commit-Queue: Régis Crelier <regis@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

Change-Id: I7a0caa078950637d9fe831732577fd2467061099
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95263
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-03-08 18:33:02 +00:00
Ryan Macnak 60de5b4983 [vm] Avoid quadratic growth in (Malloc)TextBuffer and ZoneTextBuffer.
In particular, avoid quadratic memory use in ZoneTextBuffer.

Change-Id: I8d2ea77d35cd3c2c353ae557a2ee676ee8413653
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95483
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-03-05 22:32:22 +00:00
Dan Field eb73f132c1 [vm] Add macro for fallthrough annotations
Internal builds in Google are catching this as an error.

I'm guarding it because I assume we might support building using other
compilers.

Change-Id: I665099cace9c6a40d737c471dd1b0fdb326fea39
Reviewed-on: https://dart-review.googlesource.com/c/91162
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-02-15 01:12:01 +00:00
Alexander Markov 336969538c [vm/bytecode] Revise representation of types, constants and calls in bytecode
* Type arguments are moved to global object table (and de-duplicated).
* Finalize non-recursive generic types at bytecode generation time.
* Constants are moved to global object table (and de-duplicated).
* ICData creation is avoided for direct calls.
* Interface calls reference target member instead of selector name.

Size of a dilp files: 17868K => 15896K (-11%).

Change-Id: I0c9bf338137a0fae6ed90ab6b125ed2b24a1a8ad
Reviewed-on: https://dart-review.googlesource.com/c/91108
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-02-05 20:13:45 +00:00
Ryan Macnak cdd4adf467 [vm, kbc, dbc] Remove dependency on computed goto.
Change-Id: I0727a431149123640b883e29d4e3ca83cb953dce
Reviewed-on: https://dart-review.googlesource.com/c/84341
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-11-26 18:20:27 +00:00
Alexander Markov ed48cfeb47 [vm/bytecode] Support source positions when executing bytecode
This includes both interpreted and compiled bytecode.

Change-Id: I6309ec4f0687f68caf6260cc57dacf94f027177d
Reviewed-on: https://dart-review.googlesource.com/c/84481
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-11-15 00:48:04 +00:00
Daco Harkes 1a3bca5485 [vm] Use atomic release-acquire operations to update RawICData::ic_data_
Background compiler expects to see fully initialized array when it
reads RawICData::ic_data_ array - which previously was not
guaranteed on architectures with weak memory model.

Fixes https://github.com/dart-lang/sdk/issues/34999
Change-Id: Ie9544d7fc4683fb5cb145aa1a572e8939bd8dc13
Reviewed-on: https://dart-review.googlesource.com/c/82442
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-11-01 18:29:05 +00:00
Zach Anderson 27c79f9459 [vm] Propagate more UTF8 conversion errors
Change-Id: I8d4f3a892a51bed8b922961bd74bcad727f66508
Reviewed-on: https://dart-review.googlesource.com/73280
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-09-06 02:23:21 +00:00
Ryan Macnak 28178aade6 [vm] Move VM globals from runtime/platform to runtime/vm.
Change-Id: Ia271602865c259cc5a6e001869f3104817d1ce44
Reviewed-on: https://dart-review.googlesource.com/63261
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-09-04 21:16:39 +00:00
Zach Anderson 707040bfa0 [vm] Adds targets for gen_snapshot that include the interpreter
As the interpreter matures it will hopefully be merged into the regular
jit configuration, but for now we make a separate configuration for it.

Change-Id: Ie287ffccadbf34243d64d90ee43cf5d429966082
Reviewed-on: https://dart-review.googlesource.com/69420
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-08-10 22:05:55 +00:00
Vyacheslav Egorov 4fa139b4b8 [vm/compiler] Rework how logical expressions are compiled to IL.
When logical expression is evaluated in the control context (e.g. if (cond) { ... })
avoid materializing a boolean value and then dispatching on it. Instead connect
true and false successors directly to then and else branches.

This CL also improves IL generated when logical expression is evaluated for value
(e.g. x = (cond)): we similarly avoid materializing intermediate results and also
avoid comparisons that are not needed, e.g. when evaluating x = A && B we construct
graph x = A ? B : false, instead of x = A ? (B == true ? true : false) : false style
of graph.

Change-Id: I204d414cc6751949641b6c46423a6319f6e2d89b
Reviewed-on: https://dart-review.googlesource.com/67562
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-08-02 10:51:53 +00:00
Ryan Macnak 83a4d98554 [vm] Weaken CAS to RMW when accessing the remembered and mark bits.
Tighten some sequences in the write barrier stub.

Change-Id: Ib3657b9b582082137d17e86135200444172f428a
Reviewed-on: https://dart-review.googlesource.com/60820
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-06-20 21:53:12 +00:00
Ben Konyi e35ed9c749 [ VM / Build ] Added '--no-include-kernel-service' to build.py. By default, the kernel service is now included in all build modes, including product mode. Providing '--no-include-kernel-service' will build the specified configuration without the kernel service.
Change-Id: I682cd7c2895a9bcb215948615f2bdc627abe8d08
Reviewed-on: https://dart-review.googlesource.com/56286
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-05-23 20:35:53 +00:00
Martin Kustermann 11006c3bac Reland "[VM] Use IR for code in [CatchEntryInstr]s to populate captured exception/stacktrace variables"
This fixes an issue when a program got loaded via dill, a function
with a try-catch got optimized and the exception/stacktrace variables
got captured.

Change-Id: Icb8ea5f3557080f8274f7db2af09e33154820e5b
Reviewed-on: https://dart-review.googlesource.com/55721
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-17 16:48:56 +00:00
Martin Kustermann e6fc78c87b Revert "Reland "[VM] Use IR for code in [CatchEntryInstr]s to populate captured exception/stacktrace variables""
This reverts commit 23b4a505ec.

Reason for revert: The language_2/custom_await_stack_trace_test started failing.

Original change's description:
> Reland "[VM] Use IR for code in [CatchEntryInstr]s to populate captured exception/stacktrace variables"
> 
> This fixes an issue when a program got loaded via dill, a function
> with a try-catch got optimized and the exception/stacktrace variables
> got captured.
> 
> Change-Id: Icb626965019b248afe3b72a6679c5049ea7b7b00
> Reviewed-on: https://dart-review.googlesource.com/55681
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> Commit-Queue: Martin Kustermann <kustermann@google.com>

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

Change-Id: Ic825c1e3ed14c731da1d43aa6f27d37ed5d36b4c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/55720
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-05-17 15:13:50 +00:00
Martin Kustermann 23b4a505ec Reland "[VM] Use IR for code in [CatchEntryInstr]s to populate captured exception/stacktrace variables"
This fixes an issue when a program got loaded via dill, a function
with a try-catch got optimized and the exception/stacktrace variables
got captured.

Change-Id: Icb626965019b248afe3b72a6679c5049ea7b7b00
Reviewed-on: https://dart-review.googlesource.com/55681
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-05-17 14:16:16 +00:00
Martin Kustermann b3affa6721 Revert "[VM] Use IR for code in [CatchEntryInstr]s to populate captured exception/stacktrace variables"
This reverts commit 3531af383e.

Reason for revert: Caused many buildbot failures.

Original change's description:
> [VM] Use IR for code in [CatchEntryInstr]s to populate captured exception/stacktrace variables
> 
> This fixes an issue when a program got loaded via dill, a function
> with a try-catch got optimized.
> 
> Change-Id: I98b2a4aaa7e5472f3e37fd71c1276079102b0142
> Reviewed-on: https://dart-review.googlesource.com/54021
> Commit-Queue: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

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

Change-Id: If4b80128525754d30cec680ad5ff6bc4035296bd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/55422
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-05-16 17:27:13 +00:00
Martin Kustermann 3531af383e [VM] Use IR for code in [CatchEntryInstr]s to populate captured exception/stacktrace variables
This fixes an issue when a program got loaded via dill, a function
with a try-catch got optimized.

Change-Id: I98b2a4aaa7e5472f3e37fd71c1276079102b0142
Reviewed-on: https://dart-review.googlesource.com/54021
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-16 16:46:42 +00:00
Zach Anderson 70cf29cc59 [GN] Add interpreter config. Refactor configs.
Change-Id: Ic7f7c437464fe8c27850e1dc5c958d699143b87c
Reviewed-on: https://dart-review.googlesource.com/54712
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-05-14 15:26:37 +00:00
Régis Crelier 41fcbd097c [VM runtime] Initial version of Kernel Bytecode interpreter in VM runtime.
Not fully working yet, only x64, no gc, no frame walking, etc...

Change-Id: I4d8357f6d46371bf21c3d54266cfe26163e3c8dc
Reviewed-on: https://dart-review.googlesource.com/50021
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-05-09 20:29:27 +00:00
Ryan Macnak 65d7bf8152 [vm] Align 64-bit atomic variables for 32-bit iOS.
Change-Id: I2bbe637fce59bd5d84f7db8a44960e36fe63d2d9
Reviewed-on: https://dart-review.googlesource.com/53822
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-05-07 18:37:12 +00:00
Ryan Macnak 7e54844fe7 [vm] Fix build for gcc 7.3.0.
Change-Id: I02ead73679c3a6e1e5c9313f78c5f02ad6ca79b0
Reviewed-on: https://dart-review.googlesource.com/53521
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-05-03 17:59:44 +00:00
asiva b64f2acfb9 Revert "[VM] Improve code generation for uint32"
Please see issue https://github.com/dart-lang/sdk/issues/33008 for more
details on the regression caused by this commit.

This reverts commit 9741c220f3.

It also effectively reverts

https://dart-review.googlesource.com/c/sdk/+/53006
https://dart-review.googlesource.com/c/sdk/+/53001

which were follow up CLs to the main commit.

Change-Id: Iac399c620a312ab3c3b27a3cba4e681742bcfe33
Reviewed-on: https://dart-review.googlesource.com/53164
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-05-01 00:25:01 +00:00
Erik Corry a8b0a1a5fa [VM] Except SIMDBC from change for x64 and ARM64
R=vegorov@google.com
TBR=vegoroc@google.com
Change-Id: I1ddb72e0de13400d57dd6ca0a551a7273c4dea24
Reviewed-on: https://dart-review.googlesource.com/53001
Reviewed-by: Erik Corry <erikcorry@google.com>
2018-04-29 18:15:03 +00:00
Erik Corry 9741c220f3 [VM] Improve code generation for uint32
Simplify by no longer using the signed unboxed int32 type on
64 bit platforms.

R=vegorov@google.com

Change-Id: Ic8eab7308f2ce01e5618344f50f72b95ce13a0dc
Reviewed-on: https://dart-review.googlesource.com/52762
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-04-29 12:41:43 +00:00
Ryan Macnak aee4561882 [vm] Remove dependency of platform/assert.cc on vm/profiler.h
Change-Id: Ieab84b164ed620d5edca06e3c7b63b33bdcd6569
Reviewed-on: https://dart-review.googlesource.com/52943
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-04-27 23:30:48 +00:00
Ben Konyi 090d9e9231 [ VM / Dart 2 ] Reland: Fixed StackTraceFormat test to expect file URIs in stacks generated by the Dart frontend.
This reverts commit a81f4babcc.

Change-Id: I88f0d004640dd1a994b211ab2a698fd2f87afeca
Reviewed-on: https://dart-review.googlesource.com/49540
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-04-04 21:28:16 +00:00
Ryan Macnak d9c3190e44 [vm] Remove some bin -> vm includes.
Change-Id: Id304de9618a299a201b946a901a54352772f56fb
Reviewed-on: https://dart-review.googlesource.com/48704
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-03-28 23:16:09 +00:00
Zach Anderson 0482cf4da1 [fuchsia] Add rules to build gen_snapshot targeting Fuchsia
This change enables building a gen_snapshot that targets Fuchsia during
an SDK build that targets the host (Mac, Linux).

Change-Id: I4cfbcbe4e26e4be7108fc40c96122fe9a2fb4c19
Reviewed-on: https://dart-review.googlesource.com/48683
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-03-28 19:39:49 +00:00
Martin Kustermann 31dd6683f8 [VM] Optimize performance of dart_boostrap in debug-kernel-strong mode.
Since the kernel reading helpers have been extended to not only work
with a kernel blob in C heap, but also work based on a [TypedData]
buffer in the VM heap, access to the [TypedData] buffer is on the hot
path now.

This hot path is slowing things down considerably, in particular due
to NoSafepoingScope's.

This CL removes a critical NoSafepoingScope when accessing the
[TypedData] in read-only mode.  It also allows passing in the [Thread]
directly, to avoid TLS lookups.

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

Change-Id: I91955bea5cd4eddbbd21c5d3bc6813504c2cece9
Reviewed-on: https://dart-review.googlesource.com/47222
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-21 10:24:29 +00:00
Vyacheslav Egorov d41794ee11 [vm/compiler] Fix UB in ToIntegerConstant helper
Change-Id: I5ffbebb12bd84eacca33fb81b3df51ba4ca291a8
Reviewed-on: https://dart-review.googlesource.com/46722
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-03-19 14:12:15 +00:00
Ryan Macnak 558a931409 [vm] Move some string utils from runtime/vm to runtime/platform.
Change-Id: I552086445a7e07792f9da85afa5edf23b6c450d5
Reviewed-on: https://dart-review.googlesource.com/44402
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-03-01 02:07:46 +00:00
Ryan Macnak b5966dbddc [vm] Don't use popcount intrinsic on both x86s.
Bug: https://github.com/dart-lang/sdk/issues/32314
Change-Id: I5589a22de5777af664c83f221758ba5b35d8678a
Reviewed-on: https://dart-review.googlesource.com/43886
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-02-28 17:48:16 +00:00
asiva 1aaebedd70 Reland https://dart-review.googlesource.com/c/sdk/+/43497
(Strip out platform dill files and the kernel service dill file from a
 product build)
After fixing the issue of using 'is_product' which is not present in the
flutter build environment.

Change-Id: I49dd68e63b1f6d7ac0981b28bf2b08618551ae2e
Reviewed-on: https://dart-review.googlesource.com/44024
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-02-28 01:15:47 +00:00
Vyacheslav Egorov 59c3f0f0c3 Revert "Strip out platform dill files and the kernel service dill file from"
This reverts commit 92b5bf86a1.

Reason for revert: this breaks Flutter engine build because is_product is not defined.

Original change's description:
> Strip out platform dill files and the kernel service dill file from
> a product build.
> They only need to run a self contained '.dill' file as their application.
> 
> Change-Id: I9a2566b9e552a7aef4ebf52c2ecb664088ad030c
> Reviewed-on: https://dart-review.googlesource.com/43497
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Zach Anderson <zra@google.com>
> Reviewed-by: Siva Chandra <sivachandra@google.com>

TBR=zra@google.com,sivachandra@google.com,asiva@google.com

Change-Id: Id55a3f749290813aba479cc705c6065b75a0ac9c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/43980
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-02-27 08:45:39 +00:00
asiva 92b5bf86a1 Strip out platform dill files and the kernel service dill file from
a product build.
They only need to run a self contained '.dill' file as their application.

Change-Id: I9a2566b9e552a7aef4ebf52c2ecb664088ad030c
Reviewed-on: https://dart-review.googlesource.com/43497
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Siva Chandra <sivachandra@google.com>
2018-02-26 23:58:07 +00:00
Ryan Macnak afdbce7b13 [vm, isolate] Send large TypedData as ExternalTypedData in isolate messages.
Be careful to free external data when reading or writing a message is interrupted, or releasing messaging without reading on shutdown.

Bug: https://github.com/dart-lang/sdk/issues/31959
Change-Id: Ia39acb9ca0e27cf9e8b83961741e5949b5930266
Reviewed-on: https://dart-review.googlesource.com/41561
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-02-21 18:57:14 +00:00
Alexander Markov 1a1c7693d2 [VM/compiler] Fix range analysis for 64-bit fixed-size integers
This CL corrects handling of overflows in range analysis to
account for wrap-around (which happens with new integer semantics).

* If there is an overflow while doing computations in range
  analysis, the resulting range is approximated as full int64 range.

* For symbolic range boundaries 'symbol + offset', offset is checked
  to stay within [kMinInt64 - kSmiMin, kMaxInt64 - kSmiMax] in order
  to guarantee that overflow doesn't occur.

Issue: https://github.com/dart-lang/sdk/issues/31920
Change-Id: I2c16adbe3597e9b718ed2f6ce7210426fcc9e6a6
Reviewed-on: https://dart-review.googlesource.com/39423
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-02-08 21:49:42 +00:00
Alexander Aprelev 99e8f560af Revert "Revert "Reintroduce incremental compiler wrapper that supports accept protocol.""
This reverts commit 2d4c606e63.

The fix for the debug buildbot breakage now consists of skipping wide to utf8 conversion
altogether, instead move uri to path conversion directly into newly added File::OpenUri method.

Change-Id: Id3d7457d6a6b5045e5f38678548f4d7bed6d2c43
Reviewed-on: https://dart-review.googlesource.com/39801
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-02-07 20:58:51 +00:00
Alexander Aprelev 2d4c606e63 Revert "Reintroduce incremental compiler wrapper that supports accept protocol."
This reverts commit d78a41e0ee.

Revert "Fix length for WideToUTF8 conversion in UriToPath"

This reverts commit 011e1cc1c5.

Change-Id: I36140426a474962f77605e1aed6ddfd158bd064a
Reviewed-on: https://dart-review.googlesource.com/39480
Reviewed-by: Alexander Aprelev <aam@google.com>
2018-02-07 04:02:36 +00:00
Alexander Aprelev d78a41e0ee Reintroduce incremental compiler wrapper that supports accept protocol.
This reverts 4e677e9606

Change-Id: I32410b3a4ee9cc8a6f3318917ed519e13eea14f6
Reviewed-on: https://dart-review.googlesource.com/37862
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-02-06 18:38:58 +00:00
Martin Kustermann 0a652c9ca9 Revert "[VM] Use IR for code in [CatchEntryInstr]s to populate captured exception/stacktrace variables"
This reverts commit 12759870a4.

Reason for revert: Broke many bots.

Original change's description:
> [VM] Use IR for code in [CatchEntryInstr]s to populate captured exception/stacktrace variables
> 
> This fixes an issue when a program got loaded via dill, a function
> with a try-catch got optimized and the exception/stacktrace variables
> got captured.
> 
> Change-Id: Ia6b62f2a0986c78b90afe7fae25025ca4e5b09db
> Reviewed-on: https://dart-review.googlesource.com/35182
> Commit-Queue: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

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

Change-Id: I2ec7b4bea401e6d5665f6e789eb8e241b99db7b3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/36200
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-01-21 20:46:49 +00:00
Martin Kustermann 12759870a4 [VM] Use IR for code in [CatchEntryInstr]s to populate captured exception/stacktrace variables
This fixes an issue when a program got loaded via dill, a function
with a try-catch got optimized and the exception/stacktrace variables
got captured.

Change-Id: Ia6b62f2a0986c78b90afe7fae25025ca4e5b09db
Reviewed-on: https://dart-review.googlesource.com/35182
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-01-21 16:12:58 +00:00
Martin Kustermann cf1de7d46c [VM] Replace hand-written assembly prologues with IR
As part of the prologue changes we get rid of the empty context as well.

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

Change-Id: I707e23c631bcfbbad6c91c4963d0c10f7a0be625
Reviewed-on: https://dart-review.googlesource.com/25320
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-12-13 16:04:34 +00:00
Siva Chandra 702e4aecb8 Keep the line starts delta encoded in the VM heap as well - take 2
This reverts commit adf04d0ac6.

The original change used macros from stdint.h and it failed build on
the linux sdk bot:
https://uberchromegw.corp.google.com/i/client.dart/builders/dart-sdk-linux-be/builds/17348

In the newer version, constants from runtime/platform/globals.h are used
instead of the macros from stdint.h. Constants for int8 have been added as
they were not present already.

Change-Id: Ia4f27613fa5dca2cd6dbfeb37715ea70a85cec95
Reviewed-on: https://dart-review.googlesource.com/25083
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Chandra <sivachandra@google.com>
2017-12-01 05:16:48 +00:00
Samir Jindel be07555207 Revert "Revert "[kernel] Implementation of fine-grained strong mode argument type-checks, phase 2""
This fixes some incorrect asserts that were breaking the debug bots.
The original revision is available in Patchset 1.

This reverts commit 26735519cb.

Bug:
Change-Id: Ifa599b7bff752dec4c505e10fd6db206e1abd977
Reviewed-on: https://dart-review.googlesource.com/23820
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2017-11-27 18:25:31 +00:00
Vyacheslav Egorov 26735519cb Revert "[kernel] Implementation of fine-grained strong mode argument type-checks, phase 2"
This reverts commit f13f772bb2.

Reason for revert: dartk(p)-strong debug mode is completely broken
because we convert int values non-representable as Smi to Smi, which
triggers that assert. The code that does tagging checks that
Untag(Tag(x)) == x, however for our purposes this identity does not
need to hold because we only care about lower bits and ignore the sign.

Reverting to restore green-ness of DEBUG builds.

TBR=sjindel@google.com

Bug:
Change-Id: Id436cbe000d6dec8db3469070ed531327cc82d89
Reviewed-on: https://dart-review.googlesource.com/23661
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-26 10:21:01 +00:00
Samir Jindel f13f772bb2 [kernel] Implementation of fine-grained strong mode argument type-checks, phase 2
This revision continues the implementation of:
https://docs.google.com/document/d/1KK8b6kzr0pQev5YNftSZhN3M6I8HcvOJwJ6U-cW4nfw/edit?ts=5a05b3e9#heading=h.7j21arix8p2

* Add argument checking bits for named arguments in the arguments descriptor.
* Add argument checking bits for type arguments.
* Calculate argument checking bits for setters.
* Add dispatch category to PropertySet and DirectPropertySet.

Bug:
Change-Id: Ieb0a4a99c401f53a72de473fda7bab61581f9996
Reviewed-on: https://dart-review.googlesource.com/22700
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2017-11-24 18:23:57 +00:00
Erik Corry d300b08e35 [VM] Use X64 disassembler for IA32 and X64 (reland)
R=vegorov@google.com

This removes the IA32 disassembler and uses the X64 disassembler for
both variants.  Instructions that were in the IA32 assembler, but not
supported by the X64 disassembler have been added.  It also adds some
regression tests for a lot of the disassembler output.
Bug:
Change-Id: I243abbb04c3a77810ce96ca74f7f42a5a1aea0cf
Reviewed-on: https://dart-review.googlesource.com/22982
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Erik Corry <erikcorry@google.com>
2017-11-22 12:04:18 +00:00
Erik Corry 80992a5a09 Revert "[VM] Use X64 disassembler for IA32 and X64"
This reverts commit 9e42f006d9.
due to test failures on non-Linux platforms.

R=karlklose@google.com

Bug:
Change-Id: I5dc40da75d8d89fca8fce98a69a39d767493af1b
Reviewed-on: https://dart-review.googlesource.com/22921
Reviewed-by: Karl Klose <karlklose@google.com>
2017-11-22 09:11:12 +00:00
Erik Corry 9e42f006d9 [VM] Use X64 disassembler for IA32 and X64
R=vegorov@google.com

Bug:
Change-Id: I19b1f58e16ea35dc81b941c54e6e57b97cad3d74
Reviewed-on: https://dart-review.googlesource.com/22020
Commit-Queue: Erik Corry <erikcorry@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-22 08:01:07 +00:00
Samir Jindel a991c17dc9 [kernel] Implementation of fine-grained strong mode argument type-checks, phase 1
The revision begins the implementation of:
https://docs.google.com/document/d/1KK8b6kzr0pQev5YNftSZhN3M6I8HcvOJwJ6U-cW4nfw/edit?ts=5a05b3e9#heading=h.7j21arix8p2

* The ArgumentsDescriptor is updated to hold a bitvector for positional arguments.
* The kernel flowgraph builder is updated to calculate the appropriate bits from
  the interface target and pass them through the ArgumentsDescriptor
  for regular MethodInvocations.

Bug:
Change-Id: I1cd9f43f697df1dd4f36103bbdfc0ba000125c02
Reviewed-on: https://dart-review.googlesource.com/21541
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2017-11-21 15:35:48 +00:00
Erik Corry 1109ffcb6a [VM] Add ARM64 bitfield instructions
R=rmacnak@google.com

Also some minor cleanup in the way we encode ARM instructions.
I'll be needing these for 32 bit Smis on ARM64.
Bug:
Change-Id: I5f515590375a2c6ad11bc6f1a80a4f8e27cd82b4
Reviewed-on: https://dart-review.googlesource.com/20668
Commit-Queue: Erik Corry <erikcorry@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-11-16 15:34:11 +00:00
Ryan Macnak 374c21ccb4 [vm] Improve packing of StackMaps.
Flutter gallery ARM32:
StackMaps        1248008 ->   898886 (-28.0%)
Total snapshot  11089876 -> 10741228 (-3.1%)

Bug: https://github.com/dart-lang/sdk/issues/31302
Change-Id: I61c6fbf9024648907238d1d835d13d75b17f224a
Reviewed-on: https://dart-review.googlesource.com/20480
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2017-11-14 20:04:14 +00:00
Ryan Macnak f60efb7e40 Reapply "[vm] Popcount via compiler intrinsics."
Add missing rename of CountOneBits in ARM assembler.

Change-Id: I735da06343248573a1b049109ebc2bf0d1634960
Reviewed-on: https://dart-review.googlesource.com/18504
Reviewed-by: Zach Anderson <zra@google.com>
2017-11-03 17:39:16 +00:00
Ryan Macnak 2761c556ca Revert "[vm] Popcount via compiler intrinsics."
This reverts commit c4f4cdbf29.

Reason for revert: ARM compile-time errors

Original change's description:
> [vm] Popcount via compiler intrinsics.
> 
> Change-Id: I8913beea7b984f04cec7f9efc00673aa12095eda
> Reviewed-on: https://dart-review.googlesource.com/18423
> Reviewed-by: Zach Anderson <zra@google.com>

TBR=rmacnak@google.com,zra@google.com

Change-Id: I5efe8100e3c1fa404b1c24f369dca5c137acd2b8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/18640
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-11-03 16:50:47 +00:00
Ryan Macnak c4f4cdbf29 [vm] Popcount via compiler intrinsics.
Change-Id: I8913beea7b984f04cec7f9efc00673aa12095eda
Reviewed-on: https://dart-review.googlesource.com/18423
Reviewed-by: Zach Anderson <zra@google.com>
2017-11-03 16:34:35 +00:00
Zachary Anderson 9ab8b55663 [gn] Split target arch/os defines from dart_config
This is a baby-step towards building an SDK targeting the host arch
during a cross-build. This will require a similar update to the use
of dart_config in the Flutter engine at //flutter/lib/io/BUILD.gn:19.

Change-Id: I8b871cceb53038cab8407264664c5ce545e6e010
Reviewed-on: https://dart-review.googlesource.com/17523
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-10-31 17:33:13 +00:00
Ryan Macnak 031069d2bd [vm] Avoid using a generated stub to get the current SP, since generated stubs aren't available during early start up.
Change-Id: Ib0d78965ba5ccb1fa2b084d82b2bb79485b7900f
Reviewed-on: https://dart-review.googlesource.com/12780
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-10 22:52:25 +00:00
Ryan Macnak 3609522166 printf format checking is a compiler feature, not a platform feature.
Change-Id: Ib3e0beb814b5cae6f2b4be13f055069f682674f5
Reviewed-on: https://dart-review.googlesource.com/11645
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-09 22:26:01 +00:00
Alexander Markov f6d6766920 [VM] Restore disassembler in flutter/profile (dart/release) mode
This CL restores disassembler in precompiled mode after it was removed
in 8cb752f73b.
Without disassembler observatory is not able to show assembly code
in 'flutter run --profile' mode.

This CL also pulls BufferFormatter out of il_printer.h/.cc as it is also
used in disassembler.

Change-Id: I098ddb8d8f5a2426028c1f467d58e5c2d6a82d21
Reviewed-on: https://dart-review.googlesource.com/7486
Reviewed-by: Zach Anderson <zra@google.com>
2017-09-21 16:07:02 +00:00
Ryan Macnak 3d21a46b72 Limit preserialized JSON for timeline events from Dart code to the arguments.
Avoids string copies in C++ and map copies in Dart.

Also remove some vestiages of removed feature that allowed an embedder to add pre-encoded events to the timeline.

Change-Id: I962a67093ba461c991d9169b0391c44af1d489db
Bug: https://github.com/dart-lang/sdk/issues/30787
Reviewed-on: https://dart-review.googlesource.com/6762
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-09-19 23:29:55 +00:00
Alexander Markov ffc85d1e92 [VM] Fix undefined behavior in Utils::Abs
Issue: https://github.com/dart-lang/sdk/issues/30572

Change-Id: If8c743edb140edb7a7f803521b51c776d41db5d6
Reviewed-on: https://dart-review.googlesource.com/5881
Reviewed-by: Zach Anderson <zra@google.com>
2017-09-14 18:15:17 +00:00
Zachary Anderson 3470145529 [Fuchsia] Update to use new tracing API
Change-Id: Ied0bc594fe16f427be10444ad5739a30b7003acc
Reviewed-on: https://dart-review.googlesource.com/4062
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-09-12 16:42:07 +00:00
Zachary Anderson 734beef062 [infra] Translate _sources.gypi files to _sources.gni files
Also deletes code that becomes dead as a result.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2996903002 .
2017-08-14 21:54:36 -07:00
Alexander Markov ed74405635 [vm] Revise Dart_IntegerToHexCString to avoid dependency on Bigint, v.2
Reapply 3d4838fc70 with the following
modifications:
* define PRIX64 to fix compilation errors on Windows;
* add and use short form format specifiers PX and PX64 to make it
  uniform with other format specifiers.

Original review: https://codereview.chromium.org/2987183002

Description of the original CL:

Until this change, implementation of Dart_IntegerToHexCString()
always created Bigint objects and used Bigint::ToHexCString() to do
the work.

In --limit-ints-to-64-bits mode (with Dart integers limited to 64
bits) Bigints are banned and should not be used.
This CL revises Dart_IntegerToHexCString implementation to avoid
creating Bigint objects for Smi and Mint arguments, so it would
work in --limit-ints-to-64-bits mode.

Also, this CL adds test case to lock down the behavior of
Dart_IntegerToHexCString.

R=zra@google.com

Issue: https://github.com/dart-lang/sdk/issues/30103
Review-Url: https://codereview.chromium.org/2985423002 .
2017-08-01 10:49:51 -07:00
Zachary Anderson 6cd8a79078 VM: Re-format to use at most one newline between functions
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07:00
Alexander Markov 7a20b6b8d8 Option to truncate integers to 64 bits, part 1 (core VM changes)
This changeset revises --limit-ints-to-64-bits option to
change range of integers from unlimited to int64.
On overflow, integer arithmetic operations silently wrap around and
discard extra bits. No Bigints are allocated in case of overflow.

This changeset is the 1st part in the series of changes, it revises the implementation of integer arithmetic operations. More changes will follow.

R=regis@google.com, zra@google.com

Issue: https://github.com/dart-lang/sdk/issues/30103
Review-Url: https://codereview.chromium.org/2974633003 .
2017-07-10 15:16:40 -07:00
Erik Corry 029b1cb948 Spelling fixes e to i.
R=kevmoo@google.com
BUG=

Review-Url: https://codereview.chromium.org/2957593002 .
2017-06-24 13:41:39 +02:00
Zachary Anderson ac16656161 Remove MIPS support
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2858623002 .
2017-06-22 08:49:22 -07:00
Ryan Macnak e1b31c6b4b [arm, arm64] Convince the Android toolchain not to bypass memcpy in Read/StoreUnaligned.
R=zra@google.com

Review-Url: https://codereview.chromium.org/2953653002 .
2017-06-21 14:03:50 -07:00
Ryan Macnak dddd96cfd2 [arm] Avoid unaligned access fault in Int32x4/Float32x4::value().
R=zra@google.com

Review-Url: https://codereview.chromium.org/2947783002 .
2017-06-21 09:11:04 -07:00
Zachary Anderson 5850122513 Fix simarm build for newer gcc's
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2924473002 .
2017-06-05 09:22:06 -07:00
Erik Corry aa60a2ea90 More compact string representation on 64 bit.
This moves the hash code into the header word for strings on 64 bit
platforms.  With the old layout, 9 character strings became 48-byte
objects.  With the new layout you have to go to 17 characters before
you are bumped from 4 to 6 words (32 to 48 bytes).

As a side effect, the class ID field is now 16 bits on all platforms
instead of having two different sizes, and the size field is 8 bits
on all platforms.

This also paves the way for moving the hash code for instance objects
into the header, so we won't need the side-lookup in the
hash-table-of-hash-codes on 64 bit platforms.

This is a reapplication of https://codereview.chromium.org/2893553002/
after issues were fixed in https://codereview.chromium.org/2888413002/
and https://codereview.chromium.org/2896583002/

R=vegorov@google.com
BUG=

Review-Url: https://codereview.chromium.org/2895183002 .
2017-05-22 10:04:59 +02:00
Dmitry Stefantsov e5f93a068f Revert "More compact string representation on 64 bit."
This reverts commit 5c8e472c82.

TBR=erikcorry@google.com

Review-Url: https://codereview.chromium.org/2889723005 .
2017-05-18 14:23:12 +02:00
Erik Corry 5c8e472c82 More compact string representation on 64 bit.
This moves the hash code into the header word for strings on 64 bit
platforms.  With the old layout, 9 character strings became 48-byte
objects.  With the new layout you have to go to 17 characters before
you are bumped from 4 to 6 words (32 to 48 bytes).

As a side effect, the class ID field is now 16 bits on all platforms
instead of having two different sizes, and the size field is 8 bits
on all platforms.

This also paves the way for moving the hash code for instance objects
into the header, so we won't need the side-lookup in the
hash-table-of-hash-codes on 64 bit platforms.

R=vegorov@google.com
BUG=

Review-Url: https://codereview.chromium.org/2893553002 .
2017-05-18 11:54:40 +02:00
Erik Corry aa6353b6da Dart SDK Spelling b, c, and d.
R=kmillikin@google.com
BUG=

Review-Url: https://codereview.chromium.org/2850783002 .
2017-05-01 08:28:10 +02:00
Zachary Anderson 8c9c54d833 [dart:io] Don't close stdin with a socket finalizer
If an Isolate touches the 'stdio' getter, a _NativeSocket with
attached finalizer is created for it. Previously, when such an
Isolate exited, the finalizer would close the underlying
file descriptor. This CL changes the finalizer for stdin such
that the native objects will be cleaned up, but the underlying
file descriptor will not be closed. The underlying file
descriptor will now only be closed if the stdin stream
subscription is explicitly canceled.

Accessing the stdin getter after the stream is explicitly
canceled will result in a FileSystemException.

See also: https://github.com/dart-lang/test/issues/583

fixes #29229

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2791423002 .
2017-04-04 13:57:42 -07:00
Ryan Macnak 9f2668c998 Set TARGET_OS_* from GN, falling back to HOST_OS_*.
Use TARGET_OS_* instead of HOST_OS_* to decide on the assembly variant to use. Allows, say, a gen_snapshot compiled for a Mac to target Android when generating AOT as assembly.

R=fschneider@google.com, zra@google.com

Review-Url: https://codereview.chromium.org/2757783003 .
2017-03-20 14:48:28 -07:00
Ryan Macnak 877284947b Rename TARGET_OS_* to HOST_OS_*.
Like HOST_ARCH_*, HOST_OS_* describes the OS the VM is running on, which may be different from the OS the VM is generating code for during AOT compilation.

Currently we conflate the two when emitting AOT as assembly, and we get away with it because Flutter only uses assembly for targeting iOS and one can only target iOS from a Mac, but we expect to use assembly for Android as well so native tools can unwind Dart frames.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2750843003 .
2017-03-15 13:11:05 -07:00
Ryan Macnak 781fd36086 Add an option to gen_snapshot for creating a Makefile describing a snapshot's dependencies. This option may be used when generating any snapshot kind, or without generating a snapshot.
- Factor out MallocGrowableArray from vm to platform.
 - Add File::Print.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2715463003 .
2017-02-23 12:40:48 -08:00
Ryan Macnak 9eb216a495 Reapply "Create an app snapshot of the Dart front end."
Skip training on Windows, issue #28532.

R=hausner@google.com

Review-Url: https://codereview.chromium.org/2665753002 .
2017-01-31 09:47:51 -08:00
Ryan Macnak 728f460798 Revert "Create an app snapshot of the Dart front end."
This reverts commit 8c7111c967.
This reverts commit 27c8e59d2e.

Review-Url: https://codereview.chromium.org/2657123002 .
2017-01-26 17:42:25 -08:00
Ryan Macnak 8c7111c967 Create an app snapshot of the Dart front end.
R=asiva@google.com, hausner@google.com, zra@google.com

Review-Url: https://codereview.chromium.org/2655173002 .
2017-01-26 16:28:59 -08:00
Martin Kustermann a9fbe2004d VM: Tell lsan about mmap()ed regions used for our heap
The mmap()ed pages hold pointers to `VirtualMemory` objects. So we tell
lsan that the mmap()ed regions are roots.

R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2646363005 .
2017-01-24 12:47:36 +01:00
Ryan Macnak 4f598c584d GN: Fix cross ARM64 and cross MIPS builds.
R=zra@google.com

Review-Url: https://codereview.chromium.org/2643583002 .
2017-01-20 15:44:24 -08:00
Martin Kustermann 37dfdbdc97 VM: Remove unused (and incomplete) HashMap::Remove() function
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2542103002 .
2016-12-01 13:51:49 +01:00
Martin Kustermann d822f36f15 VM: Fix memory leak during shutdown
The way runtime/platform/hashmap.h:HashMap was implemented so far did not allow
deleting elements while iterating over the map. If one iterated like this

  HashMap::Entry* cursor = map.Start();
  while (cursor != NULL) {
    if (cond) {
      map.Remove(cursor->key, cursor->hash);
    }
    cursor = map.Next(cursor);
  }

Then the iteration `cursor` will skip elements. This is due to the fact that
`HashMap::Remove()` is left-rotating elements in certain cases and
`HashMap::Next()` will unconditionally advance to the next position in the
backing store.

PROBLEM IS: There was existing code which did remove elements while iterating
over a HashMap.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2533303005 .
2016-11-30 23:52:04 +01:00
Siva Annamalai 501720c644 Retry landing cl for issue with TSAN.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2525103003 .
2016-11-23 15:40:26 -08:00
Siva Annamalai 66cb033ac1 Revert "Fix tsan failure"
This reverts commit 159a5ab366.

This reverts commit aa76de9a8f.

BUG=

Review URL: https://codereview.chromium.org/2510093005 .
2016-11-18 16:44:32 -08:00
Siva Annamalai 159a5ab366 Fix tsan failure
We have a racy read of the object header in the stack frame walker
called from the profiler (in this case the gc marker is running at
the same time).

It is appropriate to avoid this even though we think the access is
safe as the objects are in old space and never forwarded and only
the mark bits are manipulated while marking
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2517473002 .
2016-11-18 14:09:02 -08:00
Vyacheslav Egorov 35c828c2d2 VM: Fix Flutter build.
libdart_vm_nosnapshot should not include dart_maybe_precompiled_runtime_config.

DART_NOSNAPSHOT and DART_PRECOMPILED_RUNTIME are mutually exclusive configurations
add a meaningful check in the globals.h to catch this instead of cryptic compile
time errors.

R=kustermann@google.com
BUG=

Review URL: https://codereview.chromium.org/2515663002 .
2016-11-18 15:48:01 +01:00
Zachary Anderson a1bcf051d8 clang-format runtime/vm
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2481873005 .
2016-11-08 13:54:47 -08:00
Zachary Anderson 6953586716 Add .clang-format and run clang-format on runtime/platform.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2470663006 .
2016-11-03 14:25:16 -07:00
Zachary Anderson e29da6037b Small cleanups and linter fixes.
Review URL: https://codereview.chromium.org/2455983002 .
2016-10-27 05:02:20 -07:00
Zachary Anderson 103881d01c Make header include guards great again
i.e. #ifndef VM_WHATEVER -> #ifndef RUNTIME_VM_WHATEVER

This lets us remove a hack from the PRESUBMIT.py script that existed
for reasons that are no longer valid, and sets us up to add some
presubmit checks for the GN build.

R=asiva@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/2450713004 .
2016-10-26 00:26:03 -07:00
Zachary Anderson 8200955ed0 Fuchsia: Add native symbol resolver. Small fixes.
R=asiva@google.com

Review URL: https://codereview.chromium.org/2438843002 .
2016-10-20 13:39:35 -07:00
Ryan Macnak 61bf8abd75 Make fatal out of memory messages uniform.
Add checks in a few more places with large allocations.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2418323002 .
2016-10-19 16:37:59 -07:00
Zach Anderson 71a84cfed6 GN: Fix Debug flags. Fix Windows build.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2425043002 .
2016-10-17 12:58:24 -07:00
Siva Annamalai 42c58c5c2d - fix some cases where we are using uninitialized memory
- use attribute 'no msan' on NativeEntry::ReturnValueIsError function
  as msan doesn't seem to track the return slot being set by a native
  function
- vsnprintf seems to have issues with msan so unpoison the allocated
  memory buffer everytime vsnprintf is used to suppress the error.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2383293003 .
2016-10-05 16:54:18 -07:00
Ryan Macnak 47cc06ae66 Shrink AOT snapshot size and memory usage.
- Conditionally remove fields of Code, Function and ICData that are not used in the AOT runtime.
 - Don't include RawClosureData.context_scope_ in AOT snapshots.
 - Remove parameter names not needed for method resolution.
 - Remove parameter types not needed for function type tests.
 - Deduplicate parameter name and parameter type lists.
 - Shrink and share the initial MegamorphicCache table.

Flutter gallery (IsolateSnapshotReader event)
snapshot size 2731129 -> 2199999 (-19.4%)
initial heap  7899568 -> 5433176 (-31.2%)

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2326483005 .
2016-09-15 15:06:42 -07:00
Zach Anderson a695975d00 Fixes run_vm_tests Windows shutdown problem
related #27250

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2311283002 .
2016-09-06 10:10:40 -07:00
Ryan Macnak d418dde65b Reduce copying in sending service responses.
Add missing safepoint transitions.

Issue #27092
Likely contributes to Issue #27010

dart2js hello
Peak RSS at first Observatory visit -> Peak RSS after visiting timeline (with endless recorder)
Before 215M -> 321M
After 182M -> 233M

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2254543006 .
2016-08-18 10:34:50 -07:00
Zach Anderson 581939d8b6 Retry: Fixes memory leaks in the eventhandler
Crashes were caused by removing from a std::map while iterating over it.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2231123002 .
2016-08-10 15:20:30 -07:00
Zachary Anderson bf085120f6 Revert: Fixes leak of duplicate command line environment strings
For bot crashes on Mac

Review URL: https://codereview.chromium.org/2229973002 .
2016-08-09 15:36:57 -07:00
Zachary Anderson 92abe83b26 Fixes memory leaks in the eventhandler
These probably only happen when the VM is going down after an unhandled
exception, but I want to fix them anyway.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2228503007 .
2016-08-09 15:20:50 -07:00
Zachary Anderson e476e00ca6 Fuchsia: Use low-level prng call, add test, update test runner.
There is now a syscall for getting cryptographically secure random bytes.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2204523002 .
2016-08-02 13:18:37 -07:00
Ryan Macnak b01541d54d Attempt to print the stack using the profiler upon assertion failure.
Fix mismatched free of native symbol.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2199453002 .
2016-07-29 13:29:25 -07:00
Zachary Anderson 74bbc7f55f Fuchsia: Make some more VM tests pass
R=asiva@google.com

Review URL: https://codereview.chromium.org/2189973003 .
2016-07-29 08:07:25 -07:00
Zachary Anderson 53374c3b99 Fuchsia: Build standalone VM. Make it run "Hello, World!".
This CL adds targets to the GN build that build the standalone Dart VM
without the observatory, and with dart:io enabled but with most of the
functionality stubbed out as UNIMPLEMENTED(). It also adds a simple
eventhandler for Fuchsia for implementing Timers.

R=asiva@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2168193002 .
2016-07-22 14:00:31 -07:00
Zachary Anderson b30da81483 Fuchsia: Hello, Fuchsia!
R=asiva@google.com

Review URL: https://codereview.chromium.org/2158673002 .
2016-07-18 10:35:03 -07:00
Zachary Anderson e27b49fc80 [fuchsia] GN build support for Fuchsia OS and fuchsia_test target
This adds a GN target for the 'fuchsia_test' executable and teaches
the GN build about is_fuchsia. Key differences:

*) There's not currently a dart:io implementation for Fuchsia
*) Fuchsia's toolchain currently doesn't support (or need) ldl or lpthread
*) Fuchsia's buildconfig doesn't currently set the is_asan variable

Review URL: https://codereview.chromium.org/2149953003 .
2016-07-14 15:01:30 -07:00
Ryan Macnak d75699e863 Make core snapshots word-size portable again.
Flutter creates a single core snapshot (from x64) that is used by both sky_snapshot (x64) and the engine (arm).

R=asiva@google.com

Review URL: https://codereview.chromium.org/2132833002 .
2016-07-08 14:18:44 -07:00
Zachary Anderson a503570e3a Fuchsia: Initial check-in.
Instructions to build and run are in README.fuchsia.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2117593002 .
2016-07-01 12:42:05 -07:00
Carlo Bernaschina 21ce02fb70 Use official JSON encoding for stream
Closes https://github.com/dart-lang/sdk/issues/26721

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2081433002 .
2016-06-28 15:40:08 -07:00
Zachary Anderson fcf4578c03 Remove STL use from platform/assert.cc
R=asiva@google.com

Review URL: https://codereview.chromium.org/2085703002 .
2016-06-21 12:50:43 -07:00
Vyacheslav Egorov 97a8c4caff VM: Fix WeakProperty processing during parallel marking.
Previously if one marker marked the weak property and another marker marked its key then the first marker might stop marking before it sees that the key was marked.

Here is a possible concurrent execution, assuming P is a WeakProperty and K is P.key:

    (Marker A)                        (Marker B)
        |                                  |
[ mark property P     ]                    |
        |                                  |
[ drain marking stack ]                    |
[ no more work to do  ]                    |
        |                       [ mark K               ]
        |                       [ draing marking stack ]
        |                       [ no more work to do   ]
        |                                  |
        |                                  |
       ...                                ...
        |                                  |
    [Finalize]                         [Finalize]
        |
    [Clear P]

In this execution we end up clearing P even though P.key is marked.

To fix this issue without reintroducing central WeakProperty processing
we change the marking phase loop in such a way that markers consider the
marking done only if all of them agree that they have no more weak properties
with marked keys.

Essentially the marking loop now has a separate phase where all markers check
their pending weak properties. The decision to proceed to the next marking phase
(weak handles processing) is done in lock step using barrier - either all threads
advance to the next stage or one of the threads finds a weak property
with marked key and unmarked value and all threads resume marking.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2041413005 .
2016-06-09 18:50:23 +02:00
Ryan Macnak 85cdc0eac2 Don't assume we want the iOS ABI if running simarm on Mac and the EABI otherwise.
Allow controlling the target ABI by defining TARGET_ABI_IOS or TARGET_ABI_EABI.  If neither is defined, default to the previous behavior.

Make Linux, Mac, Android and iOS agree on the value of PreferredCodeAlignment for all architectures.

BUG=http://dartbug.com/26464
R=zra@google.com

Review URL: https://codereview.chromium.org/1982613003 .
2016-05-17 15:03:54 -07:00
John McCutchan fc117e0b87 Merge branch 'master' into undo_last_change
Undo the previous change
2016-05-17 12:38:04 -07:00
John McCutchan dfb1e1b0f5 Attempt to get the bots to rebuild the world
BUG=

Review URL: https://codereview.chromium.org/1988843003 .
2016-05-17 12:35:29 -07:00
Zachary Anderson f82a8c9af2 Disable concurrent marking/sweeping, and background compilation on ARMv5TE
Also adds missing feature detection to the graph intrinsifier.

R=iposva@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1974873002 .
2016-05-12 15:09:42 -07:00
John McCutchan 0cfd4f5cd5 GN Build fixes for Flutter + gen_snapshot fix
1. Add "dart_runtime_mode" GN argument. This is an enum with three valid values: "release", "profile", and "develop".
   *) "release" builds product precompiled-runtime.
   *) "profile" builds non-product precompiled-runtime.
   *) "develop" builds non-product non-precompiled-runtime.

2. Remove the redundant "dart_product" GN argument.

3. Kill all *precompiled_runtime static library variants and the related config.

4. Always include the precompiler in gen_snapshot.

5. Support multiple --embedder_entry_points_manifest arguments to gen_snapshot.

6. Update our test harness to use gen_snapshot and pass the same kinds of command line arguments the Flutter folks are using.

7. ASSERT that both DART_PRECOMPILED_RUNTIME and DART_PRECOMPILER are not set at the same time.

R=fschneider@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/1903583002 .
2016-04-22 07:00:03 -07:00