Commit Graph

303 Commits

Author SHA1 Message Date
Ryan Macnak 6b5d9f1d1b [vm] Progress toward running without TSAN warnings.
- Ignore all data races on object headers. These are harmless because of higher-level constraints in the GC.
 - Make all concurrent marker tasks check-in with the monitor to indicate they are done marking roots, not just the last one. This establishes synchronization between the which ever task read the handle blocks and the mutator resuming and writing to the handle blocks.
 - When a helper thread exits the isolate, perform clearing of the reusable handles under the thread registry's lock so it doesn't race with the GC visiting thread roots.
 - Disable background compilation when running under TSAN. There are lots of races here. Many are harmless. It's hard to annotate these without effectively disabling TSAN checks for the entire Dart heap, so simply disabling the background compiler will give us the most TSAN coverage for the time being.
 - Fix race in abandoning TLABs during helper thread exit.
 - Remove harmless race between concurrent sweeper and allocation of new heap pages.
 - Suppress TSAN on known race in array truncation.
 - Remove racy access FLAG_stacktrace_every, which is no longer needed as compilation can no longer trigger execution to evaluate constants.

Bug: https://github.com/dart-lang/sdk/issues/39611
Change-Id: Ibaa101b4f12ff5fa30678471fb37e63608ba7f8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128305
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-16 18:32:23 +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
yuanhuihui fe9f30c389 [timeline] support vm events available to systrace
more detail: https://github.com/dart-lang/sdk/issues/39757

Signed-off-by: yuanhuihui <gityuan@gmail.com>
Bug: https://github.com/dart-lang/sdk/issues/39757
Change-Id: I6174500796289ffcfb7a53d3f897c5d7f82932ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128200
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-13 00:41:46 +00:00
Ryan Macnak a8d8a18642 [vm, arm64] Fix heap corruption in PushArrayOfArguments.
The store barrier may clobber condition flags, causing the loop to copy past the last argument.

Bug: https://github.com/dart-lang/sdk/issues/36906
Change-Id: Ia863ec88aaa26c4193cadba26df62b43e68c377e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128108
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-12 01:52:48 +00:00
Ryan Macnak 617933c3c1 [vm, gc] As a debugging aid, remember the previous object during heap iteration.
Bug: https://github.com/dart-lang/sdk/issues/36906
Change-Id: Id7214aaa475929e33e5e5ae5bc58c99eb927b74b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127743
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-10 00:57:23 +00:00
Ryan Macnak 9929b53c71 [vm, gc] Allow old-space collections for allocations during safepoints.
Earlier versions of the safepointing mechanism had trouble with this, so we skipped the collections expecting a higher-level caller to eventually clean-up. This is no longer necessary.

Disallow old-space collections under a force-growth scope.

Bug: https://github.com/dart-lang/sdk/issues/39484
Bug: https://github.com/dart-lang/sdk/issues/39493
Change-Id: Id5027899d06a29a307ceeca21dd4d1bc96c94920
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127102
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-04 19:08:09 +00:00
Ryan Macnak ec81b3edf7 Revert "[vm] Avoid holding canonical hashes at rest."
This reverts commit b7de866bee.

Reason for revert: assertion failures on reload stress bots

Original change's description:
> [vm] Avoid holding canonical hashes at rest.
> 
> Canonical hashes are only stored during a round of canonicalization to avoid expontential time in cases such as those in tests/language_2/canonicalization_hasing_*. Clearing them avoids the GC spending time to visit them.
> 
> Bug: https://github.com/dart-lang/sdk/issues/37523
> Change-Id: Icad1fad30dcb7eb95864bea8a26991aeccd7adc6
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125760
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,alexmarkov@google.com,asiva@google.com

Change-Id: I2e6b29fd1b529d6302ab979acd4757f45bf989ef
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/37523
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125935
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-11-21 23:58:30 +00:00
Ryan Macnak b7de866bee [vm] Avoid holding canonical hashes at rest.
Canonical hashes are only stored during a round of canonicalization to avoid expontential time in cases such as those in tests/language_2/canonicalization_hasing_*. Clearing them avoids the GC spending time to visit them.

