Commit Graph

63 Commits

Author SHA1 Message Date
Adam Lesinski 919f68d8ac [process][fuchsia] Clone UTC clock when launching processes
Fuchsia is transitioning from UTC time being tracked in the kernel,
to userspace UTC clock handles.

This preserves the existing behavior that each dart process
has access to the global UTC clock.

Bug: 43629
Change-Id: I23005bccd8bec09ed6db7c6f475b6f5d6e84613c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165500
Auto-Submit: Adam Lesinski <adamlesinski@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2020-10-01 15:25:58 +00:00
Liam Appelbe 764e72800f Reland "Revert "Add an --os=fuchsia option to build.py:""
This reverts commit d39d4d0d55.

Reason for revert: Relanding with fix

Change-Id: I6d6911b6cdc578a3b576b237db94c7f1db9824b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151600
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-06-18 00:24:31 +00:00
George Wright d39d4d0d55 Revert "Add an --os=fuchsia option to build.py:"
This reverts commit 4ce18ab931.

Reason for revert: bad merge, caused build breakages in flutter/engine

Original change's description:
> Add an --os=fuchsia option to build.py:
> 
> tools/build.py --os=fuchsia runtime create_sdk
> 
> This is analogous to --os=android. It cross compiles from Linux x64 to
> Fuchsia.
> 
> A lot of the build rules are just slightly different between the existing
> Fuchsia build rules used by Flutter, and the ones added by GN SDK. For
> example "$fuchsia_sdk_root/pkg:fdio" is now "$fuchsia_sdk_root/pkg/fdio".
> So to support this I had to add a new variable, using_fuchsia_gn_sdk,
> analogous to using_fuchsia_sdk. Flutter will need to set this to false.
> 
> Change-Id: Ief275d65f30a42a801607de93cf2d27a1fe825dd
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150689
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Liam Appelbe <liama@google.com>

TBR=rmacnak@google.com,asiva@google.com,liama@google.com,kaushikiska@google.com,matthewcarroll@google.com

Change-Id: If01ee34eba906c55f2d56ba650748a86e81e701c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151321
Auto-Submit: George Wright <wrightgeorge@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2020-06-15 23:01:53 +00:00
Liam Appelbe 4ce18ab931 Add an --os=fuchsia option to build.py:
tools/build.py --os=fuchsia runtime create_sdk

This is analogous to --os=android. It cross compiles from Linux x64 to
Fuchsia.

A lot of the build rules are just slightly different between the existing
Fuchsia build rules used by Flutter, and the ones added by GN SDK. For
example "$fuchsia_sdk_root/pkg:fdio" is now "$fuchsia_sdk_root/pkg/fdio".
So to support this I had to add a new variable, using_fuchsia_gn_sdk,
analogous to using_fuchsia_sdk. Flutter will need to set this to false.

Change-Id: Ief275d65f30a42a801607de93cf2d27a1fe825dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150689
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-06-15 20:05:16 +00:00
Zach Anderson bbebad9eca [dart:io] Don't treat a file descriptor as a signal o_o;
Prior to this CL, the signal handler finalizer passes a file descriptor
where a signal number is expected.

This went uncaught for awhile since it is innocuous in most cases.
Clearing a signal handler just involves setting it back to the
default. It is not innocuous where the VM chose to override the
default, for example in the case of SIGPIPE. When setting signal
handlers with the dart:io API, if the finalizer for a _NativeSocket
for a signal handler runs, some time later the VM may be killed by
SIGPIPE instead of getting EPIPE from an IO call.

This CL replaces the call in the finalizer with a new call that
expects a file descriptor, and uses the file descriptor to look
up the signal handler that needs to be cleaned up.

Change-Id: I54caa14a556e434872d12fd9acf8c2fcf767b91e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146080
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-05-04 20:19:18 +00:00
Martin Kustermann 1569b25fde [vm] Follow-up changes to process_fuchsia.cc
This is a follow-up to

 https://dart-review.googlesource.com/c/sdk/+/139640

Due to the lack of fuchsia builders on Dart CI this was only uncovered
by the roller.

Issue https://github.com/dart-lang/sdk/issues/41076

