[vm, ffi] Emit the FFI callback stub as a raw blob and place it in the Fuchsia package.

Any blob in the package can be loaded as an executable VMO.

TEST=child CL
Bug: https://dartbug.com/52579
Change-Id: I61f7a84453da4da4733c5a70d4d19f0a6652581b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496661
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
This commit is contained in:
Ryan Macnak
2026-04-20 11:31:19 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 877ded1a38
commit e860a9b0fa
8 changed files with 81 additions and 2 deletions
+22
View File
@@ -6911,6 +6911,28 @@ Dart_CreateVMAOTSnapshotAsAssembly(Dart_StreamingWriteCallback callback,
#endif
}
DART_EXPORT Dart_Handle
Dart_WriteCallbackStub(Dart_StreamingWriteCallback callback,
void* callback_data) {
#if defined(TARGET_ARCH_IA32)
return Api::NewError("AOT compilation is not supported on IA32.");
#elif !defined(DART_PRECOMPILER)
return Api::NewError(
"This VM was built without support for AOT compilation.");
#else
DARTSCOPE(Thread::Current());
API_TIMELINE_DURATION(T);
CHECK_NULL(callback);
callback(callback_data,
reinterpret_cast<uint8_t*>(
StubCode::FfiCallbackTrampoline().EntryPoint()),
StubCode::FfiCallbackTrampoline().Size());
return Api::Success();
#endif
}
DART_EXPORT Dart_Handle
Dart_CreateAppAOTSnapshotAsElf(Dart_StreamingWriteCallback callback,
void* callback_data,