Bug: https://github.com/dart-lang/sdk/issues/37523
Change-Id: Icad1fad30dcb7eb95864bea8a26991aeccd7adc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125760
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-11-21 21:29:48 +00:00
Ryan Macnak 545b10389d [vm, service] Compute allocation stats on demand, instead of during allocation and GC.
Removes support for accumulators, which now repeat the current live values.
Decreases performance difference between release and product modes.
Fixes inaccuracy when counters are queried before the first full GC.

Golem geomean   x64 4.687%
Golem geomean arm64 5.770%

Bug: https://github.com/dart-lang/sdk/issues/37678
Change-Id: I12b26a9834b0f0f911ddcc6e8e5ff4573272607d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116885
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-11-16 00:22:56 +00:00
Ryan Macnak bbd88424ac [vm, gc] When evaluating idle GC, check only for enough time to start concurrent marking, instead of enough to run a full GC.
Don't trigger an interrupt when concurrent marking finishes, which could trigger cause synchronous finalization in the middle of a frame; instead wait for the next allocation failure or idle notification.

Change-Id: I969c7e8de05ee1eb70103eda2df98cb2320085b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125082
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-11-14 18:51:54 +00:00
Ryan Macnak 9223b9d844 [vm, gc] Change CollectAllGarbage to ensure there is no floating garbage caused by incremental marking.
Fix vm/cc/OldGC_Unsync to not change FLAG_marker_tasks while incremental marking is in progress.

Fix vm/cc/IterateReadOnly to not mark the heap as read-only while marking or sweeping are in progress.

Remove unnecessary WaitForGCTasks leftover from background finalization.

Bug: https://github.com/dart-lang/sdk/issues/39299
Change-Id: Ib3340e514b44230b9735b74b1f2012ca9b998d50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124824
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-11-14 02:08:35 +00:00
Ryan Macnak 9cd6c01bfd [vm, gc] Add a release barrier to prevent header initialization during promotion from being ordered after publishing stores of that object.
Compare 6354b0b97d, which did the same for direct old-space allocations.

Change-Id: Ifc047b48dfa10891ea7f1b39794f5fdbc7cf2ec8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124841
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-11-14 00:50:46 +00:00
Ryan Macnak 23770fcc6c [vm, gc] Increase HeapPage size to 512k; increase max heap size to 32GB.
Change-Id: I0d5649d37a73caea39d3f703f429a4af7b4c29c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113950
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-11-07 22:45:47 +00:00
Ryan Macnak b34f11adbd [vm, gc] Remove expensive, low-value GC verification flags.
--verify_gc_contains is roughly O(heap^2) and gives false errors in some cases involving remembered cards
--verify_on_transition takes over 30 minutes for even hello world

Change-Id: Idee7e535bb96b11f0fa620532debbd21ca9d7135
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123329
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-10-29 19:25:16 +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 79e5a3f1f7 [vm] Regression test for free-list protection.
Change-Id: Iea1a81ced0f53db1b2419f0b7a01be0a48c576a5
Fixed: 2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122645
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-24 12:13:53 +00:00
Samir Jindel b359ac0a1e [vm] Don't leave code pages unprotected when a free-list element's header straddles a page boundary.
The old code breaks in this situation. ^ indicates page boundary:

| <allocated code> | <header> | <remainder> | <other code> |
|       ^               ^                         ^        |

It would have unprotected the start of <other code> without re-protecting it after updating the header.

Fixes https://github.com/dart-lang/sdk/issues/38528

Change-Id: I989becc3ade434fac6ec0eba5b7f8130178f6f68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122643
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-23 14:46:53 +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
Ryan Macnak 8e7ffafbaf Reland "[vm, compiler] Reduce alignment of Instructions and remove some debugging trap instructions."
Further adjustments for simarm_x64.