Change-Id: Ib2bb69aa3b6d1a12f79e544323a8bd3cefe496e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139810
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-03-17 18:26:50 +00:00
Martin Kustermann 0ae869771a [vm] Avoid allocating Monitor/Mutex/... with global initializer, use Init()/Cleanup() functions instead
This CL adds a `dart::embedder::Cleanup()` (we already have `dart::embedder::InitOnce()`).
This allows us to allocate the global state and also tear it down.

As a side-effect this will also not allocate those variables if not
needed, which should fix b/151210948

Change-Id: I3c5c619586380bf27ee863ba026bbc631f243d85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139640
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-03-17 08:49:52 +00:00
James Tucker 454758d1e1 [fuchsia] swap out deprecated flag name
FDIO_SPAWN_CLONE_LDSVC was replaced with FDIO_SPAWN_DEFAULT_LDSVC, as it no
longer always means clone.

Fuchsia Bug: ZX-3031

Change-Id: I62ace1e8b9f87440adf7aea31424137a47d16303
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105400
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
Auto-Submit: James Tucker <raggi@google.com>
2019-06-07 16:38:43 +00:00
Adam Barth 20b2118dc4 [fuchsia] Finish migration to fdio_pipe_half
fdio_pipe_half is now the same as fdio_pipe_half2. We can complete the
migration by switch back to the cleaner name.

Change-Id: I6fbec450b9e2e1a4be1e68b8f9281e4d3e370e07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104805
Auto-Submit: Adam Barth <abarth@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2019-06-04 16:49:56 +00:00
Ryan Macnak 971f4845d7 [build] Remove last platform -> vm and bin -> vm dependencies. Fix some ODR violations.
Change some static_libraries to source_sets to make ODR violations link-time errors.

This is needed to enable (stop suppressing) -fvisibility=hidden in Fuchsia product builds.

Change-Id: I699cec8d4b516beab9cebf9db0a522a7ff99e004
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99822
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-04-22 20:15:43 +00:00
Drew Fisher 92c14cb7ef [fuchsia] Mark subprocess images as executable
Currently, the VMO returned by `fdio_get_vmo_clone` is executable,
despite being documented as being read-only.  We wish to correct
the implementation, but doing so would break anything that relies
on the implicit executability of that VMO.

To enable Fuchsia to make this transition, we should explicitly call
zx_vmo_replace_as_executable on the VMO holding the binary image we
wish to launch as a subprocess.

Change-Id: I040ed2409120a58a30e88ef34a01fe73434a7ea0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99369
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
Auto-Submit: Drew Fisher <zarvox@google.com>
2019-04-15 22:32:46 +00:00
Michael Powell dfcc52f909 [vm/dart:io/fuchsia] Improve fdio_pipe_half signature, step 2.
The return value on fdio_pipe_half conflated two things: the error code
on failure (as a zx_status_t) or a file descriptor on success. This
technically worked, because they're both ints, the error code was always
negative, and the file descriptor always positive. However, the stated
return type of zx_status_t was misleading. This changes the signature
such that it always returns an actual zx_status_t, and the file
descriptor is returned through a pointer argument.

Also remove the last argument, since it was always given the same value.

This needs to be done as a soft transition because it's called from the
Dart runtime. The steps are as follows:
1. Add fdio_pipe_half2 with the new signature.
2. Update the Dart runtime to call fdio_pipe_half2.
3. Change fdio_pipe_half to be identical to fdio_pipe_half2.
4. Update the Dart runtime to call the updated fdio_pipe_half.
5. Delete fdio_pipe_half2.

This is step 2.

Change-Id: Ieac841c5f8055f34000851cef364a12b6c0aca2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96664
Commit-Queue: Zach Anderson <zra@google.com>
Auto-Submit: Michael Powell <mikepowell@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2019-03-28 17:45:55 +00:00
Adam Barth 07b2f82203 [fuchsia] Remove unused header
This header is no longer needed and will be removed soon.

Change-Id: I5d96b725bc2a7c6695bb5248377075b00fe7fc6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95880
Commit-Queue: Zach Anderson <zra@google.com>
Auto-Submit: Adam Barth <abarth@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2019-03-07 20:10:21 +00:00
Liam Appelbe ec599a5977 [VM] Remove retry logic from close(fd) calls
This covers Linux, Mac, Android, and Fuchsia.

