OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 library kernel.target.vmreify; | 4 library kernel.target.vmreify; |
5 | 5 |
6 import '../ast.dart' show Program; | 6 import '../ast.dart' show Program; |
7 import '../core_types.dart' show CoreTypes; | 7 import '../core_types.dart' show CoreTypes; |
8 import '../transformations/generic_types_reification.dart' as reify | 8 import '../transformations/generic_types_reification.dart' as reify |
9 show transformProgram; | 9 show transformProgram; |
10 import 'targets.dart' show TargetFlags; | 10 import 'targets.dart' show TargetFlags; |
11 import 'vmcc.dart' as vmcc_target; | 11 import 'vmcc.dart' as vmcc_target; |
12 | 12 |
13 /// Specializes the kernel IR to the Dart VM with reified generic types. | 13 /// Specializes the kernel IR to the Dart VM with reified generic types. |
14 class VmGenericTypesReifiedTarget extends vmcc_target.VmClosureConvertedTarget { | 14 class VmGenericTypesReifiedTarget extends vmcc_target.VmClosureConvertedTarget { |
15 VmGenericTypesReifiedTarget(TargetFlags flags) : super(flags); | 15 VmGenericTypesReifiedTarget(TargetFlags flags) : super(flags); |
16 | 16 |
17 @override | 17 @override |
18 String get name => "vmreify"; | 18 String get name => "vmreify"; |
19 | 19 |
20 // This is the order that bootstrap libraries are loaded according to | 20 // This is the order that bootstrap libraries are loaded according to |
21 // `runtime/vm/object_store.h`. | 21 // `runtime/vm/object_store.h`. |
22 List<String> get extraRequiredLibraries { | 22 List<String> get extraRequiredLibraries { |
23 return new List<String>.from(super.extraRequiredLibraries) | 23 return new List<String>.from(super.extraRequiredLibraries) |
24 ..add("${flags.kernelRuntime.resolve('reify/types.dart')}") | 24 ..add("${flags.kernelRuntime.resolve('reify/types.dart')}") |
25 ..add("${flags.kernelRuntime.resolve('reify/declarations.dart')}") | 25 ..add("${flags.kernelRuntime.resolve('reify/declarations.dart')}") |
26 ..add("${flags.kernelRuntime.resolve('reify/interceptors.dart')}"); | 26 ..add("${flags.kernelRuntime.resolve('reify/interceptors.dart')}"); |
27 } | 27 } |
28 | 28 |
29 @override | 29 @override |
30 void performGlobalTransformations(CoreTypes coreTypes, Program program, | 30 void performGlobalTransformations(CoreTypes coreTypes, Program program) { |
31 {void logger(String msg)}) { | |
32 super.performGlobalTransformations(coreTypes, program); | 31 super.performGlobalTransformations(coreTypes, program); |
33 // TODO(dmitryas) this transformation should be made modular | 32 // TODO(dmitryas) this transformation should be made modular |
34 reify.transformProgram(coreTypes, program); | 33 reify.transformProgram(coreTypes, program); |
35 } | 34 } |
36 | 35 |
37 // Disable tree shaking for Generic Types Reification. There are some runtime | 36 // Disable tree shaking for Generic Types Reification. There are some runtime |
38 // libraries that are required for the transformation and are shaken off, | 37 // libraries that are required for the transformation and are shaken off, |
39 // because they aren't invoked from the program being transformed prior to | 38 // because they aren't invoked from the program being transformed prior to |
40 // the transformation. | 39 // the transformation. |
41 // TODO(dmitryas): remove this when the libraries are in dart:_internal | 40 // TODO(dmitryas): remove this when the libraries are in dart:_internal |
42 @override | 41 @override |
43 void performTreeShaking(CoreTypes coreTypes, Program program) {} | 42 void performTreeShaking(CoreTypes coreTypes, Program program) {} |
44 | 43 |
45 // Here we disable Erasure pass of VmTarget class. The information deleted by | 44 // Here we disable Erasure pass of VmTarget class. The information deleted by |
46 // the Erasure pass is required for Generic Type Reification. Also, reify | 45 // the Erasure pass is required for Generic Type Reification. Also, reify |
47 // transformation also performs its own Erasure pass. | 46 // transformation also performs its own Erasure pass. |
48 @override | 47 @override |
49 void performErasure(Program program) {} | 48 void performErasure(Program program) {} |
50 } | 49 } |
OLD | NEW |