Commit Graph

388 Commits

Author SHA1 Message Date
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
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
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
Ryan Macnak f51d1b229c Cleanup embedder API functions for app snapshots.
- Rename functions to make correspondence between JIT and AOT app snapshot clearer.
 - Update documentation on assembly output of AOT snapshots.
 - Remove old Dart_PrecompileJIT.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2611343002 .
2017-01-12 09:36:22 -08:00
Florian Schneider bef4967ea1 Remove dart_noopt and related parts from the VM.
dart_noopt is not needed anymore because we have testing
and builbot integration of the real precompilation pipeline in place now.

Fixes #24569
Fixes #25726
Fixes #25845

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2624393002 .
2017-01-11 16:55:55 -08:00
Ryan Macnak 4607e38d28 Reapply "Save and restore feedback from JIT."
Ensure ICData is attached to the callee flow graph in the inliner when built from kernel IR, not just from source.

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2572423004 .
2016-12-16 16:00:17 -08:00
Ryan Macnak 1a41627ecc When creating a JIT app snapshot, don't recreate the VM isolate snapshot.
Prerequisite for using multiple isolate snapshots in the same process.

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2583673002 .
2016-12-16 15:44:29 -08:00
Ryan Macnak 2f532ab58b Remove Dart_CreateLibrarySnapshot.
This API was never used by Dartium, Flutter or Standalone.

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2584943002 .
2016-12-16 15:06:02 -08:00
Ryan Macnak 176d732cc3 Revert "Save and restore feedback from JIT."
This reverts commit 31ee20297e.

Review-Url: https://codereview.chromium.org/2579413002 .
2016-12-16 13:53:20 -08:00
Ryan Macnak 31ee20297e Save and restore feedback from JIT.
- Adjust fingerprints to be independent of the library's private key, which varies with load order.
 - Use usage_counter in AOT inlining decisions if JIT feedback is available.
 - Reduce inlining in cold functions.

dart2js product aot snapshot 15841351 -> 14436273 (-8.86%)

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2562693003 .
2016-12-16 10:21:40 -08:00
John McCutchan f125cc7d0b Improve the casing of Stackmap and Stacktrace.
- [x] Stackmap -> StackMap
- [x] Stacktrace -> StackTrace

This makes us consistent with the Dart language (StackTrace) and
corrects the casing of StackMap.

BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2572563004 .
2016-12-12 14:51:30 -08:00
Matthias Hausner f5ab173c77 Add Kernel Isolate, second attempt
To run a script with the Dart->Kernel parser, use the -dfe option:

dart --dfe=runtime/tools/kernel-service.dart  --packages=/src/d2/sdk/.packages  foo.dart

The front end expects a directory named patched_sdk in the build directory (patched_sdk should be a sibling of the directory that contains the dart executable.)

Warning: using a debug build dart executable is very slow. It takes 2 minutes to run Hello World in a debug build, and about 7 seconds in a release build.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2558673002 .
2016-12-07 09:11:16 -08:00
Matthias Hausner 2ea399285a Revert "Add Kernel Isolate"
This reverts commit c9399fc557.

The change broke Dartium and Fuchsia.

BUG=

Review URL: https://codereview.chromium.org/2554953004 .
2016-12-06 14:17:09 -08:00
Matthias Hausner c9399fc557 Add Kernel Isolate
To run a script with the Dart->Kernel parser, use the -dfe option:

dart --dfe=runtime/tools/kernel-service.dart  --packages=/src/d2/sdk/.packages  foo.dart

The front end expects a directory named patched_sdk in the build directory (patched_sdk should be a sibling of the directory that contains the dart executable.)

Warning: using a debug build dart executable is very slow. It takes 2 minutes to run Hello World in a debug build, and about 7 seconds in a release build.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2483373002 .
2016-12-06 12:23:09 -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 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
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
John McCutchan f43b48e34d Support reloading from source on top of a script snapshot.
- [x] Add arguments `rootLibUri` and `packagesUri` to the reload service rpc. These allow the uri of the root library and the .packages files to be overridden.
- [x] When pairing libraries during reload, support the base url changing.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2512483002 .
2016-11-17 11:29:12 -08: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
Zachary Anderson da81562dc8 Fix mac build
Review URL: https://codereview.chromium.org/2490003002 .
2016-11-09 12:51:21 -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 ab26422df0 Check that Dart_CreateIsolate is given a correct kind of snapshot.
R=zra@google.com

Review URL: https://codereview.chromium.org/2481013006 .
2016-11-08 16:49:59 -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
Ryan Macnak 0c3773fd71 Allow Platform.executable for JIT app snapshots.
Because they run on a VM that can also run from source, they don't have the same fork-bomb problem we have when running with AOT.

Related to #26417

R=asiva@google.com

Review URL: https://codereview.chromium.org/2466363003 .
2016-11-02 16:28:09 -07:00
Zachary Anderson 103881d01c Make header include guards great again
i.e. #ifndef VM_WHATEVER -> #ifndef RUNTIME_VM_WHATEVER

