Commit graph

11009 commits

Author SHA1 Message Date
Martin Kustermann 554c3c9683 VM: Enforce correctly formatted C++ code
Currently the presubmit script for 'git cl upload' will just warn the developer
that code is incorrectly formatted and asks whether to proceed. This makes
developers sometimes just ignore the warning and upload incorrectly formatted
C++ code.

This causes incorrectly formatted code to be committed to the repository and
will cause a presubmit warning/question for all developers afterwards.

This CL will therefore turn the warning into an error to ensure our c++ code is
always correctly formatted.

R=zra@google.com

Review URL: https://codereview.chromium.org/2525633002 .
2016-11-30 23:52:52 +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
Ben Konyi 7e918f5b48 Fixed the conditions of an assert causing the debug VM to crash when trying to load a library from an invalid path. Created copy of a previous deferred_import_t02.dart test from co19 as a regression test until deferred_import_t02.dart is reverted to the previous test.
Fixes #27201

R=zra@google.com

Review URL: https://codereview.chromium.org/2537253002 .
2016-11-29 14:07:19 -08: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
Florian Schneider ff483c2a78 VM: Fix potential problem with visiting stack frames.
LookupDartCode would only return a non-null coe object for regular functions,
but not for stub code objects.  We should also visit pointers for stub code objects.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2528433007 .
2016-11-29 09:57:05 -08:00
William Hesse e2a48dbf38 Update status for failing tests
BUG=https://github.com/dart-lang/sdk/issues/27925
R=eernst@google.com

Review URL: https://codereview.chromium.org/2536183002 .
2016-11-29 14:26:27 +01: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 0cf02040f8 Add a version of heap snapshots that use only fields and stack frames as roots and only include instances.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2502283003 .
2016-11-28 16:00:06 -08:00
Ryan Macnak e60c9d52b6 Fuchsia: Enable newly working socket tests; use MX_CLOCK_UTC.
R=kulakowski@google.com, zra@google.com

Review URL: https://codereview.chromium.org/2536943002 .
2016-11-28 15:50:54 -08:00
Matthias Hausner b48435197a Turn on initializing formal access
Change default value of --initializing_formal_access to true.

BUG=27892
R=regis@google.com

Review URL: https://codereview.chromium.org/2540453002 .
2016-11-28 13:15:15 -08:00
Martin Kustermann e697ce94af VM: [Kernel] Remove assertion in TranslateStatement() - we use it inside let expressions
Review URL: https://codereview.chromium.org/2535823002 .
2016-11-28 16:17:04 +01:00
Vyacheslav Egorov 8eceda053f VM: [Kernel] Don't add implicit getters for top level fields into the library dictionary.
Tree shaker can't cope with this and produces incorrect snapshots that contains tree shaken classes.

R=kustermann@google.com
BUG=

Review URL: https://codereview.chromium.org/2536683002 .
2016-11-28 15:50:24 +01:00
Martin Kustermann 0c6beaca1c VM: [Kernel] Need to keep stack_ correct, fixes failures in debug JIT mode
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2535813002 .
2016-11-28 15:40:40 +01:00
Lasse Reichstein Holst Nielsen 7957a1c256 Make EfficientLength extend Iterable.
This should help least-upper-bound computations to not think of EfficientLength
as completely separate from Iterable even though they are always used together.

It doesn't solve all problems with the least-upper-bound computation,
but at least some of the more often occuring ones.

R=floitsch@google.com

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

Committed: b08fb1373f
2016-11-28 08:04:04 +01:00
Kevin Millikin c0bfda8a08 Remove an unnecessary (empty) scope, streamline the function parsing code.
The scope containing function expressions is always empty.

R=hausner@google.com

Review URL: https://codereview.chromium.org/2013233003 .
2016-11-25 10:24:17 +01:00
Vyacheslav Egorov 584788a47c VM: [Kernel] Don't emit ReturnInstr that are not connected to the graph.
This breaks inlining because it expects that all collected ReturnInstr
are strongly connected to the rest of the graph.

Source based FlowGraphBuilder achieves that by eagerly stopping construction
as constructed fragment is closed (e.g. Throw is emitted).

R=kustermann@google.com
BUG=

Review URL: https://codereview.chromium.org/2528673002 .
2016-11-24 16:19:53 +01:00
Vyacheslav Egorov 73ef820ec1 VM: [Kernel] Relax assertions in SSA construction and in Kernel loading.
- Kernel-to-IL translation leaves behind some unused constants without temp indices assigned.

- Let compile time errors propagate instead of failing with FATAL error in the post load class finalization.

R=kustermann@google.com
BUG=

Review URL: https://codereview.chromium.org/2528763002 .
2016-11-24 16:19:22 +01:00
Kevin Millikin c33789c4f5 Dart VM: Simplify token positions in the translation of await.
We can reuse the token position given by ST(node->token_pos()).  This
allows the token positions for the final result to fit the pattern
assumed by MakeName.

