mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 23:49:47 +00:00
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>
This commit is contained in:
parent
b2d6a2327c
commit
f8a680e511
|
@ -157,8 +157,6 @@ template("build_gen_snapshot") {
|
|||
"dfe.cc",
|
||||
"dfe.h",
|
||||
"gen_snapshot.cc",
|
||||
"kernel_isolate.cc",
|
||||
"kernel_isolate.h",
|
||||
"options.cc",
|
||||
"options.h",
|
||||
"vmservice_impl.cc",
|
||||
|
@ -717,8 +715,6 @@ template("dart_executable") {
|
|||
"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 @@ executable("run_vm_tests") {
|
|||
"dfe.h",
|
||||
"error_exit.cc",
|
||||
"error_exit.h",
|
||||
"kernel_isolate.cc",
|
||||
"kernel_isolate.h",
|
||||
"run_vm_tests.cc",
|
||||
"snapshot_utils.cc",
|
||||
"snapshot_utils.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"
|
||||
|
|
|
@ -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
|
|
@ -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_
|
|
@ -3068,6 +3068,65 @@ DART_EXPORT Dart_Handle Dart_GetPeer(Dart_Handle object, void** peer);
|
|||
*/
|
||||
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
|
||||
|
|
|
@ -5373,6 +5373,105 @@ DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer) {
|
|||
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) {
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue