Commit graph

25 commits

Author SHA1 Message Date
Ryan Macnak efbf68f306 [vm, gc] Common page structure for both generations.
- Prep work for non-moving promotion.
 - The generations still have different alignment offsets.
 - Old-space pages now participate in the page cache.
 - Fix boolean/null bit tricks to assert the right requirements on the alignment of a page's first object.

TEST=ci
Change-Id: I4369d8c6af73228e162c226d411914868bafed33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260401
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-09-27 21:34:05 +00:00
Ryan Macnak bc43e97b74 [vm] Place only Dart heap pages in the 4GB compressible region.
Don't allocate zones, timeline events or profile samples in the compressible region, since these allocations don't yeild compressed pointers and are competing for a limited resource.

TEST=ci
Bug: b/196510517
Change-Id: I4fc2f0d67060f927fa10d241b15b1cae3b73d919
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212400
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-09-08 01:16:57 +00:00
Liam Appelbe 807874d51a [vm] Align compressed pointer allocations on windows.
Change-Id: I95ad0a2cf679a5918d42b12bb95f1503bb219fca
TEST=CI
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184846
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-02-25 20:48:07 +00:00
Liam Appelbe be0978cbde Reland "[vm] Align heap allocations to 2GB regions in comp ptr mode"
Fixed the mac build.

This reverts commit 0ed3fb3dee.

Bug: https://github.com/dart-lang/sdk/issues/45059
Change-Id: I0cd6710a641b195403dda717108bdbe3395a21fa
TEST=CI
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186340
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-02-22 19:58:49 +00:00
Vyacheslav Egorov 0ed3fb3dee Revert "[vm] Align heap allocations to 2GB regions in comp ptr mode"
This reverts commit d10d17cca2.

Reason for revert: Broke Mac builds

Original change's description:
> [vm] Align heap allocations to 2GB regions in comp ptr mode
>
> This only handles the POSIX case. The Windows case will work exactly the
> same as this, so I want to get this reviewed before I start porting it
> to windows.
>
> TEST=Manual testing. I'll update the unit tests once it's ported.
>
> Bug: https://github.com/dart-lang/sdk/issues/45059
> Change-Id: I0bc0eddd95101fc2fddfe5668488670e741af586
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183142
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Liam Appelbe <liama@google.com>

Bug: https://github.com/dart-lang/sdk/issues/45059
Change-Id: I840c31ead015f60bca32b551c8f8d31fa75ad645
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186101
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-02-21 15:25:03 +00:00
Liam Appelbe d10d17cca2 [vm] Align heap allocations to 2GB regions in comp ptr mode
This only handles the POSIX case. The Windows case will work exactly the
same as this, so I want to get this reviewed before I start porting it
to windows.

TEST=Manual testing. I'll update the unit tests once it's ported.

Bug: https://github.com/dart-lang/sdk/issues/45059
Change-Id: I0bc0eddd95101fc2fddfe5668488670e741af586
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183142
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2021-02-20 01:29:35 +00:00
Ryan Macnak 5241586246 [vm, gc] Rename HeapPage to OldPage for symmetry.
Change-Id: I282eaf894fad17a731dbfc76873468b04117cebd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147324
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-08 18:28:06 +00:00
Alexander Aprelev 0cc27b5db0 Reland "[vm, linux] Try to attach names to all VirtualMemory allocations using memfd."
This reverts commit 4dee4bd204 as it now has the fix for precompiled flow in patchsets 3, 7.

Change-Id: Ib99763a91073df7698e8b597a67e11e557fc131e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128574
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-12-18 18:02:41 +00:00
Clement Skau 4dee4bd204 Revert "[vm, linux] Try to attach names to all VirtualMemory allocations using memfd."
This reverts commit f5e57f89d2.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> [vm, linux] Try to attach names to all VirtualMemory allocations using memfd.
> 
> For example,
> 
> $ cat /proc/<pid>/smaps
> ...
> 7fd2ad2e0000-7fd2ad2f0000 rw-s 00000000 00:05 15576579 /memfd:dart-zone (deleted)
> 7fd2b2b7f000-7fd2b2d7f000 rw-s 00000000 00:05 15695692 /memfd:dart-newspace (deleted)
> 7fd2b2f00000-7fd2b2f80000 r--s 00000000 00:05 15695687 /memfd:dart-codespace (deleted)
> 7fd2b2f80000-7fd2b3000000 r--s 00000000 00:05 15695685 /memfd:dart-oldspace (deleted)
> 7fd2b3163000-7fd2b3beb000 rw-s 00000000 00:05 15695684 /memfd:dart-profiler (deleted)
> 7fd2b3beb000-7fd2b3eb0000 rw-s 00000000 00:05 15695683 /memfd:dart-timeline (deleted)
> ...
> 
> Bug: b/144232910
> Change-Id: I9722247853b244daff63b7a631678d44e19c2d69
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128603
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

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

Change-Id: I8a983d4650ca10e9c7396536603af21c974dcb78
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b/144232910
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128587
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2019-12-17 11:14:19 +00:00
Ryan Macnak f5e57f89d2 [vm, linux] Try to attach names to all VirtualMemory allocations using memfd.
For example,

