OLD | NEW |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 library fletchc.incremental_backend; | 5 library dartino_compiler.incremental_backend; |
6 | 6 |
7 import 'package:compiler/src/elements/elements.dart' show | 7 import 'package:compiler/src/elements/elements.dart' show |
8 Element, | 8 Element, |
9 FieldElement, | 9 FieldElement, |
10 FunctionElement; | 10 FunctionElement; |
11 | 11 |
12 import 'fletch_system.dart' show | 12 import 'dartino_system.dart' show |
13 FletchSystem; | 13 DartinoSystem; |
14 | 14 |
15 import 'src/fletch_system_builder.dart' show | 15 import 'src/dartino_system_builder.dart' show |
16 FletchSystemBuilder; | 16 DartinoSystemBuilder; |
17 | 17 |
18 import 'src/fletch_context.dart' show | 18 import 'src/dartino_context.dart' show |
19 FletchContext; | 19 DartinoContext; |
20 | 20 |
21 // TODO(ahe): Move this to dart2js upstream when it's stabilized | 21 // TODO(ahe): Move this to dart2js upstream when it's stabilized |
22 abstract class IncrementalBackend { | 22 abstract class IncrementalBackend { |
23 | 23 |
24 /// Remove [element] from the compilation result. Called after resolution and | 24 /// Remove [element] from the compilation result. Called after resolution and |
25 /// codegen phase. | 25 /// codegen phase. |
26 /// | 26 /// |
27 /// This is different from [Backend.forgetElement] which is about preparing | 27 /// This is different from [Backend.forgetElement] which is about preparing |
28 /// for a new round of resolution and codegen. `forgetElement` is called | 28 /// for a new round of resolution and codegen. `forgetElement` is called |
29 /// before processing the work queue, this method is called after and the old | 29 /// before processing the work queue, this method is called after and the old |
30 /// version of [element] should be removed. | 30 /// version of [element] should be removed. |
31 void removeFunction(FunctionElement element); | 31 void removeFunction(FunctionElement element); |
32 | 32 |
33 /// Remove [element] from the compilation result. Called after resolution and | 33 /// Remove [element] from the compilation result. Called after resolution and |
34 /// codegen phase. | 34 /// codegen phase. |
35 /// | 35 /// |
36 /// See [removeFunction] for how this compares to `forgetElement`. | 36 /// See [removeFunction] for how this compares to `forgetElement`. |
37 void removeField(FieldElement element); | 37 void removeField(FieldElement element); |
38 | 38 |
39 /// Register that [element] is now part of the compilation. This happens | 39 /// Register that [element] is now part of the compilation. This happens |
40 /// during the codegen phase. | 40 /// during the codegen phase. |
41 // TODO(ahe): We should probably remove this API, I believe it is an artifact | 41 // TODO(ahe): We should probably remove this API, I believe it is an artifact |
42 // of the incremental compiler not enqueuing fields. | 42 // of the incremental compiler not enqueuing fields. |
43 void newElement(Element element); | 43 void newElement(Element element); |
44 | 44 |
45 /// Update references to [element] in [users]. | 45 /// Update references to [element] in [users]. |
46 // TODO(ahe): Computing [users] is expensive, and may not be necessary in | 46 // TODO(ahe): Computing [users] is expensive, and may not be necessary in |
47 // dart2js. Move to IncrementalFletchBackend or add a bool to say if the call | 47 // dart2js. Move to IncrementalDartinoBackend or add a bool to say if the call |
48 // is needed. | 48 // is needed. |
49 void replaceFunctionUsageElement(Element element, List<Element> users); | 49 void replaceFunctionUsageElement(Element element, List<Element> users); |
50 } | 50 } |
51 | 51 |
52 abstract class IncrementalFletchBackend implements IncrementalBackend { | 52 abstract class IncrementalDartinoBackend implements IncrementalBackend { |
53 FletchSystemBuilder get systemBuilder; | 53 DartinoSystemBuilder get systemBuilder; |
54 | 54 |
55 void newSystemBuilder(FletchSystem predecessorSystem); | 55 void newSystemBuilder(DartinoSystem predecessorSystem); |
56 | 56 |
57 /// In Fletch, assembleProgram is incremental. In dart2js it isn't. | 57 /// In Dartino, assembleProgram is incremental. In dart2js it isn't. |
58 int assembleProgram(); | 58 int assembleProgram(); |
59 } | 59 } |
OLD | NEW |