Commit Graph

55 Commits

Author SHA1 Message Date
Jens Johansen adb1dc9380 [VM] [CFE]: Make VM send over type information for expression compilation
Missing:
* Function types.
* Type variables in bounds, like "method<T, S extends T>() {}" and
  "method<T extends Foo<T>>() {}"

This is in many ways a follow-up to
https://dart-review.googlesource.com/c/sdk/+/212286

TEST=service and (cfe) expression suite tests added.

Change-Id: I20472b59ed73e9845f073e176d73b2c213f9407a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215760
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-01-28 07:49:21 +00:00
Alexander Aprelev eb4eade02a [vm/gen_snapshot] Avoid redundant compilation when generating kernel snapshot.
Fixes https://github.com/dart-lang/sdk/issues/39580
TEST=ci

Change-Id: I98e7201350433754c9ff1746e1d6e24b7107099e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225740
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-01-05 17:51:26 +00:00
Jens Johansen 48d8225b17 [VM] [CFE]: Expression compilation inside extension method
This CL handles expression compilation inside extension methods better.
It is now possible to evaluate "this" and other methods defined in the
extension.

https://github.com/dart-lang/sdk/issues/46757

TEST=service tests added.

Change-Id: I3c71eb23117e26b01961f32103f4046f0b537976
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212286
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-09-10 12:02:57 +00:00
Martin Kustermann 2e2d542969 [vm/concurrency] Use isolate group id as key for incremental compiler for reload
As part of implementing hot-reload for isolate groups, we have to ensure
reloads on a group are performed using the same state of incremental
compiler.

This means we cannot use a specific isolate's information (such as it's
main port) for reloading purposes. Instead we use the unqiue isolate
group id when communicating with the kernel service.

Issue https://github.com/dart-lang/sdk/issues/36097

TEST=Existing test coverage, future test when hot-reload is fully
     implemented with isolate groups.

Change-Id: Ifab39cd2ba689c08507dfab4091cd26951ed54e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185320
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-02-18 06:59:24 +00:00
asiva ac520f984d [ VM / CLI ] Add --verbosity to VM options
The verbosity option allows for specifying the CFE output verbosity

Fixes https://github.com/dart-lang/sdk/issues/44727

TEST=existing tests compile_test.dart and run_test.dart have new tests

Change-Id: I3d4e50811f84650aacf774ddb370a6eb765b9b24
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181100
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2021-01-26 03:01:58 +00:00
Johnni Winther 55b34a467c Reland "[vm] Pass snapshot flag to kernel_service"
Enable reporting of null safety compilation mode when running
`dart compile aot-snapshot`, `dart compile jit-snapshot`,
and `dart compile kernel`.

Closes #44234

TEST=pkg/dartdev/test/commands/compile_test.dart

Change-Id: Id9e72751068d5f208055ab953d2c8392e84c4798
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180187
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-21 21:18:32 +00:00
Aske Simon Christensen 903e92a196 Revert "[vm] Pass snapshot flag to kernel_service"
This reverts commit f8b0d26cc3.

Reason for revert: Multiple test failures in app-jit and simarm(64)

Original change's description:
> [vm] Pass snapshot flag to kernel_service
>
> Enable reporting of null safety compilation mode when running
> `dart compile aot-snapshot`, `dart compile jit-snapshot`,
> and `dart compile kernel`.
>
> Closes #44234
>
> TEST=pkg/dartdev/test/commands/compile_test.dart
>
> Change-Id: I0d4b35c6ccb4167c0c7539a4eb24a5139e29cf53
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178990
> Commit-Queue: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

TBR=bkonyi@google.com,johnniwinther@google.com

Change-Id: I83aeaa8620c640d02d5ccfd1fe8112d8209a9ad4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179773
Auto-Submit: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-18 21:00:03 +00:00
Johnni Winther f8b0d26cc3 [vm] Pass snapshot flag to kernel_service
Enable reporting of null safety compilation mode when running
`dart compile aot-snapshot`, `dart compile jit-snapshot`,
and `dart compile kernel`.

Closes #44234

TEST=pkg/dartdev/test/commands/compile_test.dart