$ cat /proc/<pid>/smaps
...
7fd2ad2e0000-7fd2ad2f0000 rw-s 00000000 00:05 15576579 /memfd:dart-zone (deleted)
7fd2b2b7f000-7fd2b2d7f000 rw-s 00000000 00:05 15695692 /memfd:dart-newspace (deleted)
7fd2b2f00000-7fd2b2f80000 r--s 00000000 00:05 15695687 /memfd:dart-codespace (deleted)
7fd2b2f80000-7fd2b3000000 r--s 00000000 00:05 15695685 /memfd:dart-oldspace (deleted)
7fd2b3163000-7fd2b3beb000 rw-s 00000000 00:05 15695684 /memfd:dart-profiler (deleted)
7fd2b3beb000-7fd2b3eb0000 rw-s 00000000 00:05 15695683 /memfd:dart-timeline (deleted)
...

Bug: b/144232910
Change-Id: I9722247853b244daff63b7a631678d44e19c2d69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128603
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-16 23:30:03 +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
Matthew Dempsky 9308cac681 [vm] Simplify VirtualMemory::Truncate
Callers always want to try to unmap the trailing pages, and the
OS-specific FreeSubSegment helper routine can never fail. Simplify
code accordingly.

Change-Id: I32e4bc72f626e15032d73326bee76a4a2ef71025
Reviewed-on: https://dart-review.googlesource.com/c/91146
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-31 21:01:48 +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 2d22b6ee6b Report errno on munmap failure.
Bug: b/70275153
Change-Id: I78724a72adb25dff38168436a5c1b34a1acff0c2
Reviewed-on: https://dart-review.googlesource.com/33220
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-01-09 20:03:49 +00:00
Ryan Macnak b247090c9e [vm] Align old-space pages.
Allows quick access to the page header for any old-space object, which is a convenient place to keep forwarding information.

Also combine the reserve and commit operations of VirtualMemory.

Bug: https://github.com/dart-lang/sdk/issues/30978
Change-Id: Id3fe06932f7bef882bb1cc29d72441b0a3602eb6
Reviewed-on: https://dart-review.googlesource.com/17046
Reviewed-by: Erik Corry <erikcorry@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-30 22:02:20 +00: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
Zachary Anderson 1393e84863 [Fuchsia] Give VMOs names
This CL assigns names to vmos formatted as "isolate space type" where
isolate is the name of the isolate, space is "oldspace" or "newspace",
and type is "code" or "data".

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2929203002 .
2017-06-09 15:33:18 -07:00
Ben Konyi f2fd150ea0 Added new type of unit test, RAW_UNIT_TEST_CASE, which is used for tests that can be flaky if run while the VM is alive. Tests created using the RAW_UNIT_TEST_CASE macro will run after the VM has shutdown to avoid having any worker threads contaminating the test results.
BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2666133002 .
2017-01-31 15:16:38 -08:00
koda@google.com 0b85873fc8 Deletion barrier preparation: validate overwritten references.
With the upcoming deletion barrier, every update of a pointer field must know whether the previous value was a valid pointer.

Currently, we always use StorePointer/StoreSmi, both for initialization and updates.

Initialization, and thus the potential for overwriting garbage values, appears in three places:
1. Object::Allocate/Foo::New.
2. Creating isolate from full snapshot.
3. Allocation in generated code.

Case 1 already null-initializes all underlying memory.
Case 2 is addressed by this CL by exploiting that:
i) fresh pages are zero-filled by OS, and
ii) freelist headers use only even values.
Case 3 is remains a TODO for future CLs.

(An alternative solution for case 2 would have been to add an init_foo method for every set_foo called.)

R=iposva@google.com

Review URL: https://codereview.chromium.org//792163003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42584 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-02 18:16:13 +00:00
koda@google.com d4cdb228f9 Add unit test for VirtualMemory::Commit.
Better late than never.

R=iposva@google.com

Review URL: https://codereview.chromium.org//684783010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41539 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-06 00:26:26 +00:00
koda@google.com 9fc1ca4536 Add unit test for freeing VirtualMemory.
R=iposva@google.com

Review URL: https://codereview.chromium.org//648473002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41043 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-10 15:41:00 +00:00
koda@google.com 2965f45064 Simplify VirtualMemory by removing unused ReserveAligned method.
Also add the ability to truncate without actually unmapping.
Note: We never create holes in the underlying reservation.

This CL is in preparation for using a thin wrapper around VirtualMemory to verify our upcoming concurrent write barrier.

R=iposva@google.com

Review URL: https://codereview.chromium.org//644453003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41017 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-09 15:59:28 +00:00
sgjesse@google.com bf67f24098 Move assert.h/assert.cc from runtime/vm to runtime/platform
The purpose of this change is twofold:

1. Source in the bin directory can now use the same assertions as
   source in the vm directory. The ASSERT macro used by the code
   in runtime/bin was just defined to use assert from the standard
   C library.
2. Moving other implementation parts from runtime/vm to
   runtime/platform (e.g. classes Monitor and Mutex) for sharing
   between runtime/bin and runtime/vm will be easier as these
   implementations rely on these assertion macros.

Created two gypi files for the platform directory. One for the
headers and one for the source. The source one is only included
when building the VM library and will be present in libdart.a
when the dart executable is linked.

All the code for asserts is still in the dart namespace.

Also re-arranged the order of includes to be alphabetically in
the files touched.

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

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3335 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-16 12:28:10 +00:00
dgrove@google.com 4c0f559d23 Initial checkin.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 05:20:07 +00:00