Flutter Gallery:
ARM32
Instructions(CodeSize): 6979424 ->  6771856 (-2.97%)
Total(CodeSize):       10855163 -> 10363319 (-4.53%)
ARM64
Instructions(CodeSize): 7334368 ->  6817312 (-7.05%)
Total(CodeSize):       11505069 -> 10771431 (-6.37%)

Bug: https://github.com/dart-lang/sdk/issues/37103
Bug: https://github.com/dart-lang/sdk/issues/38452
Change-Id: I2bb44e7b2c002d53830b66cf4aedc4455c815326
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119440
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-17 21:45:38 +00:00
Ryan Macnak b5bbc97566 Revert "[vm, linux] Try to attach names to all VirtualMemory allocations using memfd."
This reverts commit 48e93d3d3b.

Reason for revert: ~10% regression on Isolate.SendReceiveBytes benchmarks, likely heavy allocation and freeing of large heap pages

Original change's description:
> [vm, linux] Try to attach names to all VirtualMemory allocations using memfd.
>
> For example,
>
> $ cat /proc/<pid>/smaps
> ...
> 7fe527158000-7fe527be0000 rw-s 00000000 00:05 35765318                   /memfd:dart-profiler (deleted)
> 7fe527be0000-7fe527ea5000 rw-s 00000000 00:05 35765317                   /memfd:dart-timeline (deleted)
> 7fe528a40000-7fe528a51000 rw-s 00000000 00:05 35762832                   /memfd:dart-heap (deleted)
> ...
>
> Change-Id: I10452a1261cec26719ceadf569aadd864be5378e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120981
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>

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

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

Change-Id: Ic839bd0ce67d8ac438916d6b4c626f0f7d6991d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121412
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-10-14 16:59:31 +00:00
Ryan Macnak 48e93d3d3b [vm, linux] Try to attach names to all VirtualMemory allocations using memfd.
For example,

$ cat /proc/<pid>/smaps
...
7fe527158000-7fe527be0000 rw-s 00000000 00:05 35765318                   /memfd:dart-profiler (deleted)
7fe527be0000-7fe527ea5000 rw-s 00000000 00:05 35765317                   /memfd:dart-timeline (deleted)
7fe528a40000-7fe528a51000 rw-s 00000000 00:05 35762832                   /memfd:dart-heap (deleted)
...

Change-Id: I10452a1261cec26719ceadf569aadd864be5378e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120981
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-10-10 00:49:41 +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
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
Ryan Macnak d2738bf9f0 [vm, gc] Reserve ForwardingPages up front.
Allocate space for ForwardingPages when allocating a new HeapPages that is subject to compaction, instead of allocating it at compaction time, which is when we're already low on memory.

This has a 4KB/256KB = 1.5% overhead for ordinary pages, no overhead for large and code pages.

Bug: https://github.com/dart-lang/sdk/issues/37772
Change-Id: I9ce4d0791093df8ee98d9bda17f0a1cc33788e28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114020
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-10-04 00:29:34 +00:00
Samir Jindel 132bee48d0 Revert "Reland "[vm, compiler] Reduce alignment of Instructions and remove some debugging trap instructions.""
This reverts commit 44da8af04f.

Reason for revert: SIMARM_X64 assembly generation is still broken.

You can see the new bot "vm-kernel-precomp-linux-debug-simarm_x64" for failing tests. Also https://github.com/dart-lang/sdk/issues/38617 and https://github.com/flutter/flutter/issues/41484.

Original change's description:
> Reland "[vm, compiler] Reduce alignment of Instructions and remove some debugging trap instructions."
> 
> Fix generating assembly from simarm_x64.
> 
> Bug: https://github.com/dart-lang/sdk/issues/37103
> Bug: https://github.com/dart-lang/sdk/issues/38452
> Change-Id: Ic3402beb0278dc483ba82874cb573ce26b8669b2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118702
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Aart Bik <ajcbik@google.com>
> Reviewed-by: Liam Appelbe <liama@google.com>

