Unverified Commit eb8219ed authored by Stanislav Baranov's avatar Stanislav Baranov Committed by GitHub

Emulator support for dynamic mode on Intel architecture (#26565)

parent 9e4c9640
...@@ -364,7 +364,8 @@ class AndroidDevice extends Device { ...@@ -364,7 +364,8 @@ class AndroidDevice extends Device {
final TargetPlatform devicePlatform = await targetPlatform; final TargetPlatform devicePlatform = await targetPlatform;
if (!(devicePlatform == TargetPlatform.android_arm || if (!(devicePlatform == TargetPlatform.android_arm ||
devicePlatform == TargetPlatform.android_arm64) && devicePlatform == TargetPlatform.android_arm64) &&
!debuggingOptions.buildInfo.isDebug) { !(debuggingOptions.buildInfo.isDebug ||
debuggingOptions.buildInfo.isDynamic)) {
printError('Profile and release builds are only supported on ARM targets.'); printError('Profile and release builds are only supported on ARM targets.');
return LaunchResult.failed(); return LaunchResult.failed();
} }
......
...@@ -458,8 +458,25 @@ class JITSnapshotter { ...@@ -458,8 +458,25 @@ class JITSnapshotter {
outputPaths.add(isolateSnapshotInstructions); outputPaths.add(isolateSnapshotInstructions);
} }
// There are a couple special cases below where we create a snapshot
// with only the data section, which only contains interpreted code.
bool supportsAppJit = true;
if (platform == TargetPlatform.android_x64 &&
getCurrentHostPlatform() == HostPlatform.windows_x64) {
supportsAppJit = false;
printStatus('Android x64 dynamic build on Windows x64 will use purely interpreted '
'code for now (see https://github.com/flutter/flutter/issues/17489).');
}
if (platform == TargetPlatform.android_x86) {
supportsAppJit = false;
printStatus('Android x86 dynamic build will use purely interpreted code for now. '
'To optimize performance, consider using --target-platform=android-x64.');
}
genSnapshotArgs.addAll(<String>[ genSnapshotArgs.addAll(<String>[
'--snapshot_kind=app-jit', '--snapshot_kind=${supportsAppJit ? 'app-jit' : 'app'}',
'--load_compilation_trace=$compilationTraceFilePath', '--load_compilation_trace=$compilationTraceFilePath',
'--load_vm_snapshot_data=$engineVmSnapshotData', '--load_vm_snapshot_data=$engineVmSnapshotData',
'--load_isolate_snapshot_data=$engineIsolateSnapshotData', '--load_isolate_snapshot_data=$engineIsolateSnapshotData',
...@@ -533,6 +550,8 @@ class JITSnapshotter { ...@@ -533,6 +550,8 @@ class JITSnapshotter {
return const <TargetPlatform>[ return const <TargetPlatform>[
TargetPlatform.android_arm, TargetPlatform.android_arm,
TargetPlatform.android_arm64, TargetPlatform.android_arm64,
TargetPlatform.android_x86,
TargetPlatform.android_x64,
].contains(platform); ].contains(platform);
} }
} }
...@@ -153,7 +153,11 @@ bool isAotBuildMode(BuildMode mode) { ...@@ -153,7 +153,11 @@ bool isAotBuildMode(BuildMode mode) {
} }
// Returns true if the given build mode can be used on emulators / simulators. // Returns true if the given build mode can be used on emulators / simulators.
bool isEmulatorBuildMode(BuildMode mode) => mode == BuildMode.debug; bool isEmulatorBuildMode(BuildMode mode) {
return mode == BuildMode.debug ||
mode == BuildMode.dynamicRelease ||
mode == BuildMode.dynamicProfile;
}
enum HostPlatform { enum HostPlatform {
darwin_x64, darwin_x64,
......
...@@ -28,7 +28,7 @@ class BuildApkCommand extends BuildSubCommand { ...@@ -28,7 +28,7 @@ class BuildApkCommand extends BuildSubCommand {
) )
..addOption('target-platform', ..addOption('target-platform',
defaultsTo: 'android-arm', defaultsTo: 'android-arm',
allowed: <String>['android-arm', 'android-arm64']); allowed: <String>['android-arm', 'android-arm64', 'android-x86', 'android-x64']);
} }
@override @override
......
...@@ -30,7 +30,7 @@ class BuildBundleCommand extends BuildSubCommand { ...@@ -30,7 +30,7 @@ class BuildBundleCommand extends BuildSubCommand {
..addOption('depfile', defaultsTo: defaultDepfilePath) ..addOption('depfile', defaultsTo: defaultDepfilePath)
..addOption('target-platform', ..addOption('target-platform',
defaultsTo: 'android-arm', defaultsTo: 'android-arm',
allowed: <String>['android-arm', 'android-arm64', 'ios'] allowed: <String>['android-arm', 'android-arm64', 'android-x86', 'android-x64', 'ios']
) )
..addFlag('track-widget-creation', ..addFlag('track-widget-creation',
hide: !verboseHelp, hide: !verboseHelp,
......
...@@ -49,7 +49,7 @@ abstract class RunCommandBase extends FlutterCommand { ...@@ -49,7 +49,7 @@ abstract class RunCommandBase extends FlutterCommand {
) )
..addOption('target-platform', ..addOption('target-platform',
defaultsTo: 'default', defaultsTo: 'default',
allowed: <String>['default', 'android-arm', 'android-arm64'], allowed: <String>['default', 'android-arm', 'android-arm64', 'android-x86', 'android-x64'],
help: 'Specify the target platform when building the app for an ' help: 'Specify the target platform when building the app for an '
'Android device.\nIgnored on iOS.'); 'Android device.\nIgnored on iOS.');
usesTargetOption(); usesTargetOption();
......
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