Commit graph

2355 commits

Author SHA1 Message Date
Martin Kustermann 37dfdbdc97 VM: Remove unused (and incomplete) HashMap::Remove() function
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2542103002 .
2016-12-01 13:51:49 +01:00
Martin Kustermann d822f36f15 VM: Fix memory leak during shutdown
The way runtime/platform/hashmap.h:HashMap was implemented so far did not allow
deleting elements while iterating over the map. If one iterated like this

  HashMap::Entry* cursor = map.Start();
  while (cursor != NULL) {
    if (cond) {
      map.Remove(cursor->key, cursor->hash);
    }
    cursor = map.Next(cursor);
  }

Then the iteration `cursor` will skip elements. This is due to the fact that
`HashMap::Remove()` is left-rotating elements in certain cases and
`HashMap::Next()` will unconditionally advance to the next position in the
backing store.

PROBLEM IS: There was existing code which did remove elements while iterating
over a HashMap.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2533303005 .
2016-11-30 23:52:04 +01:00
Zachary Anderson c8ecd31aa5 Properly label vm_tests as tests
This will allow build tools that are interested in target types to work
properly.

BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/2540853002 .
2016-11-30 14:34:37 -08:00
Zachary Anderson cec2a1cab2 Adjust memory pressure from SSL
This includes the size of the internal memory buffers for the filter
and the trusted certs in the security context.

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

Review URL: https://codereview.chromium.org/2542663002 .
2016-11-30 10:26:45 -08:00
Martin Kustermann f9c9c4e767 VM: Fix segfault during shutdown of socket listening registry
The following happened:

A listening socket (ipv4, first-port) was created.  Afterwards another
listening socket (ipv6, 0) is being created.  We look up in the hashmap
if there is already a listening socket on port `0` (which is never the case).
So we create a new socket, the OS assigns the socket a random port
(which just happens to be `first-port` as well).  Then we insert a new OSSocket
entry into the hashmap with key `first-port` (and set its `next` field to NULL).
This will simply override the existing entry.

During shutdown we loop over all (fd, OSSocket) pairs and try to remove
`OSSocket` from the port->socket map (via the linked `next` list).  We cannot
find the `OSSocket` which we accidentally droped earlier, so we dereference
`0->next` and hit a SEGFAULT.

What should've happend is to correctly link the `OSSocket`s via the next field.

Fixes #27847

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

Review URL: https://codereview.chromium.org/2540013002 .
2016-11-30 11:48:08 +01:00
Zachary Anderson 2644362215 GN: Reset default for fallback root certs to false.
R=johnmccutchan@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/2536273002 .
2016-11-29 12:24:48 -08:00
Siva Annamalai 280d6ede9d Temporary workaround to isolate memory leak issue.
BUG=
R=kulakowski@google.com

Review URL: https://codereview.chromium.org/2535683003 .
2016-11-28 19:08:49 -08:00
Ryan Macnak 2cf2297b4f Print snapshot size in PRODUCT mode as well.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2525063002 .
2016-11-23 14:30:24 -08:00
Ryan Macnak 1b51889447 Allow binding the vm service to IPv6 addresses.
Change the default bind address to 'localhost', which will be resolved to '127.0.0.1' or '::1' depending on the host's support for IPv6.

Fixes #27841

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2515023002 .
2016-11-23 14:24:52 -08:00
Ryan Macnak 8d57e3d540 Enable SecureSocket on Fuchsia using BoringSSL and compiled-in certificates from dart-sdk/root_certificates.
Implement OS::CurrentTimeMicros in terms of gettimeofday.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2519133005 .
2016-11-23 10:48:18 -08:00
Florian Schneider 6cfce40fab Fix product and Mac build.
BUG=

Review URL: https://codereview.chromium.org/2518063008 .
2016-11-23 10:47:44 -08:00
Florian Schneider 6cd141def5 Dump stack trace on segfault in the VM.
Install a signal handler in the standalone VM that dumps a backtrace
similar to what we already do on assertion failures.

For now only Linux and MacOS are supported.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2514113002 .
2016-11-23 10:29:07 -08:00
Martin Kustermann 2c9cbb1d2c VM: [Kernel] Go back to previous behavior in loader.cc
Review URL: https://codereview.chromium.org/2523183002 .
2016-11-23 10:55:59 +01:00
Martin Kustermann 1aff626804 VM: [Kernel] Split kernel API into 3 steps: ([read binary], parse-binary, bootstrap, load program)
This avoids reading and parsing the kernel binary multiple times and avois
having it multiple times in memory (we don't free the 'kernel::Program*' object
ATM).

R=kmillikin@google.com

Review URL: https://codereview.chromium.org/2525623002 .
2016-11-23 09:26:15 +01:00
Ryan Macnak 171da0489f Fuchsia sockets:
- Remove CheckConnect.
  - Enable NODELAY.
  - Add testSimpleReadWriteClose to hello_fuchsia_test.

