Skip to content

Commit

Permalink
Roll Dart to 67ab3be (flutter#9638)
Browse files Browse the repository at this point in the history
This is a reland of flutter#9364 with fixes for Fuchsia.

000cf05 clean up type_literal_test
0f20911 Improve type_literal_test
a108bef [vm, bytecode] Interpreter support for newer recognized natives.
2a15d38 Revert "[llvm] Add initial scaffolding"
13b470a Parse error expectations in tests.
b71d2d9 [llvm] Add initial scaffolding
5f2bcd9 [vm/bytecode] Reuse flow graph building for recognized methods

This includes a breaking change: https://dart-review.googlesource.com/c/sdk/+/105241
```
  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
```
  • Loading branch information
cbracken authored Jul 1, 2019
1 parent 628b174 commit fd24007
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 46 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ vars = {
# Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS.
# You can use //tools/dart/create_updated_flutter_deps.py to produce
# updated revision list of existing dependencies.
'dart_revision': '0abff7b2bb047cc893ea737d95656f9dabfef1e9',
'dart_revision': '67ab3be10d35d994641da167cc806f20a7ffa679',

# WARNING: DO NOT EDIT MANUALLY
# The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
Expand Down
2 changes: 1 addition & 1 deletion ci/licenses_golden/licenses_third_party
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Signature: 128f33291640edb36f623069120b87d6
Signature: f1e40299965f80773c3d4983274e6c46

UNUSED LICENSES:

Expand Down
27 changes: 15 additions & 12 deletions runtime/dart_isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) {
}

auto* isolate_data = static_cast<std::shared_ptr<DartIsolate>*>(
Dart_IsolateData(dart_isolate));
Dart_IsolateGroupData(dart_isolate));
if (isolate_data->get() != this) {
return false;
}
Expand All @@ -174,7 +174,7 @@ bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) {
// We are entering a new scope (for the first time since initialization) and
// we want to restore the current scope to null when we exit out of this
// method. This balances the implicit Dart_EnterIsolate call made by
// Dart_CreateIsolate (which calls the Initialize).
// Dart_CreateIsolateGroup (which calls the Initialize).
Dart_ExitIsolate();

tonic::DartIsolateScope scope(isolate());
Expand Down Expand Up @@ -636,8 +636,8 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate(
return service_isolate->isolate();
}

// |Dart_IsolateCreateCallback|
Dart_Isolate DartIsolate::DartIsolateCreateCallback(
// |Dart_IsolateGroupCreateCallback|
Dart_Isolate DartIsolate::DartIsolateGroupCreateCallback(
const char* advisory_script_uri,
const char* advisory_script_entrypoint,
const char* package_root,
Expand Down Expand Up @@ -720,14 +720,16 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(
}

// Create the Dart VM isolate and give it the embedder object as the baton.
Dart_Isolate isolate = Dart_CreateIsolate(
Dart_Isolate isolate = Dart_CreateIsolateGroup(
advisory_script_uri, //
advisory_script_entrypoint, //
(*embedder_isolate)->GetIsolateSnapshot()->GetDataMapping(),
(*embedder_isolate)->GetIsolateSnapshot()->GetInstructionsMapping(),
(*embedder_isolate)->GetSharedSnapshot()->GetDataMapping(),
(*embedder_isolate)->GetSharedSnapshot()->GetInstructionsMapping(), flags,
embedder_isolate.get(), error);
embedder_isolate.get(), // isolate_group_data
embedder_isolate.get(), // isolate_data
error);

if (isolate == nullptr) {
FML_DLOG(ERROR) << *error;
Expand Down Expand Up @@ -770,14 +772,15 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(

// |Dart_IsolateShutdownCallback|
void DartIsolate::DartIsolateShutdownCallback(
std::shared_ptr<DartIsolate>* embedder_isolate) {
embedder_isolate->get()->OnShutdownCallback();
std::shared_ptr<DartIsolate>* isolate_group_data,
std::shared_ptr<DartIsolate>* isolate_data) {
isolate_group_data->get()->OnShutdownCallback();
}

// |Dart_IsolateCleanupCallback|
void DartIsolate::DartIsolateCleanupCallback(
std::shared_ptr<DartIsolate>* embedder_isolate) {
delete embedder_isolate;
// |Dart_IsolateGroupCleanupCallback|
void DartIsolate::DartIsolateGroupCleanupCallback(
std::shared_ptr<DartIsolate>* isolate_group_data) {
delete isolate_group_data;
}

fml::RefPtr<const DartSnapshot> DartIsolate::GetIsolateSnapshot() const {
Expand Down
13 changes: 7 additions & 6 deletions runtime/dart_isolate.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ class DartIsolate : public UIDartState {

void OnShutdownCallback();

// |Dart_IsolateCreateCallback|
static Dart_Isolate DartIsolateCreateCallback(
// |Dart_IsolateGroupCreateCallback|
static Dart_Isolate DartIsolateGroupCreateCallback(
const char* advisory_script_uri,
const char* advisory_script_entrypoint,
const char* package_root,
Expand Down Expand Up @@ -186,11 +186,12 @@ class DartIsolate : public UIDartState {

// |Dart_IsolateShutdownCallback|
static void DartIsolateShutdownCallback(
std::shared_ptr<DartIsolate>* embedder_isolate);
std::shared_ptr<DartIsolate>* isolate_group_data,
std::shared_ptr<DartIsolate>* isolate_data);

// |Dart_IsolateCleanupCallback|
static void DartIsolateCleanupCallback(
std::shared_ptr<DartIsolate>* embedder_isolate);
// |Dart_IsolateGroupCleanupCallback|
static void DartIsolateGroupCleanupCallback(
std::shared_ptr<DartIsolate>* isolate_group_data);

FML_DISALLOW_COPY_AND_ASSIGN(DartIsolate);
};
Expand Down
13 changes: 7 additions & 6 deletions runtime/dart_vm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,13 @@ DartVM::DartVM(std::shared_ptr<const DartVMData> vm_data,
params.vm_snapshot_data = vm_data_->GetVMSnapshot().GetDataMapping();
params.vm_snapshot_instructions =
vm_data_->GetVMSnapshot().GetInstructionsMapping();
params.create = reinterpret_cast<decltype(params.create)>(
DartIsolate::DartIsolateCreateCallback);
params.shutdown = reinterpret_cast<decltype(params.shutdown)>(
DartIsolate::DartIsolateShutdownCallback);
params.cleanup = reinterpret_cast<decltype(params.cleanup)>(
DartIsolate::DartIsolateCleanupCallback);
params.create_group = reinterpret_cast<decltype(params.create_group)>(
DartIsolate::DartIsolateGroupCreateCallback);
params.shutdown_isolate =
reinterpret_cast<decltype(params.shutdown_isolate)>(
DartIsolate::DartIsolateShutdownCallback);
params.cleanup_group = reinterpret_cast<decltype(params.cleanup_group)>(
DartIsolate::DartIsolateGroupCleanupCallback);
params.thread_exit = ThreadExitCallback;
params.get_service_assets = GetVMServiceAssetsArchiveCallback;
params.entropy_source = dart::bin::GetEntropy;
Expand Down
7 changes: 4 additions & 3 deletions shell/platform/fuchsia/dart/dart_component_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,13 @@ bool DartComponentController::CreateIsolate(
auto state = new std::shared_ptr<tonic::DartState>(new tonic::DartState(
namespace_fd, [this](Dart_Handle result) { MessageEpilogue(result); }));

isolate_ = Dart_CreateIsolate(
isolate_ = Dart_CreateIsolateGroup(
url_.c_str(), label_.c_str(), isolate_snapshot_data,
isolate_snapshot_instructions, shared_snapshot_data,
shared_snapshot_instructions, nullptr /* flags */, state, &error);
shared_snapshot_instructions, nullptr /* flags */,
state /* isolate_group_data */, state /* isolate_data */, &error);
if (!isolate_) {
FX_LOGF(ERROR, LOG_TAG, "Dart_CreateIsolate failed: %s", error);
FX_LOGF(ERROR, LOG_TAG, "Dart_CreateIsolateGroup failed: %s", error);
return false;
}

Expand Down
26 changes: 13 additions & 13 deletions shell/platform/fuchsia/dart/dart_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ const char* kDartVMArgs[] = {
// clang-format on
};

Dart_Isolate IsolateCreateCallback(const char* uri,
const char* name,
const char* package_root,
const char* package_config,
Dart_IsolateFlags* flags,
void* callback_data,
char** error) {
Dart_Isolate IsolateGroupCreateCallback(const char* uri,
const char* name,
const char* package_root,
const char* package_config,
Dart_IsolateFlags* flags,
void* callback_data,
char** error) {
if (std::string(uri) == DART_VM_SERVICE_ISOLATE_NAME) {
#if defined(DART_PRODUCT)
*error = strdup("The service isolate is not implemented in product mode");
Expand All @@ -81,7 +81,7 @@ Dart_Isolate IsolateCreateCallback(const char* uri,
return NULL;
}

void IsolateShutdownCallback(void* callback_data) {
void IsolateShutdownCallback(void* isolate_group_data, void* isolate_data) {
// The service isolate (and maybe later the kernel isolate) doesn't have an
// async loop.
auto dispatcher = async_get_default_dispatcher();
Expand All @@ -92,8 +92,8 @@ void IsolateShutdownCallback(void* callback_data) {
}
}

void IsolateCleanupCallback(void* callback_data) {
delete static_cast<std::shared_ptr<tonic::DartState>*>(callback_data);
void IsolateGroupCleanupCallback(void* isolate_group_data) {
delete static_cast<std::shared_ptr<tonic::DartState>*>(isolate_group_data);
}

void RunApplication(
Expand Down Expand Up @@ -167,9 +167,9 @@ DartRunner::DartRunner() : context_(sys::ComponentContext::Create()) {
params.vm_snapshot_data = vm_snapshot_data_.address();
params.vm_snapshot_instructions = vm_snapshot_instructions_.address();
#endif
params.create = IsolateCreateCallback;
params.shutdown = IsolateShutdownCallback;
params.cleanup = IsolateCleanupCallback;
params.create_group = IsolateGroupCreateCallback;
params.shutdown_isolate = IsolateShutdownCallback;
params.cleanup_group = IsolateGroupCleanupCallback;
params.entropy_source = EntropySource;
#if !defined(DART_PRODUCT)
params.get_service_assets = GetVMServiceAssetsArchiveCallback;
Expand Down
8 changes: 4 additions & 4 deletions shell/platform/fuchsia/dart/service_isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ Dart_Isolate CreateServiceIsolate(const char* uri,
#endif

auto state = new std::shared_ptr<tonic::DartState>(new tonic::DartState());
Dart_Isolate isolate = Dart_CreateIsolate(
Dart_Isolate isolate = Dart_CreateIsolateGroup(
uri, DART_VM_SERVICE_ISOLATE_NAME, mapped_isolate_snapshot_data.address(),
mapped_isolate_snapshot_instructions.address(),
mapped_shared_snapshot_data.address(),
mapped_shared_snapshot_instructions.address(), nullptr /* flags */, state,
error);
mapped_shared_snapshot_instructions.address(), nullptr /* flags */,
state /* isolate_group_data */, state /* isolate_data */, error);
if (!isolate) {
FX_LOGF(ERROR, LOG_TAG, "Dart_CreateIsolate failed: %s", *error);
FX_LOGF(ERROR, LOG_TAG, "Dart_CreateIsolateGroup failed: %s", *error);
return nullptr;
}

Expand Down

0 comments on commit fd24007

Please sign in to comment.