Bug: https://github.com/dart-lang/sdk/issues/35954
Fixes: https://github.com/dart-lang/sdk/issues/35954
Change-Id: I8142332c530be8ad3ce46312a4a5ac750953c288
Reviewed-on: https://dart-review.googlesource.com/c/93320
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-02-15 23:28:17 +00:00
Ryan Macnak 0f24b9e7ae [standalone] Name dart:io threads, take 2.
Mac's pthread_setname_np assumes the current thread.

Bug: US-588
Change-Id: Ibbddd1f7bffeab10fd470a6176f68b1c0440aa99
Reviewed-on: https://dart-review.googlesource.com/c/93120
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-02-13 20:29:46 +00:00
Ryan Macnak d566a674d0 Revert "[standalone] Name dart:io threads."
This reverts commit cc3218b771.

Reason for revert: Mac build

Original change's description:
> [standalone] Name dart:io threads.
> 
> Change-Id: I5f5248366b39afab96a8b70b4f107ec5134b84f4
> Reviewed-on: https://dart-review.googlesource.com/c/92960
> Reviewed-by: Zach Anderson <zra@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

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

Change-Id: I9071c955d4710f8146a661d15fa980f237b6eb81
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/93064
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-02-13 18:04:49 +00:00
Ryan Macnak cc3218b771 [standalone] Name dart:io threads.
Change-Id: I5f5248366b39afab96a8b70b4f107ec5134b84f4
Reviewed-on: https://dart-review.googlesource.com/c/92960
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-02-13 17:23:56 +00:00
Zach Anderson 56f87f409e [dart:io,fuchsia] Pass Isolate namespace to child process. Fix double free.
Before this change, the child process inherits the namespace of the
process. After this change the child process inherits the namespace of
the calling isolate.

Related: DX-710

Change-Id: Idbc72e30f5796f8034cedae776d4572ad0b0360f
Reviewed-on: https://dart-review.googlesource.com/c/89460
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2019-01-15 22:07:51 +00:00
Martin Kustermann f5d1229081 Reland "[VM] Inline ClassID.getID() eagerly, extend pattern matching logic to recognize it, use it to special case ascii decoding"
This change extends/fixes the exiting "pattern recognition" which tries
to recognize the pattern

  v2 <- LoadClassIdInstr(v1)
  BranchIf v2 == IntegerConstant(cid)

Furthermore we start inlining the recognized `ClassID.getID` method very
early in the pipeline.  This allows the VM to recognize the above
pattern and insert redefinitions before the actual inlining pass.

Furthermore we special-case two very hot methods in utf8 decoding by
manually having two loops, one of which is guarded by a class-id check
against the _Uint8ArrayView class, which is most common.  (In the future
we would like to unify the typed data layouts so we no longer need to
use `ClassId.getID`, thereby also allowing non core library code to use
this).

This improves dart-aot by
  * 31%+ for a protobuf decoding benchmark we care about

Issue https://github.com/dart-lang/sdk/issues/31954

Change-Id: I7181bbf096aabe303634fd3b2bff9cc96d69719c
Reviewed-on: https://dart-review.googlesource.com/c/85443
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-11-28 10:43:32 +00:00
William Hesse faafdb4b2f Revert "[VM] Inline ClassID.getID() eagerly, extend pattern matching logic to recognize it, use it to special case ascii decoding"
This reverts commit d7cf6959bb.

Reason for revert: This causes crashes on the vm-obfuscate builder at https://ci.chromium.org/p/dart/builders/luci.dart.ci.sandbox/vm-kernel-precomp-obfuscate-linux-release-x64
like

FAILED: dartkp-dart_precompiled release_x64 corelib_2/linked_hash_map_test
Expected: Pass
Actual: Crash
Unexpected compile error.

--- Command "vm_compile_to_kernel" (took 11.000189s):
DART_CONFIGURATION=ReleaseX64 /b/s/w/ir/cache/builder/sdk/pkg/vm/tool/gen_kernel --aot --platform=out/ReleaseX64/vm_platform_strong.dill -o /b/s/w/ir/cache/builder/sdk/out/ReleaseX64/generated_compilations/dartkp/tests_corelib_2_linked_hash_map_test/out.dill /b/s/w/ir/cache/builder/sdk/tests/corelib_2/linked_hash_map_test.dart --packages=/b/s/w/ir/cache/builder/sdk/.packages -Ddart.developer.causal_async_stacks=true

exit code:
0