Add stub implementation of OS::MaxRSS so Observatory can load without crashing the target VM.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2523133002 .
2016-11-22 16:52:21 -08:00
John McCutchan ea94a5dcb0 Don't pass --print_snapshot_sizes in product mode
BUG=

Review URL: https://codereview.chromium.org/2521323003 .
2016-11-22 14:47:05 -08:00
Ryan Macnak b83fb06741 Fuchsia sockets:
- Enable FDUtils::AvailableBytes.
 - Disable Socket::SetNoDelay.
 - Implement Socket::GetRemotePeer same as Linux.
 - Implement Socket::ParseAddress same as Linux.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2522923002 .
2016-11-22 12:49:01 -08:00
John McCutchan ed47486f60 Fix gen_snapshot product mode build
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2527473002 .
2016-11-22 11:35:27 -08:00
John McCutchan 2510646aaf Wire up the stub native resolver for all libraries in gen_snapshot
Fixes https://github.com/flutter/flutter/issues/6952

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2518233003 .
2016-11-22 11:15:25 -08:00
Ryan Macnak 5ee71cae9d Don't include usage counters, etc in snapshots with code. If we already have code, eagerly recompiling in unlikely to have new type feedback.
Print snapshot sizes when generating an AOT snapshot from gen_snapshot (e.g., Flutter).
Remove some unnecessary symbols.
Use named constants for exit codes.
Use Log::PrintErr instead of fprintf(stderr) so we see error messages in adb logcat.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2517683002 .
2016-11-22 09:59:06 -08:00
Ryan Macnak f62713e97c Fix app snapshots on IA32 Windows.
The file size is not rounded up after the isolate snapshot if there are no rodata/instruction pieces. The other OS's use mmap instead of read, which is apparently okay with over-reading the file.

Fixes #27786

R=asiva@google.com

Review URL: https://codereview.chromium.org/2521883002 .
2016-11-22 09:20:51 -08:00
Ryan Macnak 6c45f24fa6 Report a peer address over IPv4 as IPv4.
R=asiva@google.com

Review URL: https://codereview.chromium.org/2518263002 .
2016-11-22 09:19:08 -08:00
Zachary Anderson bb7aae9c4f Fix android build
Review URL: https://codereview.chromium.org/2516323002 .
2016-11-20 22:46:54 -08:00
Zach Anderson d6560ee76c Fix mac build
Review URL: https://codereview.chromium.org/2516293002 .
2016-11-20 22:14:16 -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
Adam Barth 7125282478 Move fuchsia tests to new mx_object_get_info style
BUG=
R=abarth@google.com, zra@google.com

Review URL: https://codereview.chromium.org/2511983002 .
2016-11-17 20:38:30 -08:00
Ryan Macnak f555cf852f The flag --collect_code is not available in product mode.
TBR=asiva@google.com

Review URL: https://codereview.chromium.org/2508993002 .
2016-11-16 10:02:02 -08:00
Ryan Macnak 13ba4b2710 When building app snapshots for the SDK, train dart2js on itself.
Don't train the analzyer on itself as this makes running the test suite slower.

Disable code collection when generating an app snapshot.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2509453002 .
2016-11-16 09:10:22 -08:00
Vyacheslav Egorov 6f1efe295c VM: Remove _nativeScript external. JS has no equivalent.
It was added to @patch member in the VM patches.

The right fix is to remove @patch annotation from the _nativeScript.

TBR=kustermann@google.com
BUG=

Review URL: https://codereview.chromium.org/2506033002 .
2016-11-16 16:36:10 +01:00
Vyacheslav Egorov eb38fb5d67 VM: Fix incorrect free in TryReadKernel.
SniffForMagicNumber updates buffer pointer to skip snapshot magic number.

Thus we have to preserve and pass original buffer pointer to the free(...) call.

R=kustermann@google.com
BUG=

Review URL: https://codereview.chromium.org/2503363002 .
2016-11-16 14:40:57 +01:00
Vyacheslav Egorov 23fd1a184b VM: Support bootstrapping core libraries from Kernel binaries instead of source.
BUG=http://dartbug.com/27590
R=asiva@google.com

Review URL: https://codereview.chromium.org/2485993002 .
2016-11-16 13:56:20 +01:00
James Robinson 7a43c648c3 [gn] Consolidate exec_script calls to speed up generation
Calling out to python from GN to process gypi files is relatively
expensive with a 20-45ms fixed overhead for setup/teardown regardless
of what the script does. This makes runtime/vm/BUILD.gn take 1-1.5s
(per toolchain) to run as the template for libraries expands
out to 25 calls to gypi_to_gn.py, even though the actual time spent
processing the gypi files is negligible.