Change-Id: I0d4b35c6ccb4167c0c7539a4eb24a5139e29cf53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178990
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-01-18 09:27:59 +00:00
Liam Appelbe fadf8fd85d [vm] Get experimental flag default values from YAML
Bug: https://github.com/dart-lang/sdk/issues/44053
Change-Id: Ia7ee5fe212cf0f5c619026d967e5747d71bf31ec
Fixes: https://github.com/dart-lang/sdk/issues/44053
TEST=No behavior change, so just running existing tests.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171663
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-11-13 00:29:38 +00:00
Jens Johansen e8d3389eb5 [VM] Expression compilation when loaded from dill (part 2)
Previous version
(landed via https://dart-review.googlesource.com/c/sdk/+/135683)
only worked if the dill was loaded via
Dart_LoadScriptFromKernel where script_kernel_size was set,
and when the platform dill could be loaded from a file called the right
thing.

This CL makes it work for Dart_LoadLibraryFromKernel too and allows
the VM to send the platform along (explicitly or implicitly) and only
tries to load the platform from a file with the right name if no
platform is given in any of the inputs.

This should fix http://b/148776866

Change-Id: I62317400a932b7dcd9e126a5a88907d507f9d658
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153609
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-07-09 14:55:11 +00:00
Siva Annamalai d46a696957 Revert "Reland : [VM/Runtime] Cleanup package config initialization code"
This reverts commit 03777dba31.

Reason for revert: Failures in couple of bots

Original change's description:
> Reland : [VM/Runtime] Cleanup package config initialization code
> 
> - Use _Init function for initialization of package config
> - Remove DartUtils::SetWorkingDirectory, SingleArgDart_Invoke,
> 
>   DartUtils::SetupPackageConfig
> - Rename Loader::InitForSnapshot to Loader::Init
> - Remove _setPackagesConfig, _setWorkingDirectory from builtin library
> - Rename _setPackagesMap to _setPackagesConfig
> Change-Id: I1e4a25e79706d7764247c9fbfcc8e8ce3231343c
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151633
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>

TBR=aam@google.com,asiva@google.com

Change-Id: Ibea8c35fe310ac7708f00bb9ffd58715b6924cb5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151869
Reviewed-by: Siva Annamalai <asiva@google.com>
Auto-Submit: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-06-20 08:02:53 +00:00
asiva 03777dba31 Reland : [VM/Runtime] Cleanup package config initialization code
- Use _Init function for initialization of package config
- Remove DartUtils::SetWorkingDirectory, SingleArgDart_Invoke,

  DartUtils::SetupPackageConfig
- Rename Loader::InitForSnapshot to Loader::Init
- Remove _setPackagesConfig, _setWorkingDirectory from builtin library
- Rename _setPackagesMap to _setPackagesConfig
Change-Id: I1e4a25e79706d7764247c9fbfcc8e8ce3231343c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151633
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-06-20 05:50:49 +00:00
asiva 4b9aa2bd7e Revert "[VM/Runtime] Cleanup package config initialization code"
This reverts commit 29e93bcdbd.

Reason for revert: Windows bots are failing with package resolution
errors. Looks like we are missing a windows path sanitization step.

Change-Id: Ib56f7e926b4f385fa3fde74c9c71947f64b8be1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151469
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-06-17 00:03:19 +00:00
asiva 29e93bcdbd [VM/Runtime] Cleanup package config initialization code
- Use _Init function for initialization of package config
- Remove DartUtils::SetWorkingDirectory, SingleArgDart_Invoke,
  DartUtils::SetupPackageConfig
- Rename Loader::InitForSnapshot to Loader::Init
- Remove _setPackagesConfig, _setWorkingDirectory from builtin library
- Rename _setPackagesMap to _setPackagesConfig
Change-Id: I0b83574593fa95e1b948134fcd4a7b4858ea19c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151045
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-06-16 23:24:26 +00:00
asiva a782dd82db [VM/runtime] - detect null safety before isolate initialization
- Detect null safety when not specified before isolate
      initialization
      - for source files by having CFE parse the source file
        for @dart annotations
      - for kernel files by sniffing the kernel file for
        compilation mode
      - for appJIT files by sniffing the feature string
      - for AOT snapshots by sniffing the feature string

    - Remove workaround of returning null safety to false during
      bootstrapping

    - Add a new Dart C API call for detecting null safety

Bug: 41766
Change-Id: Ia8cf264323a2d0d58c2855ce6491456aa6f1da07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150089
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-06-11 01:22:35 +00:00
asiva 8e4421a95e [VM/runtime] Conditionally include kernel/service isolate code
- Do not include the kernel isolate code in the precompiled runtime
- Do not include the service isolate code in PRODUCT mode

Change-Id: I6c49a9d4b3523205d1d70d1c6e5743b809ef3212
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129807
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-12-27 19:46:15 +00:00
Aart Bik 434dc832c6 Revert "[vm] Avoid allocating monitors globally - embedders in certain situations will run into reported leakes due to them"
This reverts commit d9a306fc59.

Reason for revert:

=================================================================
==176913==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 13 byte(s) in 1 object(s) allocated from:
    #0 0x55d94882d540 in __interceptor_strdup /b/s/w/ir/kitchen-workdir/llvm-project/compiler-rt/lib/asan/asan_interceptors.cc:447:3
    #1 0x55d9491abcd7 in dart::KernelIsolate::AddExperimentalFlag(char const*) ../../out/DebugX64/../../runtime/vm/kernel_isolate.cc:382:28
    #2 0x55d9490af7d2 in dart::Flags::SetFlagFromString(dart::Flag*, char const*) ../../out/DebugX64/../../runtime/vm/flags.cc:338:7
    #3 0x55d9490b0221 in dart::Flags::Parse(char const*) ../../out/DebugX64/../../runtime/vm/flags.cc:399:12
    #4 0x55d9490b0538 in dart::Flags::ProcessCommandLineFlags(int, char const**) ../../out/DebugX64/../../runtime/vm/flags.cc:438:5
    #5 0x55d9488885df in dart::bin::main(int, char**) ../../out/DebugX64/../../runtime/bin/main.cc:1149:11
    #6 0x55d94888ad9a in main ../../out/DebugX64/../../runtime/bin/main.cc:1245:3
    #7 0x7f5ccc4a452a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2352a)

SUMMARY: AddressSanitizer: 13 byte(s) leaked in 1 allocation(s).


Original change's description:
> [vm] Avoid allocating monitors globally - embedders in certain situations will run into reported leakes due to them
> 
> Change-Id: Ied0446aebfdd8fb7e15c510cdf4160ff9ad013a6
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122148
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,rmacnak@google.com,asiva@google.com

Change-Id: I2c98bf7e0e565c6f8c016b4832d5587868c65a83
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122680
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-10-23 19:34:28 +00:00
Martin Kustermann d9a306fc59 [vm] Avoid allocating monitors globally - embedders in certain situations will run into reported leakes due to them
Change-Id: Ied0446aebfdd8fb7e15c510cdf4160ff9ad013a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122148
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-10-22 20:31:56 +00:00
Liam Appelbe aa569dfff0 [vm] Enable non-nullable experiment when building platform dill with --nnbd flag.
Change-Id: I00632cc2dcf5e929698ee6b88eefbd5c58752297
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122174
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-10-21 19:14:04 +00:00
asiva cd95fcc810 [VM] Start the kernel isolate only when compilations are needed
- Start the kernel isolate only when a compilation is needed
- Remove some dead code and state in the loader path

Change-Id: I39e14cd79cda18b155af6334a11635c44e2fc11f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121923
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-10-18 00:27:16 +00:00
Alexander Aprelev 0425997b31 Second attempt to reland "[vm/concurrency] Introduce concept of Isolate Groups"
This reverts commit 3d14b75f97.

An Isolate Group (IG) is a collection of isolates which were spawned from the
same source. This allows the VM to:

  * have a guarantee that all isolates within one IG can safely exchange
    structured objects (currently we rely on embedder for this
    guarantee)

  * hot-reload all isolates together (currently we only reload one
    isolate, leaving same-source isolates in inconsistent state)

  * make a shared heap for all isolates from the same IG, which paves
    the way for faster communication and sharing of immutable objects.

All isolates within one IG will share the same IsolateGroupSource.

**Embedder changes**

This change makes breaking embedder API changes to support this new
concept of Isolate Groups: The existing isolate lifecycle callbacks
given to Dart_Initialize will become Isolate Group lifecycle callbacks.
A new callback `initialize_isolate` callback will be added which can
initialize a new isolate within an existing IG.

Existing embedders can be updated by performing the following renames

  Dart_CreateIsolate -> Dart_CreateIsolateGroup
  Dart_IsolateCreateCallback -> Dart_IsolateGroupCreateCallback
  Dart_IsolateCleanupCallback -> Dart_IsolateGroupShutdownCallback
  Dart_CreateIsolateFromKernel -> Dart_CreateIsolateGroupFromKernel
  Dart_CurrentIsolateData -> Dart_CurrentIsolateGroupData
  Dart_IsolateData -> Dart_IsolateGroupData
  Dart_GetNativeIsolateData -> Dart_GetNativeIsolateGroupData
  Dart_InitializeParams.create -> Dart_InitializeParams.create_group
  Dart_InitializeParams.cleanup -> Dart_InitializeParams.shutdown_group
  Dart_InitializeParams.shutdown -> Dart_InitializeParams.shutdown_isolate

By default `Isolate.spawn` will cause the creation of a new IG.

Though an embedder can opt-into supporting multiple isolates within one IG by
providing a callback to the newly added `Dart_InitializeParams.initialize_isolate`.
The responsibility of this new callback is to initialize an existing
isolate (which was setup by re-using source code from the spawning
isolate - i.e. the one which used `Isolate.spawn`) by setting native
resolvers, initializing global state, etc.

Issue https://github.com/dart-lang/sdk/issues/36648
Issue https://github.com/dart-lang/sdk/issues/36097

Original review: https://dart-review.googlesource.com/c/sdk/+/105241

Difference to original review:

  * Give each isolate it's own [Loader] (for now)
  * Sort classes during initialization for spawned isolates if app-jit is used (to match main isolate)
  * Fix IsolateData memory leak if isolate startup fails

Difference to first reland(Patchset 2):

  * Fix typo where memory was freed twice.

Change-Id: Ib1c83fe83b629cd50ae6af90ee99fdd44da882d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108367
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-07-08 23:49:05 +00:00
Vyacheslav Egorov 3d14b75f97 Revert "Reland "[vm/concurrency] Introduce concept of Isolate Groups""
This reverts commit 67ab3be10d.

Reason for revert: Causes non-deterministic failures on front-end bots on Windows with "Isolate creation failed" error. See https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8909292129328681248/+/steps/unit_tests/0/stdout

Original change's description:
> Reland "[vm/concurrency] Introduce concept of Isolate Groups"
> 
> An Isolate Group (IG) is a collection of isolates which were spawned from the
> same source. This allows the VM to:
> 
>   * have a guarantee that all isolates within one IG can safely exchange
>     structured objects (currently we rely on embedder for this
>     guarantee)
> 
>   * hot-reload all isolates together (currently we only reload one
>     isolate, leaving same-source isolates in inconsistent state)
> 
>   * make a shared heap for all isolates from the same IG, which paves
>     the way for faster communication and sharing of immutable objects.
> 
> All isolates within one IG will share the same IsolateGroupSource.
> 
> **Embedder changes**
> 
> This change makes breaking embedder API changes to support this new
> concept of Isolate Groups: The existing isolate lifecycle callbacks
> given to Dart_Initialize will become Isolate Group lifecycle callbacks.
> A new callback `initialize_isolate` callback will be added which can
> initialize a new isolate within an existing IG.
> 
> Existing embedders can be updated by performing the following renames
> 
>   Dart_CreateIsolate -> Dart_CreateIsolateGroup
>   Dart_IsolateCreateCallback -> Dart_IsolateGroupCreateCallback
>   Dart_IsolateCleanupCallback -> Dart_IsolateGroupShutdownCallback
>   Dart_CreateIsolateFromKernel -> Dart_CreateIsolateGroupFromKernel
>   Dart_CurrentIsolateData -> Dart_CurrentIsolateGroupData
>   Dart_IsolateData -> Dart_IsolateGroupData
>   Dart_GetNativeIsolateData -> Dart_GetNativeIsolateGroupData
>   Dart_InitializeParams.create -> Dart_InitializeParams.create_group
>   Dart_InitializeParams.cleanup -> Dart_InitializeParams.shutdown_group
>   Dart_InitializeParams.shutdown -> Dart_InitializeParams.shutdown_isolate
> 
> By default `Isolate.spawn` will cause the creation of a new IG.
> 
> Though an embedder can opt-into supporting multiple isolates within one IG by
> providing a callback to the newly added `Dart_InitializeParams.initialize_isolate`.
> The responsibility of this new callback is to initialize an existing
> isolate (which was setup by re-using source code from the spawning
> isolate - i.e. the one which used `Isolate.spawn`) by setting native
> resolvers, initializing global state, etc.
> 
> Issue https://github.com/dart-lang/sdk/issues/36648
> Issue https://github.com/dart-lang/sdk/issues/36097
> 
> Original review: https://dart-review.googlesource.com/c/sdk/+/105241
> 
> Difference to original review:
> 
>   * Give each isolate it's own [Loader] (for now)
>   * Sort classes during initialization for spawned isolates if app-jit is used (to match main isolate)
>   * Fix IsolateData memory leak if isolate startup fails
> 
> Change-Id: I98277d3d10fe275aa9b8a16b6bdd446bbea0b100
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107506
> Commit-Queue: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TBR=kustermann@google.com,aam@google.com,rmacnak@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Ia4e0f4f9fc317499d3570a371c5bdf9aed799e77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108101
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2019-07-03 12:19:15 +00:00
Martin Kustermann 67ab3be10d Reland "[vm/concurrency] Introduce concept of Isolate Groups"
An Isolate Group (IG) is a collection of isolates which were spawned from the
same source. This allows the VM to:

  * have a guarantee that all isolates within one IG can safely exchange
    structured objects (currently we rely on embedder for this
    guarantee)

  * hot-reload all isolates together (currently we only reload one
    isolate, leaving same-source isolates in inconsistent state)

  * make a shared heap for all isolates from the same IG, which paves
    the way for faster communication and sharing of immutable objects.

All isolates within one IG will share the same IsolateGroupSource.

**Embedder changes**

This change makes breaking embedder API changes to support this new
concept of Isolate Groups: The existing isolate lifecycle callbacks
given to Dart_Initialize will become Isolate Group lifecycle callbacks.
A new callback `initialize_isolate` callback will be added which can
initialize a new isolate within an existing IG.

Existing embedders can be updated by performing the following renames

  Dart_CreateIsolate -> Dart_CreateIsolateGroup
  Dart_IsolateCreateCallback -> Dart_IsolateGroupCreateCallback
  Dart_IsolateCleanupCallback -> Dart_IsolateGroupShutdownCallback
  Dart_CreateIsolateFromKernel -> Dart_CreateIsolateGroupFromKernel
  Dart_CurrentIsolateData -> Dart_CurrentIsolateGroupData
  Dart_IsolateData -> Dart_IsolateGroupData
  Dart_GetNativeIsolateData -> Dart_GetNativeIsolateGroupData
  Dart_InitializeParams.create -> Dart_InitializeParams.create_group
  Dart_InitializeParams.cleanup -> Dart_InitializeParams.shutdown_group
  Dart_InitializeParams.shutdown -> Dart_InitializeParams.shutdown_isolate

By default `Isolate.spawn` will cause the creation of a new IG.

Though an embedder can opt-into supporting multiple isolates within one IG by
providing a callback to the newly added `Dart_InitializeParams.initialize_isolate`.
The responsibility of this new callback is to initialize an existing
isolate (which was setup by re-using source code from the spawning
isolate - i.e. the one which used `Isolate.spawn`) by setting native
resolvers, initializing global state, etc.

Issue https://github.com/dart-lang/sdk/issues/36648
Issue https://github.com/dart-lang/sdk/issues/36097

Original review: https://dart-review.googlesource.com/c/sdk/+/105241

Difference to original review:

  * Give each isolate it's own [Loader] (for now)
  * Sort classes during initialization for spawned isolates if app-jit is used (to match main isolate)
  * Fix IsolateData memory leak if isolate startup fails

Change-Id: I98277d3d10fe275aa9b8a16b6bdd446bbea0b100
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107506
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-06-29 18:45:11 +00:00
Martin Kustermann b2171f16f1 Revert "[vm/concurrency] Introduce concept of Isolate Groups"
This reverts commit b75057b687.

Reason for revert: Caused some failures on app-jit builders

Original change's description:
> [vm/concurrency] Introduce concept of Isolate Groups
> 
> An Isolate Group (IG) is a collection of isolates which were spawned from the
> same source. This allows the VM to:
> 
>   * have a guarantee that all isolates within one IG can safely exchange
>     structured objects (currently we rely on embedder for this
>     guarantee)
> 
>   * hot-reload all isolates together (currently we only reload one
>     isolate, leaving same-source isolates in inconsistent state)
> 
>   * make a shared heap for all isolates from the same IG, which paves
>     the way for faster communication and sharing of immutable objects.
> 
> All isolates within one IG will share the same IsolateGroupSource.
> 
> **Embedder changes**
> 
> This change makes breaking embedder API changes to support this new
> concept of Isolate Groups: The existing isolate lifecycle callbacks
> given to Dart_Initialize will become Isolate Group lifecycle callbacks.
> A new callback `initialize_isolate` callback will be added which can
> initialize a new isolate within an existing IG.
> 
> Existing embedders can be updated by performing the following renames
> 
>   Dart_CreateIsolate -> Dart_CreateIsolateGroup
>   Dart_IsolateCreateCallback -> Dart_IsolateGroupCreateCallback
>   Dart_IsolateCleanupCallback -> Dart_IsolateGroupShutdownCallback
>   Dart_CreateIsolateFromKernel -> Dart_CreateIsolateGroupFromKernel
>   Dart_CurrentIsolateData -> Dart_CurrentIsolateGroupData
>   Dart_IsolateData -> Dart_IsolateGroupData
>   Dart_GetNativeIsolateData -> Dart_GetNativeIsolateGroupData
>   Dart_InitializeParams.create -> Dart_InitializeParams.create_group
>   Dart_InitializeParams.cleanup -> Dart_InitializeParams.shutdown_group
>   Dart_InitializeParams.shutdown -> Dart_InitializeParams.shutdown_isolate
> 
> By default `Isolate.spawn` will cause the creation of a new IG.
> 
> Though an embedder can opt-into supporting multiple isolates within one IG by
> providing a callback to the newly added `Dart_InitializeParams.initialize_isolate`.
> The responsibility of this new callback is to initialize an existing
> isolate (which was setup by re-using source code from the spawning
> isolate - i.e. the one which used `Isolate.spawn`) by setting native
> resolvers, initializing global state, etc.
> 
> Issue https://github.com/dart-lang/sdk/issues/36648
> Issue https://github.com/dart-lang/sdk/issues/36097
> 
> Change-Id: I82437ac017ca33018d45e02f353b0672db155f6a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105241
> Commit-Queue: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>

TBR=kustermann@google.com,aam@google.com,rmacnak@google.com

Change-Id: Ibd90992a01d61188f27b445c21532e0c46f996ea
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107405
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-06-26 16:04:27 +00:00
Martin Kustermann b75057b687 [vm/concurrency] Introduce concept of Isolate Groups
An Isolate Group (IG) is a collection of isolates which were spawned from the
same source. This allows the VM to:

  * have a guarantee that all isolates within one IG can safely exchange
    structured objects (currently we rely on embedder for this
    guarantee)

  * hot-reload all isolates together (currently we only reload one
    isolate, leaving same-source isolates in inconsistent state)

  * make a shared heap for all isolates from the same IG, which paves
    the way for faster communication and sharing of immutable objects.

All isolates within one IG will share the same IsolateGroupSource.

**Embedder changes**

This change makes breaking embedder API changes to support this new
concept of Isolate Groups: The existing isolate lifecycle callbacks
given to Dart_Initialize will become Isolate Group lifecycle callbacks.
A new callback `initialize_isolate` callback will be added which can
initialize a new isolate within an existing IG.

Existing embedders can be updated by performing the following renames

  Dart_CreateIsolate -> Dart_CreateIsolateGroup
  Dart_IsolateCreateCallback -> Dart_IsolateGroupCreateCallback
  Dart_IsolateCleanupCallback -> Dart_IsolateGroupShutdownCallback
  Dart_CreateIsolateFromKernel -> Dart_CreateIsolateGroupFromKernel
  Dart_CurrentIsolateData -> Dart_CurrentIsolateGroupData
  Dart_IsolateData -> Dart_IsolateGroupData
  Dart_GetNativeIsolateData -> Dart_GetNativeIsolateGroupData
  Dart_InitializeParams.create -> Dart_InitializeParams.create_group
  Dart_InitializeParams.cleanup -> Dart_InitializeParams.shutdown_group
  Dart_InitializeParams.shutdown -> Dart_InitializeParams.shutdown_isolate

By default `Isolate.spawn` will cause the creation of a new IG.

Though an embedder can opt-into supporting multiple isolates within one IG by
providing a callback to the newly added `Dart_InitializeParams.initialize_isolate`.
The responsibility of this new callback is to initialize an existing
isolate (which was setup by re-using source code from the spawning
isolate - i.e. the one which used `Isolate.spawn`) by setting native
resolvers, initializing global state, etc.

Issue https://github.com/dart-lang/sdk/issues/36648
Issue https://github.com/dart-lang/sdk/issues/36097

Change-Id: I82437ac017ca33018d45e02f353b0672db155f6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105241
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2019-06-26 11:34:48 +00:00
Ryan Macnak 9e279a5054 [vm] Dart_Cleanup: wait for outstanding vm-service and kernel isolate spawns.
Also make the ServiceIsolate and KernelIsolate implementations more similar.

Bug: https://github.com/dart-lang/sdk/issues/36502
Change-Id: Ief494600e938d9edb9d316bd6708c445694290a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98867
Reviewed-by: Chinmay Garde <chinmaygarde@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2019-04-10 22:55:20 +00:00
Liam Appelbe df0671d664 [VM] Experimental flags in the dart CLI
Blocked on https://dart-review.googlesource.com/c/sdk/+/88840

Bug: https://github.com/dart-lang/sdk/issues/35602
Change-Id: I72b1cf574c9cb3d1dac2fbd8dfeb0f3fd80e330e
Reviewed-on: https://dart-review.googlesource.com/c/89042
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-01-15 01:02:07 +00:00
Liam Appelbe f8a680e511 Revert "Remove kernel isolate API from the public dart_api.h"
This reverts commit 9906819fb7.

Reason for revert: Follow up CLs are more complicated than I thought, so I don't want to leave it in an inconsistent state.

Original change's description:
> Remove kernel isolate API from the public dart_api.h
> 
> This is the first step in moving the kernel isolate out
> of the VM and into the standalone embedder.
> 
> Bug: https://github.com/dart-lang/sdk/issues/33433
> Change-Id: Ie8d9ac1c27efe2661f0441b75275119966d197af
> Reviewed-on: https://dart-review.googlesource.com/c/84829
> Commit-Queue: Liam Appelbe <liama@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,liama@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: https://github.com/dart-lang/sdk/issues/33433
Change-Id: Iaf753c210e918df167364b50ee823b2557896628
Reviewed-on: https://dart-review.googlesource.com/c/87623
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2018-12-18 20:20:42 +00:00
Liam Appelbe 9906819fb7 Remove kernel isolate API from the public dart_api.h
This is the first step in moving the kernel isolate out
of the VM and into the standalone embedder.

Bug: https://github.com/dart-lang/sdk/issues/33433
Change-Id: Ie8d9ac1c27efe2661f0441b75275119966d197af
Reviewed-on: https://dart-review.googlesource.com/c/84829
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-11-26 22:47:20 +00:00
asiva 54ae4f9172 [VM] - Fix race condition in setting kernel isolate
(was being added to the isolate list before it was marked as a kernel isolate)

Also do not send service events or debug events from the kernel isolate

Change-Id: I82a1dac3c8a845344dd26ce8a2a9077eb93f8447
Reviewed-on: https://dart-review.googlesource.com/65881
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-08-16 22:01:42 +00:00
Ryan Macnak 3e59362747 [vm] Shut down application isolates before the kernel isolate.
Bug: https://github.com/dart-lang/sdk/issues/32134
Change-Id: I9609e8a5df77d91e2d9c007571f6388dd72d059d
Reviewed-on: https://dart-review.googlesource.com/64462
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-07-11 19:29:15 +00:00
Alexander Aprelev f67cba1067 [vm] Introduce kernel_multiroot options to support multiroot compilation mode in kernel service.
This extends existing support for multiroot compilation from frontend server to kernel service.

Bug: dartbug.com/33508
Change-Id: I76e49038765793b4d683869ab812dde5e6baf6c4
Reviewed-on: https://dart-review.googlesource.com/61982
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-06-26 00:56:56 +00:00
Alexander Aprelev 828df76c85 Notify kernel service of isolate shutdown.
This is needed to clean up compiler associated with the isolate.

Bug: dartbug.com/33428
Change-Id: Ia5c0ac38e30d39a4feb946efca77d197c4e0d7a4
Reviewed-on: https://dart-review.googlesource.com/61113
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2018-06-20 04:01:21 +00:00
Ryan Macnak 26c7ab1331 [standalone] Record dependencies in DFE and include them in snapshot depfiles.
Bug: https://github.com/dart-lang/sdk/issues/33390
Change-Id: Ib1ce6078ccff1b8727c26a8ff7b24e9fb99fd086
Reviewed-on: https://dart-review.googlesource.com/60020
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-06-12 22:29:33 +00:00
Samir Jindel 39c93a2b19 Revert "Revert "[vm/kernel] Expression execution through Kernel."
This reverts commit b5154dd01e.

Original revision is in patchset 1.

Change-Id: Ic0776011c6fdbd64c025086535351474a9a88b6e
Reviewed-on: https://dart-review.googlesource.com/54407
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2018-05-15 12:03:22 +00:00
Samir Jindel b5154dd01e Revert "[vm/kernel] Expression execution through Kernel.
This reverts commit afd0a52a5a.

Reason for revert: Breaks kernel-a32 and kernel-rbc bots

Original change's description:
> [vm/kernel] Expression execution through Kernel.
> 
> Change-Id: Id90c91cb3b71f9ce703e21fe48147b86a7764d34
> Reviewed-on: https://dart-review.googlesource.com/42562
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Samir Jindel <sjindel@google.com>

TBR=aam@google.com,rmacnak@google.com,sjindel@google.com

Change-Id: If1ecad6145aeab81d5d3581798a628ead0265c38
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/54420
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-05-09 12:41:00 +00:00
Samir Jindel afd0a52a5a [vm/kernel] Expression execution through Kernel.
Change-Id: Id90c91cb3b71f9ce703e21fe48147b86a7764d34
Reviewed-on: https://dart-review.googlesource.com/42562
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-05-09 10:27:52 +00:00
asiva ee6351a147 [VM] Set up package config value when invoking the front end for compilation,
this should fix issue 32950 "(Isolate.spawnUri() ignores packageConfig
argument in Dart 2 mode.'

Bug:32950
Change-Id: I1247c87c171ac44d3da6e2a93212adba20c42e54
Reviewed-on: https://dart-review.googlesource.com/52986
Reviewed-by: Alexander Aprelev <aam@google.com>
2018-05-01 22:57:35 +00:00
Ben Konyi b641826ccf [ VM / CFE ] Removed changes introduced in c7e4a7d333 which allowed for dart:_internal to be imported for tests and updated DartAPI_InvokeNoSuchMethod to not depend on dart:_internal.
Change-Id: Ia861f7ef9eb6de0ee79743592d3517011c66327e
Reviewed-on: https://dart-review.googlesource.com/52266
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-04-24 22:14:48 +00:00
Ben Konyi c7e4a7d333 [ VM / CFE ] Added override to allowPlatformPrivateLibraryAccess in VmTarget for tests which need to import dart:_internal.
Change-Id: I7421c43b6949092c16af59df449a7c63cfa954c2
Reviewed-on: https://dart-review.googlesource.com/49623
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-04-12 15:39:39 +00:00
Ben Konyi 2ba978a186 [VM] Hooked up incremental compiler wrapper w/ accept protocol
Change-Id: I965e84cc2f8783d37f68a20880a37315c1918c0f
Reviewed-on: https://dart-review.googlesource.com/40200
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-02-12 17:23:07 +00:00
Ben Konyi 6338914d31 - Removed dead code (pulled from review 36121)
- Enabled incremental compiler in the dart frontend for the command-line VM
- Added method to update in-memory file system with in-memory sources provided by tests

Change-Id: Ica26b7235383185dbb6b4b41064193d432dfcba0
Reviewed-on: https://dart-review.googlesource.com/36126
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-02-07 19:35:39 +00:00
Ben Konyi b853cfdbb1 [VM] Removed old space heap size limit for Kernel and Service isolates.
Change-Id: Ib19cc5ca22f319e41c21e6553e6228dfe0c34809
Reviewed-on: https://dart-review.googlesource.com/39420
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-02-07 00:19:25 +00:00
Siva Chandra 71dba8a0e5 Link the platform kernel with the command line dart executable.
Change-Id: Ib376a259e2e9ff9b487820c041d6795f8f7192d1
Reviewed-on: https://dart-review.googlesource.com/37420
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Chandra <sivachandra@google.com>
2018-02-01 15:11:29 +00: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
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
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
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