| 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)}) { |
| 31 super.performGlobalTransformations(coreTypes, program); | 32 super.performGlobalTransformations(coreTypes, program); |
| 32 // TODO(dmitryas) this transformation should be made modular | 33 // TODO(dmitryas) this transformation should be made modular |
| 33 reify.transformProgram(coreTypes, program); | 34 reify.transformProgram(coreTypes, program); |
| 34 } | 35 } |
| 35 | 36 |
| 36 // Disable tree shaking for Generic Types Reification. There are some runtime | 37 // Disable tree shaking for Generic Types Reification. There are some runtime |
| 37 // libraries that are required for the transformation and are shaken off, | 38 // libraries that are required for the transformation and are shaken off, |
| 38 // because they aren't invoked from the program being transformed prior to | 39 // because they aren't invoked from the program being transformed prior to |
| 39 // the transformation. | 40 // the transformation. |
| 40 // TODO(dmitryas): remove this when the libraries are in dart:_internal | 41 // TODO(dmitryas): remove this when the libraries are in dart:_internal |
| 41 @override | 42 @override |
| 42 void performTreeShaking(CoreTypes coreTypes, Program program) {} | 43 void performTreeShaking(CoreTypes coreTypes, Program program) {} |
| 43 | 44 |
| 44 // Here we disable Erasure pass of VmTarget class. The information deleted by | 45 // Here we disable Erasure pass of VmTarget class. The information deleted by |
| 45 // the Erasure pass is required for Generic Type Reification. Also, reify | 46 // the Erasure pass is required for Generic Type Reification. Also, reify |
| 46 // transformation also performs its own Erasure pass. | 47 // transformation also performs its own Erasure pass. |
| 47 @override | 48 @override |
| 48 void performErasure(Program program) {} | 49 void performErasure(Program program) {} |
| 49 } | 50 } |
| OLD | NEW |