Commit 76460967 authored by Ryan Macnak's avatar Ryan Macnak Committed by GitHub

Adapt to refactoring of snapshot APIs in the Dart VM. (#7589)

parent bf296f71
858e401c4d83f44634341a0e1fe2b01428fe6746
adef37080fc7dd025c53bec5413edc353ff25b06
......@@ -134,10 +134,10 @@ class FlutterTask extends DefaultTask {
return project.copySpec {
from "${intermediateDir}/app.flx"
if (buildMode != 'debug') {
from "${intermediateDir}/snapshot_aot_instr"
from "${intermediateDir}/snapshot_aot_isolate"
from "${intermediateDir}/snapshot_aot_rodata"
from "${intermediateDir}/snapshot_aot_vmisolate"
from "${intermediateDir}/vm_snapshot_data"
from "${intermediateDir}/vm_snapshot_instr"
from "${intermediateDir}/isolate_snapshot_data"
from "${intermediateDir}/isolate_snapshot_instr"
}
}
}
......
......@@ -19,7 +19,7 @@ import 'build.dart';
// Files generated by the ahead-of-time snapshot builder.
const List<String> kAotSnapshotFiles = const <String>[
'snapshot_aot_instr', 'snapshot_aot_isolate', 'snapshot_aot_rodata', 'snapshot_aot_vmisolate',
'vm_snapshot_data', 'vm_snapshot_instr', 'isolate_snapshot_data', 'isolate_snapshot_instr',
];
class BuildAotCommand extends BuildSubCommand {
......@@ -144,10 +144,10 @@ Future<String> _buildAotSnapshot(
Directory outputDir = fs.directory(outputPath);
outputDir.createSync(recursive: true);
String vmIsolateSnapshot = path.join(outputDir.path, 'snapshot_aot_vmisolate');
String isolateSnapshot = path.join(outputDir.path, 'snapshot_aot_isolate');
String instructionsBlob = path.join(outputDir.path, 'snapshot_aot_instr');
String rodataBlob = path.join(outputDir.path, 'snapshot_aot_rodata');
String vmSnapshotData = path.join(outputDir.path, 'vm_snapshot_data');
String vmSnapshotInstructions = path.join(outputDir.path, 'vm_snapshot_instr');
String isolateSnapshotData = path.join(outputDir.path, 'isolate_snapshot_data');
String isolateSnapshotInstructions = path.join(outputDir.path, 'isolate_snapshot_instr');
String vmEntryPoints = path.join(entryPointsDir, 'dart_vm_entry_points.txt');
String ioEntryPoints = path.join(dartEntryPointsDir, 'dart_io_entries.txt');
......@@ -209,8 +209,8 @@ Future<String> _buildAotSnapshot(
List<String> genSnapshotCmd = <String>[
genSnapshot,
'--vm_isolate_snapshot=$vmIsolateSnapshot',
'--isolate_snapshot=$isolateSnapshot',
'--vm_snapshot_data=$vmSnapshotData',
'--isolate_snapshot_data=$isolateSnapshotData',
'--packages=${packageMap.packagesPath}',
'--url_mapping=dart:ui,$uiPath',
'--url_mapping=dart:jni,$jniPath',
......@@ -227,8 +227,8 @@ Future<String> _buildAotSnapshot(
case TargetPlatform.android_x64:
case TargetPlatform.android_x86:
genSnapshotCmd.addAll(<String>[
'--rodata_blob=$rodataBlob',
'--instructions_blob=$instructionsBlob',
'--vm_snapshot_instructions=$vmSnapshotInstructions',
'--isolate_snapshot_instructions=$isolateSnapshotInstructions',
'--embedder_entry_points_manifest=$vmEntryPointsAndroid',
'--no-sim-use-hardfp',
'--no-use-integer-division', // Not supported by the Pixel in 32-bit mode.
......@@ -264,34 +264,34 @@ Future<String> _buildAotSnapshot(
printStatus('Building app.dylib...');
// These names are known to from the engine.
String kVmIsolateSnapshot = 'kVmIsolateSnapshot';
String kIsolateSnapshot = 'kIsolateSnapshot';
String kVmSnapshotData = 'kDartVmSnapshotData';
String kIsolateSnapshotData = 'kDartIsolateSnapshotData';
String kVmIsolateSnapshotC = path.join(outputDir.path, '$kVmIsolateSnapshot.c');
String kIsolateSnapshotC = path.join(outputDir.path, '$kIsolateSnapshot.c');
String kVmSnapshotDataC = path.join(outputDir.path, '$kVmSnapshotData.c');
String kIsolateSnapshotDataC = path.join(outputDir.path, '$kIsolateSnapshotData.c');
String kVmSnapshotDataO = path.join(outputDir.path, '$kVmSnapshotData.o');
String kIsolateSnapshotDataO = path.join(outputDir.path, '$kIsolateSnapshotData.o');
String assemblyO = path.join(outputDir.path, 'snapshot_assembly.o');
String kVmIsolateSnapshotO = path.join(outputDir.path, '$kVmIsolateSnapshot.o');
String kIsolateSnapshotO = path.join(outputDir.path, '$kIsolateSnapshot.o');
List<String> commonBuildOptions = <String>['-arch', 'arm64', '-miphoneos-version-min=8.0'];
if (interpreter) {
runCheckedSync(<String>['mv', vmIsolateSnapshot, path.join(outputDir.path, kVmIsolateSnapshot)]);
runCheckedSync(<String>['mv', isolateSnapshot, path.join(outputDir.path, kIsolateSnapshot)]);
runCheckedSync(<String>['mv', vmSnapshotData, path.join(outputDir.path, kVmSnapshotData)]);
runCheckedSync(<String>['mv', isolateSnapshotData, path.join(outputDir.path, kIsolateSnapshotData)]);
runCheckedSync(<String>[
'xxd', '--include', kVmIsolateSnapshot, path.basename(kVmIsolateSnapshotC)
'xxd', '--include', kVmSnapshotData, path.basename(kVmSnapshotDataC)
], workingDirectory: outputDir.path);
runCheckedSync(<String>[
'xxd', '--include', kIsolateSnapshot, path.basename(kIsolateSnapshotC)
'xxd', '--include', kIsolateSnapshotData, path.basename(kIsolateSnapshotDataC)
], workingDirectory: outputDir.path);
runCheckedSync(<String>['xcrun', 'cc']
..addAll(commonBuildOptions)
..addAll(<String>['-c', kVmIsolateSnapshotC, '-o', kVmIsolateSnapshotO]));
..addAll(<String>['-c', kVmSnapshotDataC, '-o', kVmSnapshotDataO]));
runCheckedSync(<String>['xcrun', 'cc']
..addAll(commonBuildOptions)
..addAll(<String>['-c', kIsolateSnapshotC, '-o', kIsolateSnapshotO]));
..addAll(<String>['-c', kIsolateSnapshotDataC, '-o', kIsolateSnapshotDataO]));
} else {
runCheckedSync(<String>['xcrun', 'cc']
..addAll(commonBuildOptions)
......@@ -310,8 +310,8 @@ Future<String> _buildAotSnapshot(
'-o', appSo,
]);
if (interpreter) {
linkCommand.add(kVmIsolateSnapshotO);
linkCommand.add(kIsolateSnapshotO);
linkCommand.add(kVmSnapshotDataO);
linkCommand.add(kIsolateSnapshotDataO);
} else {
linkCommand.add(assemblyO);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment