Commit Graph

29 Commits

Author SHA1 Message Date
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
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 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 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 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
Zachary Anderson b90106e6fd [Fuchsia] Quiet an spurious error message in the EventHandler
FW-223

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2955883003 .
2017-06-26 11:09:45 -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 89dba57bcf [dart:io] Adds a finalizer to _NativeSocket to avoid socket leaks
The finalizer sends the "close" message to the EventHandler for the
file descriptor in the _NativeSocket's native field. To avoid races and
spurious messages, this CL stores a pointer to a wrapper object in the
native field instead of the file descriptor. All messsages about the
_NativeSocket sent to the EventHandler use the wrapper object instead of
the file descriptor. When the EventHandler closes the file, the file
descriptor in the wrapper object is set to -1 so that the finalizer will
instead do nothing.

On Windows, there is another level of indirection since the OS HANDLEs
were already wrapped in various kinds of Handle objects. As an additional
complication, ClientSocket close on Windows is asynchronous, so the
EventHandler may shutdown before all of the ClientSocket Handles can be
destroyed.

related #27898, #28081

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2760293002 .
2017-03-28 07:44:05 -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
Zachary Anderson 0c3d73967d VM eventhandler: Update epoll/kqueue even if the only event is an error
Otherwise, we may try to add an fd to epoll/kqueue when it is already
there.

Also avoid sending multiple notifications on an error.

related #24417

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2655893002 .
2017-01-25 13:50:00 -08:00
Zachary Anderson e2220c3ea8 VM eventhandler: Read "old" event mask before it can be modified.
related #24417

R=johnmccutchan@google.com, kustermann@google.com

Review-Url: https://codereview.chromium.org/2635253002 .
2017-01-23 08:54:52 -08:00
Zachary Anderson 44e5ace2df Fuchsia: Remove overly-restrictive assert from eventhandler
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2625463002 .
2017-01-09 11:20:51 -08:00
Ryan Macnak 3126ade6d0 Fuchsia: Throttle epoll to prevent message queues from being overwhelmed with level-triggered events.
BUG=US-109
R=asiva@google.com, zra@google.com

Review URL: https://codereview.chromium.org/2545833003 .
2016-12-01 16:39:22 -08:00
Zachary Anderson 14233482d9 Fuchsia: Partial implementation of dart:io sockets
This changes the eventhandler to epoll and adds some code for sockets
to runtime/bin/sockets_fuchsia.cc. It also adds some simple tests
to hello_fuchsia.dart.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2515643004 .
2016-11-20 22:04:14 -08:00
Zachary Anderson 479a97b129 clang-format runtime/bin
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2480793002 .
2016-11-04 12:30:56 -07:00
Zachary Anderson 40073c3844 Remove unused handles array missed in previous patch.
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/2479453002 .
2016-11-03 13:59:00 -07:00
Adam Barth 46c326fae3 Update usage of mx_handle_wait_many() API.
BUG=
R=abarth@google.com

Review URL: https://codereview.chromium.org/2468423002 .
2016-11-02 22:48:18 -07:00
Zachary Anderson be11752b14 Use 'mx_channel' instead of deprecated 'mx_msgpipe' naming
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/2458703004 .
2016-10-31 11:10:06 -07:00
Zachary Anderson 2312ff7cf4 Fuchsia: Use mx_handle_wait_many in the eventhandler
This is to set up for more handles coming in from sockets, etc.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2438903002 .
2016-10-21 13:38:06 -07:00
Zachary Anderson 1baa650388 Fuchsia: Fix eventhandler for changed syscall return
Review URL: https://codereview.chromium.org/2433833005 .
2016-10-20 07:47:26 -07:00
Zachary Anderson 9d29251368 Remove dependency on Fuchsia's runtime library.
This library is no longer publicly exposed. The only functionality used
by it is the utility function for printing mx errors, which has now
moved into the vDSO and is available in <magenta/status.h>.

R=zra@google.com, zra@chromium.org

Review URL: https://codereview.chromium.org/2428373005 .
2016-10-19 15:09:32 -07:00
Zachary Anderson 7ace8dc4f7 [fuchsia] fix uninitialized field in the event handler
R=asiva@google.com

Review URL: https://codereview.chromium.org/2399283003 .
2016-10-07 11:16:57 -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
Zachary Anderson 53374c3b99 Fuchsia: Build standalone VM. Make it run "Hello, World!".
This CL adds targets to the GN build that build the standalone Dart VM
without the observatory, and with dart:io enabled but with most of the
functionality stubbed out as UNIMPLEMENTED(). It also adds a simple
eventhandler for Fuchsia for implementing Timers.

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

Review URL: https://codereview.chromium.org/2168193002 .
2016-07-22 14:00:31 -07:00