Unverified Commit 064d2f42 authored by Chris Bracken's avatar Chris Bracken Committed by GitHub

Simplify split between assembly/blob AOT compile (#17157)

This de-duplicates assembly AOT configuration between Android and iOS,
and makes it easier to adjust parameters for 32-bit iOS (which, like
32-bit Android, requires --no-integer-division) in an upcoming patch.
parent bf42524b
...@@ -318,21 +318,14 @@ class Snapshotter { ...@@ -318,21 +318,14 @@ class Snapshotter {
genSnapshotArgs.addAll(extraGenSnapshotOptions); genSnapshotArgs.addAll(extraGenSnapshotOptions);
} }
// Compile-to-assembly outputs.
final String assembly = fs.path.join(outputDir.path, 'snapshot_assembly.S'); final String assembly = fs.path.join(outputDir.path, 'snapshot_assembly.S');
final String assemblyO = fs.path.join(outputDir.path, 'snapshot_assembly.o'); if (compileToSharedLibrary || platform == TargetPlatform.ios) {
final String assemblySo = fs.path.join(outputDir.path, 'app.so'); // Assembly AOT snapshot.
outputPaths.add(assembly);
switch (platform) {
case TargetPlatform.android_arm:
case TargetPlatform.android_arm64:
case TargetPlatform.android_x64:
case TargetPlatform.android_x86:
if (compileToSharedLibrary) {
outputPaths.add(assemblySo);
genSnapshotArgs.add('--snapshot_kind=app-aot-assembly'); genSnapshotArgs.add('--snapshot_kind=app-aot-assembly');
genSnapshotArgs.add('--assembly=$assembly'); genSnapshotArgs.add('--assembly=$assembly');
} else { } else {
// Blob AOT snapshot.
final String vmSnapshotInstructions = fs.path.join(outputDir.path, 'vm_snapshot_instr'); final String vmSnapshotInstructions = fs.path.join(outputDir.path, 'vm_snapshot_instr');
final String isolateSnapshotInstructions = fs.path.join(outputDir.path, 'isolate_snapshot_instr'); final String isolateSnapshotInstructions = fs.path.join(outputDir.path, 'isolate_snapshot_instr');
outputPaths.addAll(<String>[vmSnapshotData, isolateSnapshotData]); outputPaths.addAll(<String>[vmSnapshotData, isolateSnapshotData]);
...@@ -342,23 +335,10 @@ class Snapshotter { ...@@ -342,23 +335,10 @@ class Snapshotter {
'--isolate_snapshot_instructions=$isolateSnapshotInstructions', '--isolate_snapshot_instructions=$isolateSnapshotInstructions',
]); ]);
} }
if (platform == TargetPlatform.android_arm) { if (platform == TargetPlatform.android_arm) {
genSnapshotArgs.addAll(<String>[ // Not supported by the Pixel in 32-bit mode.
'--no-use-integer-division', // Not supported by the Pixel in 32-bit mode. genSnapshotArgs.add('--no-use-integer-division');
]);
}
break;
case TargetPlatform.ios:
genSnapshotArgs.add('--snapshot_kind=app-aot-assembly');
genSnapshotArgs.add('--assembly=$assembly');
outputPaths.add(assemblyO);
break;
case TargetPlatform.darwin_x64:
case TargetPlatform.linux_x64:
case TargetPlatform.windows_x64:
case TargetPlatform.fuchsia:
case TargetPlatform.tester:
assert(false);
} }
genSnapshotArgs.add(mainPath); genSnapshotArgs.add(mainPath);
...@@ -397,8 +377,9 @@ class Snapshotter { ...@@ -397,8 +377,9 @@ class Snapshotter {
// end-developer can link into their app. // end-developer can link into their app.
if (platform == TargetPlatform.ios) { if (platform == TargetPlatform.ios) {
printStatus('Building App.framework...'); printStatus('Building App.framework...');
const List<String> commonBuildOptions = const <String>['-arch', 'arm64', '-miphoneos-version-min=8.0']; const List<String> commonBuildOptions = const <String>['-arch', 'arm64', '-miphoneos-version-min=8.0'];
final String assemblyO = fs.path.join(outputDir.path, 'snapshot_assembly.o');
await xcode.cc(commonBuildOptions.toList()..addAll(<String>['-c', assembly, '-o', assemblyO])); await xcode.cc(commonBuildOptions.toList()..addAll(<String>['-c', assembly, '-o', assemblyO]));
final String frameworkDir = fs.path.join(outputDir.path, 'App.framework'); final String frameworkDir = fs.path.join(outputDir.path, 'App.framework');
...@@ -422,6 +403,7 @@ class Snapshotter { ...@@ -422,6 +403,7 @@ class Snapshotter {
// based upon libunwind use just one and ignore the contents of the other // based upon libunwind use just one and ignore the contents of the other
// (which causes it to not look into the other section and therefore not // (which causes it to not look into the other section and therefore not
// find the correct unwinding information). // find the correct unwinding information).
final String assemblySo = fs.path.join(outputDir.path, 'app.so');
await runCheckedAsync(<String>[androidSdk.ndkCompiler] await runCheckedAsync(<String>[androidSdk.ndkCompiler]
..addAll(androidSdk.ndkCompilerArgs) ..addAll(androidSdk.ndkCompilerArgs)
..addAll(<String>[ '-shared', '-nostdlib', '-o', assemblySo, assembly ])); ..addAll(<String>[ '-shared', '-nostdlib', '-o', assemblySo, assembly ]));
......
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