--- Command "precompiler" (took 583ms):
DART_CONFIGURATION=ReleaseX64 out/ReleaseX64/gen_snapshot --snapshot-kind=app-aot-assembly --assembly=/b/s/w/ir/cache/builder/sdk/out/ReleaseX64/generated_compilations/dartkp/tests_corelib_2_linked_hash_map_test/out.S --obfuscate --sync-async --ignore-unrecognized-flags --packages=/b/s/w/ir/cache/builder/sdk/.packages /b/s/w/ir/cache/builder/sdk/out/ReleaseX64/generated_compilations/dartkp/tests_corelib_2_linked_hash_map_test/out.dill

exit code:
-6

stderr:
Warning: This VM has been configured to obfuscate symbol information which violates the Dart standard.
         See dartbug.com/30524 for more information.

===== CRASH =====
version=2.2.0-edge.83712405657ff736033380cb24b0bd5a62fc3692 (Tue Nov 27 16:56:07 2018 +0000) on "linux_x64"
si_signo=Segmentation fault(11), si_code=1, si_addr=0xd1400050e5f
Dumping native stack trace for thread 2b71
  [0x000056001fc426c7] Unknown symbol
  [0x000056001fc426c7] Unknown symbol
  [0x000056001fe5763d] Unknown symbol
  [0x000056001fe4c99c] Unknown symbol
  [0x000056001fe6166a] Unknown symbol
  [0x000056001fe59c0c] Unknown symbol
 

Original change's description:
> [VM] Inline ClassID.getID() eagerly, extend pattern matching logic to recognize it, use it to special case ascii decoding
> 
> This change extends/fixes the exiting "pattern recognition" which tries
> to recognize the pattern
> 
>   v2 <- LoadClassIdInstr(v1)
>   BranchIf v2 == IntegerConstant(cid)
> 
> Furthermore we start inlining the recognized `ClassID.getID` method very
> early in the pipeline.  This allows the VM to recognize the above
> pattern and insert redefinitions before the actual inlining pass.
> 
> Furthermore we special-case two very hot methods in utf8 decoding by
> manually having two loops, one of which is guarded by a class-id check
> against the _Uint8ArrayView class, which is most common.  (In the future
> we would like to unify the typed data layouts so we no longer need to
> use `ClassId.getID`, thereby also allowing non core library code to use
> this).
> 
> This improves dart-aot by
>   * 31%+ for a protobuf decoding benchmark we care about
> 
> 
> Issue https://github.com/dart-lang/sdk/issues/31954
> 
> Change-Id: Ia567b92b7e76ff28eda1726deaafda32732ed8f5
> Reviewed-on: https://dart-review.googlesource.com/c/85281
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> Reviewed-by: Jenny Messerly <jmesserly@google.com>
> Commit-Queue: Martin Kustermann <kustermann@google.com>

TBR=vegorov@google.com,kustermann@google.com,jmesserly@google.com,johnniwinther@google.com,sra@google.com

Change-Id: I912b0768c32cbb00297ce48db29dbdbea44c14fa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/85441
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: William Hesse <whesse@google.com>
2018-11-27 18:15:36 +00:00
Martin Kustermann d7cf6959bb [VM] Inline ClassID.getID() eagerly, extend pattern matching logic to recognize it, use it to special case ascii decoding
This change extends/fixes the exiting "pattern recognition" which tries
to recognize the pattern

  v2 <- LoadClassIdInstr(v1)
  BranchIf v2 == IntegerConstant(cid)

Furthermore we start inlining the recognized `ClassID.getID` method very
early in the pipeline.  This allows the VM to recognize the above
pattern and insert redefinitions before the actual inlining pass.

Furthermore we special-case two very hot methods in utf8 decoding by
manually having two loops, one of which is guarded by a class-id check
against the _Uint8ArrayView class, which is most common.  (In the future
we would like to unify the typed data layouts so we no longer need to
use `ClassId.getID`, thereby also allowing non core library code to use
this).

This improves dart-aot by
  * 31%+ for a protobuf decoding benchmark we care about


Issue https://github.com/dart-lang/sdk/issues/31954

Change-Id: Ia567b92b7e76ff28eda1726deaafda32732ed8f5
Reviewed-on: https://dart-review.googlesource.com/c/85281
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-11-27 13:14:27 +00:00
Zach Anderson 3ad0571cf9 [fuchsia] Fixes for the Fuchsia build
Makes public some include paths needed for the dart_runner to depend on
dart_io.

