Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
bootstrap_natives.h
Go to the documentation of this file.
1// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
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.
4
5#ifndef RUNTIME_VM_BOOTSTRAP_NATIVES_H_
6#define RUNTIME_VM_BOOTSTRAP_NATIVES_H_
7
8#include "vm/native_entry.h"
9
10// bootstrap dart natives used in the core dart library.
11
12namespace dart {
13
14// List of bootstrap native entry points used in the core dart library.
15// V(function_name, argument_count)
16#define BOOTSTRAP_NATIVE_LIST(V) \
17 V(AsyncStarMoveNext_debuggerStepCheck, 1) \
18 V(DartAsync_fatal, 1) \
19 V(Object_equals, 2) \
20 V(Object_getHash, 1) \
21 V(Object_toString, 1) \
22 V(Object_runtimeType, 1) \
23 V(Object_haveSameRuntimeType, 2) \
24 V(Object_instanceOf, 4) \
25 V(Object_simpleInstanceOf, 2) \
26 V(Function_apply, 2) \
27 V(Closure_equals, 2) \
28 V(Closure_computeHash, 1) \
29 V(AbstractType_equality, 2) \
30 V(AbstractType_getHashCode, 1) \
31 V(AbstractType_toString, 1) \
32 V(Type_equality, 2) \
33 V(LibraryPrefix_isLoaded, 1) \
34 V(LibraryPrefix_setLoaded, 1) \
35 V(LibraryPrefix_loadingUnit, 1) \
36 V(LibraryPrefix_issueLoad, 1) \
37 V(Identical_comparison, 2) \
38 V(Integer_bitAndFromInteger, 2) \
39 V(Integer_bitOrFromInteger, 2) \
40 V(Integer_bitXorFromInteger, 2) \
41 V(Integer_addFromInteger, 2) \
42 V(Integer_subFromInteger, 2) \
43 V(Integer_mulFromInteger, 2) \
44 V(Integer_truncDivFromInteger, 2) \
45 V(Integer_moduloFromInteger, 2) \
46 V(Integer_greaterThanFromInteger, 2) \
47 V(Integer_equalToInteger, 2) \
48 V(Integer_fromEnvironment, 3) \
49 V(Integer_parse, 1) \
50 V(Integer_shlFromInteger, 2) \
51 V(Integer_shrFromInteger, 2) \
52 V(Integer_ushrFromInteger, 2) \
53 V(Bool_fromEnvironment, 3) \
54 V(Bool_hasEnvironment, 2) \
55 V(Capability_factory, 1) \
56 V(Capability_equals, 2) \
57 V(Capability_get_hashcode, 1) \
58 V(RawReceivePort_factory, 2) \
59 V(RawReceivePort_get_id, 1) \
60 V(RawReceivePort_closeInternal, 1) \
61 V(RawReceivePort_setActive, 2) \
62 V(RawReceivePort_getActive, 1) \
63 V(SendPort_get_id, 1) \
64 V(SendPort_get_hashcode, 1) \
65 V(SendPort_sendInternal_, 2) \
66 V(Smi_bitNegate, 1) \
67 V(Smi_bitLength, 1) \
68 V(SuspendState_instantiateClosureWithFutureTypeArgument, 2) \
69 V(Mint_bitNegate, 1) \
70 V(Mint_bitLength, 1) \
71 V(Developer_debugger, 2) \
72 V(Developer_getIsolateIdFromSendPort, 1) \
73 V(Developer_getObjectId, 1) \
74 V(Developer_getServerInfo, 1) \
75 V(Developer_getServiceMajorVersion, 0) \
76 V(Developer_getServiceMinorVersion, 0) \
77 V(Developer_inspect, 1) \
78 V(Developer_lookupExtension, 1) \
79 V(Developer_registerExtension, 2) \
80 V(Developer_log, 8) \
81 V(Developer_postEvent, 2) \
82 V(Developer_webServerControl, 3) \
83 V(Developer_NativeRuntime_buildId, 0) \
84 V(Developer_NativeRuntime_writeHeapSnapshotToFile, 1) \
85 V(Developer_reachability_barrier, 0) \
86 V(Double_getIsNegative, 1) \
87 V(Double_getIsInfinite, 1) \
88 V(Double_getIsNaN, 1) \
89 V(Double_add, 2) \
90 V(Double_sub, 2) \
91 V(Double_mul, 2) \
92 V(Double_div, 2) \
93 V(Double_remainder, 2) \
94 V(Double_modulo, 2) \
95 V(Double_greaterThanFromInteger, 2) \
96 V(Double_equalToInteger, 2) \
97 V(Double_greaterThan, 2) \
98 V(Double_equal, 2) \
99 V(Double_doubleFromInteger, 2) \
100 V(Double_round, 1) \
101 V(Double_floor, 1) \
102 V(Double_ceil, 1) \
103 V(Double_truncate, 1) \
104 V(Double_toInt, 1) \
105 V(Double_parse, 3) \
106 V(Double_toString, 1) \
107 V(Double_toStringAsFixed, 2) \
108 V(Double_toStringAsExponential, 2) \
109 V(Double_toStringAsPrecision, 2) \
110 V(Double_flipSignBit, 1) \
111 V(RegExp_factory, 6) \
112 V(RegExp_getPattern, 1) \
113 V(RegExp_getIsMultiLine, 1) \
114 V(RegExp_getIsCaseSensitive, 1) \
115 V(RegExp_getIsUnicode, 1) \
116 V(RegExp_getIsDotAll, 1) \
117 V(RegExp_getGroupCount, 1) \
118 V(RegExp_getGroupNameMap, 1) \
119 V(RegExp_ExecuteMatch, 3) \
120 V(RegExp_ExecuteMatchSticky, 3) \
121 V(List_allocate, 2) \
122 V(List_setIndexed, 3) \
123 V(List_getLength, 1) \
124 V(List_slice, 4) \
125 V(ImmutableList_from, 4) \
126 V(StringBase_createFromCodePoints, 3) \
127 V(StringBase_substringUnchecked, 3) \
128 V(StringBase_joinReplaceAllResult, 4) \
129 V(StringBase_intern, 1) \
130 V(StringBuffer_createStringFromUint16Array, 3) \
131 V(OneByteString_substringUnchecked, 3) \
132 V(OneByteString_allocateFromOneByteList, 3) \
133 V(TwoByteString_allocateFromTwoByteList, 3) \
134 V(String_getHashCode, 1) \
135 V(String_getLength, 1) \
136 V(String_charAt, 2) \
137 V(String_concat, 2) \
138 V(String_fromEnvironment, 3) \
139 V(String_toLowerCase, 1) \
140 V(String_toUpperCase, 1) \
141 V(String_concatRange, 3) \
142 V(Math_doublePow, 2) \
143 V(Random_initialSeed, 0) \
144 V(SecureRandom_getBytes, 1) \
145 V(DateTime_currentTimeMicros, 0) \
146 V(DateTime_timeZoneName, 1) \
147 V(DateTime_timeZoneOffsetInSeconds, 1) \
148 V(AssertionError_throwNew, 3) \
149 V(AssertionError_throwNewSource, 5) \
150 V(Error_throwWithStackTrace, 2) \
151 V(StackTrace_current, 0) \
152 V(TypeError_throwNew, 4) \
153 V(Stopwatch_now, 0) \
154 V(Stopwatch_frequency, 0) \
155 V(Timeline_getNextTaskId, 0) \
156 V(Timeline_getTraceClock, 0) \
157 V(Timeline_isDartStreamEnabled, 0) \
158 V(Timeline_reportTaskEvent, 5) \
159 V(TypedDataBase_length, 1) \
160 V(TypedDataBase_setClampedRange, 5) \
161 V(TypedData_GetFloat32, 2) \
162 V(TypedData_SetFloat32, 3) \
163 V(TypedData_GetFloat64, 2) \
164 V(TypedData_SetFloat64, 3) \
165 V(TypedData_GetFloat32x4, 2) \
166 V(TypedData_SetFloat32x4, 3) \
167 V(TypedData_GetInt32x4, 2) \
168 V(TypedData_SetInt32x4, 3) \
169 V(TypedData_GetFloat64x2, 2) \
170 V(TypedData_SetFloat64x2, 3) \
171 V(TypedDataView_offsetInBytes, 1) \
172 V(TypedDataView_typedData, 1) \
173 V(Float32x4_fromDoubles, 4) \
174 V(Float32x4_splat, 1) \
175 V(Float32x4_fromInt32x4Bits, 2) \
176 V(Float32x4_fromFloat64x2, 2) \
177 V(Float32x4_zero, 1) \
178 V(Float32x4_add, 2) \
179 V(Float32x4_negate, 1) \
180 V(Float32x4_sub, 2) \
181 V(Float32x4_mul, 2) \
182 V(Float32x4_div, 2) \
183 V(Float32x4_cmplt, 2) \
184 V(Float32x4_cmplte, 2) \
185 V(Float32x4_cmpgt, 2) \
186 V(Float32x4_cmpgte, 2) \
187 V(Float32x4_cmpequal, 2) \
188 V(Float32x4_cmpnequal, 2) \
189 V(Float32x4_scale, 2) \
190 V(Float32x4_abs, 1) \
191 V(Float32x4_clamp, 3) \
192 V(Float32x4_getX, 1) \
193 V(Float32x4_getY, 1) \
194 V(Float32x4_getZ, 1) \
195 V(Float32x4_getW, 1) \
196 V(Float32x4_getSignMask, 1) \
197 V(Float32x4_shuffle, 2) \
198 V(Float32x4_shuffleMix, 3) \
199 V(Float32x4_setX, 2) \
200 V(Float32x4_setY, 2) \
201 V(Float32x4_setZ, 2) \
202 V(Float32x4_setW, 2) \
203 V(Float32x4_min, 2) \
204 V(Float32x4_max, 2) \
205 V(Float32x4_sqrt, 1) \
206 V(Float32x4_reciprocal, 1) \
207 V(Float32x4_reciprocalSqrt, 1) \
208 V(Float64x2_fromDoubles, 2) \
209 V(Float64x2_splat, 1) \
210 V(Float64x2_zero, 1) \
211 V(Float64x2_fromFloat32x4, 2) \
212 V(Float64x2_add, 2) \
213 V(Float64x2_negate, 1) \
214 V(Float64x2_sub, 2) \
215 V(Float64x2_mul, 2) \
216 V(Float64x2_div, 2) \
217 V(Float64x2_scale, 2) \
218 V(Float64x2_abs, 1) \
219 V(Float64x2_clamp, 3) \
220 V(Float64x2_getX, 1) \
221 V(Float64x2_getY, 1) \
222 V(Float64x2_getSignMask, 1) \
223 V(Float64x2_setX, 2) \
224 V(Float64x2_setY, 2) \
225 V(Float64x2_min, 2) \
226 V(Float64x2_max, 2) \
227 V(Float64x2_sqrt, 1) \
228 V(Int32x4_fromInts, 4) \
229 V(Int32x4_fromBools, 4) \
230 V(Int32x4_fromFloat32x4Bits, 2) \
231 V(Int32x4_or, 2) \
232 V(Int32x4_and, 2) \
233 V(Int32x4_xor, 2) \
234 V(Int32x4_add, 2) \
235 V(Int32x4_sub, 2) \
236 V(Int32x4_getX, 1) \
237 V(Int32x4_getY, 1) \
238 V(Int32x4_getZ, 1) \
239 V(Int32x4_getW, 1) \
240 V(Int32x4_setX, 2) \
241 V(Int32x4_setY, 2) \
242 V(Int32x4_setZ, 2) \
243 V(Int32x4_setW, 2) \
244 V(Int32x4_getSignMask, 1) \
245 V(Int32x4_shuffle, 2) \
246 V(Int32x4_shuffleMix, 3) \
247 V(Int32x4_getFlagX, 1) \
248 V(Int32x4_getFlagY, 1) \
249 V(Int32x4_getFlagZ, 1) \
250 V(Int32x4_getFlagW, 1) \
251 V(Int32x4_setFlagX, 2) \
252 V(Int32x4_setFlagY, 2) \
253 V(Int32x4_setFlagZ, 2) \
254 V(Int32x4_setFlagW, 2) \
255 V(Int32x4_select, 3) \
256 V(Isolate_exit_, 2) \
257 V(Isolate_getCurrentRootUriStr, 0) \
258 V(Isolate_getDebugName, 1) \
259 V(Isolate_getPortAndCapabilitiesOfCurrentIsolate, 0) \
260 V(Isolate_registerKernelBlob, 1) \
261 V(Isolate_unregisterKernelBlob, 1) \
262 V(Isolate_sendOOB, 2) \
263 V(Isolate_spawnFunction, 10) \
264 V(Isolate_spawnUri, 12) \
265 V(GrowableList_allocate, 2) \
266 V(GrowableList_setIndexed, 3) \
267 V(GrowableList_getLength, 1) \
268 V(GrowableList_getCapacity, 1) \
269 V(GrowableList_setLength, 2) \
270 V(GrowableList_setData, 2) \
271 V(Internal_unsafeCast, 1) \
272 V(Internal_nativeEffect, 1) \
273 V(Internal_collectAllGarbage, 0) \
274 V(Internal_makeListFixedLength, 1) \
275 V(Internal_makeFixedListUnmodifiable, 1) \
276 V(Internal_extractTypeArguments, 2) \
277 V(Internal_prependTypeArguments, 4) \
278 V(Internal_boundsCheckForPartialInstantiation, 2) \
279 V(Internal_allocateOneByteString, 1) \
280 V(Internal_allocateTwoByteString, 1) \
281 V(Internal_writeIntoOneByteString, 3) \
282 V(Internal_writeIntoTwoByteString, 3) \
283 V(Internal_deoptimizeFunctionsOnStack, 0) \
284 V(Internal_allocateObjectInstructionsStart, 0) \
285 V(Internal_allocateObjectInstructionsEnd, 0) \
286 V(InvocationMirror_unpackTypeArguments, 2) \
287 V(NoSuchMethodError_existingMethodSignature, 3) \
288 V(Uri_isWindowsPlatform, 0) \
289 V(UserTag_new, 2) \
290 V(UserTag_label, 1) \
291 V(UserTag_defaultTag, 0) \
292 V(UserTag_makeCurrent, 1) \
293 V(Profiler_getCurrentTag, 0) \
294 V(VMService_SendIsolateServiceMessage, 2) \
295 V(VMService_SendRootServiceMessage, 1) \
296 V(VMService_SendObjectRootServiceMessage, 1) \
297 V(VMService_OnStart, 0) \
298 V(VMService_OnExit, 0) \
299 V(VMService_OnServerAddressChange, 1) \
300 V(VMService_ListenStream, 2) \
301 V(VMService_CancelStream, 1) \
302 V(VMService_RequestAssets, 0) \
303 V(VMService_DecodeAssets, 1) \
304 V(VMService_AddUserTagsToStreamableSampleList, 1) \
305 V(VMService_RemoveUserTagsFromStreamableSampleList, 1) \
306 V(Ffi_createNativeCallableListener, 2) \
307 V(Ffi_createNativeCallableIsolateLocal, 3) \
308 V(Ffi_deleteNativeCallable, 1) \
309 V(Ffi_updateNativeCallableKeepIsolateAliveCounter, 1) \
310 V(Ffi_dl_open, 1) \
311 V(Ffi_dl_close, 1) \
312 V(Ffi_dl_lookup, 2) \
313 V(Ffi_dl_getHandle, 1) \
314 V(Ffi_dl_providesSymbol, 2) \
315 V(Ffi_dl_processLibrary, 0) \
316 V(Ffi_dl_executableLibrary, 0) \
317 V(Ffi_GetFfiNativeResolver, 0) \
318 V(DartApiDLInitializeData, 0) \
319 V(DartApiDLMajorVersion, 0) \
320 V(DartApiDLMinorVersion, 0) \
321 V(DartNativeApiFunctionPointer, 1) \
322 V(TransferableTypedData_factory, 2) \
323 V(TransferableTypedData_materialize, 1)
324
325// List of bootstrap native entry points used in the dart:mirror library.
326#define MIRRORS_BOOTSTRAP_NATIVE_LIST(V) \
327 V(Mirrors_makeLocalClassMirror, 1) \
328 V(Mirrors_makeLocalTypeMirror, 1) \
329 V(Mirrors_instantiateGenericType, 2) \
330 V(Mirrors_mangleName, 2) \
331 V(MirrorReference_equals, 2) \
332 V(MirrorSystem_libraries, 0) \
333 V(MirrorSystem_isolate, 0) \
334 V(IsolateMirror_loadUri, 1) \
335 V(InstanceMirror_invoke, 5) \
336 V(InstanceMirror_invokeGetter, 3) \
337 V(InstanceMirror_invokeSetter, 4) \
338 V(InstanceMirror_computeType, 1) \
339 V(ClosureMirror_function, 1) \
340 V(TypeMirror_subtypeTest, 2) \
341 V(ClassMirror_libraryUri, 1) \
342 V(ClassMirror_supertype, 1) \
343 V(ClassMirror_supertype_instantiated, 1) \
344 V(ClassMirror_interfaces, 1) \
345 V(ClassMirror_interfaces_instantiated, 1) \
346 V(ClassMirror_mixin, 1) \
347 V(ClassMirror_mixin_instantiated, 2) \
348 V(ClassMirror_members, 3) \
349 V(ClassMirror_constructors, 3) \
350 V(LibraryMirror_members, 2) \
351 V(LibraryMirror_libraryDependencies, 2) \
352 V(ClassMirror_invoke, 5) \
353 V(ClassMirror_invokeGetter, 3) \
354 V(ClassMirror_invokeSetter, 4) \
355 V(ClassMirror_invokeConstructor, 5) \
356 V(ClassMirror_type_variables, 1) \
357 V(ClassMirror_type_arguments, 1) \
358 V(LibraryMirror_fromPrefix, 1) \
359 V(LibraryMirror_invoke, 5) \
360 V(LibraryMirror_invokeGetter, 3) \
361 V(LibraryMirror_invokeSetter, 4) \
362 V(TypeVariableMirror_owner, 1) \
363 V(TypeVariableMirror_upper_bound, 1) \
364 V(DeclarationMirror_location, 1) \
365 V(DeclarationMirror_metadata, 1) \
366 V(FunctionTypeMirror_call_method, 2) \
367 V(FunctionTypeMirror_parameters, 2) \
368 V(FunctionTypeMirror_return_type, 1) \
369 V(MethodMirror_owner, 2) \
370 V(MethodMirror_parameters, 2) \
371 V(MethodMirror_return_type, 2) \
372 V(MethodMirror_source, 1) \
373 V(ParameterMirror_type, 3) \
374 V(VariableMirror_type, 2)
375
376#define BOOTSTRAP_FFI_NATIVE_LIST(V) \
377 V(FinalizerEntry_SetExternalSize, void, (Dart_Handle, intptr_t)) \
378 V(Pointer_asTypedListFinalizerAllocateData, void*, ()) \
379 V(Pointer_asTypedListFinalizerCallbackPointer, void*, ())
380
382 public:
384 int argument_count,
385 bool* auto_setup_scope);
386
387 // For use with @Native.
388 static void* LookupFfiNative(const char* name, uintptr_t argument_count);
389
390 static const uint8_t* Symbol(Dart_NativeFunction nf);
391
392#define DECLARE_BOOTSTRAP_NATIVE(name, ignored) \
393 static ObjectPtr DN_##name(Thread* thread, Zone* zone, \
394 NativeArguments* arguments);
395
397#if !defined(DART_PRECOMPILED_RUNTIME)
399#endif
400#undef DECLARE_BOOTSTRAP_NATIVE
401
402#define DECLARE_BOOTSTRAP_FFI_NATIVE(name, return_type, argument_types) \
403 static return_type FN_##name argument_types;
405#undef DECLARE_BOOTSTRAP_FFI_NATIVE
406};
407
408} // namespace dart
409
410#endif // RUNTIME_VM_BOOTSTRAP_NATIVES_H_
#define DECLARE_BOOTSTRAP_FFI_NATIVE(name, return_type, argument_types)
#define BOOTSTRAP_FFI_NATIVE_LIST(V)
#define MIRRORS_BOOTSTRAP_NATIVE_LIST(V)
#define BOOTSTRAP_NATIVE_LIST(V)
#define DECLARE_BOOTSTRAP_NATIVE(name, ignored)
static Dart_NativeFunction Lookup(Dart_Handle name, int argument_count, bool *auto_setup_scope)
static void * LookupFfiNative(const char *name, uintptr_t argument_count)
struct _Dart_Handle * Dart_Handle
Definition dart_api.h:258
void(* Dart_NativeFunction)(Dart_NativeArguments arguments)
Definition dart_api.h:3198
int argument_count
Definition fuchsia.cc:52
const char *const name