TBR=aam@google.com,rmacnak@google.com,alexmarkov@google.com,ajcbik@google.com,liama@google.com

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

Bug: https://github.com/dart-lang/sdk/issues/37103, https://github.com/dart-lang/sdk/issues/38452
Change-Id: If9fe95a04371d2960200ffc1f5e5c008298b9890
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119149
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-09-27 18:01:00 +00:00
Ryan Macnak 44da8af04f Reland "[vm, compiler] Reduce alignment of Instructions and remove some debugging trap instructions."
Fix generating assembly from simarm_x64.

Bug: https://github.com/dart-lang/sdk/issues/37103
Bug: https://github.com/dart-lang/sdk/issues/38452
Change-Id: Ic3402beb0278dc483ba82874cb573ce26b8669b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118702
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2019-09-26 16:40:18 +00:00
Alexander Aprelev 69b5681546 Revert "[vm, compiler] Reduce alignment of Instructions and remove some debugging trap instructions."
This reverts commit b26636925d as it introduces failure to run `flutter run --profile` on ios 32-bit devices.

Revert "[vm, compiler] Further reduce alignment of Instructions."

This reverts commit e2adba804b as collateral damage.

Bug: https://github.com/flutter/flutter/issues/41228
Change-Id: Ia831a23d1237ef7635e6e1fa5d8fbcbcb91b2a74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118661
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2019-09-24 23:43:24 +00:00
Ryan Macnak e2adba804b [vm, compiler] Further reduce alignment of Instructions.
ARM64
Unaffected

ARM32
VMIsolate(CodeSize):       4731 ->     4730
Isolate(CodeSize):      2020887 ->  2020860
ReadOnlyData(CodeSize): 2161000 ->  2161000
Instructions(CodeSize): 6879032 ->  6811384 (-0.98%)
Total(CodeSize):       11065650 -> 10997974 (-0.61%)

Bug: https://github.com/dart-lang/sdk/issues/38452
Change-Id: Ic969a92814afd352767368e063e493099dd89377
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118181
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-09-20 22:29:18 +00:00
Martin Kustermann 6717bfe423 [vm/concurrency] Lock weak table to prepare for concurrent access.
Right now there is only one mutator working on a heap and it can
therefore access the heap's weak maps without locking. The GC is the
only other user of the weak maps and it accesses it within a safepoint
operation scope.

Once we move the heap to the isolate group there can be concurrent
accesses to the weak maps. As a preparation step this CL adds locking
around the non-GC API.

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

Change-Id: I84acce24612b12a7393154cab816f0eff9c7589a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116201
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-09-10 14:33:46 +00:00
Martin Kustermann ef9d699f07 [vm/concurrency] Move all information except for the class pointers out of [ClassTable] into [SharedClassTable]
This CL moves heap related information (namely instance sizes and
allocation stats) out of the [ClassTable] into a [SharedClassTable].
Both classes are always in sync (i.e. they have the same number of entries).

This CL also changes GC related code to start using the size information
from the new [SharedClassTable].

In a futher step we will move the heap as well as this shared class
table out of the [Isolate] and into [IsolateGroup].

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

Change-Id: Id54a89c9251ad3bbc13e60d32dc4f7bcc7f1d805
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116064
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-09-10 12:48:16 +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
Clement Skau b31566b297 [nit] Adds missing newlines to error prints.
Bug: 132924757
Change-Id: I1354534bfac13006897f204990270d636fc0063f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114519
Auto-Submit: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2019-09-05 12:56:49 +00:00
asiva a2228905b5 [VM/runtime] Add some asserts and remove reference to String::MakeExternal
from comments as this method does not exist anymore.

Change-Id: I484ab2bfd101cb3069ab0f285de5b781834b3932
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114980
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-08-30 23:29:09 +00:00
Martin Kustermann 8667223d72 [vm/concurrency] Have custom weak table per isolate used for snapshot writing
Currently the snapshotter will just reset the weak tables once it's
done. Once we have a shared heap this would not work anymore since the
resetting of the weak tables can happen while another isolate is in the
middle of snapshotting.

