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 2939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2950 * the same process. | 2950 * the same process. |
2951 * | 2951 * |
2952 * \return An error handle if a compilation error or runtime error running const | 2952 * \return An error handle if a compilation error or runtime error running const |
2953 * constructors was encountered. | 2953 * constructors was encountered. |
2954 */ | 2954 */ |
2955 DART_EXPORT Dart_Handle Dart_Precompile( | 2955 DART_EXPORT Dart_Handle Dart_Precompile( |
2956 Dart_QualifiedFunctionName entry_points[], | 2956 Dart_QualifiedFunctionName entry_points[], |
2957 bool reset_fields); | 2957 bool reset_fields); |
2958 | 2958 |
2959 | 2959 |
| 2960 /** |
| 2961 * Creates a precompiled snapshot. |
| 2962 * - The VM must not have been started from a snapshot. |
| 2963 * - A root library must have been loaded. |
| 2964 * - Dart_Precompile must have been called. |
| 2965 * |
| 2966 * Outputs a vm isolate snapshot, an isolate snapshot, and an assembly file |
| 2967 * defining the symbols kInstructionsSnapshot and kDataSnapshot. The assembly |
| 2968 * should be compiled as a static or shared library and linked or loaded by the |
| 2969 * embedder. |
| 2970 * Running this snapshot requires a VM compiled with DART_PRECOMPILED_SNAPSHOT. |
| 2971 * The vm isolate snapshot, kInstructionsSnapshot and kDataSnapshot should be |
| 2972 * passed as arguments to Dart_Initialize. The isolate snapshot should be |
| 2973 * passed to Dart_CreateIsolate. |
| 2974 */ |
2960 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotAssembly( | 2975 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotAssembly( |
2961 uint8_t** vm_isolate_snapshot_buffer, | 2976 uint8_t** vm_isolate_snapshot_buffer, |
2962 intptr_t* vm_isolate_snapshot_size, | 2977 intptr_t* vm_isolate_snapshot_size, |
2963 uint8_t** isolate_snapshot_buffer, | 2978 uint8_t** isolate_snapshot_buffer, |
2964 intptr_t* isolate_snapshot_size, | 2979 intptr_t* isolate_snapshot_size, |
2965 uint8_t** instructions_assembly_buffer, | 2980 uint8_t** assembly_buffer, |
2966 intptr_t* instructions_assembly_size); | 2981 intptr_t* assembly_size); |
2967 | 2982 |
2968 | 2983 |
| 2984 /** |
| 2985 * Same as Dart_CreatePrecompiledSnapshotAssembly, except the instruction and |
| 2986 * data snapshot pieces are provided directly as bytes that the embedder can |
| 2987 * load with mmap. The instructions piece must be loaded with read and |
| 2988 * execute permissions; the rodata piece may be loaded as read-only. |
| 2989 */ |
2969 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotBlob( | 2990 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotBlob( |
2970 uint8_t** vm_isolate_snapshot_buffer, | 2991 uint8_t** vm_isolate_snapshot_buffer, |
2971 intptr_t* vm_isolate_snapshot_size, | 2992 intptr_t* vm_isolate_snapshot_size, |
2972 uint8_t** isolate_snapshot_buffer, | 2993 uint8_t** isolate_snapshot_buffer, |
2973 intptr_t* isolate_snapshot_size, | 2994 intptr_t* isolate_snapshot_size, |
2974 uint8_t** instructions_blob_buffer, | 2995 uint8_t** instructions_blob_buffer, |
2975 intptr_t* instructions_blob_size, | 2996 intptr_t* instructions_blob_size, |
2976 uint8_t** rodata_blob_buffer, | 2997 uint8_t** rodata_blob_buffer, |
2977 intptr_t* rodata_blob_size); | 2998 intptr_t* rodata_blob_size); |
2978 | 2999 |
2979 | 3000 |
2980 DART_EXPORT Dart_Handle Dart_PrecompileJIT(); | 3001 DART_EXPORT Dart_Handle Dart_PrecompileJIT(); |
2981 | 3002 |
2982 | 3003 |
2983 DART_EXPORT Dart_Handle Dart_CreatePrecompiledJITSnapshotBlob( | 3004 DART_EXPORT Dart_Handle Dart_CreatePrecompiledJITSnapshotBlob( |
2984 uint8_t** vm_isolate_snapshot_buffer, | 3005 uint8_t** vm_isolate_snapshot_buffer, |
2985 intptr_t* vm_isolate_snapshot_size, | 3006 intptr_t* vm_isolate_snapshot_size, |
2986 uint8_t** isolate_snapshot_buffer, | 3007 uint8_t** isolate_snapshot_buffer, |
2987 intptr_t* isolate_snapshot_size, | 3008 intptr_t* isolate_snapshot_size, |
2988 uint8_t** instructions_blob_buffer, | 3009 uint8_t** instructions_blob_buffer, |
2989 intptr_t* instructions_blob_size, | 3010 intptr_t* instructions_blob_size, |
2990 uint8_t** rodata_blob_buffer, | 3011 uint8_t** rodata_blob_buffer, |
2991 intptr_t* rodata_blob_size); | 3012 intptr_t* rodata_blob_size); |
2992 | 3013 |
2993 | 3014 |
| 3015 /** |
| 3016 * Returns whether the VM only supports running from precompiled snapshots and |
| 3017 * not from any other kind of snapshot or no snapshot (that is, the VM was |
| 3018 * compiled with DART_PRECOMPILED_RUNTIME). |
| 3019 */ |
| 3020 DART_EXPORT bool Dart_IsPrecompiledRuntime(); |
| 3021 |
| 3022 |
| 3023 /** |
| 3024 * Returns whether the VM was initialized with a precompiled snapshot. Only |
| 3025 * valid after Dart_Initialize. |
| 3026 * DEPRECATED. This is currently used to disable Platform.executable and |
| 3027 * Platform.resolvedExecutable under precompilation to prevent process |
| 3028 * spawning tests from becoming fork-bombs. |
| 3029 */ |
2994 DART_EXPORT bool Dart_IsRunningPrecompiledCode(); | 3030 DART_EXPORT bool Dart_IsRunningPrecompiledCode(); |
2995 | 3031 |
2996 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ | 3032 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ |
OLD | NEW |