Also updates some dart:io implementations to give and OSError
instead of crashing when something is unimplemented.

Change-Id: I862fc7cc43f56e74de791ecc021b88238b54a8e5
Reviewed-on: https://dart-review.googlesource.com/c/84920
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-11-26 16:30:33 +00:00
Todd Eisenberger cbf97be4e7 [fuchsia] Switch to new fdio API names
Change-Id: Ib11fad17ddc04dad641a457f0a6db1e39d1f1c06
Reviewed-on: https://dart-review.googlesource.com/77700
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-10-03 18:28:27 +00:00
George Kulakowski a1bd1dd6ee Use standard I/O posix functions for Fuchsia, not 64 bit variants
These are not standard, and Fuchsia's libc would like to remove
them. They are all currently defines of the non-64 ones anyway, so
there will be no behavior change.

Change-Id: I7babf04f75aef132d77edd651a86c2ae15ea7aa3
Reviewed-on: https://dart-review.googlesource.com/62710
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-06-27 23:23:02 +00:00
Adam Barth 03bcc495f7 [fuchsia] Migrate process creation to fdio_spawn_vmo
We previously used liblaunchpad.so, which will be removed from the
Fuchsia SDK.

Change-Id: I5992d195dc53549c449ae21b3b201bc1dade519a
Reviewed-on: https://dart-review.googlesource.com/60147
Reviewed-by: Zach Anderson <zra@google.com>
2018-06-14 23:31:26 +00:00
Adam Barth 6dd945599e [fuchsia] Move FDIO headers
These headers are now at this location.

Change-Id: I61bbe005093e241d9d7ca4435e3d7bbd6f9d27b8
Reviewed-on: https://dart-review.googlesource.com/58701
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Adam Barth <abarth@google.com>
2018-06-06 16:47:05 +00:00
Adam Barth 57d256377c [fuchsia] Update for port API change
zx_port_wait and zx_port_queue no longer take an unused count parameter.

Change-Id: I62f03871282d076638c51527603473252821d316
Reviewed-on: https://dart-review.googlesource.com/56705
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Adam Barth <abarth@google.com>
2018-05-25 19:43:15 +00:00
Garret Kelly 7ff1a22d3d Call zx_port_{wait,queue} with correct count
In the near future zx_port_{wait,queue} will not accept a count of zero.
Change all callers to call these functions with a count of one.

Change-Id: If37933344e07b96f07504e2837c0c12133a7cb4e
Reviewed-on: https://dart-review.googlesource.com/51500
Reviewed-by: Zach Anderson <zra@google.com>
2018-04-17 15:53:08 +00:00
Sean Klein e4b72146ca Reduce usage of LP_CLONE_FDIO_CWD
To pass a CWD to a child through launchpad, simply set
the PWD environment variable, and the child will open
their CWD relative to their root handle when they initialize.

Change-Id: I24cd01c05e705c5a0ec2dfbaae4dbe8de42d7ed4
Reviewed-on: https://dart-review.googlesource.com/15421
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2017-10-20 03:50:27 +00:00
Ryan Macnak 3609522166 printf format checking is a compiler feature, not a platform feature.
Change-Id: Ib3e0beb814b5cae6f2b4be13f055069f682674f5
Reviewed-on: https://dart-review.googlesource.com/11645
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-09 22:26:01 +00:00
George Kulakowski daa92a9401 [fuchsia] Remove some unneeded reinterpret_casts around port syscalls
Shortly, the zx_port_queue and zx_port_wait system calls will take
pointers to zx_port_packet_t instead of void. They currently take void
as the last vestiges of the ports v1 and v2 compatibility story.

All callers are passing actual pointers to zx_port_packet_t, so there
is no real code change.

Change-Id: I8f61791846c7693d70edc8c37c1973e8637949bb
Reviewed-on: https://dart-review.googlesource.com/9796
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-02 18:02:14 +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 d0295c873c [dart:io] Namespaces for file IO
Fuchsia requires the ability to sandbox Isolates w.r.t. file IO.
When a new Isolate starts, Fuchsia will pass the Isolate an object
called a namespace. We can translate the namespace object into a
file descriptor suitable for passing to the *at() family of
POSIX file system calls. The file system calls will then
have visibility only into the specified namespace.

We also plumb Namespaces through on all the other platforms as well to
make the change easier to test and so that in the future we can
implement e.g. per-isolate cwds.

