| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 * for details. All rights reserved. Use of this source code is governed by a | 3 * for details. All rights reserved. Use of this source code is governed by a |
| 4 * BSD-style license that can be found in the LICENSE file. | 4 * BSD-style license that can be found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #ifndef RUNTIME_INCLUDE_DART_API_H_ | 7 #ifndef RUNTIME_INCLUDE_DART_API_H_ |
| 8 #define RUNTIME_INCLUDE_DART_API_H_ | 8 #define RUNTIME_INCLUDE_DART_API_H_ |
| 9 | 9 |
| 10 /** \mainpage Dart Embedding API Reference | 10 /** \mainpage Dart Embedding API Reference |
| (...skipping 3200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3211 Dart_Precompile(Dart_QualifiedFunctionName entry_points[], | 3211 Dart_Precompile(Dart_QualifiedFunctionName entry_points[], |
| 3212 uint8_t* jit_feedback, | 3212 uint8_t* jit_feedback, |
| 3213 intptr_t jit_feedback_length); | 3213 intptr_t jit_feedback_length); |
| 3214 | 3214 |
| 3215 | 3215 |
| 3216 /** | 3216 /** |
| 3217 * Creates a precompiled snapshot. | 3217 * Creates a precompiled snapshot. |
| 3218 * - A root library must have been loaded. | 3218 * - A root library must have been loaded. |
| 3219 * - Dart_Precompile must have been called. | 3219 * - Dart_Precompile must have been called. |
| 3220 * | 3220 * |
| 3221 * Outputs a vm isolate snapshot, an isolate snapshot, and an assembly file | 3221 * Outputs an assembly file defining the symbols kVmIsolateSnapshot, |
| 3222 * defining the symbols kInstructionsSnapshot and kDataSnapshot. The assembly | 3222 * kIsolateSnapshot, kInstructionsSnapshot and kDataSnapshot. The assembly |
| 3223 * should be compiled as a static or shared library and linked or loaded by the | 3223 * should be compiled as a static or shared library and linked or loaded by the |
| 3224 * embedder. | 3224 * embedder. |
| 3225 * Running this snapshot requires a VM compiled with DART_PRECOMPILED_SNAPSHOT. | 3225 * Running this snapshot requires a VM compiled with DART_PRECOMPILED_SNAPSHOT. |
| 3226 * The vm isolate snapshot, kInstructionsSnapshot and kDataSnapshot should be | 3226 * The kVmIsolateSnapshot, kInstructionsSnapshot and kDataSnapshot should be |
| 3227 * passed as arguments to Dart_Initialize. The isolate snapshot should be | 3227 * passed as arguments to Dart_Initialize. The kIsolateSnapshot snapshot should |
| 3228 * passed to Dart_CreateIsolate. | 3228 * be passed to Dart_CreateIsolate. |
| 3229 * | 3229 * |
| 3230 * The buffers are scope allocated and are only valid until the next call to | 3230 * The buffers are scope allocated and are only valid until the next call to |
| 3231 * Dart_ExitScope. | 3231 * Dart_ExitScope. |
| 3232 * | 3232 * |
| 3233 * \return A valid handle if no error occurs during the operation. | 3233 * \return A valid handle if no error occurs during the operation. |
| 3234 */ | 3234 */ |
| 3235 DART_EXPORT Dart_Handle | 3235 DART_EXPORT Dart_Handle |
| 3236 Dart_CreatePrecompiledSnapshotAssembly(uint8_t** assembly_buffer, | 3236 Dart_CreateAppAOTSnapshotAsAssembly(uint8_t** assembly_buffer, |
| 3237 intptr_t* assembly_size); | 3237 intptr_t* assembly_size); |
| 3238 | 3238 |
| 3239 | 3239 |
| 3240 /** | 3240 /** |
| 3241 * Same as Dart_CreatePrecompiledSnapshotAssembly, except the instruction and | 3241 * Same as Dart_CreateAppAOTSnapshotAsAssembly, except all the pieces are |
| 3242 * data snapshot pieces are provided directly as bytes that the embedder can | 3242 * provided directly as bytes that the embedder can load with mmap. The |
| 3243 * load with mmap. The instructions piece must be loaded with read and | 3243 * instructions piece must be loaded with read and execute permissions; the |
| 3244 * execute permissions; the rodata piece may be loaded as read-only. | 3244 * other pieces may be loaded as read-only. |
| 3245 */ | 3245 */ |
| 3246 DART_EXPORT Dart_Handle | 3246 DART_EXPORT Dart_Handle |
| 3247 Dart_CreatePrecompiledSnapshotBlob(uint8_t** vm_isolate_snapshot_buffer, | 3247 Dart_CreateAppAOTSnapshotAsBlobs(uint8_t** vm_isolate_snapshot_buffer, |
| 3248 intptr_t* vm_isolate_snapshot_size, | 3248 intptr_t* vm_isolate_snapshot_size, |
| 3249 uint8_t** isolate_snapshot_buffer, | 3249 uint8_t** isolate_snapshot_buffer, |
| 3250 intptr_t* isolate_snapshot_size, | 3250 intptr_t* isolate_snapshot_size, |
| 3251 uint8_t** instructions_blob_buffer, | 3251 uint8_t** instructions_blob_buffer, |
| 3252 intptr_t* instructions_blob_size, | 3252 intptr_t* instructions_blob_size, |
| 3253 uint8_t** rodata_blob_buffer, | 3253 uint8_t** rodata_blob_buffer, |
| 3254 intptr_t* rodata_blob_size); | 3254 intptr_t* rodata_blob_size); |
| 3255 | |
| 3256 | |
| 3257 DART_EXPORT Dart_Handle Dart_PrecompileJIT(); | |
| 3258 | 3255 |
| 3259 | 3256 |
| 3260 /** | 3257 /** |
| 3261 * Creates a snapshot that caches unoptimized code and type feedback for faster | 3258 * Creates a snapshot that caches unoptimized code and type feedback for faster |
| 3262 * startup and quicker warmup in a subsequent process. | 3259 * startup and quicker warmup in a subsequent process. |
| 3263 * | 3260 * |
| 3264 * Outputs a snapshot in four pieces. The vm isolate snapshot, | 3261 * Outputs a snapshot in four pieces. The vm isolate snapshot, |
| 3265 * instructions_blob and rodata_blob should be passed as arguments to | 3262 * instructions_blob and rodata_blob should be passed as arguments to |
| 3266 * Dart_Initialize. The isolate snapshot should be passed to | 3263 * Dart_Initialize. The isolate snapshot should be passed to |
| 3267 * Dart_CreateIsolate. The instructions piece must be loaded with execute | 3264 * Dart_CreateIsolate. The instructions piece must be loaded with execute |
| 3268 * permissions; the other pieces may loaded as read-only. | 3265 * permissions; the other pieces may loaded as read-only. |
| 3269 * | 3266 * |
| 3270 * - Requires the VM to have been started with --load-deferred-eagerly. | 3267 * - Requires the VM to have been started with --load-deferred-eagerly. |
| 3271 * - Requires the VM to have not been started with --precompilation. | 3268 * - Requires the VM to have not been started with --precompilation. |
| 3272 * - Not supported when targeting IA32. | 3269 * - Not supported when targeting IA32. |
| 3273 * - The VM writing the snapshot and the VM reading the snapshot must be the | 3270 * - The VM writing the snapshot and the VM reading the snapshot must be the |
| 3274 * same version, must be built in the same DEBUG/RELEASE/PRODUCT mode, must | 3271 * same version, must be built in the same DEBUG/RELEASE/PRODUCT mode, must |
| 3275 * be targeting the same architecture, and must both be in checked mode or | 3272 * be targeting the same architecture, and must both be in checked mode or |
| 3276 * both in unchecked mode. | 3273 * both in unchecked mode. |
| 3277 * | 3274 * |
| 3278 * The buffers are scope allocated and are only valid until the next call to | 3275 * The buffers are scope allocated and are only valid until the next call to |
| 3279 * Dart_ExitScope. | 3276 * Dart_ExitScope. |
| 3280 * | 3277 * |
| 3281 * \return A valid handle if no error occurs during the operation. | 3278 * \return A valid handle if no error occurs during the operation. |
| 3282 */ | 3279 */ |
| 3283 DART_EXPORT Dart_Handle | 3280 DART_EXPORT Dart_Handle |
| 3284 Dart_CreateAppJITSnapshot(uint8_t** isolate_snapshot_buffer, | 3281 Dart_CreateAppJITSnapshotAsBlobs(uint8_t** isolate_snapshot_buffer, |
| 3285 intptr_t* isolate_snapshot_size, | 3282 intptr_t* isolate_snapshot_size, |
| 3286 uint8_t** instructions_blob_buffer, | 3283 uint8_t** instructions_blob_buffer, |
| 3287 intptr_t* instructions_blob_size, | 3284 intptr_t* instructions_blob_size, |
| 3288 uint8_t** rodata_blob_buffer, | 3285 uint8_t** rodata_blob_buffer, |
| 3289 intptr_t* rodata_blob_size); | 3286 intptr_t* rodata_blob_size); |
| 3290 | 3287 |
| 3291 | 3288 |
| 3292 /** | 3289 /** |
| 3293 * Returns whether the VM only supports running from precompiled snapshots and | 3290 * Returns whether the VM only supports running from precompiled snapshots and |
| 3294 * not from any other kind of snapshot or from source (that is, the VM was | 3291 * not from any other kind of snapshot or from source (that is, the VM was |
| 3295 * compiled with DART_PRECOMPILED_RUNTIME). | 3292 * compiled with DART_PRECOMPILED_RUNTIME). |
| 3296 */ | 3293 */ |
| 3297 DART_EXPORT bool Dart_IsPrecompiledRuntime(); | 3294 DART_EXPORT bool Dart_IsPrecompiledRuntime(); |
| 3298 | 3295 |
| 3299 | 3296 |
| 3300 /** | 3297 /** |
| 3301 * Print a native stack trace. Used for crash handling. | 3298 * Print a native stack trace. Used for crash handling. |
| 3302 */ | 3299 */ |
| 3303 DART_EXPORT void Dart_DumpNativeStackTrace(void* context); | 3300 DART_EXPORT void Dart_DumpNativeStackTrace(void* context); |
| 3304 | 3301 |
| 3305 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ | 3302 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ |
| OLD | NEW |