[VM] Move kernel service to pkg/vm, populate pkg/vm with necessary files

* kernel-service.dart is moved to pkg/vm/bin and renamed to
  kernel_service.dart

* LICENSE, pubspec.yaml and analysis_options.yaml added to pkg/vm.

* Kernel isolate name is corrected to be independent of URI passed
  in --dfe VM option.

Change-Id: I5b7b860297314e240e557af80913e7ac3e6324ad
Reviewed-on: https://dart-review.googlesource.com/21260
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Alexander Markov 2017-11-17 17:45:03 +00:00 committed by commit-bot@chromium.org
parent 6f57467887
commit 58ffdbf5fc
11 changed files with 59 additions and 12 deletions

View file

@ -56,7 +56,7 @@ case "${1//_/-}" in
| head -1)
exec "${DART_VM}" -DDFE_VERBOSE=true \
--kernel-binaries=${PATCHED_SDK_DIR} \
--dfe="${REPO_DIR}/utils/kernel-service/kernel-service.dart" "$@"
--dfe="${REPO_DIR}/pkg/vm/bin/kernel_service.dart" "$@"
;;
testing)
SCRIPT="${REPO_DIR}/pkg/testing/bin/testing.dart"

26
pkg/vm/LICENSE Normal file
View file

@ -0,0 +1,26 @@
Copyright 2017, the Dart project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -0,0 +1,11 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
analyzer:
strong-mode: true
language:
enableSuperMixins: false
exclude:
- testcases/**
- tool/**

View file

@ -10,12 +10,12 @@
/// This is either invoked as the root script of the Kernel isolate when used
/// as a part of
///
/// dart --dfe=utils/kernel-service/kernel-service.dart ...
/// dart --dfe=pkg/vm/bin/kernel_service.dart ...
///
/// invocation or it is invoked as a standalone script to perform training for
/// the app-jit snapshot
///
/// dart utils/kernel-service/kernel-service.dart --train <source-file>
/// dart pkg/vm/bin/kernel_service.dart --train <source-file>
///
///
library runtime.tools.kernel_service;

10
pkg/vm/pubspec.yaml Normal file
View file

@ -0,0 +1,10 @@
name: vm
version: 0.1.0-alpha.1
author: Dart Team <misc@dartlang.org>
description: VM specific Dart code and helper scripts
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/vm
environment:
sdk: ">=1.8.0 <2.0.0"
dependencies:
front_end: 0.1.0-alpha.6
kernel: 0.3.0-alpha.3

View file

@ -334,8 +334,8 @@ static Dart_Isolate CreateAndSetupKernelIsolate(const char* main,
IsolateData* isolate_data =
new IsolateData(script_uri, package_root, packages_config, app_snapshot);
Dart_Isolate isolate = Dart_CreateIsolate(
script_uri, main, isolate_snapshot_data, isolate_snapshot_instructions,
flags, isolate_data, error);
DART_KERNEL_ISOLATE_NAME, main, isolate_snapshot_data,
isolate_snapshot_instructions, flags, isolate_data, error);
if (isolate == NULL) {
delete isolate_data;
return NULL;

View file

@ -154,8 +154,8 @@ static Dart_Isolate CreateIsolateAndSetup(const char* script_uri,
bin::IsolateData* isolate_data = new bin::IsolateData(
script_uri, package_root, packages_config, NULL /* app_snapshot */);
Dart_Isolate isolate = Dart_CreateIsolate(
script_uri, main, isolate_snapshot_data, isolate_snapshot_instructions,
flags, isolate_data, error);
DART_KERNEL_ISOLATE_NAME, main, isolate_snapshot_data,
isolate_snapshot_instructions, flags, isolate_data, error);
if (isolate == NULL) {
*error = strdup("Failed to create isolate");
delete isolate_data;

View file

@ -1090,7 +1090,8 @@ static char* BuildIsolateName(const char* script_uri, const char* main) {
}
}
if (ServiceIsolate::NameEquals(script_uri)) {
if (ServiceIsolate::NameEquals(script_uri) ||
(strcmp(script_uri, DART_KERNEL_ISOLATE_NAME) == 0)) {
return strdup(script_uri);
}

View file

@ -200,7 +200,7 @@ void KernelIsolate::InitCallback(Isolate* I) {
ASSERT(I == T->isolate());
ASSERT(I != NULL);
ASSERT(I->name() != NULL);
if (strstr(I->name(), DART_KERNEL_ISOLATE_NAME) == NULL) {
if (strcmp(I->name(), DART_KERNEL_ISOLATE_NAME) != 0) {
// Not kernel isolate.
return;
}

View file

@ -639,7 +639,7 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration {
var args = <String>[];
if (useDfe) {
if (!_isStrong) {
args.add('--dfe=utils/kernel-service/kernel-service.dart');
args.add('--dfe=pkg/vm/bin/kernel_service.dart');
}
// TODO(dartbug.com/30480): avoid using additional kernel binaries
args.add('--kernel-binaries=' +

View file

@ -6,11 +6,10 @@ import("../../build/dart_host_sdk_toolchain.gni")
import("../application_snapshot.gni")
application_snapshot("kernel-service") {
dfe_script = "kernel-service.dart"
main_dart = "../../pkg/vm/bin/kernel_service.dart"
deps = [
"../../runtime/vm:kernel_platform_files($dart_host_toolchain)",
]
main_dart = dfe_script
training_args = [
"--train",
"file://" + rebase_path("../../pkg/compiler/lib/src/dart2js.dart"),