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