Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
kernel_isolate.cc
Go to the documentation of this file.
1// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#include "vm/kernel_isolate.h"
6
9#include "vm/dart_api_impl.h"
10#include "vm/dart_entry.h"
11#include "vm/flags.h"
12#include "vm/isolate.h"
13#include "vm/lockers.h"
14#include "vm/message.h"
15#include "vm/message_handler.h"
16#include "vm/native_arguments.h"
17#include "vm/native_entry.h"
19#include "vm/object.h"
20#include "vm/object_store.h"
21#include "vm/port.h"
22#include "vm/service.h"
23#include "vm/symbols.h"
24#include "vm/thread_pool.h"
25#include "vm/timeline.h"
26
27#if !defined(DART_PRECOMPILED_RUNTIME)
28
29namespace dart {
30
31#define Z (T->zone())
32
33DEFINE_FLAG(bool, trace_kernel, false, "Trace Kernel service requests.");
35 kernel_multiroot_filepaths,
36 nullptr,
37 "Comma-separated list of file paths that should be treated as roots"
38 " by frontend compiler.");
40 kernel_multiroot_scheme,
41 nullptr,
42 "URI scheme that replaces filepaths prefixes specified"
43 " by kernel_multiroot_filepaths option");
44
51
53 public:
54 virtual void Run() {
55 ASSERT(Isolate::Current() == nullptr);
56#ifdef SUPPORT_TIMELINE
57 TimelineBeginEndScope tbes(Timeline::GetVMStream(), "KernelIsolateStartup");
58#endif // SUPPORT_TIMELINE
59 char* error = nullptr;
60 Isolate* isolate = nullptr;
61
62 Dart_IsolateGroupCreateCallback create_group_callback =
64 ASSERT(create_group_callback != nullptr);
65
66 // Note: these flags must match those passed to the VM during
67 // the app-jit training run (see //utils/kernel-service/BUILD.gn).
68 Dart_IsolateFlags api_flags;
69 Isolate::FlagsInitialize(&api_flags);
70 api_flags.enable_asserts = false;
71 api_flags.null_safety = true;
72 api_flags.is_system_isolate = true;
73 api_flags.is_kernel_isolate = true;
74#if !defined(DART_PRECOMPILER)
75 api_flags.use_field_guards = true;
76#endif
77#if !defined(DART_PRECOMPILER)
78 api_flags.use_osr = true;
79#endif
80
81 isolate = reinterpret_cast<Isolate*>(
82 create_group_callback(KernelIsolate::kName, KernelIsolate::kName,
83 nullptr, nullptr, &api_flags, nullptr, &error));
84 if (isolate == nullptr) {
85 if (FLAG_trace_kernel) {
86 OS::PrintErr(DART_KERNEL_ISOLATE_NAME ": Isolate creation error: %s\n",
87 error);
88 }
89 free(error);
90 error = nullptr;
93 return;
94 }
95
96 bool got_unwind;
97 {
98 ASSERT(Isolate::Current() == nullptr);
99 StartIsolateScope start_scope(isolate);
100 got_unwind = RunMain(isolate);
101 }
103
104 if (got_unwind) {
105 ShutdownIsolate(reinterpret_cast<uword>(isolate));
106 return;
107 }
108
109 // isolate_ was set as side effect of create callback.
110 ASSERT(isolate->is_kernel_isolate());
111
112 isolate->message_handler()->Run(isolate->group()->thread_pool(), nullptr,
114 reinterpret_cast<uword>(isolate));
115 }
116
117 protected:
118 static void ShutdownIsolate(uword parameter) {
119 if (FLAG_trace_kernel) {
120 OS::PrintErr(DART_KERNEL_ISOLATE_NAME ": ShutdownIsolate\n");
121 }
123 Dart_EnterIsolate(reinterpret_cast<Dart_Isolate>(parameter));
124 {
125 auto T = Thread::Current();
126 TransitionNativeToVM transition(T);
127 StackZone zone(T);
128 HandleScope handle_scope(T);
129
130 auto I = T->isolate();
131 ASSERT(I->is_kernel_isolate());
132
133 // Print the error if there is one. This may execute dart code to
134 // print the exception object, so we need to use a StartIsolateScope.
136 error = T->sticky_error();
137 if (!error.IsNull() && !error.IsUnwindError()) {
139 error.ToErrorCString());
140 }
141 error = I->sticky_error();
142 if (!error.IsNull() && !error.IsUnwindError()) {
144 error.ToErrorCString());
145 }
146 }
148 if (FLAG_trace_kernel) {
149 OS::PrintErr(DART_KERNEL_ISOLATE_NAME ": Shutdown.\n");
150 }
152 }
153
156 ASSERT(I == T->isolate());
157 StackZone zone(T);
158 // Invoke main which will return the port to which load requests are sent.
159 const Library& root_library =
160 Library::Handle(Z, I->group()->object_store()->root_library());
161 if (root_library.IsNull()) {
163 ": Embedder did not install a script.");
164 // Kernel isolate is not supported by embedder.
165 return false;
166 }
167 ASSERT(!root_library.IsNull());
168 const String& entry_name = String::Handle(Z, String::New("main"));
169 ASSERT(!entry_name.IsNull());
170 const Function& entry = Function::Handle(
171 Z, root_library.LookupFunctionAllowPrivate(entry_name));
172 if (entry.IsNull()) {
173 // Kernel isolate is not supported by embedder.
175 ": Embedder did not provide a main function.");
176 return false;
177 }
178 ASSERT(!entry.IsNull());
180 Z, DartEntry::InvokeFunction(entry, Object::empty_array()));
181 ASSERT(!result.IsNull());
182 if (result.IsError()) {
183 // Kernel isolate did not initialize properly.
184 if (FLAG_trace_kernel) {
185 const Error& error = Error::Cast(result);
187 ": Calling main resulted in an error: %s",
188 error.ToErrorCString());
189 }
190 if (result.IsUnwindError()) {
191 return true;
192 }
193 return false;
194 }
195 ASSERT(result.IsReceivePort());
196 const ReceivePort& rp = ReceivePort::Cast(result);
198 return false;
199 }
200};
201
203 // Grab the isolate create callback here to avoid race conditions with tests
204 // that change this after Dart_Initialize returns.
205 if (FLAG_trace_kernel) {
206 OS::PrintErr(DART_KERNEL_ISOLATE_NAME ": InitializeState\n");
207 }
209 if (create_group_callback_ == nullptr) {
211 return;
212 }
213}
214
216 if (create_group_callback_ == nullptr) {
217 if (FLAG_trace_kernel) {
219 ": Attempted to start kernel isolate without setting "
220 "Dart_InitializeParams property 'start_kernel_isolate' "
221 "to true\n");
222 }
223 return false;
224 }
225 bool start_task = false;
226 {
228 if (state_ == kNotStarted) {
229 if (FLAG_trace_kernel) {
231 }
232 start_task = true;
234 ml.NotifyAll();
235 }
236 }
237 bool task_started = true;
238 if (start_task) {
239 task_started = Dart::thread_pool()->Run<RunKernelTask>();
240 }
241 return task_started;
242}
243
246 while (state_ == kStarting) {
247 ml.Wait();
248 }
249 if (state_ == kStopped || state_ == kNotStarted) {
250 return;
251 }
254 ml.NotifyAll();
256 while (state_ != kStopped) {
257 ml.Wait();
258 }
259}
260
263 ASSERT(I == T->isolate());
264 ASSERT(I != nullptr);
265 if (!I->is_kernel_isolate()) {
266 // Not kernel isolate.
267 return;
268 }
269 ASSERT(!Exists());
270 if (FLAG_trace_kernel) {
271 OS::PrintErr(DART_KERNEL_ISOLATE_NAME ": InitCallback for %s.\n",
272 I->name());
273 }
275}
276
279 return (kernel_port_ != ILLEGAL_PORT) && (isolate_ != nullptr);
280}
281
284 return isolate_ != nullptr;
285}
286
289 ASSERT(isolate == nullptr || isolate->is_kernel_isolate());
290 isolate_ = isolate;
291 ml.NotifyAll();
292}
293
296 kernel_port_ = port;
297 ml.NotifyAll();
298}
299
306
313
320
322 VMTagScope tagScope(Thread::Current(), VMTag::kLoadWaitTagId);
324 while (state_ == kStarting && (kernel_port_ == ILLEGAL_PORT)) {
325 ml.Wait();
326 }
327 return kernel_port_;
328}
329
330static Dart_CObject BuildFilesPairs(int source_files_count,
331 Dart_SourceFile source_files[]) {
332 Dart_CObject files;
334 files.value.as_array.length = source_files_count * 2;
335 // typedef Dart_CObject* Dart_CObjectPtr;
336 Dart_CObject** fileNamePairs = new Dart_CObject*[source_files_count * 2];
337 for (int i = 0; i < source_files_count; i++) {
338 Dart_CObject* source_uri = new Dart_CObject();
339 source_uri->type = Dart_CObject_kString;
340 source_uri->value.as_string = const_cast<char*>(source_files[i].uri);
341 fileNamePairs[i * 2] = source_uri;
342 Dart_CObject* source_code = new Dart_CObject();
343
344 if (source_files[i].source != nullptr) {
345 source_code->type = Dart_CObject_kTypedData;
347 source_code->value.as_typed_data.length = strlen(source_files[i].source);
348 source_code->value.as_typed_data.values =
349 reinterpret_cast<const uint8_t*>(source_files[i].source);
350 } else {
351 source_code->type = Dart_CObject_kNull;
352 }
353 fileNamePairs[(i * 2) + 1] = source_code;
354 }
355 files.value.as_array.values = fileNamePairs;
356 return files;
357}
358
359static void ReleaseFilesPairs(const Dart_CObject& files) {
360 for (intptr_t i = 0; i < files.value.as_array.length; i++) {
361 delete files.value.as_array.values[i];
362 }
363 delete[] files.value.as_array.values;
364}
365
366static void PassThroughFinalizer(void* isolate_callback_data, void* peer) {}
367
368MallocGrowableArray<char*>* KernelIsolate::experimental_flags_ =
369 new MallocGrowableArray<char*>();
370
371void KernelIsolate::AddExperimentalFlag(const char* value) {
372 char* save_ptr; // Needed for strtok_r.
373 char* temp = Utils::StrDup(value);
374 char* token = strtok_r(temp, ",", &save_ptr);
375 while (token != nullptr) {
377 token = strtok_r(nullptr, ",", &save_ptr);
378 }
379 free(temp);
380}
381
383 const char* value = GetExperimentalFeatureName(feature);
384 for (const char* str : *experimental_flags_) {
385 if (strcmp(str, value) == 0) {
386 return true;
387 } else if (strstr(str, "no-") == str && strcmp(str + 3, value) == 0) {
388 return false;
389 }
390 }
391 return GetExperimentalFeatureDefault(feature);
392}
393
395 enable_experiment,
396 "Comma separated list of experimental features.");
397
399 public:
401 : monitor_(),
402 port_(Dart_NewNativePort("kernel-compilation-port",
403 &HandleResponse,
404 false)),
405 next_(nullptr),
406 prev_(nullptr) {
407 RegisterRequest(this);
409 result_.error = nullptr;
410 result_.kernel = nullptr;
411 result_.kernel_size = 0;
412 }
413
415 UnregisterRequest(this);
416 if (port_ != ILLEGAL_PORT) {
418 }
419 }
420
421 intptr_t setDillData(Dart_CObject** dills_array,
422 intptr_t dill_num,
423 const uint8_t* buffer,
424 intptr_t buffer_size) {
425 if (buffer != nullptr) {
426 dills_array[dill_num] = new Dart_CObject;
427 dills_array[dill_num]->type = Dart_CObject_kExternalTypedData;
428 dills_array[dill_num]->value.as_external_typed_data.type =
430 dills_array[dill_num]->value.as_external_typed_data.length = buffer_size;
431 dills_array[dill_num]->value.as_external_typed_data.data =
432 const_cast<uint8_t*>(buffer);
433 dills_array[dill_num]->value.as_external_typed_data.peer =
434 const_cast<uint8_t*>(buffer);
435 dills_array[dill_num]->value.as_external_typed_data.callback =
437 dill_num++;
438 }
439 return dill_num;
440 }
441
443 Dart_Port kernel_port,
444 const uint8_t* platform_kernel,
445 intptr_t platform_kernel_size,
446 const char* expression,
447 const Array& definitions,
448 const Array& definition_types,
449 const Array& type_definitions,
450 const Array& type_bounds,
451 const Array& type_defaults,
452 char const* library_uri,
453 char const* klass,
454 char const* method,
455 int64_t token_pos,
456 char const* script_uri,
457 bool is_static,
458 const MallocGrowableArray<char*>* experimental_flags) {
459 if (port_ == ILLEGAL_PORT) {
462 result.error =
463 Utils::StrDup("Error Kernel Isolate : unable to create reply port");
464 return result;
465 }
466 Thread* thread = Thread::Current();
467 TransitionNativeToVM transition(thread);
468 Dart_CObject tag;
471
472 Dart_CObject send_port;
473 send_port.type = Dart_CObject_kSendPort;
474 send_port.value.as_send_port.id = port_;
476
477 Dart_CObject dart_platform_kernel;
478 if (platform_kernel != nullptr) {
479 dart_platform_kernel.type = Dart_CObject_kExternalTypedData;
480 dart_platform_kernel.value.as_external_typed_data.type =
482 dart_platform_kernel.value.as_external_typed_data.length =
483 platform_kernel_size;
484 dart_platform_kernel.value.as_external_typed_data.data =
485 const_cast<uint8_t*>(platform_kernel);
486 dart_platform_kernel.value.as_external_typed_data.peer =
487 const_cast<uint8_t*>(platform_kernel);
488 dart_platform_kernel.value.as_external_typed_data.callback =
490 } else {
491 // If nullptr, the kernel service looks up the platform dill file
492 // next to the executable.
493 dart_platform_kernel.type = Dart_CObject_kNull;
494 }
495
496 Dart_CObject expression_object;
497 expression_object.type = Dart_CObject_kString;
498 expression_object.value.as_string = const_cast<char*>(expression);
499
500 Dart_CObject definitions_object;
501 intptr_t num_definitions = definitions.Length();
502 definitions_object.type = Dart_CObject_kArray;
503 definitions_object.value.as_array.length = num_definitions;
504
505 Dart_CObject** definitions_array = new Dart_CObject*[num_definitions];
506 for (intptr_t i = 0; i < num_definitions; ++i) {
507 definitions_array[i] = new Dart_CObject;
508 definitions_array[i]->type = Dart_CObject_kString;
509 definitions_array[i]->value.as_string = const_cast<char*>(
510 String::CheckedHandle(thread->zone(), definitions.At(i)).ToCString());
511 }
512 definitions_object.value.as_array.values = definitions_array;
513
514 Dart_CObject definition_types_object;
515 intptr_t num_definition_types = definition_types.Length();
516 definition_types_object.type = Dart_CObject_kArray;
517 definition_types_object.value.as_array.length = num_definition_types;
518
519 Dart_CObject** definition_types_array =
520 new Dart_CObject*[num_definition_types];
521 for (intptr_t i = 0; i < num_definition_types; ++i) {
522 definition_types_array[i] = new Dart_CObject;
523 definition_types_array[i]->type = Dart_CObject_kString;
524 definition_types_array[i]->value.as_string = const_cast<char*>(
525 String::CheckedHandle(thread->zone(), definition_types.At(i))
526 .ToCString());
527 }
528 definition_types_object.value.as_array.values = definition_types_array;
529
530 Dart_CObject type_definitions_object;
531 intptr_t num_type_definitions = type_definitions.Length();
532 type_definitions_object.type = Dart_CObject_kArray;
533 type_definitions_object.value.as_array.length = num_type_definitions;
534
535 Dart_CObject** type_definitions_array =
536 new Dart_CObject*[num_type_definitions];
537 for (intptr_t i = 0; i < num_type_definitions; ++i) {
538 type_definitions_array[i] = new Dart_CObject;
539 type_definitions_array[i]->type = Dart_CObject_kString;
540 type_definitions_array[i]->value.as_string = const_cast<char*>(
541 String::CheckedHandle(thread->zone(), type_definitions.At(i))
542 .ToCString());
543 }
544 type_definitions_object.value.as_array.values = type_definitions_array;
545
546 Dart_CObject type_bounds_object;
547 intptr_t num_type_bounds = type_bounds.Length();
548 type_bounds_object.type = Dart_CObject_kArray;
549 type_bounds_object.value.as_array.length = num_type_bounds;
550
551 Dart_CObject** type_bounds_array = new Dart_CObject*[num_type_bounds];
552 for (intptr_t i = 0; i < num_type_bounds; ++i) {
553 type_bounds_array[i] = new Dart_CObject;
554 type_bounds_array[i]->type = Dart_CObject_kString;
555 type_bounds_array[i]->value.as_string = const_cast<char*>(
556 String::CheckedHandle(thread->zone(), type_bounds.At(i)).ToCString());
557 }
558 type_bounds_object.value.as_array.values = type_bounds_array;
559
560 Dart_CObject type_defaults_object;
561 intptr_t num_type_defaults = type_defaults.Length();
562 type_defaults_object.type = Dart_CObject_kArray;
563 type_defaults_object.value.as_array.length = num_type_defaults;
564
565 Dart_CObject** type_defaults_array = new Dart_CObject*[num_type_defaults];
566 for (intptr_t i = 0; i < num_type_defaults; ++i) {
567 type_defaults_array[i] = new Dart_CObject;
568 type_defaults_array[i]->type = Dart_CObject_kString;
569 type_defaults_array[i]->value.as_string = const_cast<char*>(
570 String::CheckedHandle(thread->zone(), type_defaults.At(i))
571 .ToCString());
572 }
573 type_defaults_object.value.as_array.values = type_defaults_array;
574
575 Dart_CObject library_uri_object;
576 library_uri_object.type = Dart_CObject_kString;
577 library_uri_object.value.as_string = const_cast<char*>(library_uri);
578
579 Dart_CObject class_object;
580 if (klass != nullptr) {
581 class_object.type = Dart_CObject_kString;
582 class_object.value.as_string = const_cast<char*>(klass);
583 } else {
584 class_object.type = Dart_CObject_kNull;
585 }
586
587 Dart_CObject method_object;
588 if (method != nullptr) {
589 method_object.type = Dart_CObject_kString;
590 method_object.value.as_string = const_cast<char*>(method);
591 } else {
592 method_object.type = Dart_CObject_kNull;
593 }
594
595 Dart_CObject is_static_object;
596 is_static_object.type = Dart_CObject_kBool;
597 is_static_object.value.as_bool = is_static;
598
599 Dart_CObject token_pos_object;
600 token_pos_object.type = Dart_CObject_kInt64;
601 token_pos_object.value.as_int64 = token_pos;
602
603 Dart_CObject script_uri_object;
604 if (script_uri != nullptr) {
605 script_uri_object.type = Dart_CObject_kString;
606 script_uri_object.value.as_string = const_cast<char*>(script_uri);
607 } else {
608 script_uri_object.type = Dart_CObject_kNull;
609 }
610
611 auto isolate_group = thread->isolate_group();
612 auto source = isolate_group->source();
613
614 Dart_CObject isolate_id;
615 isolate_id.type = Dart_CObject_kInt64;
616 isolate_id.value.as_int64 = static_cast<int64_t>(isolate_group->id());
617
618 intptr_t num_dills = 0;
619 if (source->kernel_buffer != nullptr) {
620 num_dills++;
621 }
622 if (source->script_kernel_buffer != nullptr) {
623 num_dills++;
624 }
625 Array& loaded_blobs = Array::Handle();
626 if (source->loaded_blobs_ != nullptr) {
627 loaded_blobs = source->loaded_blobs_;
628 WeakProperty& weak_property = WeakProperty::Handle();
629 for (intptr_t i = 0; i < loaded_blobs.Length(); i++) {
630 weak_property ^= loaded_blobs.At(i);
631 if (weak_property.key() != ExternalTypedData::null()) {
632 num_dills++;
633 }
634 }
635 }
636
637 Dart_CObject dills_object;
638 dills_object.type = Dart_CObject_kArray;
639 dills_object.value.as_array.length = num_dills;
640
641 Dart_CObject** dills_array = new Dart_CObject*[num_dills];
642 intptr_t dill_num = 0;
643 dill_num = setDillData(dills_array, dill_num, source->kernel_buffer,
644 source->kernel_buffer_size);
645 dill_num = setDillData(dills_array, dill_num, source->script_kernel_buffer,
646 source->script_kernel_size);
647 if (!loaded_blobs.IsNull()) {
648 WeakProperty& weak_property = WeakProperty::Handle();
649 for (intptr_t i = 0; i < loaded_blobs.Length(); i++) {
650 weak_property ^= loaded_blobs.At(i);
651 if (weak_property.key() != ExternalTypedData::null()) {
652 ExternalTypedData& externalTypedData = ExternalTypedData::Handle(
653 thread->zone(), ExternalTypedData::RawCast(weak_property.key()));
654 NoSafepointScope no_safepoint(thread);
655 const uint8_t* data = const_cast<uint8_t*>(
656 reinterpret_cast<uint8_t*>(externalTypedData.DataAddr(0)));
657 dill_num = setDillData(dills_array, dill_num, data,
658 externalTypedData.Length());
659 }
660 }
661 }
662 dills_object.value.as_array.values = dills_array;
663
664 Dart_CObject num_blob_loads;
665 num_blob_loads.type = Dart_CObject_kInt64;
666 num_blob_loads.value.as_int64 = source->num_blob_loads_;
667
668 Dart_CObject enable_asserts;
669 enable_asserts.type = Dart_CObject_kBool;
670 enable_asserts.value.as_bool = isolate_group->asserts();
671
672 intptr_t num_experimental_flags = experimental_flags->length();
673 Dart_CObject** experimental_flags_array =
674 new Dart_CObject*[num_experimental_flags];
675 for (intptr_t i = 0; i < num_experimental_flags; ++i) {
676 experimental_flags_array[i] = new Dart_CObject;
677 experimental_flags_array[i]->type = Dart_CObject_kString;
678 experimental_flags_array[i]->value.as_string = (*experimental_flags)[i];
679 }
680 Dart_CObject experimental_flags_object;
681 experimental_flags_object.type = Dart_CObject_kArray;
682 experimental_flags_object.value.as_array.values = experimental_flags_array;
683 experimental_flags_object.value.as_array.length = num_experimental_flags;
684
685 Dart_CObject enable_mirrors;
686 enable_mirrors.type = Dart_CObject_kBool;
687 enable_mirrors.value.as_bool = FLAG_enable_mirrors;
688
691 Dart_CObject* message_arr[] = {&tag,
692 &send_port,
693 &isolate_id,
694 &dart_platform_kernel,
695 &expression_object,
696 &definitions_object,
697 &definition_types_object,
698 &type_definitions_object,
699 &type_bounds_object,
700 &type_defaults_object,
701 &library_uri_object,
702 &class_object,
703 &method_object,
704 &is_static_object,
705 &token_pos_object,
706 &script_uri_object,
707 &dills_object,
708 &num_blob_loads,
709 &enable_asserts,
710 &experimental_flags_object,
711 &enable_mirrors};
712 message.value.as_array.values = message_arr;
713 message.value.as_array.length = ARRAY_SIZE(message_arr);
714
715 {
716 TransitionVMToNative transition(thread);
717
718 // Send the message.
719 Dart_PostCObject(kernel_port, &message);
720
721 // Wait for reply to arrive.
722 VMTagScope tagScope(thread, VMTag::kLoadWaitTagId);
723 MonitorLocker ml(&monitor_);
725 ml.Wait();
726 }
727 }
728
729 for (intptr_t i = 0; i < num_definitions; ++i) {
730 delete definitions_array[i];
731 }
732 delete[] definitions_array;
733
734 for (intptr_t i = 0; i < num_definition_types; ++i) {
735 delete definition_types_array[i];
736 }
737 delete[] definition_types_array;
738
739 for (intptr_t i = 0; i < num_type_definitions; ++i) {
740 delete type_definitions_array[i];
741 }
742 delete[] type_definitions_array;
743
744 for (intptr_t i = 0; i < num_type_bounds; ++i) {
745 delete type_bounds_array[i];
746 }
747 delete[] type_bounds_array;
748
749 for (intptr_t i = 0; i < num_type_defaults; ++i) {
750 delete type_defaults_array[i];
751 }
752 delete[] type_defaults_array;
753
754 for (intptr_t i = 0; i < num_dills; ++i) {
755 delete dills_array[i];
756 }
757 delete[] dills_array;
758
759 for (intptr_t i = 0; i < num_experimental_flags; ++i) {
760 delete experimental_flags_array[i];
761 }
762 delete[] experimental_flags_array;
763
764 return result_;
765 }
766
768 int request_tag,
769 Dart_Port kernel_port,
770 const char* script_uri,
771 const uint8_t* platform_kernel,
772 intptr_t platform_kernel_size,
773 int source_files_count,
774 Dart_SourceFile source_files[],
775 bool incremental_compile,
776 bool for_snapshot,
777 bool embed_sources,
778 const char* package_config,
779 const char* multiroot_filepaths,
780 const char* multiroot_scheme,
781 const MallocGrowableArray<char*>* experimental_flags,
783 // Build the message for the Kernel isolate.
784 // tag is used to specify which operation the frontend should perform.
785 if (port_ == ILLEGAL_PORT) {
788 result.error =
789 Utils::StrDup("Error Kernel Isolate : unable to create reply port");
790 return result;
791 }
792 Dart_CObject tag;
794 tag.value.as_int32 = request_tag;
795
796 Dart_CObject send_port;
797 send_port.type = Dart_CObject_kSendPort;
798 send_port.value.as_send_port.id = port_;
800
801 Dart_CObject uri;
802 if (script_uri != nullptr) {
804 uri.value.as_string = const_cast<char*>(script_uri);
805 } else {
807 }
808
809 Dart_CObject dart_platform_kernel;
810 if (platform_kernel != nullptr) {
811 dart_platform_kernel.type = Dart_CObject_kExternalTypedData;
812 dart_platform_kernel.value.as_external_typed_data.type =
814 dart_platform_kernel.value.as_external_typed_data.length =
815 platform_kernel_size;
816 dart_platform_kernel.value.as_external_typed_data.data =
817 const_cast<uint8_t*>(platform_kernel);
818 dart_platform_kernel.value.as_external_typed_data.peer =
819 const_cast<uint8_t*>(platform_kernel);
820 dart_platform_kernel.value.as_external_typed_data.callback =
822 } else {
823 // If nullptr, the kernel service looks up the platform dill file
824 // next to the executable.
825 dart_platform_kernel.type = Dart_CObject_kNull;
826 }
827
828 Dart_CObject dart_incremental;
829 dart_incremental.type = Dart_CObject_kBool;
830 dart_incremental.value.as_bool = incremental_compile;
831
832 Dart_CObject dart_snapshot;
833 dart_snapshot.type = Dart_CObject_kBool;
834 dart_snapshot.value.as_bool = for_snapshot;
835
836 Dart_CObject dart_embed_sources;
837 dart_embed_sources.type = Dart_CObject_kBool;
838 dart_embed_sources.value.as_bool = embed_sources;
839
840 // TODO(aam): Assert that isolate exists once we move CompileAndReadScript
841 // compilation logic out of CreateIsolateAndSetupHelper and into
842 // IsolateSetupHelper in main.cc.
843 auto thread = Thread::Current();
844 auto isolate_group = thread != nullptr ? thread->isolate_group() : nullptr;
845
846 if (incremental_compile) {
847 ASSERT(isolate_group != nullptr);
848 }
849 Dart_CObject isolate_id;
850 isolate_id.type = Dart_CObject_kInt64;
851 isolate_id.value.as_int64 = isolate_group != nullptr
852 ? static_cast<int64_t>(isolate_group->id())
853 : 0;
854
857
858 Dart_CObject files = BuildFilesPairs(source_files_count, source_files);
859
860 Dart_CObject enable_asserts;
861 enable_asserts.type = Dart_CObject_kBool;
862 enable_asserts.value.as_bool = isolate_group != nullptr
863 ? isolate_group->asserts()
864 : FLAG_enable_asserts;
865
866 intptr_t num_experimental_flags = experimental_flags->length();
867 Dart_CObject** experimental_flags_array =
868 new Dart_CObject*[num_experimental_flags];
869 for (intptr_t i = 0; i < num_experimental_flags; ++i) {
870 experimental_flags_array[i] = new Dart_CObject;
871 experimental_flags_array[i]->type = Dart_CObject_kString;
872 experimental_flags_array[i]->value.as_string = (*experimental_flags)[i];
873 }
874 Dart_CObject experimental_flags_object;
875 experimental_flags_object.type = Dart_CObject_kArray;
876 experimental_flags_object.value.as_array.values = experimental_flags_array;
877 experimental_flags_object.value.as_array.length = num_experimental_flags;
878
879 Dart_CObject package_config_uri;
880 if (package_config != nullptr) {
881 package_config_uri.type = Dart_CObject_kString;
882 package_config_uri.value.as_string = const_cast<char*>(package_config);
883 } else {
884 package_config_uri.type = Dart_CObject_kNull;
885 }
886
887 Dart_CObject multiroot_filepaths_object;
888 {
889 const char* filepaths = multiroot_filepaths != nullptr
890 ? multiroot_filepaths
891 : FLAG_kernel_multiroot_filepaths;
892 if (filepaths != nullptr) {
893 multiroot_filepaths_object.type = Dart_CObject_kString;
894 multiroot_filepaths_object.value.as_string =
895 const_cast<char*>(filepaths);
896 } else {
897 multiroot_filepaths_object.type = Dart_CObject_kNull;
898 }
899 }
900
901 Dart_CObject multiroot_scheme_object;
902 {
903 const char* scheme = multiroot_scheme != nullptr
904 ? multiroot_scheme
905 : FLAG_kernel_multiroot_scheme;
906 if (scheme != nullptr) {
907 multiroot_scheme_object.type = Dart_CObject_kString;
908 multiroot_scheme_object.value.as_string = const_cast<char*>(scheme);
909 } else {
910 multiroot_scheme_object.type = Dart_CObject_kNull;
911 }
912 }
913
914 Dart_CObject verbosity_str;
915 verbosity_str.type = Dart_CObject_kString;
916 verbosity_str.value.as_string =
917 const_cast<char*>(KernelCompilationVerbosityLevelToString(verbosity));
918
919 Dart_CObject enable_mirrors;
920 enable_mirrors.type = Dart_CObject_kBool;
921 enable_mirrors.value.as_bool = FLAG_enable_mirrors;
922
923 Dart_CObject* message_arr[] = {&tag,
924 &send_port,
925 &uri,
926 &dart_platform_kernel,
927 &dart_incremental,
928 &dart_snapshot,
929 &dart_embed_sources,
930 &isolate_id,
931 &files,
932 &enable_asserts,
933 &experimental_flags_object,
934 &package_config_uri,
935 &multiroot_filepaths_object,
936 &multiroot_scheme_object,
937 &verbosity_str,
938 &enable_mirrors};
939 message.value.as_array.values = message_arr;
940 message.value.as_array.length = ARRAY_SIZE(message_arr);
941 // Send the message.
942 Dart_PostCObject(kernel_port, &message);
943
944 ReleaseFilesPairs(files);
945
946 // Wait for reply to arrive.
947 VMTagScope tagScope(Thread::Current(), VMTag::kLoadWaitTagId);
948 MonitorLocker ml(&monitor_);
950 ml.Wait();
951 }
952
953 for (intptr_t i = 0; i < num_experimental_flags; ++i) {
954 delete experimental_flags_array[i];
955 }
956 delete[] experimental_flags_array;
957
958 return result_;
959 }
960
961 private:
962 void LoadKernelFromResponse(Dart_CObject* response) {
963 ASSERT((response->type == Dart_CObject_kTypedData) ||
964 (response->type == Dart_CObject_kNull));
965
966 if (response->type == Dart_CObject_kNull) {
967 return;
968 }
970 result_.kernel_size = response->value.as_typed_data.length;
971 result_.kernel = static_cast<uint8_t*>(malloc(result_.kernel_size));
972 memmove(result_.kernel, response->value.as_typed_data.values,
973 result_.kernel_size);
974 }
975
976 // Possible responses from the Kernel isolate:
977 //
978 // [Ok, Uint8List KernelBinary]
979 // [Error, String error, Uint8List KernelBinary]
980 // [Crash, String error]
981 //
982 void HandleResponseImpl(Dart_CObject* message) {
984 ASSERT(message->value.as_array.length >= 1);
985
987
988 MonitorLocker ml(&monitor_);
989
990 ASSERT(response[0]->type == Dart_CObject_kInt32);
991 result_.status = static_cast<Dart_KernelCompilationStatus>(
992 message->value.as_array.values[0]->value.as_int32);
993
995 LoadKernelFromResponse(response[1]);
996 } else {
998 LoadKernelFromResponse(response[2]);
999 }
1000 // This is an error.
1001 ASSERT(response[1]->type == Dart_CObject_kString);
1002 result_.error = Utils::StrDup(response[1]->value.as_string);
1003 }
1004 ml.Notify();
1005 }
1006
1007 static void HandleResponse(Dart_Port port, Dart_CObject* message) {
1008 MonitorLocker locker(requests_monitor_);
1009 KernelCompilationRequest* rq = FindRequestLocked(port);
1010 if (rq == nullptr) {
1011 return;
1012 }
1013 rq->HandleResponseImpl(message);
1014 }
1015
1016 static void RegisterRequest(KernelCompilationRequest* rq) {
1017 MonitorLocker locker(requests_monitor_);
1018 rq->next_ = requests_;
1019 if (requests_ != nullptr) {
1020 requests_->prev_ = rq;
1021 }
1022 requests_ = rq;
1023 }
1024
1025 static void UnregisterRequest(KernelCompilationRequest* rq) {
1026 MonitorLocker locker(requests_monitor_);
1027 if (rq->next_ != nullptr) {
1028 rq->next_->prev_ = rq->prev_;
1029 }
1030 if (rq->prev_ != nullptr) {
1031 rq->prev_->next_ = rq->next_;
1032 } else {
1033 requests_ = rq->next_;
1034 }
1035 }
1036
1037 // Note: Caller must hold requests_monitor_.
1038 static KernelCompilationRequest* FindRequestLocked(Dart_Port port) {
1039 for (KernelCompilationRequest* rq = requests_; rq != nullptr;
1040 rq = rq->next_) {
1041 if (rq->port_ == port) {
1042 return rq;
1043 }
1044 }
1045 return nullptr;
1046 }
1047
1048 static const char* KernelCompilationVerbosityLevelToString(
1050 switch (verbosity) {
1052 return "error";
1054 return "warning";
1056 return "info";
1058 return "all";
1059 default:
1060 UNREACHABLE();
1061 }
1062 }
1063
1064 // This monitor must be held whenever linked list of requests is accessed.
1065 static Monitor* requests_monitor_;
1066
1067 // Linked list of all active requests. Used to find a request by port number.
1068 // Guarded by requests_monitor_ lock.
1069 static KernelCompilationRequest* requests_;
1070
1071 Monitor monitor_;
1072 Dart_Port port_;
1073
1074 // Linked list of active requests. Guarded by requests_monitor_ lock.
1077
1078 Dart_KernelCompilationResult result_ = {};
1079};
1080
1081Monitor* KernelCompilationRequest::requests_monitor_ = new Monitor();
1082KernelCompilationRequest* KernelCompilationRequest::requests_ = nullptr;
1083
1085 const char* script_uri,
1086 const uint8_t* platform_kernel,
1087 intptr_t platform_kernel_size,
1088 int source_file_count,
1089 Dart_SourceFile source_files[],
1090 bool incremental_compile,
1091 bool for_snapshot,
1092 bool embed_sources,
1093 const char* package_config,
1094 const char* multiroot_filepaths,
1095 const char* multiroot_scheme,
1097 // Start the kernel Isolate if it is not already running.
1098 if (!Start()) {
1101 result.error = Utils::StrDup("Error while starting Kernel isolate task");
1102 return result;
1103 }
1104
1105 // This must be the main script to be loaded. Wait for Kernel isolate
1106 // to finish initialization.
1107 Dart_Port kernel_port = WaitForKernelPort();
1108 if (kernel_port == ILLEGAL_PORT) {
1111 result.error = Utils::StrDup("Error while initializing Kernel isolate");
1112 return result;
1113 }
1114
1116 return request.SendAndWaitForResponse(
1117 kCompileTag, kernel_port, script_uri, platform_kernel,
1118 platform_kernel_size, source_file_count, source_files,
1119 incremental_compile, for_snapshot, embed_sources, package_config,
1120 multiroot_filepaths, multiroot_scheme, experimental_flags_, verbosity);
1121}
1122
1124 Dart_Port kernel_port = WaitForKernelPort();
1125 if (kernel_port == ILLEGAL_PORT) {
1128 result.error = Utils::StrDup("Error while initializing Kernel isolate");
1129 return result;
1130 }
1131
1133 return request.SendAndWaitForResponse(
1134 kListDependenciesTag, kernel_port, nullptr, nullptr, 0, 0, nullptr, false,
1135 false, false, nullptr, nullptr, nullptr, experimental_flags_,
1137}
1138
1140 // This must be the main script to be loaded. Wait for Kernel isolate
1141 // to finish initialization.
1142 Dart_Port kernel_port = WaitForKernelPort();
1143 if (kernel_port == ILLEGAL_PORT) {
1146 result.error = Utils::StrDup("Error while initializing Kernel isolate");
1147 return result;
1148 }
1149
1151 return request.SendAndWaitForResponse(
1152 kAcceptTag, kernel_port, nullptr, nullptr, 0, 0, nullptr, true, false,
1153 false, nullptr, nullptr, nullptr, experimental_flags_,
1155}
1156
1158 // This must be the main script to be loaded. Wait for Kernel isolate
1159 // to finish initialization.
1160 Dart_Port kernel_port = WaitForKernelPort();
1161 if (kernel_port == ILLEGAL_PORT) {
1164 result.error = Utils::StrDup("Error while initializing Kernel isolate");
1165 return result;
1166 }
1167
1169 return request.SendAndWaitForResponse(
1170 kRejectTag, kernel_port, nullptr, nullptr, 0, 0, nullptr, true, false,
1171 false, nullptr, nullptr, nullptr, experimental_flags_,
1173}
1174
1176 const uint8_t* platform_kernel,
1177 intptr_t platform_kernel_size,
1178 const char* expression,
1179 const Array& definitions,
1180 const Array& definition_types,
1181 const Array& type_definitions,
1182 const Array& type_bounds,
1183 const Array& type_defaults,
1184 const char* library_url,
1185 const char* klass,
1186 const char* method,
1187 TokenPosition token_pos,
1188 const char* script_uri,
1189 bool is_static) {
1190 Dart_Port kernel_port = WaitForKernelPort();
1191 if (kernel_port == ILLEGAL_PORT) {
1194 result.error = Utils::StrDup("Error while initializing Kernel isolate");
1195 return result;
1196 }
1197
1198 intptr_t token_pos_int = -1;
1199 if (token_pos.IsReal()) {
1200 token_pos_int = token_pos.Pos();
1201 }
1202
1205 ASSERT(is_static || (klass != nullptr));
1206 return request.SendAndWaitForResponse(
1207 kernel_port, platform_kernel, platform_kernel_size, expression,
1208 definitions, definition_types, type_definitions, type_bounds,
1209 type_defaults, library_url, klass, method, token_pos_int, script_uri,
1210 is_static, experimental_flags_);
1211}
1212
1214 int source_files_count,
1215 Dart_SourceFile source_files[]) {
1216 // This must be the main script to be loaded. Wait for Kernel isolate
1217 // to finish initialization.
1218 Dart_Port kernel_port = WaitForKernelPort();
1219 if (kernel_port == ILLEGAL_PORT) {
1222 result.error = Utils::StrDup("Error while initializing Kernel isolate");
1223 return result;
1224 }
1225
1227 return request.SendAndWaitForResponse(
1228 kUpdateSourcesTag, kernel_port, nullptr, nullptr, 0, source_files_count,
1229 source_files, true, false, false, nullptr, nullptr, nullptr,
1231}
1232
1234 const IsolateGroup* isolate_group) {
1235 if (!KernelIsolate::IsRunning()) {
1236 return;
1237 }
1238 Dart_Port kernel_port = WaitForKernelPort();
1239 if (kernel_port == ILLEGAL_PORT) {
1240 return;
1241 }
1242
1243 Dart_CObject tag;
1246
1247 Dart_CObject isolate_id;
1248 isolate_id.type = Dart_CObject_kInt64;
1249 isolate_id.value.as_int64 = static_cast<int64_t>(isolate_group->id());
1250
1253 Dart_CObject* message_arr[] = {&tag, &isolate_id};
1254 message.value.as_array.values = message_arr;
1255 message.value.as_array.length = ARRAY_SIZE(message_arr);
1256 // Send the message.
1257 Dart_PostCObject(kernel_port, &message);
1258}
1259
1260} // namespace dart
1261
1262#endif // !defined(DART_PRECOMPILED_RUNTIME)
static uint32_t buffer_size(uint32_t offset, uint32_t maxAlignment)
#define UNREACHABLE()
Definition assert.h:248
#define Z
ObjectPtr At(intptr_t index) const
Definition object.h:10854
intptr_t Length() const
Definition object.h:10808
void Add(const T &value)
intptr_t length() const
static ObjectPtr InvokeFunction(const Function &function, const Array &arguments)
Definition dart_entry.cc:31
static ThreadPool * thread_pool()
Definition dart.h:73
MutatorThreadPool * thread_pool()
Definition isolate.h:736
uint64_t id() const
Definition isolate.h:673
static Isolate * Current()
Definition isolate.h:939
static void KillIfExists(Isolate *isolate, LibMsgId msg_id)
Definition isolate.cc:3660
MessageHandler * message_handler() const
Definition isolate.cc:2380
static void FlagsInitialize(Dart_IsolateFlags *api_flags)
Definition isolate.cc:1612
IsolateGroup * group() const
Definition isolate.h:990
static Dart_IsolateGroupCreateCallback CreateGroupCallback()
Definition isolate.h:1156
Dart_KernelCompilationResult SendAndWaitForResponse(Dart_Port kernel_port, const uint8_t *platform_kernel, intptr_t platform_kernel_size, const char *expression, const Array &definitions, const Array &definition_types, const Array &type_definitions, const Array &type_bounds, const Array &type_defaults, char const *library_uri, char const *klass, char const *method, int64_t token_pos, char const *script_uri, bool is_static, const MallocGrowableArray< char * > *experimental_flags)
intptr_t setDillData(Dart_CObject **dills_array, intptr_t dill_num, const uint8_t *buffer, intptr_t buffer_size)
Dart_KernelCompilationResult SendAndWaitForResponse(int request_tag, Dart_Port kernel_port, 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, bool for_snapshot, bool embed_sources, const char *package_config, const char *multiroot_filepaths, const char *multiroot_scheme, const MallocGrowableArray< char * > *experimental_flags, Dart_KernelCompilationVerbosityLevel verbosity)
static constexpr int kListDependenciesTag
static constexpr int kCompileExpressionTag
static void InitializingFailed()
static void SetLoadPort(Dart_Port port)
static void FinishedExiting()
static Dart_KernelCompilationResult ListDependencies()
static Dart_IsolateGroupCreateCallback create_group_callback_
static Dart_KernelCompilationResult UpdateInMemorySources(int source_files_count, Dart_SourceFile source_files[])
static Dart_KernelCompilationResult CompileToKernel(const char *script_uri, const uint8_t *platform_kernel, intptr_t platform_kernel_size, int source_files_count=0, Dart_SourceFile source_files[]=nullptr, bool incremental_compile=true, bool for_snapshot=false, bool embed_sources=true, const char *package_config=nullptr, const char *multiroot_filepaths=nullptr, const char *multiroot_scheme=nullptr, Dart_KernelCompilationVerbosityLevel verbosity=Dart_KernelCompilationVerbosityLevel_All)
static void InitializeState()
static bool IsRunning()
static constexpr int kNotifyIsolateShutdown
static Dart_KernelCompilationResult CompileExpressionToKernel(const uint8_t *platform_kernel, intptr_t platform_kernel_size, const char *expression, const Array &definitions, const Array &definition_types, const Array &type_definitions, const Array &type_bounds, const Array &type_defaults, const char *library_url, const char *klass, const char *method, TokenPosition token_pos, char const *script_uri, bool is_static)
static void NotifyAboutIsolateGroupShutdown(const IsolateGroup *isolate_group)
static Dart_Port WaitForKernelPort()
static constexpr int kUpdateSourcesTag
static void FinishedInitializing()
static Dart_KernelCompilationResult RejectCompilation()
static void AddExperimentalFlag(const char *value)
static constexpr int kAcceptTag
static Monitor * monitor_
static Dart_KernelCompilationResult AcceptCompilation()
static bool GetExperimentalFlag(ExperimentalFeature feature)
static void InitCallback(Isolate *I)
static Dart_Port kernel_port_
static Dart_IsolateGroupCreateCallback create_group_callback()
static void SetKernelIsolate(Isolate *isolate)
static Isolate * isolate_
static constexpr int kCompileTag
static const char * kName
static MallocGrowableArray< char * > * experimental_flags_
static constexpr int kRejectTag
FunctionPtr LookupFunctionAllowPrivate(const String &name) const
Definition object.cc:14131
bool Run(ThreadPool *pool, StartCallback start_callback, EndCallback end_callback, CallbackData data)
Monitor::WaitResult Wait(int64_t millis=Monitor::kNoTimeout)
Definition lockers.h:172
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static ObjectPtr null()
Definition object.h:433
bool IsNull() const
Definition object.h:363
static Object & Handle()
Definition object.h:407
static ObjectPtr RawCast(ObjectPtr obj)
Definition object.h:325
Dart_Port Id() const
Definition object.h:12410
bool RunMain(Isolate *I)
static void ShutdownIsolate(uword parameter)
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
Definition object.cc:23777
bool Run(Args &&... args)
Definition thread_pool.h:45
Zone * zone() const
static Thread * Current()
Definition thread.h:361
IsolateGroup * isolate_group() const
Definition thread.h:540
intptr_t Pos() const
intptr_t Length() const
Definition object.h:11492
void * DataAddr(intptr_t byte_offset) const
Definition object.h:11545
static char * StrDup(const char *s)
ObjectPtr key() const
Definition object.h:12894
Dart_Isolate(* Dart_IsolateGroupCreateCallback)(const char *script_uri, const char *main, const char *package_root, const char *package_config, Dart_IsolateFlags *flags, void *isolate_data, char **error)
Definition dart_api.h:653
Dart_KernelCompilationStatus
Definition dart_api.h:3726
@ Dart_KernelCompilationStatus_MsgFailed
Definition dart_api.h:3731
@ Dart_KernelCompilationStatus_Error
Definition dart_api.h:3729
@ Dart_KernelCompilationStatus_Unknown
Definition dart_api.h:3727
@ Dart_KernelCompilationStatus_Ok
Definition dart_api.h:3728
#define ILLEGAL_PORT
Definition dart_api.h:1530
#define DART_KERNEL_ISOLATE_NAME
Definition dart_api.h:3823
int64_t Dart_Port
Definition dart_api.h:1524
struct _Dart_Isolate * Dart_Isolate
Definition dart_api.h:88
@ Dart_TypedData_kUint8
Definition dart_api.h:2606
Dart_KernelCompilationVerbosityLevel
Definition dart_api.h:3741
@ Dart_KernelCompilationVerbosityLevel_Error
Definition dart_api.h:3742
@ Dart_KernelCompilationVerbosityLevel_Warning
Definition dart_api.h:3743
@ Dart_KernelCompilationVerbosityLevel_All
Definition dart_api.h:3745
@ Dart_KernelCompilationVerbosityLevel_Info
Definition dart_api.h:3744
@ Dart_CObject_kInt64
@ Dart_CObject_kTypedData
@ Dart_CObject_kSendPort
@ Dart_CObject_kString
@ Dart_CObject_kArray
@ Dart_CObject_kNull
@ Dart_CObject_kExternalTypedData
@ Dart_CObject_kInt32
@ Dart_CObject_kBool
struct _Dart_CObject Dart_CObject
#define ASSERT(E)
SkBitmap source
Definition examples.cpp:28
static const uint8_t buffer[]
const uint8_t uint32_t uint32_t GError ** error
uint8_t value
GAsyncResult * result
const char * charp
Definition flags.h:12
#define DEFINE_FLAG(type, name, default_value, comment)
Definition flags.h:16
#define DEFINE_OPTION_HANDLER(handler, name, comment)
Definition flags.h:23
Win32Message message
static Dart_CObject BuildFilesPairs(int source_files_count, Dart_SourceFile source_files[])
DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate)
bool GetExperimentalFeatureDefault(ExperimentalFeature feature)
static void PassThroughFinalizer(void *isolate_callback_data, void *peer)
void * malloc(size_t size)
Definition allocation.cc:19
uintptr_t uword
Definition globals.h:501
const char * GetExperimentalFeatureName(ExperimentalFeature feature)
DART_EXPORT bool Dart_CloseNativePort(Dart_Port native_port_id)
static void ReleaseFilesPairs(const Dart_CObject &files)
DART_EXPORT Dart_Port Dart_NewNativePort(const char *name, Dart_NativeMessageHandler handler, bool handle_concurrently)
DART_EXPORT bool Dart_PostCObject(Dart_Port port_id, Dart_CObject *message)
static int8_t data[kExtLength]
DART_EXPORT void Dart_ShutdownIsolate()
#define T
Dart_KernelCompilationStatus status
Definition dart_api.h:3735
const char * uri
Definition dart_api.h:3793
const char * source
Definition dart_api.h:3794
Definition SkMD5.cpp:134
struct _Dart_CObject::@86::@87 as_send_port
Dart_HandleFinalizer callback
union _Dart_CObject::@86 value
Dart_CObject_Type type
struct _Dart_CObject::@86::@90 as_typed_data
const char * as_string
struct _Dart_CObject::@86::@91 as_external_typed_data
struct _Dart_CObject::@86::@89 as_array
struct _Dart_CObject ** values
Dart_Port origin_id
#define ARRAY_SIZE(array)
Definition globals.h:72