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>
Instead of implementing separate aligned and unaligned memory
allocation primitives for each OS, just change the unaligned allocator
into a wrapper around the aligned primitive.
While here, we can optimize the AllocateAligned logic slightly: if we
want an N-page-aligned allocation, we only need to increase the
allocation size by N-1 pages instead of N.
Notably, this means 1-page-aligned allocations don't require any extra
alignment pages, so the new logic behaves identically as before on
Android, Fuchsia, Linux, and macOS.
On Windows, it behaves slightly differently only in that unaligned
requests used to be handled as a single VirtualAlloc call with
MEM_RESERVE | MEM_COMMIT, but now they're handled as two separate
calls (reserve *then* commit). Naively, I don't expect this matters in
practice, but if it does, we can always add a fast path for
alignment==page_size_ without affecting the OS-independent API.
Change-Id: I42b2cf5dfc6e137546d8acfb6cc8939a01687948
Reviewed-on: https://dart-review.googlesource.com/c/91081
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Change-Id: I6dc02b3d9de16cc176eb97613bc0c7f0bb9b16eb
Reviewed-on: https://dart-review.googlesource.com/77013
Commit-Queue: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Removes the need for the VmarList.
Overallocate VMOs instead of VMARs to get aligned memory.
Change-Id: I0c2c85e952b8c6958e28ac734b5ba54c7712a512
Reviewed-on: https://dart-review.googlesource.com/30383
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
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>
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 .
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 .
-Pre-mark instructions when writing the snapshot.
-Write the megamorphic miss function to the snapshot.
-Add missing ExceptionHandlers for megamorphic miss code.
-Add missing C++ entry points.
-Relocate Function and Code entry_points_ when reading precompiled snapshot.
-Don't try to load a script again when running from a precompiled snapshot.
R=asiva@google.com
Review URL: https://codereview.chromium.org//1336763002 .
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
Allocates hidden extra memory after VirtualMemory, and
verified writes are duplicated at a fixed offset.
This CL only adds the helper.
Next steps:
1. Use Reserve when reserving semi-spaces and heap pages.
2. Use Write for storing pointers (+ offset in generated code).
3. Use Accept for GC-related object lifecycle.
4. Call Verify regularly.
5. Fix failures (= places where we forget/ignore write barriers).
Review URL: https://codereview.chromium.org//641243004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41399 260f80e4-7a28-3924-810f-c04153c831b5
Change executable pages to be read/execute but not writable by default.
All pages are made temporarily writable just before a full GC, because both
the mark and sweep phases write to the pages. When allocating in a page and
when patching code, the pages are made temporarily writable.
The order of allocation of Code and Instructions objects is changed so that
a GC will not occur after Instructions is allocated. (A full GC would
render the Instructions unwritable.) A scoped object is used to make memory
protection simpler.
Original CL: https://codereview.chromium.org/106593002/
I added a cc test that is expected to crash.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//136563002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32493 260f80e4-7a28-3924-810f-c04153c831b5