[vm] Remove transitions for removing VM isolate.

TEST=ci
Change-Id: I65c315e9efc3cd7b8b47d2c167681986278644da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/502780
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak
2026-06-02 10:28:10 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent dd66887ed7
commit 546bf07f7d
15 changed files with 98 additions and 331 deletions
@@ -164,12 +164,6 @@ final class MachoImageWriter extends ImageWriter {
header = Header(this);
symbolTable.addSymbol(snapshotTextAsmSymbol, textSection, 0);
symbolTable.addSymbol(snapshotDataAsmSymbol, constSection, 0);
// TRANSITION
symbolTable.addSymbol("_kDartVmSnapshotInstructions", textSection, 0);
symbolTable.addSymbol("_kDartIsolateSnapshotInstructions", textSection, 0);
symbolTable.addSymbol("_kDartVmSnapshotData", constSection, 0);
symbolTable.addSymbol("_kDartIsolateSnapshotData", constSection, 0);
}
@override
-14
View File
@@ -455,9 +455,6 @@ typedef Dart_Handle (*Dart_CreateAppAOTSnapshotAndRelocatableObjectType)(
void*,
const char*,
const char*);
typedef Dart_Handle (*Dart_CreateVMAOTSnapshotAsAssemblyType)(
Dart_StreamingWriteCallback,
void*);
typedef Dart_Handle (*Dart_WriteCallbackStubType)(Dart_StreamingWriteCallback,
void*);
typedef Dart_Handle (*Dart_SortClassesType)();
@@ -771,8 +768,6 @@ static Dart_CreateAppAOTSnapshotAsBinaryType
Dart_CreateAppAOTSnapshotAsBinaryFn = NULL;
static Dart_CreateAppAOTSnapshotAndRelocatableObjectType
Dart_CreateAppAOTSnapshotAndRelocatableObjectFn = NULL;
static Dart_CreateVMAOTSnapshotAsAssemblyType
Dart_CreateVMAOTSnapshotAsAssemblyFn = NULL;
static Dart_WriteCallbackStubType Dart_WriteCallbackStubFn = NULL;
static Dart_SortClassesType Dart_SortClassesFn = NULL;
static Dart_CreateAppJITSnapshotAsBlobsType Dart_CreateAppJITSnapshotAsBlobsFn =
@@ -1367,9 +1362,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
Dart_CreateAppAOTSnapshotAndRelocatableObjectFn =
(Dart_CreateAppAOTSnapshotAndRelocatableObjectType)GetProcAddress(
process, "Dart_CreateAppAOTSnapshotAndRelocatableObject");
Dart_CreateVMAOTSnapshotAsAssemblyFn =
(Dart_CreateVMAOTSnapshotAsAssemblyType)GetProcAddress(
process, "Dart_CreateVMAOTSnapshotAsAssembly");
Dart_WriteCallbackStubFn = (Dart_WriteCallbackStubType)GetProcAddress(
process, "Dart_WriteCallbackStub");
Dart_SortClassesFn =
@@ -2693,12 +2685,6 @@ Dart_Handle Dart_CreateAppAOTSnapshotAndRelocatableObject(
debug_callback_data, identifier, path);
}
Dart_Handle Dart_CreateVMAOTSnapshotAsAssembly(
Dart_StreamingWriteCallback callback,
void* callback_data) {
return Dart_CreateVMAOTSnapshotAsAssemblyFn(callback, callback_data);
}
Dart_Handle Dart_WriteCallbackStub(Dart_StreamingWriteCallback callback,
void* callback_data) {
return Dart_WriteCallbackStubFn(callback, callback_data);
+15 -16
View File
@@ -416,11 +416,11 @@ using namespace dart::bin::elf; // NOLINT
using Mappable = dart::bin::Mappable;
#if defined(DART_HOST_OS_FUCHSIA) || defined(DART_HOST_OS_LINUX)
DART_EXPORT Dart_LoadedElf* Dart_LoadELF_Fd2(int fd,
uint64_t file_offset,
const char** error,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text) {
DART_EXPORT Dart_LoadedElf* Dart_LoadELF_Fd(int fd,
uint64_t file_offset,
const char** error,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text) {
std::unique_ptr<Mappable> mappable(Mappable::FromFD(fd));
std::unique_ptr<LoadedElf> elf(
new LoadedElf(std::move(mappable), file_offset));
@@ -434,11 +434,11 @@ DART_EXPORT Dart_LoadedElf* Dart_LoadELF_Fd2(int fd,
}
#endif
DART_EXPORT Dart_LoadedElf* Dart_LoadELF2(const char* filename,
uint64_t file_offset,
const char** error,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text) {
DART_EXPORT Dart_LoadedElf* Dart_LoadELF(const char* filename,
uint64_t file_offset,
const char** error,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text) {
std::unique_ptr<Mappable> mappable(Mappable::FromPath(filename));
if (mappable == nullptr) {
*error = "Couldn't open file.";
@@ -455,12 +455,11 @@ DART_EXPORT Dart_LoadedElf* Dart_LoadELF2(const char* filename,
return reinterpret_cast<Dart_LoadedElf*>(elf.release());
}
DART_EXPORT Dart_LoadedElf* Dart_LoadELF_Memory2(
const uint8_t* snapshot,
uint64_t snapshot_size,
const char** error,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text) {
DART_EXPORT Dart_LoadedElf* Dart_LoadELF_Memory(const uint8_t* snapshot,
uint64_t snapshot_size,
const char** error,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text) {
std::unique_ptr<Mappable> mappable(
Mappable::FromMemory(snapshot, snapshot_size));
if (mappable == nullptr) {
+35 -47
View File
@@ -26,60 +26,48 @@ typedef struct {
/// does not take ownership of the memory, but borrows it for the duration of
/// the call. The memory can be release as soon as Dart_LoadELF_Memory returns.
#if defined(__Fuchsia__) || defined(__linux__) || defined(__FreeBSD__)
DART_EXPORT Dart_LoadedElf* Dart_LoadELF_Fd2(int fd,
uint64_t file_offset,
const char** error,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text);
inline Dart_LoadedElf* Dart_LoadELF_Fd(int fd,
uint64_t file_offset,
const char** error,
const uint8_t** vm_data,
const uint8_t** vm_text,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text) {
*vm_data = nullptr;
*vm_text = nullptr;
return Dart_LoadELF_Fd2(fd, file_offset, error, snapshot_data, snapshot_text);
DART_EXPORT Dart_LoadedElf* Dart_LoadELF_Fd(int fd,
uint64_t file_offset,
const char** error,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text);
inline Dart_LoadedElf* Dart_LoadELF_Fd2(int fd,
uint64_t file_offset,
const char** error,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text) {
return Dart_LoadELF_Fd(fd, file_offset, error, snapshot_data, snapshot_text);
}
#endif
/// Please see documentation for Dart_LoadElf_Fd.
DART_EXPORT Dart_LoadedElf* Dart_LoadELF2(const char* filename,
uint64_t file_offset,
const char** error,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text);
inline Dart_LoadedElf* Dart_LoadELF(const char* filename,
uint64_t file_offset,
const char** error,
const uint8_t** vm_data,
const uint8_t** vm_text,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text) {
*vm_data = nullptr;
*vm_text = nullptr;
return Dart_LoadELF2(filename, file_offset, error, snapshot_data,
snapshot_text);
DART_EXPORT Dart_LoadedElf* Dart_LoadELF(const char* filename,
uint64_t file_offset,
const char** error,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text);
inline Dart_LoadedElf* Dart_LoadELF2(const char* filename,
uint64_t file_offset,
const char** error,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text) {
return Dart_LoadELF(filename, file_offset, error, snapshot_data,
snapshot_text);
}
/// Please see documentation for Dart_LoadElf_Fd.
DART_EXPORT Dart_LoadedElf* Dart_LoadELF_Memory2(const uint8_t* snapshot,
uint64_t snapshot_size,
const char** error,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text);
inline Dart_LoadedElf* Dart_LoadELF_Memory(const uint8_t* snapshot,
uint64_t snapshot_size,
const char** error,
const uint8_t** vm_data,
const uint8_t** vm_text,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text) {
*vm_data = nullptr;
*vm_text = nullptr;
return Dart_LoadELF_Memory2(snapshot, snapshot_size, error, snapshot_data,
snapshot_text);
DART_EXPORT Dart_LoadedElf* Dart_LoadELF_Memory(const uint8_t* snapshot,
uint64_t snapshot_size,
const char** error,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text);
inline Dart_LoadedElf* Dart_LoadELF_Memory2(const uint8_t* snapshot,
uint64_t snapshot_size,
const char** error,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text) {
return Dart_LoadELF_Memory(snapshot, snapshot_size, error, snapshot_data,
snapshot_text);
}
/// Unloads an ELF object loaded through Dart_LoadELF{_Fd, _Memory}.
+12 -89
View File
@@ -79,7 +79,6 @@ enum SnapshotKind {
kAppAOTAssembly,
kAppAOTElf,
kAppAOTMachODylib,
kVMAOTAssembly,
kFfiCallbackStub,
};
static SnapshotKind snapshot_kind = kCore;
@@ -93,7 +92,6 @@ static const char* const kSnapshotKindNames[] = {
"app-aot-assembly",
"app-aot-elf",
"app-aot-macho-dylib",
"vm-aot-assembly",
"ffi-callback-stub",
nullptr,
// clang-format on
@@ -105,10 +103,6 @@ static const char* const kSnapshotKindNames[] = {
V(load_isolate_snapshot_data, load_isolate_snapshot_data_filename) \
V(load_isolate_snapshot_instructions, \
load_isolate_snapshot_instructions_filename) \
V(vm_snapshot_data, vm_snapshot_data_filename) \
V(vm_snapshot_instructions, vm_snapshot_instructions_filename) \
V(isolate_snapshot_data, isolate_snapshot_data_filename) \
V(isolate_snapshot_instructions, isolate_snapshot_instructions_filename) \
V(snapshot_data, snapshot_data_filename) \
V(snapshot_text, snapshot_text_filename) \
V(assembly, assembly_filename) \
@@ -146,7 +140,6 @@ DEFINE_CB_OPTION(ProcessEnvironmentOption);
static bool IsSnapshottingForPrecompilation() {
return (snapshot_kind == kAppAOTAssembly) || (snapshot_kind == kAppAOTElf) ||
(snapshot_kind == kAppAOTMachODylib) ||
(snapshot_kind == kVMAOTAssembly) ||
(snapshot_kind == kFfiCallbackStub);
}
@@ -254,8 +247,8 @@ static int ParseArguments(int argc,
switch (snapshot_kind) {
case kCore: {
if ((snapshot_data_filename == nullptr) &&
(isolate_snapshot_data_filename == nullptr)) {
if ((snapshot_data_filename == nullptr) ||
(snapshot_text_filename == nullptr)) {
Syslog::PrintErr(
"Building a core snapshot requires specifying output files for "
"--snapshot_data and --snapshot_text.\n\n");
@@ -265,10 +258,8 @@ static int ParseArguments(int argc,
}
case kApp:
case kAppJIT: {
if (((snapshot_data_filename == nullptr) &&
(isolate_snapshot_data_filename == nullptr)) ||
((snapshot_text_filename == nullptr) &&
(isolate_snapshot_instructions_filename == nullptr))) {
if ((snapshot_data_filename == nullptr) ||
(snapshot_text_filename == nullptr)) {
Syslog::PrintErr(
"Building an app JIT snapshot requires specifying input files for "
"--load_vm_snapshot_data and --load_vm_snapshot_instructions, an "
@@ -296,8 +287,7 @@ static int ParseArguments(int argc,
}
break;
}
case kAppAOTAssembly:
case kVMAOTAssembly: {
case kAppAOTAssembly: {
if (assembly_filename == nullptr) {
Syslog::PrintErr(
"Building an AOT snapshot as assembly requires specifying "
@@ -426,11 +416,8 @@ static void MaybeLoadCode() {
static void CreateAndWriteCoreSnapshot() {
ASSERT(snapshot_kind == kCore);
#if 0
// TRANSITION
ASSERT(snapshot_data_filename != nullptr);
ASSERT(snapshot_text_filename != nullptr);
#endif
Dart_Handle result;
uint8_t* snapshot_data_buffer = nullptr;
@@ -439,33 +426,9 @@ static void CreateAndWriteCoreSnapshot() {
result = Dart_CreateSnapshot(&snapshot_data_buffer, &snapshot_data_size);
CHECK_RESULT(result);
if (snapshot_data_filename != nullptr) {
WriteFile(snapshot_data_filename, snapshot_data_buffer, snapshot_data_size);
}
if (snapshot_text_filename != nullptr) {
// Create empty file for the convenience of build systems.
WriteFile(snapshot_text_filename, nullptr, 0);
}
#if 1
// TRANSITION
if (vm_snapshot_data_filename != nullptr) {
// Create empty file for the convenience of build systems.
WriteFile(vm_snapshot_data_filename, nullptr, 0);
}
if (vm_snapshot_instructions_filename != nullptr) {
// Create empty file for the convenience of build systems.
WriteFile(vm_snapshot_instructions_filename, nullptr, 0);
}
if (isolate_snapshot_data_filename != nullptr) {
WriteFile(isolate_snapshot_data_filename, snapshot_data_buffer,
snapshot_data_size);
}
if (isolate_snapshot_instructions_filename != nullptr) {
// Create empty file for the convenience of build systems.
WriteFile(isolate_snapshot_instructions_filename, nullptr, 0);
}
#endif
WriteFile(snapshot_data_filename, snapshot_data_buffer, snapshot_data_size);
// Create empty file for the convenience of build systems.
WriteFile(snapshot_text_filename, nullptr, 0);
}
static std::unique_ptr<MappedMemory> MapFile(const char* filename,
@@ -503,33 +466,18 @@ static void CreateAndWriteAppSnapshot() {
result = Dart_CreateSnapshot(&snapshot_data_buffer, &snapshot_data_size);
CHECK_RESULT(result);
if (snapshot_data_filename != nullptr) {
WriteFile(snapshot_data_filename, snapshot_data_buffer, snapshot_data_size);
}
WriteFile(snapshot_data_filename, snapshot_data_buffer, snapshot_data_size);
if (snapshot_text_filename != nullptr) {
// Create empty file for the convenience of build systems.
WriteFile(snapshot_text_filename, nullptr, 0);
}
#if 1
// TRANSITION
if (isolate_snapshot_data_filename != nullptr) {
WriteFile(isolate_snapshot_data_filename, snapshot_data_buffer,
snapshot_data_size);
}
if (isolate_snapshot_instructions_filename != nullptr) {
// Create empty file for the convenience of build systems.
WriteFile(isolate_snapshot_instructions_filename, nullptr, 0);
}
#endif
}
static void CreateAndWriteAppJITSnapshot() {
ASSERT(snapshot_kind == kAppJIT);
#if 0
// TRANSITION
ASSERT(snapshot_data_filename != nullptr);
ASSERT(snapshot_text_filename != nullptr);
#endif
Dart_Handle result;
uint8_t* snapshot_data_buffer = nullptr;
intptr_t snapshot_data_size = 0;
@@ -541,24 +489,8 @@ static void CreateAndWriteAppJITSnapshot() {
&snapshot_text_size);
CHECK_RESULT(result);
if (snapshot_data_filename != nullptr) {
WriteFile(snapshot_data_filename, snapshot_data_buffer, snapshot_data_size);
}
if (snapshot_text_filename != nullptr) {
WriteFile(snapshot_text_filename, snapshot_text_buffer, snapshot_text_size);
}
#if 1
// TRANSITION
if (isolate_snapshot_data_filename != nullptr) {
WriteFile(isolate_snapshot_data_filename, snapshot_data_buffer,
snapshot_data_size);
}
if (isolate_snapshot_instructions_filename != nullptr) {
WriteFile(isolate_snapshot_instructions_filename, snapshot_text_buffer,
snapshot_text_size);
}
#endif
WriteFile(snapshot_data_filename, snapshot_data_buffer, snapshot_data_size);
WriteFile(snapshot_text_filename, snapshot_text_buffer, snapshot_text_size);
}
static void StreamingWriteCallback(void* callback_data,
@@ -678,14 +610,6 @@ static void NextElfCallback(void* callback_data,
static void CreateAndWritePrecompiledSnapshot() {
ASSERT(IsSnapshottingForPrecompilation());
if (snapshot_kind == kVMAOTAssembly) {
File* file = OpenFile(assembly_filename);
RefCntReleaseScope<File> rs(file);
Dart_Handle result =
Dart_CreateVMAOTSnapshotAsAssembly(StreamingWriteCallback, file);
CHECK_RESULT(result);
return;
}
if (snapshot_kind == kFfiCallbackStub) {
File* file = OpenFile(ffi_callback_stub_filename);
RefCntReleaseScope<File> rs(file);
@@ -892,7 +816,6 @@ static int CreateIsolateAndSnapshot(const CommandLineOptions& inputs) {
case kAppAOTAssembly:
case kAppAOTElf:
case kAppAOTMachODylib:
case kVMAOTAssembly:
case kFfiCallbackStub:
CreateAndWritePrecompiledSnapshot();
break;
+3 -3
View File
@@ -528,7 +528,7 @@ using namespace dart::bin::mach_o; // NOLINT
using Mappable = dart::bin::Mappable;
#if defined(DART_HOST_OS_FUCHSIA) || defined(DART_HOST_OS_LINUX)
DART_EXPORT Dart_LoadedMachODylib* Dart_LoadMachODylib_Fd2(
DART_EXPORT Dart_LoadedMachODylib* Dart_LoadMachODylib_Fd(
int fd,
uint64_t file_offset,
const char** error,
@@ -547,7 +547,7 @@ DART_EXPORT Dart_LoadedMachODylib* Dart_LoadMachODylib_Fd2(
}
#endif
DART_EXPORT Dart_LoadedMachODylib* Dart_LoadMachODylib2(
DART_EXPORT Dart_LoadedMachODylib* Dart_LoadMachODylib(
const char* filename,
uint64_t file_offset,
const char** error,
@@ -569,7 +569,7 @@ DART_EXPORT Dart_LoadedMachODylib* Dart_LoadMachODylib2(
return reinterpret_cast<Dart_LoadedMachODylib*>(macho.release());
}
DART_EXPORT Dart_LoadedMachODylib* Dart_LoadMachODylib_Memory2(
DART_EXPORT Dart_LoadedMachODylib* Dart_LoadMachODylib_Memory(
const uint8_t* snapshot,
uint64_t snapshot_size,
const char** error,
+12 -24
View File
@@ -28,67 +28,55 @@ typedef struct {
/// borrows it for the duration of the call. The memory can be release as soon
// as Dart_LoadAOTSnapshot_Memory returns.
#if defined(__Fuchsia__) || defined(__linux__) || defined(__FreeBSD__)
DART_EXPORT Dart_LoadedMachODylib* Dart_LoadMachODylib_Fd2(
DART_EXPORT Dart_LoadedMachODylib* Dart_LoadMachODylib_Fd(
int fd,
uint64_t file_offset,
const char** error,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text);
inline Dart_LoadedMachODylib* Dart_LoadMachODylib_Fd(
inline Dart_LoadedMachODylib* Dart_LoadMachODylib_Fd2(
int fd,
uint64_t file_offset,
const char** error,
const uint8_t** vm_data,
const uint8_t** vm_text,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text) {
*vm_data = nullptr;
*vm_text = nullptr;
return Dart_LoadMachODylib_Fd2(fd, file_offset, error, snapshot_data,
snapshot_text);
return Dart_LoadMachODylib_Fd(fd, file_offset, error, snapshot_data,
snapshot_text);
}
#endif
/// Please see documentation for Dart_LoadMachODylib_Fd.
DART_EXPORT Dart_LoadedMachODylib* Dart_LoadMachODylib2(
DART_EXPORT Dart_LoadedMachODylib* Dart_LoadMachODylib(
const char* filename,
uint64_t file_offset,
const char** error,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text);
inline Dart_LoadedMachODylib* Dart_LoadMachODylib(
inline Dart_LoadedMachODylib* Dart_LoadMachODylib2(
const char* filename,
uint64_t file_offset,
const char** error,
const uint8_t** vm_data,
const uint8_t** vm_text,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text) {
*vm_data = nullptr;
*vm_text = nullptr;
return Dart_LoadMachODylib2(filename, file_offset, error, snapshot_data,
snapshot_text);
return Dart_LoadMachODylib(filename, file_offset, error, snapshot_data,
snapshot_text);
}
/// Please see documentation for Dart_LoadMachODylib_Fd.
DART_EXPORT Dart_LoadedMachODylib* Dart_LoadMachODylib_Memory2(
DART_EXPORT Dart_LoadedMachODylib* Dart_LoadMachODylib_Memory(
const uint8_t* snapshot,
uint64_t snapshot_size,
const char** error,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text);
inline Dart_LoadedMachODylib* Dart_LoadMachODylib_Memory(
inline Dart_LoadedMachODylib* Dart_LoadMachODylib_Memory2(
const uint8_t* snapshot,
uint64_t snapshot_size,
const char** error,
const uint8_t** vm_data,
const uint8_t** vm_text,
const uint8_t** snapshot_data,
const uint8_t** snapshot_text) {
*vm_data = nullptr;
*vm_text = nullptr;
return Dart_LoadMachODylib_Memory2(snapshot, snapshot_size, error,
snapshot_data, snapshot_text);
return Dart_LoadMachODylib_Memory(snapshot, snapshot_size, error,
snapshot_data, snapshot_text);
}
/// Unloads an MachO dynamic library object loaded through
+12 -12
View File
@@ -291,13 +291,13 @@ static AppSnapshot* TryReadAppSnapshotElf(const char* script_name,
if (memory == nullptr) return nullptr;
const uint8_t* address =
reinterpret_cast<const uint8_t*>(memory->address());
handle = Dart_LoadELF_Memory2(address + file_offset, file->Length(), &error,
&snapshot_data_buffer, &snapshot_text_buffer);
handle = Dart_LoadELF_Memory(address + file_offset, file->Length(), &error,
&snapshot_data_buffer, &snapshot_text_buffer);
delete memory;
file->Release();
} else {
handle = Dart_LoadELF2(script_name, file_offset, &error,
&snapshot_data_buffer, &snapshot_text_buffer);
handle = Dart_LoadELF(script_name, file_offset, &error,
&snapshot_data_buffer, &snapshot_text_buffer);
}
if (handle == nullptr) {
Syslog::PrintErr("Loading failed: %s\n", error);
@@ -365,14 +365,14 @@ static AppSnapshot* TryReadAppSnapshotMachODylib(
}
const uint8_t* address =
reinterpret_cast<const uint8_t*>(memory->address());
handle = Dart_LoadMachODylib_Memory2(address + file_offset, file->Length(),
&error, &snapshot_data_buffer,
&snapshot_text_buffer);
handle = Dart_LoadMachODylib_Memory(address + file_offset, file->Length(),
&error, &snapshot_data_buffer,
&snapshot_text_buffer);
delete memory;
file->Release();
} else {
handle = Dart_LoadMachODylib2(script_name, file_offset, &error,
&snapshot_data_buffer, &snapshot_text_buffer);
handle = Dart_LoadMachODylib(script_name, file_offset, &error,
&snapshot_data_buffer, &snapshot_text_buffer);
}
if (handle == nullptr) {
Syslog::PrintErr("Loading failed: %s\n", error);
@@ -542,8 +542,8 @@ AppSnapshot* Snapshot::TryReadAppendedAppSnapshotFromPE(
if (magic_number == DartUtils::kAotELFMagicNumber) {
Dart_LoadedElf* const handle =
Dart_LoadELF_Memory2(snapshot.get(), size, &error,
&snapshot_data_buffer, &snapshot_text_buffer);
Dart_LoadELF_Memory(snapshot.get(), size, &error,
&snapshot_data_buffer, &snapshot_text_buffer);
if (handle == nullptr) {
Syslog::PrintErr("Loading failed: %s\n", error);
@@ -556,7 +556,7 @@ AppSnapshot* Snapshot::TryReadAppendedAppSnapshotFromPE(
if (magic_number == DartUtils::kAotMachO32MagicNumber ||
magic_number == DartUtils::kAotMachO64MagicNumber) {
Dart_LoadedMachODylib* const handle = Dart_LoadMachODylib_Memory2(
Dart_LoadedMachODylib* const handle = Dart_LoadMachODylib_Memory(
snapshot.get(), size, &error, &snapshot_data_buffer,
&snapshot_text_buffer);
+3 -29
View File
@@ -838,7 +838,7 @@ typedef Dart_Handle (*Dart_GetVMServiceAssetsArchive)(void);
* The current version of the Dart_InitializeFlags. Should be incremented every
* time Dart_InitializeFlags changes in a binary incompatible way.
*/
#define DART_INITIALIZE_PARAMS_CURRENT_VERSION (0x0000000A)
#define DART_INITIALIZE_PARAMS_CURRENT_VERSION (0x0000000B)
/** Forward declaration */
struct Dart_CodeObserver;
@@ -874,10 +874,6 @@ typedef struct {
*/
int32_t version;
/* TRANSITION */
const uint8_t* vm_snapshot_data;
const uint8_t* vm_snapshot_instructions;
/**
* A function to be called during isolate group creation.
* See Dart_IsolateGroupCreateCallback.
@@ -4018,23 +4014,6 @@ DART_EXPORT Dart_Handle Dart_LoadingUnitLibraryUris(intptr_t loading_unit_id);
#define kSnapshotTextAsmSymbol "_kDartSnapshotText"
#define kSnapshotBssAsmSymbol "_kDartSnapshotBss"
/* TRANSITION */
#if defined(__APPLE__)
#define kVmSnapshotDataCSymbol "kDartVmSnapshotData"
#define kVmSnapshotInstructionsCSymbol "kDartVmSnapshotInstructions"
#define kVmSnapshotBssCSymbol "kDartVmSnapshotBss"
#define kIsolateSnapshotDataCSymbol "kDartIsolateSnapshotData"
#define kIsolateSnapshotInstructionsCSymbol "kDartIsolateSnapshotInstructions"
#define kIsolateSnapshotBssCSymbol "kDartIsolateSnapshotBss"
#else
#define kVmSnapshotDataCSymbol "_kDartVmSnapshotData"
#define kVmSnapshotInstructionsCSymbol "_kDartVmSnapshotInstructions"
#define kVmSnapshotBssCSymbol "_kDartVmSnapshotBss"
#define kIsolateSnapshotDataCSymbol "_kDartIsolateSnapshotData"
#define kIsolateSnapshotInstructionsCSymbol "_kDartIsolateSnapshotInstructions"
#define kIsolateSnapshotBssCSymbol "_kDartIsolateSnapshotBss"
#endif
/**
* Creates a precompiled snapshot.
* - A root library must have been loaded.
@@ -4207,15 +4186,10 @@ Dart_CreateAppAOTSnapshotAndRelocatableObject(
const char* path);
/**
* Like Dart_CreateAppAOTSnapshotAsAssembly, but only includes
* kDartVmSnapshotData and kDartVmSnapshotInstructions. It also does
* not strip DWARF information from the generated assembly or allow for
* separate debug information.
* Creates a blob needed only on Fuchsia to work around platform deficiencies.
* The embedder must place it at pkg/lib/ffi_callback_stub.bin.
*/
DART_EXPORT DART_API_WARN_UNUSED_RESULT Dart_Handle
Dart_CreateVMAOTSnapshotAsAssembly(Dart_StreamingWriteCallback callback,
void* callback_data);
DART_EXPORT DART_API_WARN_UNUSED_RESULT Dart_Handle
Dart_WriteCallbackStub(Dart_StreamingWriteCallback callback,
void* callback_data);
+1 -3
View File
@@ -38,9 +38,7 @@ main(List<String> args) async {
await withElfSnapshot((Elf elf) {
// NOTE: These tests validate properties we should strive to maintain.
// Please reach out to go/dart-ama before changing them.
final Symbol? symbol = elf.dynamicSymbolFor(
'_kDartIsolateSnapshotInstructions',
);
final Symbol? symbol = elf.dynamicSymbolFor('_kDartSnapshotText');
Expect.isTrue(symbol != null && symbol.value > 0);
});
}
@@ -82,7 +82,6 @@ main() {
"Dart_CreateIsolateGroupFromKernel",
"Dart_CreateIsolateInGroup",
"Dart_CreateSnapshot",
"Dart_CreateVMAOTSnapshotAsAssembly",
"Dart_CurrentIsolate",
"Dart_CurrentIsolateData",
"Dart_CurrentIsolateGroup",
@@ -370,13 +369,13 @@ main() {
"Dart_WriteHeapSnapshot",
"Dart_WriteProfileToTimeline",
if (isAOTRuntime) ...[
"Dart_LoadELF2",
"Dart_LoadELF_Memory2",
"Dart_LoadMachODylib2",
"Dart_LoadMachODylib_Memory2",
"Dart_LoadELF",
"Dart_LoadELF_Memory",
"Dart_LoadMachODylib",
"Dart_LoadMachODylib_Memory",
"Dart_UnloadELF",
"Dart_UnloadMachODylib",
if (!Platform.isMacOS) ...["Dart_LoadELF_Fd2", "Dart_LoadMachODylib_Fd2"],
if (!Platform.isMacOS) ...["Dart_LoadELF_Fd", "Dart_LoadMachODylib_Fd"],
],
];
-30
View File
@@ -6884,36 +6884,6 @@ DART_EXPORT Dart_Handle Dart_CreateAppAOTSnapshotAsAssemblies(
#endif
}
DART_EXPORT Dart_Handle
Dart_CreateVMAOTSnapshotAsAssembly(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
const char assembly[] =
".text\n"
".globl _kDartVmSnapshotInstructions\n"
".balign 64, 0\n"
"_kDartVmSnapshotInstructions:\n"
".quad 0\n"
".size _kDartVmSnapshotInstructions, .-_kDartVmSnapshotInstructions\n"
".type _kDartVmSnapshotInstructions, %object\n"
".section .rodata\n"
".globl _kDartVmSnapshotData\n"
".balign 64, 0\n"
"_kDartVmSnapshotData:\n"
".quad 0\n"
".size _kDartVmSnapshotData, .-_kDartVmSnapshotData\n"
".type _kDartVmSnapshotData, %object\n";
callback(callback_data, reinterpret_cast<const uint8_t*>(assembly),
sizeof(assembly));
return Api::Success();
#endif
}
DART_EXPORT Dart_Handle
Dart_WriteCallbackStub(Dart_StreamingWriteCallback callback,
void* callback_data) {
-18
View File
@@ -1220,24 +1220,6 @@ void ElfSymbolTable::Initialize(const GrowableArray<ElfSection*>& sections) {
// dynamic symbols there also. (see dartbug.com/41783).
AddSymbol(portion.symbol_name, binding, type, portion.size,
section->index, portion.offset, portion.label);
#if 1
// TRANSITION
if (strcmp(portion.symbol_name, "_kDartSnapshotText") == 0) {
AddSymbol("_kDartVmSnapshotInstructions", binding, type,
portion.size, section->index, portion.offset,
portion.label);
AddSymbol("_kDartIsolateSnapshotInstructions", binding, type,
portion.size, section->index, portion.offset,
portion.label);
}
if (strcmp(portion.symbol_name, "_kDartSnapshotData") == 0) {
AddSymbol("_kDartVmSnapshotData", binding, type, portion.size,
section->index, portion.offset, portion.label);
AddSymbol("_kDartIsolateSnapshotData", binding, type, portion.size,
section->index, portion.offset, portion.label);
}
#endif
}
if (!dynamic_ && portion.symbols != nullptr) {
for (const auto& symbol_data : *portion.symbols) {
-17
View File
@@ -1650,23 +1650,6 @@ void AssemblyImageWriter::ExitSection(ProgramSection name,
UNIMPLEMENTED();
#endif
#if 1
// TRANSITION
if (name == ProgramSection::Text) {
assembly_stream_->Printf(
".globl _kDartVmSnapshotInstructions\n"
"_kDartVmSnapshotInstructions = _kDartSnapshotText\n"
".globl _kDartIsolateSnapshotInstructions\n"
"_kDartIsolateSnapshotInstructions = _kDartSnapshotText\n");
} else if (name == ProgramSection::Data) {
assembly_stream_->Printf(
".globl _kDartVmSnapshotData\n"
"_kDartVmSnapshotData = _kDartSnapshotData\n"
".globl _kDartIsolateSnapshotData\n"
"_kDartIsolateSnapshotData = _kDartSnapshotData\n");
}
#endif
// We need to generate a text segment of the appropriate size in the shared
// object writer for two reasons:
//
-17
View File
@@ -3651,23 +3651,6 @@ void MachOSymbolTable::Initialize(SharedObjectWriter::Type type,
if (portion.symbol_name != nullptr) {
AddSymbol(portion.symbol_name, mach_o::N_SECT | mach_o::N_EXT, section,
desc, portion.offset, portion.label);
#if 1
// TRANSITION
if (strcmp(portion.symbol_name, "_kDartSnapshotText") == 0) {
AddSymbol("_kDartVmSnapshotInstructions",
mach_o::N_SECT | mach_o::N_EXT, section, desc,
portion.offset, portion.label);
AddSymbol("_kDartIsolateSnapshotInstructions",
mach_o::N_SECT | mach_o::N_EXT, section, desc,
portion.offset, portion.label);
}
if (strcmp(portion.symbol_name, "_kDartSnapshotData") == 0) {
AddSymbol("_kDartVmSnapshotData", mach_o::N_SECT | mach_o::N_EXT,
section, desc, portion.offset, portion.label);
AddSymbol("_kDartIsolateSnapshotData", mach_o::N_SECT | mach_o::N_EXT,
section, desc, portion.offset, portion.label);
}
#endif
}
}
}