This lets us remove a hack from the PRESUBMIT.py script that existed
for reasons that are no longer valid, and sets us up to add some
presubmit checks for the GN build.

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

Review URL: https://codereview.chromium.org/2450713004 .
2016-10-26 00:26:03 -07:00
Vyacheslav Egorov f67ce21068 VM support for running Kernel binaries.
BUG=
R=asiva@google.com, fschneider@google.com

Review URL: https://codereview.chromium.org/2411823003 .
2016-10-15 22:48:46 +02:00
Ryan Macnak 3d00ecdc8f Reapply "Use a single file for app snapshots."
- Don't read script to check for an app snapshot if it is a pipe. Fixes loading source from a pipe.
 - Fix windows and fushsia builds.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2416973003 .
2016-10-14 09:57:54 -07:00
Ryan Macnak 6839a23240 Revert "Use a single file for app snapshots."
This reverts commit 4f8b16df3b.

Review URL: https://codereview.chromium.org/2410303008 .
2016-10-13 15:29:23 -07:00
Ryan Macnak 4f8b16df3b Use a single file for app snapshots.
For blobs, put all four pieces into a single file with a header describing their offsets.
For dynamic libraries, move the vm isolate and isolate pieces into the dynamic library as additional read-only sections.

Automatically detect if the script argument is an app snapshot and initialize the VM appropriately, similar to automatic detection of script snapshots.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2405393002 .
2016-10-13 14:33:56 -07:00
Siva Annamalai 12f86594ec Add --parse-all option in order to benchmark and measure the scanner/parser performance.
R=hausner@google.com

Review URL: https://codereview.chromium.org/2327693002 .
2016-09-23 15:20:39 -07:00
John McCutchan 632c76942c Add Dart_GetStickyError
- [x] Add Dart_GetStickyError.
- [x] Change Dart_SetStickyError to allow for null and also not set the pause on exit bit.

BUG=
R=turnidge@google.com

Review URL: https://codereview.chromium.org/2350633003 .
2016-09-19 13:31:09 -07:00
Ryan Macnak 3aa65a66d2 Assign external sizes to external strings and to external typed data created by the VM.
Observatory used to report that dart2js hello was using no external memory, but now reports 1.3MB of external memory (all token streams).

R=asiva@google.com

Review URL: https://codereview.chromium.org/2275803002 .
2016-09-01 10:56:40 -07:00
Ryan Macnak 1d50931ac4 Remove Dart_VisitPrologueWeakHandles from the API header.
This should have been removed in 4992bc72a0.

Fixes #27195.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2288763003 .
2016-08-29 16:24:41 -07:00
Ryan Macnak a0d6b94cac Remove dead callback.
R=asiva@google.com

Review URL: https://codereview.chromium.org/2245833002 .
2016-08-15 09:09:26 -07:00
Adam Barth fac99f35b3 Switch Dart_Initialize to use a struct
The number of NULL parameters was getting out of hand.

R=zra@google.com

Review URL: https://codereview.chromium.org/2223463003
2016-08-09 12:25:39 -07:00
Adam Barth bd41127c7f Revert "Switch Dart_Initialize to use a struct"
I landed the wrong version of my patch.

This reverts commit bdc25d5695.
2016-08-09 12:24:13 -07:00
Adam Barth bdc25d5695 Switch Dart_Initialize to use a struct
The number of NULL parameters was getting out of hand.

R=zra@google.com

Review URL: https://codereview.chromium.org/2223463003 .
2016-08-09 12:20:16 -07:00
John McCutchan 800b1352ce Add an API for setting the sticky error
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2223913002 .
2016-08-08 12:14:33 -07:00
Todd Turnidge 1166f83bf6 Only reload libraries when they may have been modified.
We now check all of the scripts which make up a library.  If any
script is modified, then we consider that library to be modified.  We
also consider any library which imports a modified library to be
modified.  To propagate this info efficiently, we build and discard
the imported-by graph when beginning a reload.

The embedder must provide a FileModifiedCallback in order to support
the detection of modified scripts.

In order to detect changes to package: libraries, we have modified the
embedder interface to provide the resolved url when possible, so that
we don't need to re-resolve package uris when checking for reload.
This change is incompatible and all embedders will need to be updated.

We now support a "force" flag when reloading sources.  This causes all
libraries to be reloaded regardless of whether the underlying scripts
have been updated.

Closes #26919

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2186423002 .
2016-07-29 11:23:18 -07:00
Siva Annamalai 72f7d1456c Change Dart_DefaultCanonicalizeUrl to accept the library url string instead of a library, this is useful to allow us to use this to generically resolve a Uri relative to another string.
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2068833002 .
2016-06-14 17:15:51 -07:00
Todd Turnidge 055231cee0 Allow embedder service request handlers to return JSON-RPC errors.
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2041293003 .
2016-06-07 15:47:37 -07:00
John McCutchan 6fd8fd7987 Rework standalone to use a synchronous loader that does not invoke Dart code
- [x] The first caller of the tag handler blocks, recursive callers queue work and exit.
- [x] Use a NativeMessageHandler to receive I/O results from the service isolate.
- [x] Preserve load error message format.
- [x] Move packages map into service isolate.
- [x] Wire up Todd's native URI code.

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1998963003 .
2016-06-06 14:15:01 -07:00
Todd Turnidge a7d46eb5a6 Canonicalize uris in C++ instead of Dart for the standalone embedder.
Adds Dart_DefaultCanonicalizeUrl() to the dart embedding api.

