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 | 4 |
5 #ifndef RUNTIME_BIN_DFE_H_ | 5 #ifndef RUNTIME_BIN_DFE_H_ |
6 #define RUNTIME_BIN_DFE_H_ | 6 #define RUNTIME_BIN_DFE_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "include/dart_native_api.h" | 9 #include "include/dart_native_api.h" |
10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 bool UseDartFrontend() const { return frontend_filename_ != NULL; } | 23 bool UseDartFrontend() const { return frontend_filename_ != NULL; } |
24 | 24 |
25 const char* platform_binary_filename() const { | 25 const char* platform_binary_filename() const { |
26 return platform_binary_filename_; | 26 return platform_binary_filename_; |
27 } | 27 } |
28 void set_platform_binary_filename(const char* name) { | 28 void set_platform_binary_filename(const char* name) { |
29 platform_binary_filename_ = name; | 29 platform_binary_filename_ = name; |
30 } | 30 } |
31 bool UsePlatformBinary() const { return platform_binary_filename_ != NULL; } | 31 bool UsePlatformBinary() const { return platform_binary_filename_ != NULL; } |
32 | 32 |
| 33 void set_vmservice_io_binary_filename(const char* name) { |
| 34 vmservice_io_binary_filename_ = name; |
| 35 } |
| 36 |
33 void* kernel_platform() const { return kernel_platform_; } | 37 void* kernel_platform() const { return kernel_platform_; } |
34 | 38 |
| 39 void* kernel_vmservice_io() const { return kernel_vmservice_io_; } |
| 40 |
35 // Method to reload a script into a running a isolate. | 41 // Method to reload a script into a running a isolate. |
36 // If the specified script [url] is not a kernel IR, compile it first using | 42 // If the specified script [url] is not a kernel IR, compile it first using |
37 // DFE and then reload the resulting kernel IR into the isolate. | 43 // DFE and then reload the resulting kernel IR into the isolate. |
38 // Returns Dart_Null if successful, otherwise an error object is returned. | 44 // Returns Dart_Null if successful, otherwise an error object is returned. |
39 Dart_Handle ReloadScript(Dart_Isolate isolate, const char* url_string); | 45 Dart_Handle ReloadScript(Dart_Isolate isolate, const char* url_string); |
40 | 46 |
41 // Compiles a script and reads the resulting kernel file. | 47 // Compiles a script and reads the resulting kernel file. |
42 // If the compilation is successful, returns a valid in memory kernel | 48 // If the compilation is successful, returns a valid in memory kernel |
43 // representation of the script, NULL otherwise | 49 // representation of the script, NULL otherwise |
44 // 'error' and 'exit_code' have the error values in case of errors. | 50 // 'error' and 'exit_code' have the error values in case of errors. |
45 void* CompileAndReadScript(const char* script_uri, | 51 void* CompileAndReadScript(const char* script_uri, |
46 char** error, | 52 char** error, |
47 int* exit_code); | 53 int* exit_code); |
48 | 54 |
49 // Reads the platform kernel file. | 55 // Reads the platform kernel file. |
50 // Returns an in memory kernel representation of the platform kernel file. | 56 // Returns an in memory kernel representation of the platform kernel file. |
51 void* ReadPlatform(); | 57 void* ReadPlatform(); |
52 | 58 |
| 59 // Reads the vmservice_io kernel file. |
| 60 // Returns the in memory representation of the vmservice_io kernel file. |
| 61 void* ReadVMServiceIO(); |
| 62 |
53 // Reads the script kernel file if specified 'script_uri' is a kernel file. | 63 // Reads the script kernel file if specified 'script_uri' is a kernel file. |
54 // Returns an in memory kernel representation of the specified script is a | 64 // Returns an in memory kernel representation of the specified script is a |
55 // valid kernel file, false otherwise. | 65 // valid kernel file, false otherwise. |
56 void* ReadScript(const char* script_uri); | 66 void* ReadScript(const char* script_uri); |
57 | 67 |
58 private: | 68 private: |
59 // Tries to read [script_uri] as a Kernel IR file. | 69 // Tries to read [script_uri] as a Kernel IR file. |
60 // Returns `true` if successful and sets [kernel_file] and [kernel_length] | 70 // Returns `true` if successful and sets [kernel_file] and [kernel_length] |
61 // to be the kernel IR contents. | 71 // to be the kernel IR contents. |
62 // The caller is responsible for free()ing [kernel_file] if `true` | 72 // The caller is responsible for free()ing [kernel_file] if `true` |
63 // was returned. | 73 // was returned. |
64 bool TryReadKernelFile(const char* script_uri, | 74 bool TryReadKernelFile(const char* script_uri, |
65 const uint8_t** kernel_ir, | 75 const uint8_t** kernel_ir, |
66 intptr_t* kernel_ir_size); | 76 intptr_t* kernel_ir_size); |
67 | 77 |
68 const char* frontend_filename_; | 78 const char* frontend_filename_; |
69 const char* platform_binary_filename_; | 79 const char* platform_binary_filename_; |
| 80 const char* vmservice_io_binary_filename_; |
70 void* kernel_platform_; | 81 void* kernel_platform_; |
| 82 void* kernel_vmservice_io_; |
71 | 83 |
72 DISALLOW_COPY_AND_ASSIGN(DFE); | 84 DISALLOW_COPY_AND_ASSIGN(DFE); |
73 }; | 85 }; |
74 | 86 |
75 } // namespace bin | 87 } // namespace bin |
76 } // namespace dart | 88 } // namespace dart |
77 | 89 |
78 #endif // RUNTIME_BIN_DFE_H_ | 90 #endif // RUNTIME_BIN_DFE_H_ |
OLD | NEW |