Commit Graph

2474 Commits

Author SHA1 Message Date
Vyacheslav Egorov a5e1f89583 VM: Fix an app-jit related shutdown race.
IsolateData contains AppSnapshot which might own some HeapPage-s, so we can't
destroy IsolateData in the Dart_IsolateShutdownCallback, because some thread
running in the isolate (e.g. background compiler) might still touch
thoses pages or objects they host.

We need to delay destruction of AppSnapshot until after the isolate shutdown.

Current API does not allow that, so we introduce a new isolate lifecycle
callback - Dart_IsolateCleanupCallback, which is invoked at the end of the
isolote lifecycle when things like background compiler have been stopped
and no Dart code is supposed to run.

BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2720723005 .
2017-02-28 21:10:04 +01:00
John McCutchan 7e55c12e03 Add SILENT_OBSERVATORY environment variable to Observatory web server
BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2715423002 .
2017-02-28 07:33:33 -08:00
Ryan Macnak c4f6728027 gen_snapshot:
- Consistently accept hypens or underscores in option names.
 - Replace --snapshot_kind=none with --dependencies-only, since the former is ambiguous as to whether an existing core snapshot needs to be read. Important when using an embedder-specific dart: library.
 - Don't try to canonicalize file paths for the snapshot pieces since this fails if there isn't already a file on disk.

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

Review-Url: https://codereview.chromium.org/2707383007 .
2017-02-27 15:18:27 -08:00
Vyacheslav Egorov 1c7cb7c5e9 VM: remove service_object_patch.dart and all associated code.
This deletion has several reasons:

- This code is broken and refers to non-existant private parts of dart:io
(e.g. `_NativeSocket._sockets`, `_ProcessImpl._processes`, `_RandomAccessFile._files`).

- This code is not reachable through the service protocol. `_serviceObjectHandler` uses
`paths` to fetch the right handler from `_servicePathMap` but caller `ServiceGetIOHandler`
always passes empty paths.

- The only test that was attempting to test some of this code through mirrors (sic!)
has been disabled since January 2015.

After deletion all tests continue to pass meaning that nobody really relies on this
broken code in any way.

BUG=https://github.com/dart-lang/sdk/issues/28882
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2715253002 .
2017-02-27 16:08:16 +01: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
Vyacheslav Egorov f746f27870 Fix issues in dart:io implementation found by fasta.
R=kustermann@google.com
BUG=https://github.com/dart-lang/sdk/issues/28882

Review-Url: https://codereview.chromium.org/2718673002 .
2017-02-24 12:19:55 +01:00
Ryan Macnak 781fd36086 Add an option to gen_snapshot for creating a Makefile describing a snapshot's dependencies. This option may be used when generating any snapshot kind, or without generating a snapshot.
- Factor out MallocGrowableArray from vm to platform.
 - Add File::Print.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2715463003 .
2017-02-23 12:40:48 -08:00
Zachary Anderson de63e4fa94 [Fuchsia] Update to the newest spelling of launchpad calls
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2713523005 .
2017-02-22 15:41:40 -08:00
Zach Anderson 30da80fb17 [dart:io][windows] Set up CRT error handling behavior
fixes #28852

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2710103002 .
2017-02-22 13:55:07 -08:00
Zach Anderson bc07953866 [dart:io][windows] Make unicode characters display correctly.
This change has two pieces.
- Set the console code page to UTF8.
  - This makes strings printed with print() display correctly
- Set the file translation mode to _O_WTEXT when writing to a
  stdout or stderr that is connected to a console.
  - This makes strings printed with e.g. stdout.writeln()
    display correctly.

fixes #28571

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

Review-Url: https://codereview.chromium.org/2698813002 .
2017-02-21 22:47:03 -08:00
Zachary Anderson e0e9489d4c [Fuchsia] Remove dead code
This removes a Dart configuration and a temporary test harness that
were used for Fuchsia bootstrapping, but which aren't needed anymore.

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2708163002 .
2017-02-21 12:34:59 -08:00
Erik Corry c6a199e40b Sort class IDs before training AppJIT snapshots
R=fschneider@google.com, rmacnak@google.com
BUG=