This replaces those repeated calls to gypi_to_gn.py with a call to a
custom script that process all of the gypi files needed for runtime/vm
and places the results into a single scope which can then be read from
in the template and replaces a few other scattered calls to
gypi_to_gn.py with a smaller number of calls that process multiple
gypi files and place the results into a single scope.

The end result is processing all of dart's GN files in a fuchsia build
takes ~250ms instead of >3 seconds.

R=zra@google.com

Review URL: https://codereview.chromium.org/2472813002 .

Committed: ad86d6ed26
2016-11-12 10:57:01 -08:00
Zachary Anderson 43a506bcc8 Adds some error handling to the socket implementation.
I'm starting to try to track down the hang in socket_test in
a call to read() on Mac. We weren't checking that the calls
to set fds non-blocking were successful, so I'll start with
adding code to do that.

This CL also fixes the GN arm android build.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2495003003 .
2016-11-11 21:15:16 -08:00
Ryan Macnak 646de0b77e Re-enable Platform.executable under precompilation.
Because the snapshot is passed explicitly, there is no longer the risk of a test that is valid running as a script becoming a fork-bomb when running as an AOT snapshot.

Fixes #26417

R=asiva@google.com

Review URL: https://codereview.chromium.org/2487363003 .
2016-11-11 16:19:02 -08:00
Siva Annamalai 4a9cc3e5fe Fix test breakage in checked mode.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2497693002 .
2016-11-11 15:01:32 -08:00
James Robinson e18404fd3b Revert "[gn] Consolidate exec_script calls to speed up generation"
Appears to break builds with errors like:

ninja -C xcodebuild/ProductX64 runtime
ninja: Entering directory `xcodebuild/ProductX64'
ninja: error: '../../runtime/vm/async_patch.dart', needed by 'obj/runtime/vm/concatenate_async_patch.inputdeps.stamp', missing and no known rule to make it
BUILD FAILED
step returned non-zero exit code: 1
@@@STEP_FAILURE@@@

This reverts commit ad86d6ed26.

BUG=

Review URL: https://codereview.chromium.org/2492053002 .
2016-11-10 15:17:38 -08:00
James Robinson ad86d6ed26 [gn] Consolidate exec_script calls to speed up generation
Calling out to python from GN to process gypi files is relatively
expensive with a 20-45ms fixed overhead for setup/teardown regardless
of what the script does. This makes runtime/vm/BUILD.gn take 1-1.5s
(per toolchain) to run as the template for libraries expands
out to 25 calls to gypi_to_gn.py, even though the actual time spent
processing the gypi files is negligible.

This replaces those repeated calls to gypi_to_gn.py with a call to a
custom script that process all of the gypi files needed for runtime/vm
and places the results into a single scope which can then be read from
in the template and replaces a few other scattered calls to
gypi_to_gn.py with a smaller number of calls that process multiple
gypi files and place the results into a single scope.

The end result is processing all of dart's GN files in a fuchsia build
takes ~250ms instead of >3 seconds.

R=zra@google.com

Review URL: https://codereview.chromium.org/2472813002 .
2016-11-10 15:10:45 -08:00
Zachary Anderson 630d24bec8 clang-formats remaining files and adds a presubmit check.
R=asiva@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2483363002 .
2016-11-09 12:43:57 -08:00
Ryan Macnak 0d830711bf Fix Windows build.
Review URL: https://codereview.chromium.org/2481013005 .
2016-11-07 16:38:30 -08:00
Ryan Macnak 987165f022 Reload native extensions when starting from a snapshot.
Fixes #21180
Fixes #27574

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2475523002 .
2016-11-07 16:17:47 -08:00
John McCutchan 14297ee480 Add an environment variable toggle to control new service protocol auth token
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2486443002 .
2016-11-07 14:45:52 -08:00
Adam Barth 3581dd209e Update hardcoded file system path on Fuchsia 2016-11-05 11:10:41 -07: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 52b94871a7 Fuchsia: Fix run_dart_vm_tests build
Review URL: https://codereview.chromium.org/2474273004 .
2016-11-04 08:43:31 -07:00
Adam Barth 1e4092f5a8 Use the new argument ordering for mx_cprng_draw
BUG=
R=abarth@google.com, zra@google.com

Review URL: https://codereview.chromium.org/2479683002 .
2016-11-03 15:09:53 -07:00
Adam Barth 0de5c9a03f Use the new mx_object_get_info parameter ordering
BUG=
R=zra@google.com, abarth@google.com

Review URL: https://codereview.chromium.org/2475083002 .
2016-11-03 14:17:41 -07:00
Adam Barth 7cfd287674 Move to the new mx_handle syscall argument order
BUG=
R=abarth@google.com, zra@google.com

Review URL: https://codereview.chromium.org/2475543004 .
2016-11-03 14:16:53 -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
Ryan Macnak 9dfbd3d2fa Suppress error dialogs on Windows.
Issue #27749

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2470823006 .
2016-11-03 11:00:08 -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