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