Review-Url: https://codereview.chromium.org/2699853002 .
2017-02-20 12:14:17 +01:00
kdaker e35365588b minor typo fix in CLI usage description, snapsot -> snapshot (#28828) 2017-02-18 17:06:51 -08:00
Ryan Macnak 32220dddcf Don't write magic numbers in script snapshots from gen_snapshot
Also includes tiny doc fix.

BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2701523007 .
2017-02-17 15:05:37 -08:00
Zach Anderson 063ae12ffc Fuchsia's message pipes are called channels for a while now
R=zra@google.com

Review-Url: https://codereview.chromium.org/2692853014 .
2017-02-17 07:43:53 -08:00
Peter von der Ahé 00bed94e0c Fix various nits in VM patch files.
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2705593002 .
2017-02-17 16:28:57 +01:00
Ryan Macnak 1392108dea Windows: VirtualFree with MEM_RELEASE wants 0 instead of the region's size.
R=zra@google.com

Review-Url: https://codereview.chromium.org/2700673004 .
2017-02-16 15:43:39 -08:00
Ryan Macnak ab212fedb3 Undo rename of LoadExtensionLibrary to LoadLibrary since mangling on Windows seems to create a conflict with LoadLibraryW.
Update use of IsolateData in Dartium's vm service.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2695403003 .
2017-02-16 14:22:23 -08:00
Ryan Macnak a317b90d63 Cleanup app snapshots on isolate/vm exit.
R=zra@google.com

Review-Url: https://codereview.chromium.org/2694103004 .
2017-02-16 13:54:57 -08:00
Ryan Macnak b6a9be6e39 Teach gen_snapshot how to create script snapshots if given a core snapshot to create them against.
Require an explicit --snapshot_kind option instead of inferring the desired snapshot kind from the combination of output file options.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2692223002 .
2017-02-15 14:28:35 -08:00
Ryan Macnak 7cec0a6bf5 Fix double-printing of loading errors in gen_snapshot.
Further fixes flutter/flutter#7993.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2694623008 .
2017-02-15 09:53:45 -08:00
Ryan Macnak 6500f6ee72 Factor out snapshot helpers from main.cc.
R=zra@google.com

Review-Url: https://codereview.chromium.org/2681193002 .
2017-02-13 11:17:31 -08:00
Zachary Anderson cbcc1a9f5f Use the new mx_object_wait_* name
R=zra@google.com, abarth@google.com

BUG=

Review-Url: https://codereview.chromium.org/2688303003 .
2017-02-10 21:53:36 -08:00
Ryan Macnak bed12669b8 gen_snapshot: When copying an error across isolates, remember to turn it back into an error.
Fixes flutter/flutter#7993.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2687023002 .
2017-02-09 13:58:14 -08:00
Zachary Anderson a4c42824ed [dart:io] Add new functions to file_unsupported.cc.
Review-Url: https://codereview.chromium.org/2685153003 .
2017-02-09 09:58:30 -08:00
Zachary Anderson 3f5458cdcb [dart:io] Adds functions to set file access and modification time
fixes #27877

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

Review-Url: https://codereview.chromium.org/2681683005 .
2017-02-09 09:45:25 -08:00
Zachary Anderson 3cb96e98a8 [Fuchsia] Cleanup process launching for updated launchpad API
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2681003004 .
2017-02-09 09:26:00 -08:00
Zachary Anderson a7f7343259 [dart:io] A small boringssl cleanup from davidben@
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2683703004 .
2017-02-08 12:25:55 -08:00
Zachary Anderson b0749b1e60 [dart:io] Extract better error messages from boringssl.
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2680513004 .
2017-02-07 07:45:21 -08:00
Jonas Termansen a8b5498333 Fix peer addresses being reported raw rather than the actual address byte.
The struct sockaddr containing the remote address was being reported
rather than the actual sin_addr / sin6_addr fields. Use the ToTypedData
utility function to return the real address bytes as a dart list. Before
this fix all remote addresses would be reported (on Linux) as 2.0.x.y where
2.0 means IPv4 and x.y are the remote port in big endian, i.e. the first
four bytes of struct sockaddr.

R=rmacnak@google.com
BUG=

Review-Url: https://codereview.chromium.org/2665973003 .
2017-02-06 13:48:53 +01:00
John McCutchan 7a20e49a38 Change the DevFS base path
- [x] Append the file system name as a child directory. This gives a common
suffix for source paths.

BUG=
R=turnidge@google.com

Review-Url: https://codereview.chromium.org/2669223003 .
2017-02-02 12:58:21 -08:00
Ben Konyi ed4bf4f2e0 Removed instances of fprintf in run_vm_tests and replaced them with OS::Print/PrintErr.
BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2675553002 .
2017-02-02 09:43:06 -08:00
Florian Schneider 15a4d5d6d1 Windows: Link library sources into gen_snapshot/dart_bootstrap
This allows gen_snapshot and dart_bootstrap to run without having
a full SDK snapshot around.

The generated cc file looks like:

static const char source_array_1[] = {
 '\x2f', '\x2f', '\x20', '\x43', '\x6f', ...
};
static const char source_array_2[] = {
 '\x2f', '\x2f', '\x20', '\x43', '\x6f', ...
};
...

const char* dart::Bootstrap::core_source_paths_[] = {
 "dart:core",
 "/path/to/sdk/lib/core/core.dart",
 source_array_1,

 "annotations.dart",
 "/path/to/sdk/lib/core/annotations.dart",
 source_array_2,
...

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2668353004 .
2017-02-01 15:55:59 -08:00
Siva Annamalai b25d59ebb4 Land https://codereview.chromium.org/2662393002 for Jason.
R=jsimmons@google.com

Review-Url: https://codereview.chromium.org/2667183002 .
2017-02-01 10:38:21 -08:00
Kevin Millikin 1b3b85690f Do not try to read vm-service and kernel-service
The VM service isolate and the Kernel service isolate are given script
URIs that are respectively "vm-service" and "kernel-service".  We
should not try to treat these as binary files.  Normally they just
don't exist, but if they happen to exist we should not read them.

BUG=
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2662213004 .
2017-02-01 12:59:02 +01:00
Ben Konyi f2fd150ea0 Added new type of unit test, RAW_UNIT_TEST_CASE, which is used for tests that can be flaky if run while the VM is alive. Tests created using the RAW_UNIT_TEST_CASE macro will run after the VM has shutdown to avoid having any worker threads contaminating the test results.
BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2666133002 .
2017-01-31 15:16:38 -08:00
Ryan Macnak 9eb216a495 Reapply "Create an app snapshot of the Dart front end."
Skip training on Windows, issue #28532.

R=hausner@google.com

Review-Url: https://codereview.chromium.org/2665753002 .
2017-01-31 09:47:51 -08:00
Vyacheslav Egorov 9bae50bf47 VM: [Kernel] Revert changes to the native ports that introduced peers.
The problem with these changes was that closed ports still continue to receive
messages and as a result we start using dead peer objects.

Fixing that would require more intrusive changes into message handler implementation - so instead we are reverting the changes and restoring manual PORT -> PEER mapping.

BUG=
R=erikcorry@google.com

Review-Url: https://codereview.chromium.org/2666063002 .
2017-01-31 10:30:15 +01:00
Florian Schneider 5c75e37ae4 Fix potential unprotected use of handle in Windows event handler.
The lock should be held across the use of handle_.

Attempt to resolve #28523.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2664073002 .
2017-01-30 18:18:09 -08:00
Ryan Macnak dfd471eea2 Make the segfault handler attempt to symbolize Dart frames.
R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2668443004 .
2017-01-30 16:38:50 -08:00
Vyacheslav Egorov 43a0500e37 VM: [Kernel] Fix bootstraping when Kernel isolate is used.
We must bootstrap from Kernel instead of Source when running with --dfe

BUG=
R=asiva@google.com, kustermann@google.com

Review-Url: https://codereview.chromium.org/2651633002 .
2017-01-30 20:52:59 +01:00
Ben Konyi f679b3c3e5 Reintroducing MallocHooks changes with fix for hooks being called when in execvpe after a fork while the MallocHooks lock is held by a thread that may no longer exist.
BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2647283004 .
2017-01-30 09:55:20 -08:00
Ryan Macnak 728f460798 Revert "Create an app snapshot of the Dart front end."
This reverts commit 8c7111c967.
This reverts commit 27c8e59d2e.

Review-Url: https://codereview.chromium.org/2657123002 .
2017-01-26 17:42:25 -08:00
Ryan Macnak 8c7111c967 Create an app snapshot of the Dart front end.
R=asiva@google.com, hausner@google.com, zra@google.com

Review-Url: https://codereview.chromium.org/2655173002 .
2017-01-26 16:28:59 -08: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
Florian Schneider c1e4e8ef72 Fix Windows debug assertion when cancelling pending i/o
When no pending i/o requests are found, CancelIoEx returns ERROR_NOT_FOUND.

This is ok, since there is nothing else to do before closing the handle.

Related to #22940.

TBR=zra@google.com

Review-Url: https://codereview.chromium.org/2651033004 .
2017-01-24 17:33:51 -08:00
Florian Schneider 2e1eeaf446 Cancel pending i/o when closing stdin on Windows
When cancelling a subscription to stdin, there may be pending I/O operation
that need to be explicitly cancelled before closing the stdin handle.

Otherwise the program would sit waiting for input (until CR is pressed).

Fixes dart-lang/pub#1502
Fixes #22940

R=zra@google.com

Review-Url: https://codereview.chromium.org/2650063003 .
2017-01-24 14:47:39 -08:00
Martin Kustermann 3f0ea0f50e VM: Fix asan memory leak in some standalone tests
Fixes #28350

R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2653583002 .
2017-01-23 19:45:28 +01:00
Ryan Macnak b46af1e75f Refactor snapshots pieces to include a section for loading instructions into the heap of a regular isolate.
Progress toward allowing each isolate to load a different snapshot.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2622053002 .
2017-01-23 10:25:02 -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