This change adds a new internal class to dart:io called _Namespace,
which is implemented in a patch file. See:

sdk/lib/io/namespace_impl.dart
runtime/bin/namespace_patch.dart

The embedder can set up a non-default namespace by calling
_Namespace._setupNamespace during Isolate setup.

Instances of _Namespace have a native field that holds a pointer
to a native Namespace object. See:

runtime/bin/namespace.h

Calls from e.g. file_impl.dart are now also passed a
_Namespace object. The implementations in e.g. file.cc and
file_linux.cc then extract the namespace, and use it to compute a
file descriptor and path suitable for passing to e.g. openat().

related US-313

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

Review-Url: https://codereview.chromium.org/3007703002 .
2017-08-30 09:34:36 -07:00
Zachary Anderson 747868f2b1 [dart:io] Remove DART_IO_DISABLED
This was only used by Dartium.

Review-Url: https://codereview.chromium.org/3009523002 .
2017-08-24 11:17:52 -07:00
Zachary Anderson e8eebba056 [Fuchsia] Fix Process exit code handler
There was a bug in the logic for maintaining the array of handles to
wait on. Using the ports API instead removes the need to maintain an
array of handles.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2992803002 .
2017-08-01 13:57:41 -07:00
Zachary Anderson 4b752eaf05 [Fuchsia] Fixes and cleanup for launchpad_vmo_from_file() deprecation
R=rmacnak@google.com, swetland@google.com

Review-Url: https://codereview.chromium.org/2986803002 .
2017-07-24 13:32:15 -07: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 9bbfd08910 [fuchsia] Use 0 instead of the deprecated MX_PORT_OPT_V2 option
Magenta has removed ports v1, and subsequently deprecated the need for
the MX_PORT_OPT_V2 option.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2973893002 .
2017-07-07 10:00:16 -07:00
Zachary Anderson 10d343f295 [Fuchsia] Fix definition of Process::ClearSignalHandler()
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2960233003 .
2017-06-28 15:55:26 -07:00
Zachary Anderson 2a9d570f4d Use POLL* rather than EPOLL* event bits on Fuchsia
Fuchsia defines these bits identically. We are removing epoll from
Fuchsia shortly, so use the <poll.h> ones.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2955023003 .
2017-06-26 14:21:27 -07:00
Adam Barth 2e55f22810 Use LP_CLONE_MXIO_NAMESPACE instead of LP_CLONE_MXIO_ROOT
The new name reflects MXIO_ROOT being deprecated.
2017-06-26 12:07:53 -07:00
Zachary Anderson bad6b64062 [Fuchsia] EventHandler: epoll -> ports v2
This CL rewrites the EventHandler on Fuchsia to use
the low-level ports system call API instead of the
epoll() emulation in musl. This will allow the
Magenta team to remove the epoll() emulation and
the deprecated system call API it is based on.

The new ports API doesn't provide epoll()-like
edge-triggering that clients of the EventHandler
expect. Therefore, this CL emulates it by adding
a level of indirection through a new "IOHandle"
object, which the socket code now uses instead
of file descriptors. This is similar to what we do
on Windows. See the comment at the top of
eventhandler_fuchsia.cc for more details.

Fuchsia issue US-251

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2910853002 .
2017-06-23 10:41:21 -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
James Robinson d32e55e17b [fuchsia] Replace use of epoll with mx_ primitives in process_fuchsia
process_fuchsia.cc has the ability to drain stdout, stderr, and exit
status from a child process. It was using epoll to multiplex these
streams which worked but required complicated emulation in libc which
we'd like to unwind as well as some tricky locking. This replaces the
epoll with a direct mx_object_wait_many() call that waits on the
Magenta handles backing the streams.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2903373003 .
2017-05-30 13:59:07 -07:00
Zachary Anderson 9779e2db96 [Fuchsia] Calculate RSS using new task stat fields
mem_committed_bytes is deprecated and will go away.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2906943002 .
2017-05-26 15:15:50 -07:00
Zachary Anderson 9ce608e89d [dart:io] Adds ProcessInfo.{max,current}Rss. Adds OS::MaxRSS on Fuchsia.
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2822943002 .
2017-04-17 14:41:40 -07:00
Zachary Anderson 6756e4d3ce [fuchsia] Fix shutdown crash
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2812753002 .
2017-04-10 15:46:08 -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