Commit Graph

434 Commits

Author SHA1 Message Date
Ryan Macnak dbbc005042 Update documentation for Dart_CreateIsolate and Dart_IsolateCreateCallback.
Change-Id: I35c22e59b130202eca564a1d5894248bd518bd04
Reviewed-on: https://dart-review.googlesource.com/30380
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-12-19 01:19:06 +00:00
Florian Loitsch f3e845cf48 Revert "Reland: [dart:io] Adds waitForEventSync"
This reverts commit 3ea5e13ad7.

Change-Id: Ic9fae69f3b7ef6e41aac3c7ebca3e1d288dbffb1
Reviewed-on: https://dart-review.googlesource.com/29589
Reviewed-by: Florian Loitsch <floitsch@google.com>
2017-12-14 14:10:45 +00:00
Zachary Anderson 3ea5e13ad7 Reland: [dart:io] Adds waitForEventSync
The only fix needed for relanding is adding _ensureScheduleImmediate
to the list of vm entrypoints in //runtime/vm/compiler/aot/precompiler.cc

Original commit message:

Adds a top-level call waitForEventSync to dart:io that blocks the
thread an Isolate is running on until messages are available.
Before the thread blocks, the microtask queue is drained.
Before waitForEventSync returns, all messages are handled.

Lifting this up from a comment:

This is apropos of the request that nweiz@ sent to the mailing list a
couple weeks back. I'm not sure we should land this. We certainly
shouldn't land it without some annotations that will make the analyzer
complain a lot in most configurations, but I don't know what those
annotations are.

fixes #31102

Change-Id: Id96de46cc5f10e1847045cfafb7cfed6a38bce16
Reviewed-on: https://dart-review.googlesource.com/28920
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2017-12-12 23:16:50 +00:00
Zach Anderson 9d8e6453d2 Revert "[dart:io] Adds waitForEventSync"
This reverts commit 2aed87a133.

Reverting for failures on precompiled bots.

Change-Id: I758bfc72d8f5e67b0e5e12a7367a47f1df9364e2
Reviewed-on: https://dart-review.googlesource.com/28900
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2017-12-12 21:05:01 +00:00
Zachary Anderson 2aed87a133 [dart:io] Adds waitForEventSync
Adds a top-level call waitForEventSync to dart:io that blocks the
thread an Isolate is running on until messages are available.
Before the thread blocks, the microtask queue is drained.
Before waitForEventSync returns, all messages are handled.

Lifting this up from a comment:

This is apropos of the request that nweiz@ sent to the mailing list a
couple weeks back. I'm not sure we should land this. We certainly
shouldn't land it without some annotations that will make the analyzer
complain a lot in most configurations, but I don't know what those
annotations are.

Change-Id: If8286f4525994a162dd4f4563fefccb9d0984f7c
Reviewed-on: https://dart-review.googlesource.com/25281
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-12-12 19:12:58 +00:00
Ryan Macnak 5e07efa547 [vm, gc] Add Dart_NotifyLowMemory.
Move updating class table allocation stats before/after GC to inside the GC's safepoint.

Bug: https://github.com/dart-lang/sdk/issues/30978
Change-Id: Ia15665397ae9f455c5e7e4526d3575932246bbcc
Reviewed-on: https://dart-review.googlesource.com/22805
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-12-06 22:45:31 +00:00
Régis Crelier f568029b5f [VM] Make flag --strong isolate specific.
Change-Id: I3416e65eeec8b92af7f35dce20188b3934674cb7
Reviewed-on: https://dart-review.googlesource.com/20221
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2017-11-10 20:47:10 +00:00
Ryan Macnak 8753545178 [vm] Document ownership of Dart_CreateIsolate's error message.
Change-Id: Icab6f6d169445f66b6ba9469511164e6e21ef49a
Reviewed-on: https://dart-review.googlesource.com/18425
Reviewed-by: Zach Anderson <zra@google.com>
2017-11-03 18:10:53 +00:00
Samir Jindel 6b64aa8943 [kernel] Always disable reified generic functions in the Kernel FE.
Currently, we have some tests that run with reified generic functions ON and
some with it OFF. However, this causes inconsistencies when running the Kernel
FE from snapshot in the VM, since the VM requires that the flag be consistent
with the snapshot. Our solution is to turn the reified generic functions flag
into a per-isolate flag, which is always disabled in the Kernel FE's isolate.

Bug:
Change-Id: Ia91e9f0ff5fc059edf4bdbd79ef14abb288b4a49
Reviewed-on: https://dart-review.googlesource.com/16020
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-10-24 15:21:28 +00:00
Vyacheslav Egorov 4985165e76 [VM] Make "Hello, World!" run in strong mode (through DFE).
Includes the following changes:

- Disable type checking in the service isolate when strong mode is 
turned on. We don't yet have strong mode clean vmservice Kernel 
binary available (Issue #31203);
- Introduce new Dart VM API to allow creating List<T> (T in {String, int}).
Current API only allows to create List<dynamic> and in strong mode 
List<dynamic> is not assignable to List<T>. For now we limit this API to 
a fixed number of core types for performance considerations (type 
arguments can be canonicalized and cache ahead of time). We will
extend the API allowing creation of arbitrary List<T> if we will
discover the need for it later;
- Use this new API to fix CreateRuntimeOptions to create List<String>
and not List<dynamic>;
- Likewise fix OneByteString_splitWithCharCode to return List<String>
and not List<dynamic>;

Additionally this CL refactors how getters and setters are created
in object_store.h removing 500 lines of largely boilerplate code.

Bug: https://github.com/dart-lang/sdk/issues/31052
Change-Id: I3fdcd2d54ff3f307db0913c67a7c2f009ea9d7a7
Reviewed-on: https://dart-review.googlesource.com/15884
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-10-24 11:43:48 +00:00
Siva Annamalai af550c9b6c Revert "Revert "1. Remove unused dart debugger API entrypoints which are not used anymore""
This reverts commit e76ea5b604.

1. Remove unused dart debugger API entrypoints which are not used anymore
   as this API has been deprecated and dartium was the last user.

2. Some unit tests are using some of these API entrypoints, so moved them
   over to a test file which will be linked into run_vm_tests

Change-Id: I5a486b98e4b97eb4df2e58d9cc0ba603e96c2e32
Reviewed-on: https://dart-review.googlesource.com/11180
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-10-04 20:19:22 +00:00
Siva Annamalai e76ea5b604 Revert "1. Remove unused dart debugger API entrypoints which are not used anymore"
This reverts commit c30918f11e.

Bug:
Change-Id: I6d5f037868a967a9f4fcabc1ecb20f34e957036a
Reviewed-on: https://dart-review.googlesource.com/8403
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-09-26 02:20:55 +00:00
Siva Annamalai c30918f11e 1. Remove unused dart debugger API entrypoints which are not used anymore
as this API has been deprecated and dartium was the last user.

2. Some unit tests are using some of these API entrypoints, so moved them
   over to a test file which will be linked into run_vm_tests

Change-Id: I3343b23d082400da3c803cf81ea80dfaa5e426cf
Reviewed-on: https://dart-review.googlesource.com/7942
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2017-09-26 01:00:01 +00:00
Alexander Aprelev 1fe2e4ffd1 Introduce callback parameter for Dart_ReadKernelBinary that would free kernel memory.
This is needed to support cases where memory with kernel binary was
allocated outside of Dart VM(for example, in Flutter Engine) has to be
released using appropriate mechanism too.

Bug:
Change-Id: I863db9e5a33469ba8fb5c1f8789c6498ddfbb385
Reviewed-on: https://dart-review.googlesource.com/5121
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-09-13 04:37:07 +00:00
Vyacheslav Egorov 7d5231796e [VM, Precompiler] Support obfuscation of the symbolic information in precompiler
Obfuscation is controlled by obfuscate flag in Dart_IsolateFlags.

Obfuscation of identifiers is performed during script tokenization - when TokenStream is generated from the source. All kIDENT and kINTERPOL_VAR tokens are renamed consistently using a persistent obfuscation map stored in ObjectStore::obfuscation_map.

Some identifiers (pseudo-keywords, arithmetic operators, builtin recognized methods and entry-points) are not renamed to keep name based lookups from breaking. All other identifiers are renamed.

Constant instances of Symbol-s (both created via literal syntax #ident and using constant constructor const Symbol("ident")) are renamed consistently with corresponding identifiers.

Script urls and Library urls and names are also obfuscated.

Obfuscation map can be dumped as a JSON array at the end of precompilation using Dart_GetObfuscationMap API.

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

Review-Url: https://codereview.chromium.org/3003583002 .
2017-08-25 09:48:23 +02:00
Ryan Macnak 14b5782544 Remove GC prologue and epilogue callbacks.
These should have been removed along with weak reference set support in 4992bc72a0 since they serve no other purpose.

Review-Url: https://codereview.chromium.org/3001343002 .
2017-08-22 11:19:54 -07:00
Siva Annamalai cfac48179b 1. Figure out the modified libraries from the specifeid kernel file during
reload instead of computing it based on the source modification information.

2. Fix for failure in Unit test case https://github.com/dart-lang/sdk/issues/30322

3. Fix crash in test that was being skipped in https://github.com/dart-lang/sdk/issues/30109 and turn that test on.

This CL is work towards completing issue https://github.com/dart-lang/sdk/issues/28051

R=aam@google.com

Review-Url: https://codereview.chromium.org/2998983002 .
2017-08-18 13:42:19 -07:00
Alexander Markov 5b694c1b1c [vm] Remove Dart_MakeExternalString and --support-externalizable-strings
This CL removes unused Dart API Dart_MakeExternalString, VM option
--support-externalizable-strings and underlying support for
externalizable strings from Dart VM.

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

Issue: https://github.com/dart-lang/sdk/issues/30474
Review-Url: https://codereview.chromium.org/2997173002 .
2017-08-17 17:49:35 -07:00
Alexander Aprelev ba543167ec Pass path to platform kernel binary to kernel-service.
Currently kernel-service derives path to platform binary from path to dart executable. It doesn't always work, so dartk tests fail.

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

BUG:http://dartbug.com/30456
Review-Url: https://codereview.chromium.org/3001013002 .
2017-08-17 09:49:48 -07:00
Carlo Bernaschina 491390eeaa Refactor of the GetEmbedderInformation APIs
The embedder can rely on embedded_dart_io to partially fill the
Dart_EmbedderInformation structure with all the process related
information.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2997013002 .
2017-08-16 10:59:27 -07:00
Alexander Aprelev a9afb54d6d Revert "Revert "Introduce IKG into kernel-service to support incremental compilation.""
This reverts commit c35510d835
with fix for the build - remove implicit temporary array in TestCase::LoadTestScript.

BUG=
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2998963002 .
2017-08-15 09:03:48 -07:00
Carlo Bernaschina 0cbbeeb288 Restore "Add current rss and embedder name to Observatory"
Made benchmark_test.cc independent from Service by using the
implementation of MaxRSS from bin::Process

Related https://github.com/dart-lang/sdk/commit/ce736d3ef009bf334a92d5b7d354fc0b04805b4f

R=bkonyi@google.com
TBR=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2994223002 .
2017-08-14 17:02:30 -07:00
Carlo Bernaschina 2f5a59e658 Revert "Add current rss and embedder name to Observatory"
This reverts commit ce736d3ef0.

TBR=zra@google.com

Review-Url: https://codereview.chromium.org/2999933002 .
2017-08-14 15:45:13 -07:00
Carlo Bernaschina ce736d3ef0 Add current rss and embedder name to Observatory
Moved the responsibility to provide MaxRSS and CurrentRSS from the VM to
the embedder.

The embedder can opt-it by setting a Dart_GetEmbedderInformation
callback using the public Dart_SetEmbedderInformationCallback API.

The implementation of the Dart_GetEmbedderInformation should mandatory
fill the version field and the ones it is able to fill.
The name field must reference a constant C style string, it will not be
freed by the VM code.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2996803002 .
2017-08-14 15:22:46 -07:00
Alexander Aprelev c35510d835 Revert "Introduce IKG into kernel-service to support incremental compilation."
This reverts commit f596d440f5.

BUG=

Review-Url: https://codereview.chromium.org/3002553003 .
2017-08-14 14:15:41 -07:00
Alexander Aprelev f596d440f5 Introduce IKG into kernel-service to support incremental compilation.
This CL also adds few hot-reload incremental kernel files tests(some pass, one is failing), which are useful to track progress of hot reload functionality in Flutter setting.

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

Review-Url: https://codereview.chromium.org/2993013002 .
2017-08-14 14:06:15 -07:00
Siva Annamalai 73d30074b1 - Convert all isolate flags to a bit field.
- Add a new isolate specific flag to cause the isolate to run in kernel mode.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2995723002 .
2017-08-11 12:38:25 -07:00
Ryan Macnak 6ef3f33403 [vm] Add a stub Dart_NotifyIdle() for the embedder to suggest a good time to do GC.
Issue https://github.com/flutter/flutter/issues/9594

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2998513002 .
2017-08-07 17:48:19 -07:00
Ryan Macnak 7f0204068d [vm] Add Dart_CreateVMAOTSnapshotAsAssembly.
Used in https://fuchsia-review.googlesource.com/c/45806

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2987213002 .
2017-08-02 11:00:29 -07:00
Alexander Markov 32e226be02 Cleanup unused Dart API Dart_IdentityHash
There are a few problems with this function:
* It returns uint64_t instead of int64_t, which is different from
core Dart library function identityHashCode()
* Dart_IdentityHash truncates negative Mint and Bigint values to 0,
while negative Smi values are converted to uint64_t.

The Dart_IdentityHash function is not used, so we decided to remove it
instead of fixing these problems.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2980043002 .
2017-07-13 13:56:05 -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 5a02f3819b [vm] Support flow events in Dart_TimelineEvent.
Issue https://github.com/dart-lang/sdk/issues/30142

R=zra@google.com

Review-Url: https://codereview.chromium.org/2977663003 .
2017-07-12 10:18:10 -07:00
Erik Corry 029b1cb948 Spelling fixes e to i.
R=kevmoo@google.com
BUG=

Review-Url: https://codereview.chromium.org/2957593002 .
2017-06-24 13:41:39 +02:00
Siva Annamalai 8b7af73daa 1. Dynamically compute the main closure that needs to be run by the main isolate
2. Get rid of _getMainClosure()
3. Adjust the AOT compiler to ensure it retains the function associated with
   the main closure without having to include '_getMainClosure()' in the list
   of embedder specified entry points
4. Get rid of the hack in kernel reader to do a delayed patch of
   '_getMainClosure()' in the builtin library.

BUG=
R=aam@google.com, rmacnak@google.com

Review-Url: https://codereview.chromium.org/2933603002 .
2017-06-15 10:40:45 -07:00
Ryan Macnak 74f3d1bd9c Add Dart_Save/LoadCompilationTrace.
R=zra@google.com

Review-Url: https://codereview.chromium.org/2922913004 .
2017-06-05 16:56:21 -07:00
Ryan Macnak 76df24b076 CoreJIT snapshots without training.
Only include OSR and field guards in the features descriptor for JIT code to avoid gen_snapshot and dart having different default values.

Disabled since core snapshots with code break tests with non-default flags for type checks, assertions, strict errors, OSR, or field guards.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2902313004 .
2017-05-31 13:49:12 -07:00
Vyacheslav Egorov 13f5616ef6 VM: Fix snapshoting slow-down caused by 99c6a18a1b.
Only reload packages map when we are actually doing the isolate reload.

Snapshotting creates and destroys and loader object every time it loads a dart
file - which means kInitLoader is on the hot path and we should avoid rereading
packages map.

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

Review-Url: https://codereview.chromium.org/2901093002 .
2017-05-23 22:01:45 +02:00
Alexander Aprelev ddab610d53 Revert "Revert "Use Kernel frontend from run_vm_tests.""
This reverts commit 530a0df8f3.

This relands https://codereview.chromium.org/2881953002/ that had to be reverted because it caused Dartium build regression. Now fix for Dartium build on mac is in place with Dartium order file update(https://codereview.chromium.org/2887183003) and corresponding Dartium DEPS rollforward(https://codereview.chromium.org/2888283003/).

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

Review-Url: https://codereview.chromium.org/2898743003 .
2017-05-22 15:00:30 -07:00
William Hesse 530a0df8f3 Revert "Use Kernel frontend from run_vm_tests."
This reverts commit d91f228766.
The commit causes a failure in
tools/build/mac/verify_order _ChromeMain "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}":
unordered symbols in out/Release/Chromium Framework.framework/Versions/A/Chromium Framework:

BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2884383005 .
2017-05-18 10:41:45 +02:00
Alexander Aprelev d91f228766 Use Kernel frontend from run_vm_tests.
With this change one can run run_vm_tests and pass to it reference to kernel parser snapshot. For example,

out/DebugX64/run_vm_tests --dfe=out/DebugX64/gen/kernel-service.dart.snapshot Debugger_RemoveBreakpoint

As this represents first step, this change enables only tests in debugger_test.cc to run with kernel frontend. There will be follow-up cls that enable all of the VM tests to use kernel frontend.

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

Review-Url: https://codereview.chromium.org/2881953002 .
2017-05-17 21:25:56 -07:00
John McDole d22325025d Fix include paths in runtime/include (#29362)
* Fix include path 

"dart_api.h" is in the same directory as "dart_tools_api.h"

* Update dart_mirrors_api.h

* Update dart_native_api.h
2017-04-17 11:04:47 -07:00
John McCutchan a4adbffb50 Remove legacy restart code
Also fixes #29092 by threading Error objects back to the message handler.

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

Review-Url: https://codereview.chromium.org/2759533002 .
2017-03-20 08:47:39 -07:00
Vyacheslav Egorov 021f933f69 VM: Make use_osr an Isolate flag, similar to how we made use_field_guards.
In Debug mode we have assertions checking that we don't attempt OSR when
FLAG_use_osr is disabled - however app-jit snapshots are compiled with OSR
enabled and still contain countining and OSR attempting code, which causes
assertions to fail.

Refactor how getters for isolate flags are defined, consolidate all flags into
a single list.

Update test expectations and switch -c dartk configuration to use app-jit snapshot.

BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2728163002 .
2017-03-03 19:02:23 +01:00
Vyacheslav Egorov a9a756df8e VM: Allow configuring use_field_guards on the per-isolate basis and include it into snapshot features.
We have tests that disable it but we train app-jit snapshot for Kernel with field guards enabled so
we need to make sure that Kernel isolate runs with correct settings matching the settings at the time
when app-jit snapshot was created.

BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2715213008 .
2017-02-28 21:17:17 +01:00
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
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
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