We therefore make each isolate have it's own weak table used for
snapshotting messages.

The memory for the weak tables is managed by a std::unqiue_ptr in the isolate.

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

Change-Id: Ic0f4c4a96b6e66606be9e004259d2fee995f7099
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114858
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-08-29 08:41:33 +00:00
Ryan Macnak 0da7763bae [vm, gc] Fix racy access to the growth policy in ForceGrowthSafepointOperationScope.
Compare 6653611ae4

Bug: b/139666100
Change-Id: I9828ed08ae49062dbe77483c6c2e2218682ab213
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114722
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-08-28 01:38:53 +00:00
Ryan Macnak 040fdf22c5 [vm, gc] Run old space GC when the allocation limit is crossed during NotifyIdle, even if it would exceed the idle deadline.
If a program is allocating only in new space, and scavenges are happening only at idle time, this is the only check preventing unbounded growth in old space.

Bug: b/139666100
Bug: https://github.com/dart-lang/sdk/issues/33314
Change-Id: Ib20369e43e288b1056fc220e6cb895f6f3158d6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114721
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-08-27 23:19:42 +00:00
Ryan Macnak 2bc0f49c00 [vm, gc] Add timeline event for growth policy updates.
Change-Id: If20f19606b73b70071b93909093cf024c387e971
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114561
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-08-27 18:46:23 +00:00
Daco Harkes 670d40d808 [vm/ffi] regression test for 37511
I tested this test manually by reverting 48d92b3176 to confirm that it makes the test segfault.

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

Change-Id: I62cb2b83775780a2fccfd9ee4ebff793de82090a
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try, app-kernel-linux-debug-x64-try, vm-kernel-linux-debug-simdbc64-try,vm-kernel-linux-debug-ia32-try,vm-dartkb-linux-debug-simarm64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-dartkb-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109703
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2019-08-21 08:10:34 +00:00
Ryan Macnak 239a6d1449 [vm, bytecode] Annotate super calls and clear lookup caches on reload.
Fixes remaining vm/cc/IsolateReload tests.

Change-Id: I98999b6e1164a015dbd61674b70c771cd6c488b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113901
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-08-21 00:10:26 +00:00
Samir Jindel 4ebde3fa9b [vm] Fix missing null check in FLAG_force_evacuation.
Bug: https://github.com/dart-lang/sdk/issues/37772
Change-Id: I4e62dd0355fe0ebc7716de05a093142389067191
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112403
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-08-09 20:51:41 +00:00
Ryan Macnak 6653611ae4 [vm, gc] Check if we should start concurrent marking after external allocations and background code finalization.
Bug: https://github.com/flutter/flutter/issues/36808
Change-Id: I2577ffa22e4dec5d659198948d490b4e17aae8db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111664
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-08-02 22:08:59 +00:00
Martin Kustermann fac682c5ef [vm/gc] Hold lock before accessing PageSpace::large_pages_
Change-Id: I08c4d125e929f0c1824204b813920ac8a7cf1f59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111721
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-08-02 15:26:01 +00:00
Martin Kustermann 0a2993687b [vm/concurrency] Make all isolates within an isolate group coordinate on GCs
This CL moves the thread registry and the safepoint handler to the
[IsolateGroup]. This will cause all threads belonging to the isolate
group to safepoint together.

  => We will therefore start to get an idea of the impact this will have on
  pause times.

So far it was only possible to enter a particular isolate (e.g. as mutator
thread or auxiliary thread). This CL adds support for entering an isolate
group (instead of a particular isolate) as an auxiliarly thread. The
current isolate group is available via `IsolateGroup::Current()`.

  => This is a preparation step to let GC threads enter the isolate
     group as auxiliary threads, not associated with a particular isolate but
     to an isolate group as a whole.

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