R=hausner@google.com
BUG=

Review URL: https://codereview.chromium.org/1875643002 .
2016-11-24 09:44:40 +01:00
Jens Johansen f0da43445e Use field.RawOwner() for initializer to keep correct script.
E.g.

file1:
------------
library crash;

part "file2.dart";

main() {
  print(field2);
}

crash() {
  try {
    throw "Crashing!";
  } catch(exception, stacktrace) {
    print(stacktrace);
  }
}

file2:
------------
part of crash;

var field2 = crash();

We want something like

#0      crash (whatnot/file1.dart:11:5)
#1      field2 (whatnot/file2.dart:3:14) <-- good line
#2      field2 (whatnot/file2.dart:3:5)
#3      main (whatnot/file1.dart:6:9)

and not like

#0      crash (whatnot/file1.dart:11:5)
#1      field2 (whatnot/file1.dart:3:14) <-- bad line
#2      field2 (whatnot/file2.dart:3:5)
#3      main (whatnot/file1.dart:6:9)

R=kmillikin@google.com

Review URL: https://codereview.chromium.org/2519133004 .
2016-11-24 09:27:25 +01:00
Kevin Millikin ec84b87ebf Fix some puzzling code in object.cc.
Jens was looking through object.cc and he spotted:

    if (Original()) ...

where it seems like Original returns a RawField* which is never 0, so
it is always true.  It looks like it was intended to be a call to
IsOriginal().

(See https://codereview.chromium.org/1722733002/diff/120001/runtime/vm/object.cc)

BUG=

Review URL: https://codereview.chromium.org/2525633003 .
2016-11-24 09:13:08 +01:00
Siva Annamalai 42e4370818 Adjust status files for some test failures.
TBR

BUG=

Review URL: https://codereview.chromium.org/2530783002 .
2016-11-23 22:54:29 -08:00
Siva Annamalai ae7c951b6b Fix status file.
TBR

BUG=

Review URL: https://codereview.chromium.org/2527613004 .
2016-11-23 16:44:52 -08:00
Siva Annamalai 22ac70a563 Fix status file
- Some DBC tests (regexp, field guards) was turned on inadvertantly
 - Skip cc/Profiler_InliningIntervalBoundry on release builds
  (need to figure how to handle the inlining difference between
   debug/release builds)

BUG=

Review URL: https://codereview.chromium.org/2528793003 .
2016-11-23 16:34:38 -08:00
Siva Annamalai 501720c644 Retry landing cl for issue with TSAN.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2525103003 .
2016-11-23 15:40:26 -08:00
Ryan Macnak 12de13d1ae An isolate created with spawn function doesn't necessarily agree with its parent on the library private keys.
(The long-standing issue that spawn function should use snapshots would also fix this.)

Encountered by the analyzer in https://codereview.chromium.org/2492933002/

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2509413002 .
2016-11-23 15:36:01 -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
Siva Annamalai 93043a3662 Set the default value for use_corelib_source_files to true on windows as we do not have the source bits baked in.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2522943004 .
2016-11-23 11:09:25 -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
Siva Annamalai 7d287b232b Add flag use_corelib_source_files to control how dart_bootstrap and gen_snapshot load core libraries during the boot strap process. If this flag is true then an attempt is made to read the core library sources files and if not present fallsback to the source bits baked in the binary.
By default the flag is false.

BUG=#27860
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2527693002 .
2016-11-23 10:26:06 -08:00
Siva Annamalai 7bbdbe3541 Skip multiple references to fuchsia test.
Review URL: https://codereview.chromium.org/2519133007 .
2016-11-23 09:09:12 -08:00
Siva Annamalai 373aa1980f Skip Fuchsia test on non VM runtimes.
BUG=#27867

Review URL: https://codereview.chromium.org/2530613002 .
2016-11-23 09:05:30 -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
William Hesse 4bfe727db6 Update status for Firefox 50
BUG=https://github.com/dart-lang/sdk/issues/27873
BUG=https://github.com/dart-lang/sdk/issues/27872
BUG=https://github.com/dart-lang/sdk/issues/27871
BUG=https://github.com/dart-lang/sdk/issues/27867
R=sortie@google.com

Review URL: https://codereview.chromium.org/2526493004 .
2016-11-23 09:49:01 +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
Todd Turnidge 193ddba4db Revert "Implement rewind: drop one or more frames from the debugger."
This reverts commit af1875be91.

BUG=

Review URL: https://codereview.chromium.org/2521413002 .
2016-11-22 16:05:26 -08:00
Todd Turnidge af1875be91 Implement rewind: drop one or more frames from the debugger.
Not yet implemented on dbc.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2523053002 .
2016-11-22 15:26:08 -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
John McCutchan e3a8b8085f Add RETURN_NULL_ERROR to new apis
BUG=

Review URL: https://codereview.chromium.org/2524853002 .
2016-11-22 12:53:00 -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