Flutter Engine
The Flutter Engine
dfe.cc
Go to the documentation of this file.
1// Copyright (c) 2017, 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 "bin/dfe.h"
6
7#include "bin/dartutils.h"
8#include "bin/directory.h"
9#include "bin/error_exit.h"
10#include "bin/exe_utils.h"
11#include "bin/file.h"
12#include "bin/lockers.h"
13#include "bin/platform.h"
14#include "bin/snapshot_utils.h"
15#include "bin/utils.h"
17#include "platform/utils.h"
18
19extern "C" {
20#if !defined(EXCLUDE_CFE_AND_KERNEL_PLATFORM)
21extern const uint8_t kKernelServiceDill[];
22extern intptr_t kKernelServiceDillSize;
23extern const uint8_t kPlatformStrongDill[];
24extern intptr_t kPlatformStrongDillSize;
25#else
26const uint8_t* kKernelServiceDill = nullptr;
27intptr_t kKernelServiceDillSize = 0;
28const uint8_t* kPlatformStrongDill = nullptr;
29intptr_t kPlatformStrongDillSize = 0;
30#endif // !defined(EXCLUDE_CFE_AND_KERNEL_PLATFORM)
31}
32
33namespace dart {
34namespace bin {
35
36// The run_vm_tests binary has the DART_PRECOMPILER set in order to allow unit
37// tests to exercise JIT and AOT pipeline.
38//
39// Only on X64 do we have kernel-service.dart.snapshot available otherwise we
40// need to fall back to the built-in one (if we have it).
41#if defined(EXCLUDE_CFE_AND_KERNEL_PLATFORM) || \
42 (defined(DART_PRECOMPILER) && defined(TARGET_ARCH_X64))
43const uint8_t* kernel_service_dill = nullptr;
44const intptr_t kernel_service_dill_size = 0;
45#else
48#endif
49
50#if defined(EXCLUDE_CFE_AND_KERNEL_PLATFORM)
51const uint8_t* platform_strong_dill = nullptr;
52const intptr_t platform_strong_dill_size = 0;
53#else
56#endif
57
58#if !defined(DART_PRECOMPILED_RUNTIME)
60#endif
61
62const char kKernelServiceSnapshot[] = "kernel-service.dart.snapshot";
63const char kSnapshotsDirectory[] = "snapshots";
64
66 : use_dfe_(false),
67 use_incremental_compiler_(false),
68 frontend_filename_(nullptr),
69 application_kernel_buffer_(nullptr),
70 application_kernel_buffer_size_(0),
71 kernel_blobs_(&SimpleHashMap::SameStringValue, 4),
72 kernel_blobs_lock_() {}
73
75 if (frontend_filename_ != nullptr) {
76 free(frontend_filename_);
77 }
78 frontend_filename_ = nullptr;
79
80 free(application_kernel_buffer_);
81 application_kernel_buffer_ = nullptr;
82 application_kernel_buffer_size_ = 0;
83
84 kernel_blobs_.Clear(
85 [](void* value) { delete reinterpret_cast<KernelBlob*>(value); });
86}
87
88void DFE::Init() {
89 if (platform_strong_dill == nullptr) {
90 return;
91 }
92
93 InitKernelServiceAndPlatformDills();
96}
97
98void DFE::InitKernelServiceAndPlatformDills() {
99 if (frontend_filename_ != nullptr) {
100 return;
101 }
102
103 // |dir_prefix| includes the last path separator.
105
106 // Look for the frontend snapshot next to the executable.
107 frontend_filename_ =
108 Utils::SCreate("%s%s", dir_prefix.get(), kKernelServiceSnapshot);
109 if (File::Exists(nullptr, frontend_filename_)) {
110 return;
111 }
112 free(frontend_filename_);
113 frontend_filename_ = nullptr;
114
115 // If the frontend snapshot is not found next to the executable, then look for
116 // it in the "snapshots" directory.
117 frontend_filename_ =
118 Utils::SCreate("%s%s%s%s", dir_prefix.get(), kSnapshotsDirectory,
120 if (File::Exists(nullptr, frontend_filename_)) {
121 return;
122 }
123 free(frontend_filename_);
124 frontend_filename_ = nullptr;
125}
126
128 return kernel_service_dill != nullptr;
129}
130
131void DFE::LoadKernelService(const uint8_t** kernel_service_buffer,
132 intptr_t* kernel_service_buffer_size) {
133 *kernel_service_buffer = kernel_service_dill;
134 *kernel_service_buffer_size = kernel_service_dill_size;
135}
136
137void DFE::LoadPlatform(const uint8_t** kernel_buffer,
138 intptr_t* kernel_buffer_size) {
139 *kernel_buffer = platform_strong_dill;
140 *kernel_buffer_size = platform_strong_dill_size;
141}
142
144 return (platform_strong_dill != nullptr) &&
145 (KernelServiceDillAvailable() || (frontend_filename() != nullptr));
146}
147
149#if defined(DART_HOST_OS_WINDOWS)
150 // For Windows we need to massage the paths a bit according to
151 // http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx
152 //
153 // Convert
154 // C:\one\two\three
155 // to
156 // /C:/one/two/three
157 //
158 // (see builtin.dart#_sanitizeWindowsPath)
159 if (path == nullptr) {
160 return;
161 }
162 intptr_t len = strlen(path);
163 char* uri = reinterpret_cast<char*>(new char[len + 1 + 1]);
164 if (uri == nullptr) {
166 }
167 char* s = uri;
168 if (len > 2 && path[1] == ':') {
169 *s++ = '/';
170 }
171 for (const char* p = path; *p != '\0'; ++p, ++s) {
172 *s = *p == '\\' ? '/' : *p;
173 }
174 *s = '\0';
175 sanitized_uri_ = std::unique_ptr<char[]>(uri);
176#else
177 sanitized_uri_ = path;
178#endif // defined(DART_HOST_OS_WINDOWS)
179}
180
181const char* PathSanitizer::sanitized_uri() const {
182#if defined(DART_HOST_OS_WINDOWS)
183 return sanitized_uri_.get();
184#else
185 return sanitized_uri_;
186#endif // defined(DART_HOST_OS_WINDOWS)
187}
188
190 bool incremental,
191 const char* package_config,
192 bool for_snapshot,
193 bool embed_sources) {
194 // TODO(aam): When Frontend is ready, VM should be passing vm_outline.dill
195 // instead of vm_platform.dill to Frontend for compilation.
196 PathSanitizer path_sanitizer(script_uri);
197 const char* sanitized_uri = path_sanitizer.sanitized_uri();
198
201 incremental, for_snapshot, embed_sources, package_config, verbosity());
202}
203
204void DFE::CompileAndReadScript(const char* script_uri,
205 uint8_t** kernel_buffer,
206 intptr_t* kernel_buffer_size,
207 char** error,
208 int* exit_code,
209 const char* package_config,
210 bool for_snapshot,
211 bool embed_sources) {
213 CompileScript(script_uri, use_incremental_compiler(), package_config,
214 for_snapshot, embed_sources);
215 switch (result.status) {
217 *kernel_buffer = result.kernel;
218 *kernel_buffer_size = result.kernel_size;
219 *error = nullptr;
220 *exit_code = 0;
221 break;
223 free(result.kernel);
224 *error = result.error; // Copy error message.
225 *exit_code = kCompilationErrorExitCode;
226 break;
228 free(result.kernel);
229 *error = result.error; // Copy error message.
230 *exit_code = kDartFrontendErrorExitCode;
231 break;
234 free(result.kernel);
235 *error = result.error; // Copy error message.
236 *exit_code = kErrorExitCode;
237 break;
238 }
239}
240
241void DFE::ReadScript(const char* script_uri,
242 const AppSnapshot* app_snapshot,
243 uint8_t** kernel_buffer,
244 intptr_t* kernel_buffer_size,
245 bool decode_uri,
246 std::shared_ptr<uint8_t>* kernel_blob_ptr) {
247 int64_t start = Dart_TimelineGetMicros();
248 if (!TryReadKernelFile(script_uri, app_snapshot, kernel_buffer,
249 kernel_buffer_size, decode_uri, kernel_blob_ptr)) {
250 return;
251 }
252 if (!Dart_IsKernel(*kernel_buffer, *kernel_buffer_size)) {
253 if (kernel_blob_ptr != nullptr && *kernel_blob_ptr) {
254 *kernel_blob_ptr = nullptr;
255 } else {
256 free(*kernel_buffer);
257 }
258 *kernel_buffer = nullptr;
259 *kernel_buffer_size = -1;
260 }
261 int64_t end = Dart_TimelineGetMicros();
262 Dart_RecordTimelineEvent("DFE::ReadScript", start, end, /*flow_id_count=*/0,
264 /*argument_count=*/0, nullptr, nullptr);
265}
266
267// Attempts to treat [buffer] as a in-memory kernel byte representation.
268// If successful, returns [true] and places [buffer] into [kernel_ir], byte size
269// into [kernel_ir_size].
270// If unsuccessful, returns [false], puts [nullptr] into [kernel_ir], -1 into
271// [kernel_ir_size].
273 uint8_t** p_kernel_ir,
274 intptr_t* p_kernel_ir_size) {
275 DartUtils::MagicNumber magic_number =
276 DartUtils::SniffForMagicNumber(buffer, *p_kernel_ir_size);
277 if (magic_number == DartUtils::kKernelMagicNumber) {
278 // Do not free buffer if this is a kernel file - kernel_file will be
279 // backed by the same memory as the buffer and caller will own it.
280 // Caller is responsible for freeing the buffer when this function
281 // returns true.
282 *p_kernel_ir = buffer;
283 return true;
284 }
285 free(buffer);
286 *p_kernel_ir = nullptr;
287 *p_kernel_ir_size = -1;
288 return false;
289}
290
291/// Reads [script_uri] file, returns [true] if successful, [false] otherwise.
292///
293/// If successful, newly allocated buffer with file contents is returned in
294/// [buffer], file contents byte count - in [size].
295static bool TryReadFile(const char* script_uri,
296 uint8_t** buffer,
297 intptr_t* size,
298 bool decode_uri = true) {
299 void* script_file = decode_uri ? DartUtils::OpenFileUri(script_uri, false)
300 : DartUtils::OpenFile(script_uri, false);
301 if (script_file == nullptr) {
302 return false;
303 }
304 DartUtils::ReadFile(buffer, size, script_file);
305 DartUtils::CloseFile(script_file);
306 return *buffer != nullptr;
307}
308
310 public:
311 KernelIRNode(uint8_t* kernel_ir, intptr_t kernel_size)
312 : kernel_ir_(kernel_ir), kernel_size_(kernel_size) {}
313
314 ~KernelIRNode() { free(kernel_ir_); }
315
316 static void Add(KernelIRNode** p_head,
317 KernelIRNode** p_tail,
318 KernelIRNode* node) {
319 if (*p_head == nullptr) {
320 *p_head = node;
321 } else {
322 (*p_tail)->next_ = node;
323 }
324 *p_tail = node;
325 }
326
327 static void Merge(KernelIRNode* head, uint8_t** p_bytes, intptr_t* p_size) {
328 intptr_t size = 0;
329 for (KernelIRNode* node = head; node != nullptr; node = node->next_) {
330 size = size + node->kernel_size_;
331 }
332
333 *p_bytes = reinterpret_cast<uint8_t*>(malloc(size));
334 uint8_t* p = *p_bytes;
335 KernelIRNode* node = head;
336 while (node != nullptr) {
337 memmove(p, node->kernel_ir_, node->kernel_size_);
338 p += node->kernel_size_;
339 KernelIRNode* next = node->next_;
340 node = next;
341 }
342 *p_size = size;
343 }
344
345 static void Delete(KernelIRNode* head) {
346 KernelIRNode* node = head;
347 while (node != nullptr) {
348 KernelIRNode* next = node->next_;
349 delete (node);
350 node = next;
351 }
352 }
353
354 private:
355 uint8_t* kernel_ir_;
356 intptr_t kernel_size_;
357
358 KernelIRNode* next_ = nullptr;
359
360 DISALLOW_COPY_AND_ASSIGN(KernelIRNode);
361};
362
364 public:
365 explicit StringPointer(char* c_str) : c_str_(c_str) {}
366 ~StringPointer() { free(c_str_); }
367
368 const char* c_str() { return c_str_; }
369
370 private:
371 char* c_str_;
372 DISALLOW_COPY_AND_ASSIGN(StringPointer);
373};
374
375// Supports "kernel list" files as input.
376// Those are text files that start with '#@dill' on new line, followed
377// by absolute paths to kernel files or relative paths, that are relative
378// to [script_uri] "kernel list" file.
379// Below is an example of valid kernel list file:
380// ```
381// #@dill
382// /projects/mytest/build/bin/main.vm.dill
383// /projects/mytest/build/packages/mytest/lib.vm.dill
384// ```
385static bool TryReadKernelListBuffer(const char* script_uri,
386 uint8_t* buffer,
387 intptr_t buffer_size,
388 uint8_t** kernel_ir,
389 intptr_t* kernel_ir_size) {
390 const char* kernel_list_dirname = DartUtils::DirName(script_uri);
391 if (strcmp(kernel_list_dirname, script_uri) == 0) {
392 kernel_list_dirname = "";
393 }
394 KernelIRNode* kernel_ir_head = nullptr;
395 KernelIRNode* kernel_ir_tail = nullptr;
396 // Add all kernels to the linked list
397 char* filename =
398 reinterpret_cast<char*>(buffer + kernel_list_magic_number.length);
399 intptr_t filename_size = buffer_size - kernel_list_magic_number.length;
400 char* tail = reinterpret_cast<char*>(memchr(filename, '\n', filename_size));
401 while (tail != nullptr) {
402 *tail = '\0';
403 intptr_t this_kernel_size;
404 uint8_t* this_buffer;
405
406 StringPointer resolved_filename(
407 File::IsAbsolutePath(filename)
408 ? Utils::StrDup(filename)
409 : Utils::SCreate("%s%s", kernel_list_dirname, filename));
410 if (!TryReadFile(resolved_filename.c_str(), &this_buffer,
411 &this_kernel_size)) {
412 return false;
413 }
414
415 uint8_t* this_kernel_ir;
416 if (!TryReadSimpleKernelBuffer(this_buffer, &this_kernel_ir,
417 &this_kernel_size)) {
418 // Abandon read if any of the files in the list are invalid.
419 KernelIRNode::Delete(kernel_ir_head);
420 *kernel_ir = nullptr;
421 *kernel_ir_size = -1;
422 return false;
423 }
424 KernelIRNode::Add(&kernel_ir_head, &kernel_ir_tail,
425 new KernelIRNode(this_kernel_ir, this_kernel_size));
426 filename_size -= tail + 1 - filename;
427 filename = tail + 1;
428 tail = reinterpret_cast<char*>(memchr(filename, '\n', filename_size));
429 }
430 free(buffer);
431
432 KernelIRNode::Merge(kernel_ir_head, kernel_ir, kernel_ir_size);
433 KernelIRNode::Delete(kernel_ir_head);
434 return true;
435}
436
437bool DFE::TryReadKernelFile(const char* script_uri,
438 const AppSnapshot* app_snapshot,
439 uint8_t** kernel_ir,
440 intptr_t* kernel_ir_size,
441 bool decode_uri,
442 std::shared_ptr<uint8_t>* kernel_blob_ptr) {
443 *kernel_ir = nullptr;
444 *kernel_ir_size = -1;
445
446 if (decode_uri && kernel_blob_ptr != nullptr) {
447 *kernel_blob_ptr = TryFindKernelBlob(script_uri, kernel_ir_size);
448 if (*kernel_blob_ptr) {
449 *kernel_ir = kernel_blob_ptr->get();
450 ASSERT(DartUtils::SniffForMagicNumber(*kernel_ir, *kernel_ir_size) ==
452 return true;
453 }
454 }
455 if (app_snapshot == nullptr || app_snapshot->IsKernel() ||
456 app_snapshot->IsKernelList()) {
457 uint8_t* buffer;
458 if (!TryReadFile(script_uri, &buffer, kernel_ir_size, decode_uri)) {
459 return false;
460 }
461 auto magic_number = DartUtils::kUnknownMagicNumber;
462 if (app_snapshot == nullptr) {
463 magic_number = DartUtils::SniffForMagicNumber(buffer, *kernel_ir_size);
464 } else if (app_snapshot->IsKernel()) {
465 magic_number = DartUtils::kKernelMagicNumber;
466 ASSERT(DartUtils::SniffForMagicNumber(buffer, *kernel_ir_size) ==
468 } else {
470 ASSERT(DartUtils::SniffForMagicNumber(buffer, *kernel_ir_size) ==
472 }
473 if (magic_number == DartUtils::kKernelListMagicNumber) {
474 return TryReadKernelListBuffer(script_uri, buffer, *kernel_ir_size,
475 kernel_ir, kernel_ir_size);
476 }
477 return TryReadSimpleKernelBuffer(buffer, kernel_ir, kernel_ir_size);
478 }
479 return false;
480}
481
482const char* DFE::RegisterKernelBlob(const uint8_t* kernel_buffer,
483 intptr_t kernel_buffer_size) {
484 ASSERT(DartUtils::SniffForMagicNumber(kernel_buffer, kernel_buffer_size) ==
486 uint8_t* buffer_copy = reinterpret_cast<uint8_t*>(malloc(kernel_buffer_size));
487 if (buffer_copy == nullptr) {
488 return nullptr;
489 }
490 memmove(buffer_copy, kernel_buffer, kernel_buffer_size);
491
492 MutexLocker ml(&kernel_blobs_lock_);
493 ++kernel_blob_counter_;
494 char* uri =
495 Utils::SCreate("dart-kernel-blob://blob%" Pd, kernel_blob_counter_);
496 KernelBlob* blob = new KernelBlob(uri, buffer_copy, kernel_buffer_size);
497
498 const uint32_t hash = SimpleHashMap::StringHash(uri);
499 SimpleHashMap::Entry* entry =
500 kernel_blobs_.Lookup(uri, hash, /*insert=*/true);
501 ASSERT(entry != nullptr);
502 ASSERT(entry->value == nullptr);
503 entry->value = blob;
504
505 return uri;
506}
507
508std::shared_ptr<uint8_t> DFE::TryFindKernelBlob(const char* uri,
509 intptr_t* kernel_length) {
510 *kernel_length = -1;
511
512 MutexLocker ml(&kernel_blobs_lock_);
513 if (kernel_blob_counter_ == 0) {
514 return nullptr;
515 }
516
517 // This const_cast is safe as this 'key' is only used to find entry, not add.
518 void* key = const_cast<char*>(uri);
519 const uint32_t hash = SimpleHashMap::StringHash(uri);
520 SimpleHashMap::Entry* entry =
521 kernel_blobs_.Lookup(key, hash, /*insert=*/false);
522 if (entry == nullptr) {
523 return nullptr;
524 }
525
526 KernelBlob* blob = reinterpret_cast<KernelBlob*>(entry->value);
527 *kernel_length = blob->size();
528 return blob->buffer();
529}
530
531void DFE::UnregisterKernelBlob(const char* uri) {
532 MutexLocker ml(&kernel_blobs_lock_);
533
534 // This const_cast is safe as this 'key' is only used to find entry, not add.
535 void* key = const_cast<char*>(uri);
536 const uint32_t hash = SimpleHashMap::StringHash(uri);
537 SimpleHashMap::Entry* entry =
538 kernel_blobs_.Lookup(key, hash, /*insert=*/false);
539 if (entry == nullptr) {
540 return;
541 }
542
543 KernelBlob* blob = reinterpret_cast<KernelBlob*>(entry->value);
544 entry->value = nullptr;
545 kernel_blobs_.Remove(key, hash);
546 delete blob;
547}
548
549} // namespace bin
550} // namespace dart
static uint32_t buffer_size(uint32_t offset, uint32_t maxAlignment)
static float next(float f)
static uint32_t hash(const SkShaderBase::GradientInfo &v)
#define OUT_OF_MEMORY()
Definition: assert.h:250
void Clear(ClearFun clear=nullptr)
Definition: hashmap.cc:111
Entry * Lookup(void *key, uint32_t hash, bool insert)
Definition: hashmap.cc:20
void Remove(void *key, uint32_t hash)
Definition: hashmap.cc:49
static uint32_t StringHash(const char *key)
Definition: hashmap.h:26
static char * StrDup(const char *s)
static char * SCreate(const char *format,...) PRINTF_ATTRIBUTE(1
Definition: utils.cc:231
bool IsKernelList() const
bool TryReadKernelFile(const char *script_uri, const AppSnapshot *app_snapshot, uint8_t **kernel_buffer, intptr_t *kernel_buffer_size, bool decode_uri=true, std::shared_ptr< uint8_t > *kernel_blob_ptr=nullptr)
Definition: dfe.cc:437
void CompileAndReadScript(const char *script_uri, uint8_t **kernel_buffer, intptr_t *kernel_buffer_size, char **error, int *exit_code, const char *package_config, bool for_snapshot, bool embed_sources)
Definition: dfe.cc:204
bool CanUseDartFrontend() const
Definition: dfe.cc:143
std::shared_ptr< uint8_t > TryFindKernelBlob(const char *uri, intptr_t *kernel_length)
Definition: dfe.cc:508
Dart_KernelCompilationVerbosityLevel verbosity() const
Definition: dfe.h:52
bool use_incremental_compiler() const
Definition: dfe.h:47
void LoadPlatform(const uint8_t **kernel_buffer, intptr_t *kernel_buffer_size)
Definition: dfe.cc:137
const char * RegisterKernelBlob(const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
Definition: dfe.cc:482
Dart_KernelCompilationResult CompileScript(const char *script_uri, bool incremental, const char *package_config, bool for_snapshot, bool embedd_sources)
Definition: dfe.cc:189
bool KernelServiceDillAvailable() const
Definition: dfe.cc:127
void Init()
Definition: dfe.cc:88
void UnregisterKernelBlob(const char *uri)
Definition: dfe.cc:531
void ReadScript(const char *script_uri, const AppSnapshot *app_snapshot, uint8_t **kernel_buffer, intptr_t *kernel_buffer_size, bool decode_uri=true, std::shared_ptr< uint8_t > *kernel_blob_ptr=nullptr)
Definition: dfe.cc:241
void LoadKernelService(const uint8_t **kernel_service_buffer, intptr_t *kernel_service_buffer_size)
Definition: dfe.cc:131
char * frontend_filename() const
Definition: dfe.h:32
static char * DirName(const char *url)
Definition: dartutils.cc:252
static void ReadFile(uint8_t **data, intptr_t *file_len, void *stream)
Definition: dartutils.cc:273
static void * OpenFileUri(const char *uri, bool write)
Definition: dartutils.cc:267
static void CloseFile(void *stream)
Definition: dartutils.cc:303
static MagicNumber SniffForMagicNumber(const char *filename)
Definition: dartutils.cc:403
static void * OpenFile(const char *name, bool write)
Definition: dartutils.cc:261
static CStringUniquePtr GetDirectoryPrefixFromResolvedExeName()
Definition: exe_utils.cc:68
static bool IsAbsolutePath(const char *path)
static const char * PathSeparator()
static bool Exists(Namespace *namespc, const char *path)
intptr_t size() const
Definition: dfe.h:184
std::shared_ptr< uint8_t > buffer()
Definition: dfe.h:183
static void Merge(KernelIRNode *head, uint8_t **p_bytes, intptr_t *p_size)
Definition: dfe.cc:327
static void Add(KernelIRNode **p_head, KernelIRNode **p_tail, KernelIRNode *node)
Definition: dfe.cc:316
static void Delete(KernelIRNode *head)
Definition: dfe.cc:345
KernelIRNode(uint8_t *kernel_ir, intptr_t kernel_size)
Definition: dfe.cc:311
const char * sanitized_uri() const
Definition: dfe.cc:181
PathSanitizer(const char *path)
Definition: dfe.cc:148
const char * c_str()
Definition: dfe.cc:368
StringPointer(char *c_str)
Definition: dfe.cc:365
@ Dart_KernelCompilationStatus_MsgFailed
Definition: dart_api.h:3788
@ Dart_KernelCompilationStatus_Error
Definition: dart_api.h:3786
@ Dart_KernelCompilationStatus_Crash
Definition: dart_api.h:3787
@ Dart_KernelCompilationStatus_Unknown
Definition: dart_api.h:3784
@ Dart_KernelCompilationStatus_Ok
Definition: dart_api.h:3785
@ Dart_Timeline_Event_Duration
const uint8_t kPlatformStrongDill[]
intptr_t kKernelServiceDillSize
intptr_t kPlatformStrongDillSize
const uint8_t kKernelServiceDill[]
#define ASSERT(E)
struct MyStruct s
glong glong end
const uint8_t uint32_t uint32_t GError ** error
uint8_t value
GAsyncResult * result
constexpr int kCompilationErrorExitCode
Definition: error_exit.h:16
const char kKernelServiceSnapshot[]
Definition: dfe.cc:62
DFE dfe
Definition: dfe.cc:59
static bool TryReadKernelListBuffer(const char *script_uri, uint8_t *buffer, intptr_t buffer_size, uint8_t **kernel_ir, intptr_t *kernel_ir_size)
Definition: dfe.cc:385
MagicNumberData kernel_list_magic_number
Definition: dartutils.cc:45
constexpr int kErrorExitCode
Definition: error_exit.h:18
static bool TryReadSimpleKernelBuffer(uint8_t *buffer, uint8_t **p_kernel_ir, intptr_t *p_kernel_ir_size)
Definition: dfe.cc:272
constexpr int kDartFrontendErrorExitCode
Definition: error_exit.h:12
const intptr_t kernel_service_dill_size
Definition: dfe.cc:47
const char kSnapshotsDirectory[]
Definition: dfe.cc:63
const intptr_t platform_strong_dill_size
Definition: dfe.cc:55
static bool TryReadFile(const char *script_uri, uint8_t **buffer, intptr_t *size, bool decode_uri=true)
Definition: dfe.cc:295
const uint8_t * platform_strong_dill
Definition: dfe.cc:54
const uint8_t * kernel_service_dill
Definition: dfe.cc:46
Definition: dart_vm.cc:33
DART_EXPORT bool Dart_IsKernel(const uint8_t *buffer, intptr_t buffer_size)
void * malloc(size_t size)
Definition: allocation.cc:19
DART_EXPORT void Dart_RecordTimelineEvent(const char *label, int64_t timestamp0, int64_t timestamp1_or_id, intptr_t flow_id_count, const int64_t *flow_ids, Dart_Timeline_Event_Type type, intptr_t argument_count, const char **argument_names, const char **argument_values)
DART_EXPORT Dart_KernelCompilationResult Dart_CompileToKernel(const char *script_uri, const uint8_t *platform_kernel, intptr_t platform_kernel_size, bool incremental_compile, bool for_snapshot, bool embed_sources, const char *package_config, Dart_KernelCompilationVerbosityLevel verbosity)
DART_EXPORT void Dart_SetDartLibrarySourcesKernel(const uint8_t *platform_kernel, const intptr_t platform_kernel_size)
DART_EXPORT int64_t Dart_TimelineGetMicros()
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
#define Pd
Definition: globals.h:408