Zach Anderson
c18c1f4bfb
[fuchsia] Use Unmap() instead of zx_vmar_unmap()
...
Cleanup from last CL.
Change-Id: I08547b78641867de301d6657c7bc096e7480ad55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99243
Reviewed-by: Régis Crelier <regis@google.com >
Commit-Queue: Zach Anderson <zra@google.com >
2019-04-13 21:05:53 +00:00
Zach Anderson
381f94522c
[fuchsia] Fix vmo leak
...
Change-Id: I0e3f1a869ba974a8c665d0741a2597e0bbd2a860
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99288
Reviewed-by: Ryan Macnak <rmacnak@google.com >
Reviewed-by: Régis Crelier <regis@google.com >
Commit-Queue: Zach Anderson <zra@google.com >
2019-04-12 23:29:22 +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
Matthew Dempsky
8e2f3ea4d6
[fuchsia] Always allocate executable memory in W^X mode
...
In W^X mode (i.e., FLAG_write_protect_code), the Dart VM allocates
code memory with is_executable==false and then later makes it
executable with Protect(kReadExecute). However, on Fuchsia, this will
require a VMO with ZX_RIGHT_EXECUTE (which soon will not be the
default).
This CL takes the approach of always adding ZX_RIGHT_EXECUTE when in
W^X mode. This is suboptimal because it means all VM allocated memory
can be changed to executable, but currently the OS-independent
VirtualMemory::Allocate API doesn't provide us a way to identify
memory that doesn't need to be executable now but will in the future.
(Note that ZX_RIGHT_EXECUTE only *allows* mapping the memory as
executable; the memory is still initially mapped by
VirtualMemory::Allocate as non-executable.)
Extending the VirtualMemory::Allocate API is tracked in FL-172.
Bug: SEC-42
Change-Id: I20555c546c5ab1798c4c36b7394f6221d3993c9e
Reviewed-on: https://dart-review.googlesource.com/c/90882
Reviewed-by: Zach Anderson <zra@google.com >
Commit-Queue: Zach Anderson <zra@google.com >
2019-01-24 16:59:08 +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
Matthew Dempsky
8debb4e9db
[fuchsia] Add zx_vmo_replace_as_executable calls
...
In the future, newly created VMOs on Fuchsia will not be mappable as
executable by default. In preparation for that, start using
zx_vmo_replace_as_executable to mark Fuchsia's VMOs as executable as
needed.
SEC-42
TEST=CQ
Change-Id: I9df86bbb33b02042260727d64e74b7146eb1d1a6
Reviewed-on: https://dart-review.googlesource.com/76304
Reviewed-by: Zach Anderson <zra@google.com >
Commit-Queue: Zach Anderson <zra@google.com >
2018-09-25 04:55:02 +00:00
David Moore
aa0d868b81
[syscalls] Change vmar..._old() calls back and use new params
...
ZX-2264
Test:CQ
Change-Id: I9765bf5b2d8f143710af9c423bbd762a94ec2159
Reviewed-on: https://dart-review.googlesource.com/72142
Reviewed-by: Ryan Macnak <rmacnak@google.com >
2018-08-30 22:06:39 +00:00
David Moore
975686d5a9
[syscalls] Use vmar..._old apis.
...
Modify existing calls to vmar routines in preparation for changing
the parameter order.
ZX-2264
Test: CQ
Change-Id: Iaed6ca55b890e0d8ab557b5b96d6760020a645d9
Reviewed-on: https://dart-review.googlesource.com/61480
Reviewed-by: Adam Barth <abarth@google.com >
Reviewed-by: Zach Anderson <zra@google.com >
Reviewed-by: Ryan Macnak <rmacnak@google.com >
Commit-Queue: Ryan Macnak <rmacnak@google.com >
2018-06-21 23:48:23 +00:00
Ryan Macnak
9b5a931b06
[vm] Replace most runtime/vm uses of OS::Print with OS::PrintErr.
...
Leave --print-snapshot-sizes on stdout because it is parsed by Flutter benchmarks.
Replace all runtime/bin uses of OS::Print with Log::Print.
Bug: https://github.com/dart-lang/sdk/issues/32134
Change-Id: I74aacfb410cdfa9270d06e7f6ab0534520c7c7ba
Reviewed-on: https://dart-review.googlesource.com/60021
Commit-Queue: Ryan Macnak <rmacnak@google.com >
Reviewed-by: Zach Anderson <zra@google.com >
Reviewed-by: Vyacheslav Egorov <vegorov@google.com >
2018-06-13 19:51:40 +00:00
Ryan Macnak
7855487b80
[fuchsia] Don't attempt to free an empty region.
...
Bug: https://github.com/dart-lang/sdk/issues/31841
Change-Id: I4344372316db09a891764423077e651259a49362
Reviewed-on: https://dart-review.googlesource.com/34020
Reviewed-by: Zach Anderson <zra@google.com >
Commit-Queue: Ryan Macnak <rmacnak@google.com >
2018-01-10 21:30: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
George Kulakowski
5923ff4900
Reorder Fuchsia file headers and gn format
...
These were left out of order by the mechanical changes that were part
of Fuchsia's Magenta->Zircon rename.
Change-Id: I41c81eb889c6076ffe82102018721e5abc74e7ac
Reviewed-on: https://dart-review.googlesource.com/6165
Reviewed-by: Zach Anderson <zra@google.com >
2017-09-15 20:28:49 +00:00
George Kulakowski
7800d2a995
Rename Magenta to Zircon, along with related abbreviations
...
Change-Id: Ic4215ceb00f5a60d21ec1398fd398a9f78a9eb94
Reviewed-on: https://dart-review.googlesource.com/6100
Reviewed-by: Zach Anderson <zra@google.com >
2017-09-15 14:54:18 +00:00
Zachary Anderson
15ba173993
[Fuchsia] Rename MG-nnn -> ZX-nnn
...
Change-Id: Ia84cd53ef3dcfd13a7feb22178583e00705a4e4b
Reviewed-on: https://dart-review.googlesource.com/5290
Reviewed-by: Zach Anderson <zra@google.com >
2017-09-12 20:28:12 +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
Ryan Macnak
881bf01534
Allocate the profiler sample buffer and zone segments with virtual memory instead of malloc.
...
Allows naming their memory regions.
Add check for failed sample buffer allocation.
R=zra@google.com
Review-Url: https://codereview.chromium.org/2955493002 .
2017-06-23 14:06:44 -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
Zachary Anderson
a834e6dcf3
Update Fuchsia-specific code to use the new MX_ error names
...
R=zra@google.com
Review-Url: https://codereview.chromium.org/2935483002 .
2017-06-09 13:19:54 -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
Zach Anderson
c6b5c19347
[Fuchsia] Use magenta/process.h for mx_job_default, mx_vmar_root_self
...
Those symbols will soon be removed from magenta/syscalls.h.
BUG=
R=zra@google.com
Review-Url: https://codereview.chromium.org/2711273003 .
2017-02-24 08:00:49 -08: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
672aab3cd3
Fuchsia: Implement memory region protections
...
R=rmacnak@google.com
Review-Url: https://codereview.chromium.org/2652873002 .
2017-01-24 21:44:32 -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
b556a560dd
Fuchsia: Switch to new virtual memory syscalls
...
mx_process_map_vm and mx_process_unmap_vm are deprecated.
BUG=
R=zra@google.com
Review-Url: https://codereview.chromium.org/2583543004 .
2016-12-15 19:27:10 -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
Adam Barth
913b592a4e
Move to the new mx_vmo_syscall argument order
...
BUG=
R=abarth@google.com , zra@google.com
Review URL: https://codereview.chromium.org/2471343002 .
2016-11-03 14:17:20 -07:00
Adam Barth
a850b4c977
Remove use of magenta/process.h.
...
BUG=
R=abarth@google.com
Review URL: https://codereview.chromium.org/2461393003 .
2016-10-31 18:03:18 -07:00
James Robinson
8a53ba91de
Stop using deprecated (names of) magenta syscalls.
...
R=jamesr@chromium.org
Review URL: https://codereview.chromium.org/2355953004 .
2016-09-20 15:55:51 -07:00
Adam Barth
22010919e9
Update to use mx_process_self()
...
The map and unmap calls now need mx_process_self() instead of zero as the
process handle.
2016-09-12 14:06:33 -07:00
Zachary Anderson
74bbc7f55f
Fuchsia: Make some more VM tests pass
...
R=asiva@google.com
Review URL: https://codereview.chromium.org/2189973003 .
2016-07-29 08:07:25 -07:00
Zachary Anderson
8ccb85e38e
[fuchsia] Update to new spelling of magenta syscalls
...
These now have an mx_ prefix instead of a _magenta prefix as of
https://fuchsia.googlesource.com/magenta/+/937bde71d2
R=zra@google.com
Review URL: https://codereview.chromium.org/2154443002 .
2016-07-14 14:31:07 -07:00
Zachary Anderson
64e9017629
Fuchsia: Platform specific calls needed to Initialize and Cleanup VM.
...
fuchsia_test now succeeds.
R=asiva@google.com
Review URL: https://codereview.chromium.org/2148533002 .
2016-07-13 09:12:28 -07:00
Zachary Anderson
a503570e3a
Fuchsia: Initial check-in.
...
Instructions to build and run are in README.fuchsia.
R=asiva@google.com
Review URL: https://codereview.chromium.org/2117593002 .
2016-07-01 12:42:05 -07:00