4#ifndef RUNTIME_VM_FFI_CALLBACK_METADATA_H_
5#define RUNTIME_VM_FFI_CALLBACK_METADATA_H_
15class PersistentHandle;
64 Metadata** list_head);
71 Metadata** list_head);
122 return target_isolate_ == other.target_isolate_ &&
123 trampoline_type_ == other.trampoline_type_ &&
129 bool IsLive()
const {
return target_isolate_ != 0; }
136 return target_isolate_;
194 return (
kPageSize - kNativeCallbackSharedStubSize) /
195 kNativeCallbackTrampolineSize;
203#if defined(DART_TARGET_OS_LINUX) && defined(TARGET_ARCH_ARM64)
205#elif defined(DART_TARGET_OS_ANDROID) && defined(TARGET_ARCH_IS_64_BIT)
207#elif defined(DART_TARGET_OS_MACOS) && defined(TARGET_ARCH_ARM64)
209#elif defined(DART_TARGET_OS_FUCHSIA)
240 return address & ~mask;
249#if defined(TARGET_ARCH_X64)
250 static constexpr intptr_t kNativeCallbackTrampolineSize = 12;
251 static constexpr intptr_t kNativeCallbackSharedStubSize = 289;
252 static constexpr intptr_t kNativeCallbackTrampolineStackDelta = 2;
253#elif defined(TARGET_ARCH_IA32)
254 static constexpr intptr_t kNativeCallbackTrampolineSize = 10;
255 static constexpr intptr_t kNativeCallbackSharedStubSize = 146;
256 static constexpr intptr_t kNativeCallbackTrampolineStackDelta = 4;
257#elif defined(TARGET_ARCH_ARM)
258 static constexpr intptr_t kNativeCallbackTrampolineSize = 8;
259 static constexpr intptr_t kNativeCallbackSharedStubSize = 232;
260 static constexpr intptr_t kNativeCallbackTrampolineStackDelta = 4;
261#elif defined(TARGET_ARCH_ARM64)
262 static constexpr intptr_t kNativeCallbackTrampolineSize = 8;
263 static constexpr intptr_t kNativeCallbackSharedStubSize = 332;
264 static constexpr intptr_t kNativeCallbackTrampolineStackDelta = 2;
265#elif defined(TARGET_ARCH_RISCV32)
266 static constexpr intptr_t kNativeCallbackTrampolineSize = 8;
267 static constexpr intptr_t kNativeCallbackSharedStubSize = 284;
268 static constexpr intptr_t kNativeCallbackTrampolineStackDelta = 2;
269#elif defined(TARGET_ARCH_RISCV64)
270 static constexpr intptr_t kNativeCallbackTrampolineSize = 8;
271 static constexpr intptr_t kNativeCallbackSharedStubSize = 252;
272 static constexpr intptr_t kNativeCallbackTrampolineStackDelta = 2;
274#error What architecture?
284 void EnsureStubPageLocked();
285 void AddToFreeListLocked(Metadata* entry);
286 void DeleteCallbackLocked(Metadata* entry);
289 void EnsureFreeListNotEmptyLocked();
292 uword target_entry_point,
294 Metadata** list_head);
299 Metadata** list_head);
310 uword offset_of_first_trampoline_in_page_ = 0;
311 Metadata* free_list_head_ =
nullptr;
312 Metadata* free_list_tail_ =
nullptr;
314#if defined(DART_TARGET_OS_FUCHSIA)
static constexpr uintptr_t RoundUpToPowerOfTwo(uintptr_t x)
static constexpr T RoundUp(T x, uintptr_t alignment, uintptr_t offset=0)
Dart_NativeFunction function
static constexpr intptr_t kWordSize
std::function< void()> closure