Version 2.1.1-dev.0.0
* Cherry-pick f8a680e5116493f8795c148a52dbecf8a84e4536 to dev
* Cherry-pick b1c963c84b20e715bc5c1f7d443168071c2b971d to dev
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 37ef962..54f3532 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 2.1.1-dev.0.0
+
+* Cherry-pick f8a680e5116493f8795c148a52dbecf8a84e4536 to dev
+* Cherry-pick b1c963c84b20e715bc5c1f7d443168071c2b971d to dev
+
## 2.2.0-dev.1.1
### Tool Changes
diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn
index a5c2317..f220caa 100644
--- a/runtime/bin/BUILD.gn
+++ b/runtime/bin/BUILD.gn
@@ -157,8 +157,6 @@
"dfe.cc",
"dfe.h",
"gen_snapshot.cc",
- "kernel_isolate.cc",
- "kernel_isolate.h",
"options.cc",
"options.h",
"vmservice_impl.cc",
@@ -717,8 +715,6 @@
"dart_embedder_api_impl.cc",
"error_exit.cc",
"error_exit.h",
- "kernel_isolate.cc",
- "kernel_isolate.h",
"main.cc",
"main_options.cc",
"main_options.h",
@@ -941,8 +937,6 @@
"dfe.h",
"error_exit.cc",
"error_exit.h",
- "kernel_isolate.cc",
- "kernel_isolate.h",
"run_vm_tests.cc",
"snapshot_utils.cc",
"snapshot_utils.h",
diff --git a/runtime/bin/dfe.h b/runtime/bin/dfe.h
index 47d95d2..af520658 100644
--- a/runtime/bin/dfe.h
+++ b/runtime/bin/dfe.h
@@ -5,7 +5,6 @@
#ifndef RUNTIME_BIN_DFE_H_
#define RUNTIME_BIN_DFE_H_
-#include "bin/kernel_isolate.h"
#include "include/dart_api.h"
#include "include/dart_native_api.h"
#include "platform/assert.h"
diff --git a/runtime/bin/kernel_isolate.cc b/runtime/bin/kernel_isolate.cc
deleted file mode 100644
index c6bc711..0000000
--- a/runtime/bin/kernel_isolate.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright (c) 2018, 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.
-
-#include "bin/kernel_isolate.h"
-
-#include "vm/dart_api_impl.h"
-#include "vm/isolate.h"
-#include "vm/kernel_isolate.h"
-
-namespace dart {
-
-DART_EXPORT bool Dart_IsKernelIsolate(Dart_Isolate isolate) {
-#if defined(DART_PRECOMPILED_RUNTIME)
- return false;
-#else
- Isolate* iso = reinterpret_cast<Isolate*>(isolate);
- return KernelIsolate::IsKernelIsolate(iso);
-#endif
-}
-
-DART_EXPORT bool Dart_KernelIsolateIsRunning() {
-#if defined(DART_PRECOMPILED_RUNTIME)
- return false;
-#else
- return KernelIsolate::IsRunning();
-#endif
-}
-
-DART_EXPORT Dart_Port Dart_KernelPort() {
-#if defined(DART_PRECOMPILED_RUNTIME)
- return false;
-#else
- return KernelIsolate::KernelPort();
-#endif
-}
-
-DART_EXPORT Dart_KernelCompilationResult
-Dart_CompileToKernel(const char* script_uri,
- const uint8_t* platform_kernel,
- intptr_t platform_kernel_size,
- bool incremental_compile,
- const char* package_config) {
- API_TIMELINE_DURATION(Thread::Current());
-
- Dart_KernelCompilationResult result;
-#if defined(DART_PRECOMPILED_RUNTIME)
- result.status = Dart_KernelCompilationStatus_Unknown;
- result.error = strdup("Dart_CompileToKernel is unsupported.");
-#else
- result = KernelIsolate::CompileToKernel(script_uri, platform_kernel,
- platform_kernel_size, 0, NULL,
- incremental_compile, package_config);
- if (result.status == Dart_KernelCompilationStatus_Ok) {
- Dart_KernelCompilationResult accept_result =
- KernelIsolate::AcceptCompilation();
- if (accept_result.status != Dart_KernelCompilationStatus_Ok) {
- FATAL1(
- "An error occurred in the CFE while accepting the most recent"
- " compilation results: %s",
- accept_result.error);
- }
- }
-#endif
- return result;
-}
-
-DART_EXPORT Dart_KernelCompilationResult
-Dart_CompileSourcesToKernel(const char* script_uri,
- const uint8_t* platform_kernel,
- intptr_t platform_kernel_size,
- int source_files_count,
- Dart_SourceFile sources[],
- bool incremental_compile,
- const char* package_config,
- const char* multiroot_filepaths,
- const char* multiroot_scheme) {
- Dart_KernelCompilationResult result;
-#if defined(DART_PRECOMPILED_RUNTIME)
- result.status = Dart_KernelCompilationStatus_Unknown;
- result.error = strdup("Dart_CompileSourcesToKernel is unsupported.");
-#else
- result = KernelIsolate::CompileToKernel(
- script_uri, platform_kernel, platform_kernel_size, source_files_count,
- sources, incremental_compile, package_config, multiroot_filepaths,
- multiroot_scheme);
- if (result.status == Dart_KernelCompilationStatus_Ok) {
- if (KernelIsolate::AcceptCompilation().status !=
- Dart_KernelCompilationStatus_Ok) {
- FATAL(
- "An error occurred in the CFE while accepting the most recent"
- " compilation results.");
- }
- }
-#endif
- return result;
-}
-
-DART_EXPORT Dart_KernelCompilationResult Dart_KernelListDependencies() {
- Dart_KernelCompilationResult result;
-#if defined(DART_PRECOMPILED_RUNTIME)
- result.status = Dart_KernelCompilationStatus_Unknown;
- result.error = strdup("Dart_KernelListDependencies is unsupported.");
-#else
- result = KernelIsolate::ListDependencies();
-#endif
- return result;
-}
-
-} // namespace dart
diff --git a/runtime/bin/kernel_isolate.h b/runtime/bin/kernel_isolate.h
deleted file mode 100644
index 4a9e667..0000000
--- a/runtime/bin/kernel_isolate.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2018, 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.
-
-#ifndef RUNTIME_BIN_KERNEL_ISOLATE_H_
-#define RUNTIME_BIN_KERNEL_ISOLATE_H_
-
-#include "include/dart_api.h"
-
-namespace dart {
-
-typedef enum {
- Dart_KernelCompilationStatus_Unknown = -1,
- Dart_KernelCompilationStatus_Ok = 0,
- Dart_KernelCompilationStatus_Error = 1,
- Dart_KernelCompilationStatus_Crash = 2,
-} Dart_KernelCompilationStatus;
-
-typedef struct {
- Dart_KernelCompilationStatus status;
- char* error;
-
- uint8_t* kernel;
- intptr_t kernel_size;
-} Dart_KernelCompilationResult;
-
-DART_EXPORT bool Dart_IsKernelIsolate(Dart_Isolate isolate);
-DART_EXPORT bool Dart_KernelIsolateIsRunning();
-DART_EXPORT Dart_Port Dart_KernelPort();
-DART_EXPORT Dart_KernelCompilationResult
-Dart_CompileToKernel(const char* script_uri,
- const uint8_t* platform_kernel,
- const intptr_t platform_kernel_size,
- bool incremental_compile,
- const char* package_config);
-
-typedef struct {
- const char* uri;
- const char* source;
-} Dart_SourceFile;
-DART_EXPORT Dart_KernelCompilationResult
-Dart_CompileSourcesToKernel(const char* script_uri,
- const uint8_t* platform_kernel,
- intptr_t platform_kernel_size,
- int source_files_count,
- Dart_SourceFile source_files[],
- bool incremental_compile,
- const char* package_config,
- const char* multiroot_filepaths,
- const char* multiroot_scheme);
-
-DART_EXPORT Dart_KernelCompilationResult Dart_KernelListDependencies();
-
-#define DART_KERNEL_ISOLATE_NAME "kernel-service"
-
-} // namespace dart
-
-#endif // RUNTIME_BIN_KERNEL_ISOLATE_H_
diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h
index f1d0a36..185c901 100644
--- a/runtime/include/dart_api.h
+++ b/runtime/include/dart_api.h
@@ -3076,6 +3076,65 @@
DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer);
/*
+ * ======
+ * Kernel
+ * ======
+ */
+
+/**
+ * Experimental support for Dart to Kernel parser isolate.
+ *
+ * TODO(hausner): Document finalized interface.
+ *
+ */
+
+// TODO(33433): Remove kernel service from the embedding API.
+
+typedef enum {
+ Dart_KernelCompilationStatus_Unknown = -1,
+ Dart_KernelCompilationStatus_Ok = 0,
+ Dart_KernelCompilationStatus_Error = 1,
+ Dart_KernelCompilationStatus_Crash = 2,
+} Dart_KernelCompilationStatus;
+
+typedef struct {
+ Dart_KernelCompilationStatus status;
+ char* error;
+
+ uint8_t* kernel;
+ intptr_t kernel_size;
+} Dart_KernelCompilationResult;
+
+DART_EXPORT bool Dart_IsKernelIsolate(Dart_Isolate isolate);
+DART_EXPORT bool Dart_KernelIsolateIsRunning();
+DART_EXPORT Dart_Port Dart_KernelPort();
+DART_EXPORT Dart_KernelCompilationResult
+Dart_CompileToKernel(const char* script_uri,
+ const uint8_t* platform_kernel,
+ const intptr_t platform_kernel_size,
+ bool incremental_compile,
+ const char* package_config);
+
+typedef struct {
+ const char* uri;
+ const char* source;
+} Dart_SourceFile;
+DART_EXPORT Dart_KernelCompilationResult
+Dart_CompileSourcesToKernel(const char* script_uri,
+ const uint8_t* platform_kernel,
+ intptr_t platform_kernel_size,
+ int source_files_count,
+ Dart_SourceFile source_files[],
+ bool incremental_compile,
+ const char* package_config,
+ const char* multiroot_filepaths,
+ const char* multiroot_scheme);
+
+DART_EXPORT Dart_KernelCompilationResult Dart_KernelListDependencies();
+
+#define DART_KERNEL_ISOLATE_NAME "kernel-service"
+
+/*
* =======
* Service
* =======
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 362c1a0..1c862ff 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -5430,6 +5430,105 @@
return Api::Success();
}
+// --- Dart Front-End (Kernel) support ---
+
+DART_EXPORT bool Dart_IsKernelIsolate(Dart_Isolate isolate) {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ return false;
+#else
+ Isolate* iso = reinterpret_cast<Isolate*>(isolate);
+ return KernelIsolate::IsKernelIsolate(iso);
+#endif
+}
+
+DART_EXPORT bool Dart_KernelIsolateIsRunning() {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ return false;
+#else
+ return KernelIsolate::IsRunning();
+#endif
+}
+
+DART_EXPORT Dart_Port Dart_KernelPort() {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ return false;
+#else
+ return KernelIsolate::KernelPort();
+#endif
+}
+
+DART_EXPORT Dart_KernelCompilationResult
+Dart_CompileToKernel(const char* script_uri,
+ const uint8_t* platform_kernel,
+ intptr_t platform_kernel_size,
+ bool incremental_compile,
+ const char* package_config) {
+ API_TIMELINE_DURATION(Thread::Current());
+
+ Dart_KernelCompilationResult result;
+#if defined(DART_PRECOMPILED_RUNTIME)
+ result.status = Dart_KernelCompilationStatus_Unknown;
+ result.error = strdup("Dart_CompileToKernel is unsupported.");
+#else
+ result = KernelIsolate::CompileToKernel(script_uri, platform_kernel,
+ platform_kernel_size, 0, NULL,
+ incremental_compile, package_config);
+ if (result.status == Dart_KernelCompilationStatus_Ok) {
+ Dart_KernelCompilationResult accept_result =
+ KernelIsolate::AcceptCompilation();
+ if (accept_result.status != Dart_KernelCompilationStatus_Ok) {
+ FATAL1(
+ "An error occurred in the CFE while accepting the most recent"
+ " compilation results: %s",
+ accept_result.error);
+ }
+ }
+#endif
+ return result;
+}
+
+DART_EXPORT Dart_KernelCompilationResult
+Dart_CompileSourcesToKernel(const char* script_uri,
+ const uint8_t* platform_kernel,
+ intptr_t platform_kernel_size,
+ int source_files_count,
+ Dart_SourceFile sources[],
+ bool incremental_compile,
+ const char* package_config,
+ const char* multiroot_filepaths,
+ const char* multiroot_scheme) {
+ Dart_KernelCompilationResult result;
+#if defined(DART_PRECOMPILED_RUNTIME)
+ result.status = Dart_KernelCompilationStatus_Unknown;
+ result.error = strdup("Dart_CompileSourcesToKernel is unsupported.");
+#else
+ result = KernelIsolate::CompileToKernel(
+ script_uri, platform_kernel, platform_kernel_size, source_files_count,
+ sources, incremental_compile, package_config, multiroot_filepaths,
+ multiroot_scheme);
+ if (result.status == Dart_KernelCompilationStatus_Ok) {
+ if (KernelIsolate::AcceptCompilation().status !=
+ Dart_KernelCompilationStatus_Ok) {
+ FATAL(
+ "An error occurred in the CFE while accepting the most recent"
+ " compilation results.");
+ }
+ }
+#endif
+ return result;
+}
+
+DART_EXPORT Dart_KernelCompilationResult Dart_KernelListDependencies() {
+ Dart_KernelCompilationResult result;
+#if defined(DART_PRECOMPILED_RUNTIME)
+ result.status = Dart_KernelCompilationStatus_Unknown;
+ result.error = strdup("Dart_KernelListDependencies is unsupported.");
+#else
+ result = KernelIsolate::ListDependencies();
+#endif
+ return result;
+}
+
// --- Service support ---
DART_EXPORT bool Dart_IsServiceIsolate(Dart_Isolate isolate) {
diff --git a/runtime/vm/isolate_reload.h b/runtime/vm/isolate_reload.h
index 35e6a7d..082bc48 100644
--- a/runtime/vm/isolate_reload.h
+++ b/runtime/vm/isolate_reload.h
@@ -7,7 +7,6 @@
#include "include/dart_tools_api.h"
-#include "bin/kernel_isolate.h"
#include "vm/globals.h"
#include "vm/growable_array.h"
#include "vm/hash_map.h"
diff --git a/runtime/vm/kernel_isolate.h b/runtime/vm/kernel_isolate.h
index ed610c5..a271351 100644
--- a/runtime/vm/kernel_isolate.h
+++ b/runtime/vm/kernel_isolate.h
@@ -8,7 +8,6 @@
#include "include/dart_api.h"
#include "include/dart_native_api.h"
-#include "bin/kernel_isolate.h"
#include "vm/allocation.h"
#include "vm/dart.h"
#include "vm/os_thread.h"
diff --git a/runtime/vm/kernel_loader.cc b/runtime/vm/kernel_loader.cc
index dc370e1..a11f25c 100644
--- a/runtime/vm/kernel_loader.cc
+++ b/runtime/vm/kernel_loader.cc
@@ -225,7 +225,7 @@
Library& library = Library::Handle(zone);
// Create "fake programs" for each sub-program.
intptr_t subprogram_count = subprogram_file_starts.length() - 1;
- for (intptr_t i = 0; i < subprogram_count; ++i) {
+ for (intptr_t i = subprogram_count - 1; i >= 0; --i) {
intptr_t subprogram_start = subprogram_file_starts.At(i);
intptr_t subprogram_end = subprogram_file_starts.At(i + 1);
reader.set_raw_buffer(program->kernel_data() + subprogram_start);
@@ -237,7 +237,7 @@
Object& load_result = Object::Handle(loader.LoadProgram(false));
if (load_result.IsError()) return load_result;
- if (library.IsNull() && load_result.IsLibrary()) {
+ if (load_result.IsLibrary()) {
library ^= load_result.raw();
}
diff --git a/runtime/vm/unit_test.h b/runtime/vm/unit_test.h
index e99f521..6c53746 100644
--- a/runtime/vm/unit_test.h
+++ b/runtime/vm/unit_test.h
@@ -9,7 +9,6 @@
#include "platform/globals.h"
-#include "bin/kernel_isolate.h"
#include "vm/dart.h"
#include "vm/dart_api_state.h"
#include "vm/dart_entry.h"
diff --git a/tools/VERSION b/tools/VERSION
index 146c6cc..3677e8b 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -25,7 +25,7 @@
#
CHANNEL dev
MAJOR 2
-MINOR 2
-PATCH 0
-PRERELEASE 1
-PRERELEASE_PATCH 1
+MINOR 1
+PATCH 1
+PRERELEASE 0
+PRERELEASE_PATCH 0