5#ifndef RUNTIME_VM_NATIVE_ENTRY_H_
6#define RUNTIME_VM_NATIVE_ENTRY_H_
25#define TRACE_NATIVE_CALL(format, name) \
26 if (FLAG_trace_natives) { \
27 THR_Print("Calling native: " format "\n", name); \
30#define TRACE_NATIVE_CALL(format, name) \
39#define DEFINE_NATIVE_ENTRY(name, type_argument_count, argument_count) \
40 static ObjectPtr DN_Helper##name(Isolate* isolate, Thread* thread, \
41 Zone* zone, NativeArguments* arguments); \
42 ObjectPtr BootstrapNatives::DN_##name(Thread* thread, Zone* zone, \
43 NativeArguments* arguments) { \
44 TRACE_NATIVE_CALL("%s", "" #name); \
45 ASSERT(arguments->NativeArgCount() == argument_count); \
47 ASSERT(arguments->NativeTypeArgCount() >= type_argument_count); \
48 return DN_Helper##name(thread->isolate(), thread, zone, arguments); \
50 static ObjectPtr DN_Helper##name(Isolate* isolate, Thread* thread, \
51 Zone* zone, NativeArguments* arguments)
53#define DEFINE_FFI_NATIVE_ENTRY(name, return_type, argument_types) \
54 return_type BootstrapNatives::FN_##name argument_types
58 int num_type_args_expected);
63#define NATIVE_TYPE_ARGUMENT_COUNT(expected) \
64 int __num_type_arguments = arguments->NativeTypeArgCount(); \
65 if (__num_type_arguments != expected) { \
66 DartNativeThrowTypeArgumentCountException(__num_type_arguments, expected); \
69#define GET_NATIVE_TYPE_ARGUMENT(name, value) \
70 AbstractType& name = AbstractType::Handle(value);
74#define GET_NON_NULL_NATIVE_ARGUMENT(type, name, value) \
75 const Instance& __##name##_instance__ = \
76 Instance::CheckedHandle(zone, value); \
77 if (!__##name##_instance__.Is##type()) { \
78 DartNativeThrowArgumentException(__##name##_instance__); \
80 const type& name = type::Cast(__##name##_instance__);
84#define GET_NATIVE_ARGUMENT(type, name, value) \
85 const Instance& __##name##_instance__ = \
86 Instance::CheckedHandle(zone, value); \
87 type& name = type::Handle(zone); \
88 if (!__##name##_instance__.IsNull()) { \
89 if (!__##name##_instance__.Is##type()) { \
90 DartNativeThrowArgumentException(__##name##_instance__); \
104 int number_of_arguments,
105 bool* auto_setup_scope);
134#if !defined(DART_PRECOMPILED_RUNTIME)
169 static Payload* FromTypedArray(TypedDataPtr
data);
171 const TypedData& data_;
void set_native_function(NativeFunction value) const
static MethodRecognizer::Kind GetKind(TypedDataPtr data)
NativeEntryData(const TypedData &data)
void set_trampoline(NativeFunctionWrapper value) const
static NativeFunction GetNativeFunction(TypedDataPtr data)
NativeFunctionWrapper trampoline() const
void set_kind(MethodRecognizer::Kind value) const
void set_argc_tag(intptr_t value) const
static intptr_t GetArgcTag(TypedDataPtr data)
intptr_t argc_tag() const
static TypedDataPtr New(MethodRecognizer::Kind kind, NativeFunctionWrapper trampoline, NativeFunction native_function, intptr_t argc_tag)
MethodRecognizer::Kind kind() const
NativeFunction native_function() const
static NativeFunctionWrapper GetTrampoline(TypedDataPtr data)
static void AutoScopeNativeCallWrapper(Dart_NativeArguments args, Dart_NativeFunction func)
static constexpr intptr_t kNumArguments
static void BootstrapNativeCallWrapper(Dart_NativeArguments args, Dart_NativeFunction func)
static const uint8_t * ResolveSymbol(uword pc)
static NativeFunction ResolveNative(const Library &library, const String &function_name, int number_of_arguments, bool *auto_setup_scope)
static void NoScopeNativeCallWrapper(Dart_NativeArguments args, Dart_NativeFunction func)
static uword NoScopeNativeCallWrapperEntry()
static void LinkNativeCall(Dart_NativeArguments args)
static uword AutoScopeNativeCallWrapperEntry()
static uword LinkNativeCallEntry()
static uword BootstrapNativeCallWrapperEntry()
static constexpr intptr_t kNumCallWrapperArguments
static const uint8_t * ResolveSymbolInLibrary(const Library &library, uword pc)
struct _Dart_NativeArguments * Dart_NativeArguments
void(* Dart_NativeFunction)(Dart_NativeArguments arguments)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
void(* NativeFunctionWrapper)(Dart_NativeArguments args, Dart_NativeFunction func)
void DartNativeThrowArgumentException(const Instance &instance)
ObjectPtr(* BootstrapNativeFunction)(Thread *thread, Zone *zone, NativeArguments *arguments)
void DartNativeThrowTypeArgumentCountException(int num_type_args, int num_type_args_expected)
const char *const function_name
static int8_t data[kExtLength]
void(* NativeFunction)(NativeArguments *arguments)