Motivation:

As we try to get source reloading working for the standalone embedder, things get simpler if an isolate doesn't run Dart code while it is loading Dart code.  We intend to solve this by moving the embedder tag handler calls to the service isolate.  But making a blocking rpc into the service isolate whenever a url needs to be canonicalized during parsing seems like it would slow things down and make things complicated.  By moving canonicalization into C++, we avoid this.

R=ahe@google.com, fschneider@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2011543002 .
2016-06-02 12:29:57 -07:00
Ryan Macnak ef8baa8760 Add test harness option for app snapshots with unoptimized code.
./tools/test.py -m all -c dart2appjit -r dart_app --use-blobs

Rename 'dart_product' runtime to 'dart_app'.

Rename Dart_PrecompiledJITSnapshotBlob to Dart_CreateAppJITSnapshot and add documentation.

Remove out-of-date scripts in tools/precompilation.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1992703005 .
2016-05-26 10:37:47 -07:00
John McCutchan 48c8ffa7f3 Initial isolate reload support
This is a cut of the work that Todd and I collaborated on in the reload branch.

In this CL, we've dropped the loader port hacks, in other words, on stack reloading in the standalone embedder does not work yet.

- [x] Support for hot reloading of isolate source code
- [x] Unit test harness and many tests
- [x] Service protocol and Observatory support
- [x] Product build does not include support for hot reloading.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1965823002 .
2016-05-17 12:19:06 -07:00
Ryan Macnak 354a26ce52 Add Dart_IsPrecompiledRuntime to help simplify logic in embedders that conditionally use precompilation or the JIT.
R=chinmaygarde@google.com

Review URL: https://codereview.chromium.org/1948183002 .
2016-05-05 11:32:43 -07:00
Ryan Macnak 257b3a82b8 JIT precompilated snapshots.
(Precompiled snapshots with unoptimized code.)

+ ./out/ReleaseX64/dart --package-root=./out/ReleaseX64/packages ./pkg/compiler/lib/src/dart2js.dart /usr/local/google/home/rmacnak/hello.dart
Dart file (/usr/local/google/home/rmacnak/hello.dart) compiled to JavaScript: out.js

real	0m3.299s
user	0m3.197s
sys	0m0.831s

+ ./out/ProductX64/dart_bootstrap --full-snapshot-after-run=/usr/local/google/home/rmacnak/dart3/sdk/app --package-root=./out/ReleaseX64/packages ./pkg/compiler/lib/src/dart2js.dart /usr/local/google/home/rmacnak/hello.dart
Dart file (/usr/local/google/home/rmacnak/hello.dart) compiled to JavaScript: out.js
+ ./out/ProductX64/dart --run-full-snapshot=/usr/local/google/home/rmacnak/dart3/sdk/app --package-root=./out/ReleaseX64/packages ./pkg/compiler/lib/src/dart2js.dart /usr/local/google/home/rmacnak/hello.dart
vm-service: Isolate creation error: (null)
Dart file (/usr/local/google/home/rmacnak/hello.dart) compiled to JavaScript: out.js

real	0m1.979s
user	0m1.806s
sys	0m0.581s

+ ./out/ReleaseX64/dart_bootstrap --use_blobs --gen-precompiled-jit-snapshot=/usr/local/google/home/rmacnak/dart3/sdk --package-root=./out/ReleaseX64/packages ./pkg/compiler/lib/src/dart2js.dart /usr/local/google/home/rmacnak/hello.dart
Dart file (/usr/local/google/home/rmacnak/hello.dart) compiled to JavaScript: out.js
VMIsolate(CodeSize): 2699304
Isolate(CodeSize): 5930097
Instructions(CodeSize): 9440176
Total(CodeSize): 18069577
+ ./out/ReleaseX64/dart --use_blobs --run-precompiled-jit-snapshot=/usr/local/google/home/rmacnak/dart3/sdk --package-root=./out/ReleaseX64/packages ./pkg/compiler/lib/src/dart2js.dart /usr/local/google/home/rmacnak/hello.dart
Dart file (/usr/local/google/home/rmacnak/hello.dart) compiled to JavaScript: out.js

real	0m0.994s
user	0m1.259s
sys	0m0.229s

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

Review URL: https://codereview.chromium.org/1938653002 .
2016-05-04 18:47:36 -07:00
Ryan Macnak f262fad639 Option to output precompiled instructions as a blob for use with mmap instead of assembly for use in a shared library.
BUG=http://dartbug.com/26199
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1915853004 .
2016-04-25 16:19:34 -07:00
John McCutchan 6302c1cc41 Add API to set thread name
BUG=
R=chinmaygarde@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/1851953002 .
2016-04-04 07:12:57 -07:00