@@ -67,6 +67,9 @@ abstract class CompilerConfiguration {
67
67
return new PrecompilerCompilerConfiguration (configuration);
68
68
69
69
case Compiler .dartk:
70
+ if (configuration.architecture == Architecture .simdbc64) {
71
+ return new VMKernelCompilerConfiguration (configuration);
72
+ }
70
73
return new NoneCompilerConfiguration (configuration, useDfe: true );
71
74
72
75
case Compiler .dartkp:
@@ -132,6 +135,8 @@ abstract class CompilerConfiguration {
132
135
133
136
/// The "none" compiler.
134
137
class NoneCompilerConfiguration extends CompilerConfiguration {
138
+ // This boolean is used by the [VMTestSuite] for running cc tests via
139
+ // run_vm_tests.
135
140
final bool useDfe;
136
141
137
142
NoneCompilerConfiguration (Configuration configuration, {this .useDfe: false })
@@ -186,6 +191,56 @@ class NoneCompilerConfiguration extends CompilerConfiguration {
186
191
}
187
192
}
188
193
194
+ class VMKernelCompilerConfiguration extends CompilerConfiguration
195
+ with VMKernelCompilerMixin {
196
+ VMKernelCompilerConfiguration (Configuration configuration)
197
+ : super ._subclass (configuration);
198
+
199
+ // This boolean is used by the [VMTestSuite] for running cc tests via
200
+ // run_vm_tests. We enable it here, so the cc tests continue to use the
201
+ // kernel-isolate. All the remaining tests will use a separate compilation
202
+ // command (which this class represents).
203
+ bool get useDfe => true ;
204
+
205
+ bool get _isAot => false ;
206
+
207
+ CommandArtifact computeCompilationArtifact (String tempDir,
208
+ List <String > arguments, Map <String , String > environmentOverrides) {
209
+ final commands = < Command > [
210
+ computeCompileToKernelCommand (tempDir, arguments, environmentOverrides),
211
+ ];
212
+ return new CommandArtifact (
213
+ commands, tempKernelFile (tempDir), 'application/kernel-ir' );
214
+ }
215
+
216
+ List <String > computeRuntimeArguments (
217
+ RuntimeConfiguration runtimeConfiguration,
218
+ TestInformation info,
219
+ List <String > vmOptions,
220
+ List <String > sharedOptions,
221
+ List <String > originalArguments,
222
+ CommandArtifact artifact) {
223
+ var args = < String > [];
224
+ if (_isStrong) {
225
+ args.add ('--strong' );
226
+ }
227
+ if (_isChecked) {
228
+ args.add ('--enable_asserts' );
229
+ args.add ('--enable_type_checks' );
230
+ }
231
+ if (_configuration.hotReload) {
232
+ args.add ('--hot-reload-test-mode' );
233
+ } else if (_configuration.hotReloadRollback) {
234
+ args.add ('--hot-reload-rollback-test-mode' );
235
+ }
236
+
237
+ return args
238
+ ..addAll (vmOptions)
239
+ ..addAll (sharedOptions)
240
+ ..addAll (_replaceDartFiles (originalArguments, artifact.filename));
241
+ }
242
+ }
243
+
189
244
typedef List <String > CompilerArgumentsFunction (
190
245
List <String > globalArguments, String previousCompilerOutput);
191
246
@@ -548,13 +603,18 @@ class DevKernelCompilerConfiguration extends CompilerConfiguration {
548
603
}
549
604
}
550
605
551
- class PrecompilerCompilerConfiguration extends CompilerConfiguration {
606
+ class PrecompilerCompilerConfiguration extends CompilerConfiguration
607
+ with VMKernelCompilerMixin {
608
+ // This boolean is used by the [VMTestSuite] for running cc tests via
609
+ // run_vm_tests.
552
610
final bool useDfe;
553
611
554
612
bool get _isAndroid => _configuration.system == System .android;
555
613
bool get _isArm => _configuration.architecture == Architecture .arm;
556
614
bool get _isArm64 => _configuration.architecture == Architecture .arm64;
557
615
616
+ bool get _isAot => true ;
617
+
558
618
PrecompilerCompilerConfiguration (Configuration configuration,
559
619
{this .useDfe: false })
560
620
: super ._subclass (configuration);
@@ -598,35 +658,6 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration {
598
658
commands, '$tempDir ' , 'application/dart-precompiled' );
599
659
}
600
660
601
- String tempKernelFile (String tempDir) => '$tempDir /out.dill' ;
602
-
603
- Command computeCompileToKernelCommand (String tempDir, List <String > arguments,
604
- Map <String , String > environmentOverrides) {
605
- final genKernel =
606
- Platform .script.resolve ('../../../pkg/vm/tool/gen_kernel' ).toFilePath ();
607
-
608
- final kernelBinariesFolder = _useSdk
609
- ? '${_configuration .buildDirectory }/dart-sdk/lib/_internal'
610
- : '${_configuration .buildDirectory }' ;
611
-
612
- final vmPlatform = _isStrong
613
- ? '$kernelBinariesFolder /vm_platform_strong.dill'
614
- : '$kernelBinariesFolder /vm_platform.dill' ;
615
-
616
- final dillFile = tempKernelFile (tempDir);
617
- final args = [
618
- '--aot' ,
619
- _isStrong ? '--strong-mode' : '--no-strong-mode' ,
620
- '--platform=$vmPlatform ' ,
621
- '-o' ,
622
- dillFile,
623
- ];
624
- args.add (arguments.where ((name) => name.endsWith ('.dart' )).single);
625
-
626
- return Command .vmKernelCompilation (dillFile, true , bootstrapDependencies (),
627
- genKernel, args, environmentOverrides);
628
- }
629
-
630
661
/// Creates a command to clean up large temporary kernel files.
631
662
///
632
663
/// Warning: this command removes temporary file and violates tracking of
@@ -879,12 +910,10 @@ class AppJitCompilerConfiguration extends CompilerConfiguration {
879
910
args.add ('--enable_asserts' );
880
911
args.add ('--enable_type_checks' );
881
912
}
882
- args..addAll (vmOptions)..addAll (sharedOptions)..addAll (originalArguments);
883
- for (var i = 0 ; i < args.length; i++ ) {
884
- if (args[i].endsWith (".dart" )) {
885
- args[i] = artifact.filename;
886
- }
887
- }
913
+ args
914
+ ..addAll (vmOptions)
915
+ ..addAll (sharedOptions)
916
+ ..addAll (_replaceDartFiles (originalArguments, artifact.filename));
888
917
return args;
889
918
}
890
919
}
@@ -968,3 +997,42 @@ class SpecParserCompilerConfiguration extends CompilerConfiguration {
968
997
return < String > [];
969
998
}
970
999
}
1000
+
1001
+ abstract class VMKernelCompilerMixin {
1002
+ Configuration get _configuration;
1003
+ bool get _useSdk;
1004
+ bool get _isStrong;
1005
+ bool get _isAot;
1006
+
1007
+ List <Uri > bootstrapDependencies ();
1008
+
1009
+ String tempKernelFile (String tempDir) => '$tempDir /out.dill' ;
1010
+
1011
+ Command computeCompileToKernelCommand (String tempDir, List <String > arguments,
1012
+ Map <String , String > environmentOverrides) {
1013
+ final genKernel =
1014
+ Platform .script.resolve ('../../../pkg/vm/tool/gen_kernel' ).toFilePath ();
1015
+
1016
+ final kernelBinariesFolder = _useSdk
1017
+ ? '${_configuration .buildDirectory }/dart-sdk/lib/_internal'
1018
+ : '${_configuration .buildDirectory }' ;
1019
+
1020
+ final vmPlatform = _isStrong
1021
+ ? '$kernelBinariesFolder /vm_platform_strong.dill'
1022
+ : '$kernelBinariesFolder /vm_platform.dill' ;
1023
+
1024
+ final dillFile = tempKernelFile (tempDir);
1025
+
1026
+ final args = [
1027
+ _isAot ? '--aot' : '--no-aot' ,
1028
+ _isStrong ? '--strong-mode' : '--no-strong-mode' ,
1029
+ '--platform=$vmPlatform ' ,
1030
+ '-o' ,
1031
+ dillFile,
1032
+ ];
1033
+ args.add (arguments.where ((name) => name.endsWith ('.dart' )).single);
1034
+
1035
+ return Command .vmKernelCompilation (dillFile, true , bootstrapDependencies (),
1036
+ genKernel, args, environmentOverrides);
1037
+ }
1038
+ }
0 commit comments