Flutter Engine
The Flutter Engine
unwinding_records_win.cc
Go to the documentation of this file.
1// Copyright (c) 2023, 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
6
7#include "platform/assert.h"
8#include "platform/globals.h"
9
10namespace dart {
11
12#if (defined(DART_TARGET_OS_WINDOWS) || defined(DART_HOST_OS_WINDOWS)) && \
13 (defined(TARGET_ARCH_X64) || defined(TARGET_ARCH_ARM64))
14
15#if defined(TARGET_ARCH_X64)
16const intptr_t kReservedUnwindingRecordsSizeBytes = 64;
17#else
18const intptr_t kReservedUnwindingRecordsSizeBytes = 4 * KB;
19#endif
20
22 return kReservedUnwindingRecordsSizeBytes;
23}
24
25#endif // defined(DART_TARGET_OS_WINDOWS) || defined(DART_HOST_OS_WINDOWS)
26
27#if defined(DART_HOST_OS_WINDOWS) && \
28 (defined(TARGET_ARCH_X64) || defined(TARGET_ARCH_ARM64))
29
31 void* start,
32 intptr_t size,
33 void** pp_dynamic_table) {
34 intptr_t unwinding_record_offset = size - kReservedUnwindingRecordsSizeBytes;
35 uint8_t* record_ptr = static_cast<uint8_t*>(start) + unwinding_record_offset;
36 CodeRangeUnwindingRecord* record =
37 reinterpret_cast<CodeRangeUnwindingRecord*>(record_ptr);
38 RELEASE_ASSERT(record->magic == kUnwindingRecordMagic);
39 uword start_num = reinterpret_cast<intptr_t>(start);
40 uword end_num = start_num + size;
41 DWORD status = RtlAddGrowableFunctionTable(
42 pp_dynamic_table,
43 /*FunctionTable=*/record->runtime_function,
44 /*EntryCount=*/record->runtime_function_count,
45 /*MaximumEntryCount=*/record->runtime_function_count,
46 /*RangeBase=*/start_num,
47 /*RangeEnd=*/end_num);
48 if (status != 0) {
49 FATAL("Failed to add growable function table: 0x%x\n", status);
50 }
51}
52
53void UnwindingRecordsPlatform::UnregisterDynamicTable(void* p_dynamic_table) {
54 RtlDeleteGrowableFunctionTable(p_dynamic_table);
55}
56
57#endif // defined(DART_HOST_OS_WINDOWS)
58
59} // namespace dart
#define RELEASE_ASSERT(cond)
Definition: assert.h:327
static void RegisterExecutableMemory(void *start, intptr_t size, void **pp_dynamic_table)
static void UnregisterDynamicTable(void *p_dynamic_table)
#define FATAL(error)
Definition: dart_vm.cc:33
constexpr intptr_t KB
Definition: globals.h:528
uintptr_t uword
Definition: globals.h:501
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
unsigned long DWORD
Definition: windows_types.h:22