Change-Id: I7069d07130938d370869f02060570143bfeb1b48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108801
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-07-23 10:58:11 +00:00
Ryan Macnak 60a952e261 [vm] Avoid superlinear time canonicalizing deep constants.
Bug: https://github.com/dart-lang/sdk/issues/37523
Change-Id: Ia3c2514891e2e3f07d1b3266b019b142413918d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109318
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-07-22 22:20:33 +00:00
Liam Appelbe d49bf6f25a [vm] Remove misleading usings.
Patchset 1 contains just the usings I deleted (<100 lines). All the
other diffs in the rest of the CL are just fixing all the places that
were broken by this.

Bug: https://github.com/dart-lang/sdk/issues/36839
Change-Id: I3bb4fa62ab4363ded81fd7c2815b857f91886dd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108502
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-07-10 22:20:10 +00:00
Ryan Macnak 5470159054 [vm, gc] Produce a proper error message when crashing due to lack of memory at isolate startup.
Bug: https://github.com/flutter/flutter/issues/35651
Change-Id: I2639baa4daaeb1d70d71a83da69e2c51800bdbf5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108365
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-07-08 23:44:22 +00:00
Ryan Macnak 54b197ccc2 [vm] Prevent GC when there are outstanding pointers from Dart_TypedDataAcquireData.
Bug: https://github.com/dart-lang/sdk/issues/37256
Change-Id: I1dcd2e32d8308c5a7169731169a048b8f1bfcc79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106023
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-06-19 21:31:31 +00:00
Matthew Dempsky 303dfdf9b5 [vm] Use std::unique_ptr for ThreadPool::Task
Updates #37244.

Change-Id: I32a5180a17fe43be5e18367d784cf756dffc6aeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106009
Commit-Queue: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-06-18 17:51:10 +00:00
Ben Konyi 74af4a00b2 [ VM / Service ] Created public implementation of getAllocationProfile RPC
Change-Id: I8c8cb4d47466ae6a298961652eeded762c769568
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105730
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-06-13 23:45:52 +00:00
Alexander Aprelev 4ccae238ea [vm/isolate] Add TransferableTypedData class that allows low-cost passing of Uint8List between isolates.
TransferableTypedData instances are one-use kind of thing: once receiver materializes it, it can't be used
again, once sender sends it out to an isolate, sender can't send it to different isolate.

Example of use:

sender isolate:

```
Future<TransferableTypedData> consolidateHttpClientResponseBytes(HttpClientResponse response) {
  final completer = Completer<TransferableTypedData>();
  final chunks = <Uint8List>[];
  response.listen((List<int> chunk) {
    chunks.add(chunk);
  }, onDone: () {
    completer.complete(TransferableTypedData.fromList(chunks));
  });
  return completer.future;
}
...
sendPort.send(await consolidateHttpClientResponseBytes(response));
```

receiver isolate:
```
    RawReceivePort port = RawReceivePort((TransferableTypedData transferable) {
      Uint8List content = transferable.materialize().asUint8List();
      ...
    });
```

31959[tr] and 31960[tr] tests were inspired by dartbug.com/31959, dartbug.com/31960 that this CL attempts to address:
```
╰─➤  out/ReleaseX64/dart 31960.dart
sending...
163ms for round-trip
sending...
81ms for round-trip
sending...
20ms for round-trip
sending...
14ms for round-trip
sending...
20ms for round-trip
sending...
14ms for round-trip
```

(notice no "since last checking" pauses") vs

```
╰─➤  out/ReleaseX64/dart 31960.dart
sending...
154ms since last checkin
174ms for round-trip
sending...
68ms since last checkin
9ms since last checkin
171ms for round-trip
sending...
13ms since last checkin
108ms for round-trip
sending...
14ms since last checkin
108ms for round-trip
sending...
14ms since last checkin
107ms for round-trip
```

Change-Id: I0fcb5ce285394f498c3f1db4414204531f98199d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99623
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-06-06 19:49:07 +00:00