Commit Graph

21 Commits

Author SHA1 Message Date
Daco Harkes f98a2138b7 [vm] Run clang-format on code base
When uploading CLs, the presubmit checks verify that the lines in the
diff are formatted correctly according to `git cl format runtime`.

However, when `buildtools/<os>-<arch>/clang/bin/clang-format` is
updated, it does not force reformatting of files that would be
reformatted.

This leads to two issues:
* Inconsistent style within the code base and within a single file.
* Spurious reformatting in CLs when (1) clang-format is used on the
  whole file, or (2) the diff lines overlap.

`clang-format` doesn't change that frequently, so in general this is
not a large issue, but I've seen a bit too many "spurious formatting,
please revert" comments on CLs recently.

This CL formats the runtime to be in line with the current pinned
`clang-format`:

```
$ find runtime/ -iname *.h -o -iname *.cc | xargs buildtools/mac-arm64/clang/bin/clang-format -i
```

`git cl format` (which only formats changed lines, and does so with
`clang-format`) seems to not agree with itself, or clang-format, or
cpplint in a handful of places. This CL adds `// clang-format off`
for these. (See previous patchsets for the specific instances.)

TEST=A variety of bots including GCC, MacOS and Windows.

Change-Id: I470892e898971899fda14bb3b8f2c8efefd67686
Cq-Include-Trybots: luci.dart.try:vm-gcc-linux-try,vm-ffi-qemu-linux-release-riscv64-try,vm-ffi-qemu-linux-release-arm-try,vm-aot-win-debug-x64-try,vm-win-debug-x64c-try,vm-mac-debug-x64-try,vm-mac-debug-arm64-try,vm-aot-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362780
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-04-17 19:14:41 +00:00
Ryan Macnak fbcacd7c05 Reapply "[vm] Streamline Zones."
Fix imprecision in Zone::SizeInBytes that was finally noticed by vm/cc/AllocateZone because the size of the initial inline buffer changed.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/47399
Change-Id: I152d24d03a59b21267a9a24e5d929b51af57af71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215980
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-10-14 00:10:12 +00:00
Ryan Macnak 472e2bce17 Revert "[vm] Streamline Zones."
This reverts commit b5922e6db4.

Reason for revert: vm/cc/AllocateZone fails on Mac

Original change's description:
> [vm] Streamline Zones.
>
>  - Don't put a HANDLESCOPE right after a StackZone, as there's no state worth restoring
>  - Remove remaining zone bookkeeping dead since e3a9d70591.
>  - Remove unnecessary resetting of handle blocks before zone deletion.
>  - Shrink initial chunk size to make Zone's overall size fit in a faster malloc size class.
>
> TEST=ci
> Change-Id: I920e12f5af93aa71fb876435764c60df485215f9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212261
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

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

Change-Id: Id23dcebb781791616e48e54d2dcd7e58159178bc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215943
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-10-06 23:44:33 +00:00
Ryan Macnak b5922e6db4 [vm] Streamline Zones.
- Don't put a HANDLESCOPE right after a StackZone, as there's no state worth restoring
 - Remove remaining zone bookkeeping dead since e3a9d70591.
 - Remove unnecessary resetting of handle blocks before zone deletion.
 - Shrink initial chunk size to make Zone's overall size fit in a faster malloc size class.

TEST=ci
Change-Id: I920e12f5af93aa71fb876435764c60df485215f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212261
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-10-06 22:22:32 +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 8da46d35f5 [vm] Move heap-related code to its own subdirectory (cf. compiler).
Remove some dead includes.

Change-Id: I31f3e739e5ee46dcbba5d6a2f091491b46402943
Reviewed-on: https://dart-review.googlesource.com/60146
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-06-20 00:39:49 +00:00
Ryan Macnak 9ce48e63b2 Remove background finalization.
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2809863002 .
2017-04-11 09:54:25 -07:00
Ben Konyi 1e0bf05aaf Added tracking of memory usage within ApiNativeScopes. Usage to be displayed within Observatory.
BUG=
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2650583014 .
2017-01-26 15:24:03 -08: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
Florian Schneider 9f00ce2b6e VM: Fix for deadlock with background tasks.
We have to do NotifyAll whenever a task finishes.

Also, remove thread notifications when a task is created, since we only ever wait for tasks to finish.

BUG=#27365
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2349853002 .
2016-09-16 15:03:36 -07:00
Ryan Macnak e46b3cd994 Treat background finalization as another GC task so it won't run in parallel with the marker.
Prevents a race between the marker and finalizer when the handle is freed (fixes #27029).

Disallow creating weak handles for immediate objects. We don't distinguish these from free handles, so their callbacks are never run.

Don't report freed handles over the vm service.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2281193002 .
2016-08-29 16:47:56 -07:00
Ryan Macnak c340d0f24b Add flag to control background finalization.
It seems destructing some blink strings, TypedViewPeer, etc is not thread-safe.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2091023002 .
2016-06-23 11:09:40 -07:00
Ryan Macnak a871dbc57c Don't bypass safepoint check when background finalizer task enters the isolate.
R=asiva@google.com

Review URL: https://codereview.chromium.org/2089393002 .
2016-06-22 18:22:33 -07:00
Ryan Macnak 103e316f6a Reapply "Background finalization."
- Fix double-finalization by marking handles that are in a finalization queue.
 - Remember external size in words instead of bytes.
 - Add SlowFinalizer test.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2084193003 .
2016-06-22 16:26:49 -07:00
Ryan Macnak ae94be3f4d Revert "Background finalization."
This reverts commit d265a3db53.

Review URL: https://codereview.chromium.org/2088923002 .
2016-06-21 13:15:12 -07:00
Ryan Macnak d265a3db53 Reapply "Background finalization."
This reverts commit 7d9e75e0b6.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2080353002 .
2016-06-21 09:27:23 -07:00
Ryan Macnak 7d9e75e0b6 Revert "Background finalization."
This reverts commit 082829a00b.

Review URL: https://codereview.chromium.org/2041373004 .
2016-06-07 17:21:06 -07:00
Ryan Macnak 082829a00b Background finalization.
Flutter gallery app on Nexus 4:
 max weak handle processing (main thread): 17.7ms -> 1.1ms
 max scavenge (main thread): 21.0ms -> 17.1ms

BUG=flutter/flutter#3804
R=asiva@google.com

Review URL: https://codereview.chromium.org/2012973002 .
2016-06-07 14:38:37 -07:00
cshapiro@google.com 917bbbfc39 Provide API support for weak handles and post-mortem finalization.
In addition, this change separates the storage of weak persistent
handles from ordinary persistent handles.  An ordinary persistent
handle now stores no other data than the raw pointer value.

Review URL: http://codereview.chromium.org//9148051

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3273 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-13 01:23:42 +00:00
cshapiro@google.com 32f55ce37b Implement weak persistent handles in the Dart API.
Review URL: http://codereview.chromium.org//8984006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2607 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-20 01:44:53 +00:00
turnidge@google.com 9a118fbb49 Add Dart_Null, Dart_True, and Dart_False.
Fix Dart_NewPersistentHandle so it won't break if passed one of these
persistent handles.

Reviewer: Should I document that these new functions return a
persistent handle?
Review URL: http://codereview.chromium.org//8446009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1230 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-05 00:09:36 +00:00