Samir Jindel
e59a4a2b42
[vm/ffi] Call natives through stubs if write-protection is enabled without dual-mapping.
...
Addresses the Dart -> Native half of dartbug.com/37629
Change-Id: I242b7f3a14dd105334a8b6e5c089b173c398491e
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111280
Commit-Queue: Samir Jindel <sjindel@google.com >
Reviewed-by: Martin Kustermann <kustermann@google.com >
2019-08-07 11:37:20 +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
Régis Crelier
0491d5cde7
Revert "[VM runtime] Dual mapping of executable pages."
...
This reverts commit 44186dfdcd .
Reason for revert: not working on vm-kernel-precomp-android-release-arm
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 >
TBR=rmacnak@google.com ,regis@google.com
Change-Id: I793ceee6252111eafbcbfe6e28268f4f6f2d7215
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/94989
Reviewed-by: Régis Crelier <regis@google.com >
Commit-Queue: Régis Crelier <regis@google.com >
2019-03-01 22:55:14 +00:00
Régis Crelier
44186dfdcd
[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 >
2019-03-01 22:19:31 +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
Matthew Dempsky
b11f2d8e69
[vm] Implement VirtualMemory::Allocate using AllocateAligned
...
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 >
2019-01-25 01:22:20 +00:00
Ryan Macnak
001343ce06
[vm, gc] Disable reads and writes to from-space after a scavenge.
...
Change-Id: Id44de869e9c6823baf63a80caa10ceff9758dc31
Reviewed-on: https://dart-review.googlesource.com/c/79148
Reviewed-by: Alexander Markov <alexmarkov@google.com >
Commit-Queue: Ryan Macnak <rmacnak@google.com >
2018-10-11 18:15:22 +00:00
Ben Konyi
07852532e3
[ VM ] Additional cleanup in Dart_Initialize and Dart_Cleanup
...
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 >
2018-09-28 23:18:59 +00:00
Vyacheslav Egorov
613c6d066c
[vm][windows] Implement VirtualMemory::FreeSubSegment
...
Fixes #27505
This relands fc775b3e9b with a fix to
VirtualMemory::~VirtualMemory: on Windows the only way to release
virtual address mapping is to invoke VirtualFree(..., MEM_RELEASE) with the
original base pointer returned by VirtualAlloc - that is why we need to call
VirtualFree is size of the reservation is 0: the whole reservation might have
been decommitted by VirtualFree(MEM_DECOMMIT) but it is still present.
Change-Id: I7d1d444693c523b327d44266d5fe70f7a5d8f803
Reviewed-on: https://dart-review.googlesource.com/52642
Reviewed-by: Zach Anderson <zra@google.com >
Commit-Queue: Vyacheslav Egorov <vegorov@google.com >
2018-04-25 23:39:52 +00:00
Zach Anderson
7ed7933cd4
Revert "[vm][windows] Implement VirtualMemory::FreeSubSegment"
...
This reverts commit fc775b3e9b .
Reason for revert: Crashes in FreeVirtualMemory on the bots.
Original change's description:
> [vm][windows] Implement VirtualMemory::FreeSubSegment
>
> related #27505
>
> Change-Id: I3d500a041def348e8dd61bd16e0516cf5eaf38c2
> Reviewed-on: https://dart-review.googlesource.com/52520
> Reviewed-by: Ryan Macnak <rmacnak@google.com >
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com >
> Commit-Queue: Zach Anderson <zra@google.com >
TBR=vegorov@google.com ,rmacnak@google.com ,zra@google.com
Change-Id: I2dd3fc163165773022b16735d415e11b0fa50f8e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/52540
Reviewed-by: Zach Anderson <zra@google.com >
Commit-Queue: Zach Anderson <zra@google.com >
2018-04-25 02:49:00 +00:00
Zach Anderson
fc775b3e9b
[vm][windows] Implement VirtualMemory::FreeSubSegment
...
related #27505
Change-Id: I3d500a041def348e8dd61bd16e0516cf5eaf38c2
Reviewed-on: https://dart-review.googlesource.com/52520
Reviewed-by: Ryan Macnak <rmacnak@google.com >
Reviewed-by: Vyacheslav Egorov <vegorov@google.com >
Commit-Queue: Zach Anderson <zra@google.com >
2018-04-24 21:50:48 +00:00
Ryan Macnak
e14b3a86f0
Report errno on mprotect failure.
...
Bug: b/70275153
Change-Id: I81b868b25428b39835935846ba2c9f9f67b3e84d
Reviewed-on: https://dart-review.googlesource.com/33665
Reviewed-by: Siva Annamalai <asiva@google.com >
Commit-Queue: Ryan Macnak <rmacnak@google.com >
2018-01-10 01:37:49 +00:00
Ryan Macnak
a144e263ce
Allocate from the root VMAR on Fuchsia.
...
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 >
2017-12-19 21:47:44 +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
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
8b217ec519
Rename references to "external pages" as "image pages" to avoid confusion with the kind of external memory associated with finalizers.
...
R=asiva@google.com
Review-Url: https://codereview.chromium.org/2654183002 .
2017-01-26 09:53:06 -08:00
Zachary Anderson
cf631890c6
Fuchsia: Memory reservation and partial unmapping
...
R=asiva@google.com
Review-Url: https://codereview.chromium.org/2594733003 .
2016-12-21 07:46:41 -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
Zachary Anderson
4118680345
[windows] Revert virtual memory changes
...
Revert changes to virtual_memory_win.cc in case they are the cause of
the OOM failures on the debug windows x64 bot.
Review URL: https://codereview.chromium.org/2420853002 .
2016-10-13 22:02:12 -07:00
Zach Anderson
6f7696dfc9
[windows] fix ~VirtualMemory()
...
R=asiva@google.com
Review URL: https://codereview.chromium.org/2414133002 .
2016-10-13 12:41:26 -07:00
Zach Anderson
9c83c381ec
[windows] Implements FreeSubSegment
...
fixes #27505
R=asiva@google.com
Review URL: https://codereview.chromium.org/2411253002 .
2016-10-13 09:56:36 -07:00
Siva Annamalai
b78aeee6f2
Fix race condition with HasMutatorThread that was being used without a lock.
...
R=fschneider@google.com
Review URL: https://codereview.chromium.org/2191723002 .
2016-07-28 18:32:52 -07:00
Srdjan Mitrovic
4465fc3492
Address Siva's comments from https://codereview.chromium.org/1877973002/
...
BUG=
R=asiva@google.com
Review URL: https://codereview.chromium.org/1880233002 .
2016-04-12 15:44:50 -07:00
Srdjan Mitrovic
f5392ea09a
Fix background compilation: allocate stubs at safepoint
...
BUG=
R=asiva@google.com
Review URL: https://codereview.chromium.org/1710443003 .
2016-02-17 13:17:26 -08:00
Zachary Anderson
1fb050baa0
Fixes shutdown crashes.
...
- Restores fix to debug message queue.
- Fixes for precompilation.
BUG=
R=johnmccutchan@google.com , rmacnak@google.com
Review URL: https://codereview.chromium.org/1406013004 .
2015-10-26 15:43:27 -07:00
koda@google.com
db32247d47
Fix old bug in VirtualMemory::Commit on Windows.
...
This was recently exposed by VerifiedMemory, which was the first time we commit something that's not the initial part of a reservation.
BUG=dart:21469
TBR=iposva@google.com
Review URL: https://codereview.chromium.org//701113004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41533 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-05 21:29:55 +00:00
koda@google.com
299cc226b8
Fix windows build.
...
TBR=iposva@google.com
Review URL: https://codereview.chromium.org//643563003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41020 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-09 16:09:59 +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
fschneider@google.com
78fbacbd87
Fix flag to switch write protection of code pages on/off.
...
TBR=iposva@google.com
Review URL: https://codereview.chromium.org//138913016
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32549 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-11 10:17:03 +00:00
fschneider@google.com
d6178535b2
Landing: Write protect executable pages in the VM.
...
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
2014-02-10 12:18:06 +00:00
iposva@google.com
9046a44a37
Prepare for removal of source_filter.gypi:
...
- Guard OS-dependent source files with #if TARGET_OS_* in a similar
fashion to the architecture dependent sources.
Review URL: https://codereview.chromium.org//12282051
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18786 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-20 21:17:38 +00:00
iposva@google.com
0c0bb2e270
- On Windows int != DWORD.
...
Review URL: https://chromiumcodereview.appspot.com//10820054
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9985 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-27 18:16:12 +00:00
iposva@google.com
d68bf3be66
- Add the ability to protect VirtualMemory.
...
- Write protect the VM isolate once it has been constructed.
Review URL: https://chromiumcodereview.appspot.com//10830045
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9984 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-27 18:07:59 +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