Revert "Load service isolate from a .dill file."

This reverts commit b0c2a382ca as the
vm-kernel mac bots are unhappy.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2947243002 .
This commit is contained in:
Siva Chandra 2017-06-21 13:46:15 -07:00
parent b452b39962
commit e90aa9cb5f
3 changed files with 30 additions and 92 deletions

View file

@ -13,15 +13,12 @@ namespace dart {
namespace bin {
const char kPlatformBinaryName[] = "platform.dill";
const char kVMServiceIOBinaryName[] = "vmservice_io.dill";
DFE::DFE()
: frontend_filename_(NULL),
platform_binary_filename_(NULL),
vmservice_io_binary_filename_(NULL),
kernel_platform_(NULL),
kernel_vmservice_io_(NULL) {}
kernel_platform_(NULL) {}
DFE::~DFE() {
@ -36,11 +33,6 @@ DFE::~DFE() {
delete reinterpret_cast<kernel::Program*>(kernel_platform_);
kernel_platform_ = NULL;
}
if (kernel_vmservice_io_ != NULL) {
delete reinterpret_cast<kernel::Program*>(kernel_vmservice_io_);
kernel_vmservice_io_ = NULL;
}
}
@ -51,13 +43,6 @@ void DFE::SetKernelBinaries(const char* name) {
platform_binary_filename_ = new char[len];
snprintf(platform_binary_filename_, len, "%s%s%s", name,
File::PathSeparator(), kPlatformBinaryName);
len = snprintf(NULL, 0, "%s%s%s", name, File::PathSeparator(),
kVMServiceIOBinaryName) +
1;
vmservice_io_binary_filename_ = new char[len];
snprintf(vmservice_io_binary_filename_, len, "%s%s%s", name,
File::PathSeparator(), kVMServiceIOBinaryName);
}
@ -124,11 +109,6 @@ void* DFE::ReadPlatform() {
}
void* DFE::ReadVMServiceIO() {
return kernel_vmservice_io_ = ReadScript(vmservice_io_binary_filename_);
}
void* DFE::ReadScript(const char* script_uri) {
const uint8_t* buffer = NULL;
intptr_t buffer_length = -1;

View file

@ -32,8 +32,6 @@ class DFE {
void* kernel_platform() const { return kernel_platform_; }
void* kernel_vmservice_io() const { return kernel_vmservice_io_; }
// Method to reload a script into a running a isolate.
// If the specified script [url] is not a kernel IR, compile it first using
// DFE and then reload the resulting kernel IR into the isolate.
@ -52,10 +50,6 @@ class DFE {
// Returns an in memory kernel representation of the platform kernel file.
void* ReadPlatform();
// Reads the vmservice_io kernel file.
// Returns the in memory representation of the vmservice_io kernel file.
void* ReadVMServiceIO();
// Reads the script kernel file if specified 'script_uri' is a kernel file.
// Returns an in memory kernel representation of the specified script is a
// valid kernel file, false otherwise.
@ -73,9 +67,7 @@ class DFE {
const char* frontend_filename_;
char* platform_binary_filename_;
char* vmservice_io_binary_filename_;
void* kernel_platform_;
void* kernel_vmservice_io_;
DISALLOW_COPY_AND_ASSIGN(DFE);
};

View file

@ -826,30 +826,19 @@ static Dart_Handle EnvironmentCallback(Dart_Handle name) {
}
#define SAVE_ERROR_AND_EXIT(result) \
*error = strdup(Dart_GetError(result)); \
if (Dart_IsCompilationError(result)) { \
*exit_code = kCompilationErrorExitCode; \
} else if (Dart_IsApiError(result)) { \
*exit_code = kApiErrorExitCode; \
} else { \
*exit_code = kErrorExitCode; \
} \
Dart_ExitScope(); \
Dart_ShutdownIsolate(); \
return NULL;
#define CHECK_RESULT(result) \
if (Dart_IsError(result)) { \
SAVE_ERROR_AND_EXIT(result); \
}
#define CHECK_RESULT_CLEANUP(result, cleanup) \
if (Dart_IsError(result)) { \
delete (cleanup); \
SAVE_ERROR_AND_EXIT(result); \
*error = strdup(Dart_GetError(result)); \
if (Dart_IsCompilationError(result)) { \
*exit_code = kCompilationErrorExitCode; \
} else if (Dart_IsApiError(result)) { \
*exit_code = kApiErrorExitCode; \
} else { \
*exit_code = kErrorExitCode; \
} \
Dart_ExitScope(); \
Dart_ShutdownIsolate(); \
return NULL; \
}
@ -1039,35 +1028,23 @@ static Dart_Isolate CreateAndSetupServiceIsolate(const char* script_uri,
#if defined(DART_PRECOMPILED_RUNTIME)
// AOT: All isolates start from the app snapshot.
bool skip_library_load = true;
bool isolate_run_app_snapshot = true;
const uint8_t* isolate_snapshot_data = app_isolate_snapshot_data;
const uint8_t* isolate_snapshot_instructions =
app_isolate_snapshot_instructions;
#else
// JIT: Service isolate uses the core libraries snapshot.
bool skip_library_load = false;
bool isolate_run_app_snapshot = false;
const uint8_t* isolate_snapshot_data = core_isolate_snapshot_data;
const uint8_t* isolate_snapshot_instructions =
core_isolate_snapshot_instructions;
#endif // !defined(DART_PRECOMPILED_RUNTIME)
Dart_Isolate isolate = NULL;
IsolateData* isolate_data =
new IsolateData(script_uri, package_root, packages_config, NULL);
#if defined(DART_PRECOMPILED_RUNTIME)
isolate = Dart_CreateIsolate(script_uri, main, isolate_snapshot_data,
isolate_snapshot_instructions, flags,
isolate_data, error);
#else
if (dfe.UsePlatformBinary()) {
isolate = Dart_CreateIsolateFromKernel(
script_uri, NULL, dfe.kernel_platform(), flags, isolate_data, error);
} else {
isolate = Dart_CreateIsolate(script_uri, main, isolate_snapshot_data,
isolate_snapshot_instructions, flags,
isolate_data, error);
}
#endif // !defined(DART_PRECOMPILED_RUNTIME)
Dart_Isolate isolate = Dart_CreateIsolate(
script_uri, main, isolate_snapshot_data, isolate_snapshot_instructions,
flags, isolate_data, error);
if (isolate == NULL) {
delete isolate_data;
return NULL;
@ -1078,15 +1055,8 @@ static Dart_Isolate CreateAndSetupServiceIsolate(const char* script_uri,
Dart_Handle result = Dart_SetLibraryTagHandler(Loader::LibraryTagHandler);
CHECK_RESULT(result);
#if !defined(DART_PRECOMPILED_RUNTIME)
if (dfe.UsePlatformBinary()) {
Dart_Handle library = Dart_LoadKernel(dfe.kernel_vmservice_io());
CHECK_RESULT_CLEANUP(library, isolate_data);
skip_library_load = true;
}
#endif // !defined(DART_PRECOMPILED_RUNTIME)
// Load embedder specific bits and return.
bool skip_library_load = isolate_run_app_snapshot;
if (!VmService::Setup(vm_service_server_ip, vm_service_server_port,
skip_library_load, vm_service_dev_mode,
trace_loading)) {
@ -1862,22 +1832,6 @@ void main(int argc, char** argv) {
Process::SetExitHook(SnapshotOnExitHook);
}
#if !defined(DART_PRECOMPILED_RUNTIME)
// If a kernel platform binary file is specified, read it. This
// step will become redundant once we have the snapshot version
// of the kernel core/platform libraries.
if (dfe.UsePlatformBinary()) {
if (dfe.ReadPlatform() == NULL) {
Log::PrintErr("The platform binary is not a valid Dart Kernel file.");
Platform::Exit(kErrorExitCode);
}
if (dfe.ReadVMServiceIO() == NULL) {
Log::PrintErr("Could not read dart:vmservice_io binary file.");
Platform::Exit(kErrorExitCode);
}
}
#endif
Dart_SetVMFlags(vm_options.count(), vm_options.arguments());
// Start event handler.
@ -1912,6 +1866,18 @@ void main(int argc, char** argv) {
&ServiceStreamCancelCallback);
Dart_SetFileModifiedCallback(&FileModifiedCallback);
#if !defined(DART_PRECOMPILED_RUNTIME)
// If a kernel platform binary file is specified, read it. This
// step will become redundant once we have the snapshot version
// of the kernel core/platform libraries.
if (dfe.UsePlatformBinary()) {
if (dfe.ReadPlatform() == NULL) {
Log::PrintErr("The platform binary is not a valid Dart Kernel file.");
Platform::Exit(kErrorExitCode);
}
}
#endif
// Run the main isolate until we aren't told to restart.
while (RunMainIsolate(script_name, &dart_options)) {
Log::PrintErr("Restarting VM\n");