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 INCLUDE_DART_API_H_ | 7 #ifndef INCLUDE_DART_API_H_ |
8 #define INCLUDE_DART_API_H_ | 8 #define INCLUDE_DART_API_H_ |
9 | 9 |
10 /** \mainpage Dart Embedding API Reference | 10 /** \mainpage Dart Embedding API Reference |
(...skipping 2942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2953 * \return An error handle if a compilation error or runtime error running const | 2953 * \return An error handle if a compilation error or runtime error running const |
2954 * constructors was encountered. | 2954 * constructors was encountered. |
2955 */ | 2955 */ |
2956 DART_EXPORT Dart_Handle Dart_Precompile( | 2956 DART_EXPORT Dart_Handle Dart_Precompile( |
2957 Dart_QualifiedFunctionName entry_points[], | 2957 Dart_QualifiedFunctionName entry_points[], |
2958 bool reset_fields); | 2958 bool reset_fields); |
2959 | 2959 |
2960 | 2960 |
2961 /** | 2961 /** |
2962 * Creates a precompiled snapshot. | 2962 * Creates a precompiled snapshot. |
2963 * - The VM must not have been started from a snapshot. | |
2964 * - A root library must have been loaded. | 2963 * - A root library must have been loaded. |
2965 * - Dart_Precompile must have been called. | 2964 * - Dart_Precompile must have been called. |
2966 * | 2965 * |
2967 * Outputs a vm isolate snapshot, an isolate snapshot, and an assembly file | 2966 * Outputs a vm isolate snapshot, an isolate snapshot, and an assembly file |
2968 * defining the symbols kInstructionsSnapshot and kDataSnapshot. The assembly | 2967 * defining the symbols kInstructionsSnapshot and kDataSnapshot. The assembly |
2969 * should be compiled as a static or shared library and linked or loaded by the | 2968 * should be compiled as a static or shared library and linked or loaded by the |
2970 * embedder. | 2969 * embedder. |
2971 * Running this snapshot requires a VM compiled with DART_PRECOMPILED_SNAPSHOT. | 2970 * Running this snapshot requires a VM compiled with DART_PRECOMPILED_SNAPSHOT. |
2972 * The vm isolate snapshot, kInstructionsSnapshot and kDataSnapshot should be | 2971 * The vm isolate snapshot, kInstructionsSnapshot and kDataSnapshot should be |
2973 * passed as arguments to Dart_Initialize. The isolate snapshot should be | 2972 * passed as arguments to Dart_Initialize. The isolate snapshot should be |
2974 * passed to Dart_CreateIsolate. | 2973 * passed to Dart_CreateIsolate. |
| 2974 * |
| 2975 * The buffers are scope allocated and are only valid until the next call to |
| 2976 * Dart_ExitScope. |
| 2977 * |
| 2978 * \return A valid handle if no error occurs during the operation. |
2975 */ | 2979 */ |
2976 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotAssembly( | 2980 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotAssembly( |
2977 uint8_t** vm_isolate_snapshot_buffer, | 2981 uint8_t** vm_isolate_snapshot_buffer, |
2978 intptr_t* vm_isolate_snapshot_size, | 2982 intptr_t* vm_isolate_snapshot_size, |
2979 uint8_t** isolate_snapshot_buffer, | 2983 uint8_t** isolate_snapshot_buffer, |
2980 intptr_t* isolate_snapshot_size, | 2984 intptr_t* isolate_snapshot_size, |
2981 uint8_t** assembly_buffer, | 2985 uint8_t** assembly_buffer, |
2982 intptr_t* assembly_size); | 2986 intptr_t* assembly_size); |
2983 | 2987 |
2984 | 2988 |
(...skipping 10 matching lines...) Expand all Loading... |
2995 intptr_t* isolate_snapshot_size, | 2999 intptr_t* isolate_snapshot_size, |
2996 uint8_t** instructions_blob_buffer, | 3000 uint8_t** instructions_blob_buffer, |
2997 intptr_t* instructions_blob_size, | 3001 intptr_t* instructions_blob_size, |
2998 uint8_t** rodata_blob_buffer, | 3002 uint8_t** rodata_blob_buffer, |
2999 intptr_t* rodata_blob_size); | 3003 intptr_t* rodata_blob_size); |
3000 | 3004 |
3001 | 3005 |
3002 DART_EXPORT Dart_Handle Dart_PrecompileJIT(); | 3006 DART_EXPORT Dart_Handle Dart_PrecompileJIT(); |
3003 | 3007 |
3004 | 3008 |
3005 DART_EXPORT Dart_Handle Dart_CreatePrecompiledJITSnapshotBlob( | 3009 /** |
| 3010 * Creates a snapshot that caches unoptimized code and type feedback for faster |
| 3011 * startup and quicker warmup in a subsequent process. |
| 3012 * |
| 3013 * Outputs a snapshot in four pieces. The vm isolate snapshot, |
| 3014 * instructions_blob and rodata_blob should be passed as arguments to |
| 3015 * Dart_Initialize. The isolate snapshot should be passed to |
| 3016 * Dart_CreateIsolate. The instructions piece must be loaded with execute |
| 3017 * permissions; the other pieces may loaded as read-only. |
| 3018 * |
| 3019 * - Requires the VM to have been started with --load-deferred-eagerly. |
| 3020 * - Requires the VM to have not been started with --precompilation. |
| 3021 * - Not supported when targeting IA32. |
| 3022 * - The VM writing the snapshot and the VM reading the snapshot must be the |
| 3023 * same version, must be built in the same DEBUG/RELEASE/PRODUCT mode, must |
| 3024 * be targeting the same architecture, and must both be in checked mode or |
| 3025 * both in unchecked mode. |
| 3026 * |
| 3027 * The buffers are scope allocated and are only valid until the next call to |
| 3028 * Dart_ExitScope. |
| 3029 * |
| 3030 * \return A valid handle if no error occurs during the operation. |
| 3031 */ |
| 3032 DART_EXPORT Dart_Handle Dart_CreateAppJITSnapshot( |
3006 uint8_t** vm_isolate_snapshot_buffer, | 3033 uint8_t** vm_isolate_snapshot_buffer, |
3007 intptr_t* vm_isolate_snapshot_size, | 3034 intptr_t* vm_isolate_snapshot_size, |
3008 uint8_t** isolate_snapshot_buffer, | 3035 uint8_t** isolate_snapshot_buffer, |
3009 intptr_t* isolate_snapshot_size, | 3036 intptr_t* isolate_snapshot_size, |
3010 uint8_t** instructions_blob_buffer, | 3037 uint8_t** instructions_blob_buffer, |
3011 intptr_t* instructions_blob_size, | 3038 intptr_t* instructions_blob_size, |
3012 uint8_t** rodata_blob_buffer, | 3039 uint8_t** rodata_blob_buffer, |
3013 intptr_t* rodata_blob_size); | 3040 intptr_t* rodata_blob_size); |
3014 | 3041 |
3015 | 3042 |
3016 /** | 3043 /** |
3017 * Returns whether the VM only supports running from precompiled snapshots and | 3044 * Returns whether the VM only supports running from precompiled snapshots and |
3018 * not from any other kind of snapshot or no snapshot (that is, the VM was | 3045 * not from any other kind of snapshot or no snapshot (that is, the VM was |
3019 * compiled with DART_PRECOMPILED_RUNTIME). | 3046 * compiled with DART_PRECOMPILED_RUNTIME). |
3020 */ | 3047 */ |
3021 DART_EXPORT bool Dart_IsPrecompiledRuntime(); | 3048 DART_EXPORT bool Dart_IsPrecompiledRuntime(); |
3022 | 3049 |
3023 | 3050 |
3024 /** | 3051 /** |
3025 * Returns whether the VM was initialized with a precompiled snapshot. Only | 3052 * Returns whether the VM was initialized with a precompiled snapshot. Only |
3026 * valid after Dart_Initialize. | 3053 * valid after Dart_Initialize. |
3027 * DEPRECATED. This is currently used to disable Platform.executable and | 3054 * DEPRECATED. This is currently used to disable Platform.executable and |
3028 * Platform.resolvedExecutable under precompilation to prevent process | 3055 * Platform.resolvedExecutable under precompilation to prevent process |
3029 * spawning tests from becoming fork-bombs. | 3056 * spawning tests from becoming fork-bombs. |
3030 */ | 3057 */ |
3031 DART_EXPORT bool Dart_IsRunningPrecompiledCode(); | 3058 DART_EXPORT bool Dart_IsRunningPrecompiledCode(); |
3032 | 3059 |
3033 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ | 3060 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ |
OLD | NEW |