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 dart.fletch._system; | 5 library dart.dartino._system; |
6 | 6 |
7 import 'dart:_internal' hide Symbol; | 7 import 'dart:_internal' hide Symbol; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:fletch'; | 9 import 'dart:dartino'; |
10 import 'dart:math'; | 10 import 'dart:math'; |
11 | 11 |
12 part 'list.dart'; | 12 part 'list.dart'; |
13 part 'map.dart'; | 13 part 'map.dart'; |
14 part 'nsm.dart'; | 14 part 'nsm.dart'; |
15 | 15 |
16 const native = "native"; | 16 const native = "native"; |
17 | 17 |
18 const bool enableBigint = | 18 const bool enableBigint = |
19 const bool.fromEnvironment('fletch.enable-bigint', defaultValue: true); | 19 const bool.fromEnvironment('dartino.enable-bigint', defaultValue: true); |
20 | 20 |
21 // These strings need to be kept in sync with the strings allocated | 21 // These strings need to be kept in sync with the strings allocated |
22 // for the raw failure objects in src/vm/program.cc. | 22 // for the raw failure objects in src/vm/program.cc. |
23 const wrongArgumentType = "Wrong argument type."; | 23 const wrongArgumentType = "Wrong argument type."; |
24 const indexOutOfBounds = "Index out of bounds."; | 24 const indexOutOfBounds = "Index out of bounds."; |
25 const illegalState = "Illegal state."; | 25 const illegalState = "Illegal state."; |
26 | 26 |
27 // This enum must be kept in sync with the Interpreter::InterruptKind | 27 // This enum must be kept in sync with the Interpreter::InterruptKind |
28 // enum in src/vm/interpreter.h. | 28 // enum in src/vm/interpreter.h. |
29 enum InterruptKind { | 29 enum InterruptKind { |
(...skipping 12 matching lines...) Expand all Loading... |
42 /// [arguments] is supposed to be a List<String> with command line arguments. | 42 /// [arguments] is supposed to be a List<String> with command line arguments. |
43 /// [isolateArgument] is an extra argument that can be passed via | 43 /// [isolateArgument] is an extra argument that can be passed via |
44 /// [Isolate.spawnUri]. | 44 /// [Isolate.spawnUri]. |
45 external invokeMain([arguments, isolateArgument]); | 45 external invokeMain([arguments, isolateArgument]); |
46 | 46 |
47 // Trivial wrapper around invokeMain to have a frame to restart from | 47 // Trivial wrapper around invokeMain to have a frame to restart from |
48 // if we want to restart main. | 48 // if we want to restart main. |
49 // TODO(ager): Get rid of this wrapper. | 49 // TODO(ager): Get rid of this wrapper. |
50 callMain(arguments) => invokeMain(arguments); | 50 callMain(arguments) => invokeMain(arguments); |
51 | 51 |
52 /// This is the main entry point for a Fletch program, and it takes care of | 52 /// This is the main entry point for a Dartino program, and it takes care of |
53 /// calling "main" and exiting the VM when "main" is done. | 53 /// calling "main" and exiting the VM when "main" is done. |
54 void entry(int mainArity) { | 54 void entry(int mainArity) { |
55 Fiber.exit(callMain([])); | 55 Fiber.exit(callMain([])); |
56 } | 56 } |
57 | 57 |
58 runToEnd(entry) { | 58 runToEnd(entry) { |
59 Fiber.exit(entry()); | 59 Fiber.exit(entry()); |
60 } | 60 } |
61 | 61 |
62 unresolved(name) { | 62 unresolved(name) { |
(...skipping 16 matching lines...) Expand all Loading... |
79 /// Make the current process yield. Either to allow other fibers to | 79 /// Make the current process yield. Either to allow other fibers to |
80 /// make progress or to terminate execution. | 80 /// make progress or to terminate execution. |
81 external yield(int reason); | 81 external yield(int reason); |
82 | 82 |
83 external get nativeError; | 83 external get nativeError; |
84 | 84 |
85 // Change execution to [coroutine], passing along [argument]. | 85 // Change execution to [coroutine], passing along [argument]. |
86 external coroutineChange(coroutine, argument); | 86 external coroutineChange(coroutine, argument); |
87 | 87 |
88 const patch = "patch"; | 88 const patch = "patch"; |
OLD | NEW |