5#ifndef RUNTIME_VM_RUNTIME_ENTRY_H_
6#define RUNTIME_VM_RUNTIME_ENTRY_H_
9#if !defined(DART_PRECOMPILED_RUNTIME)
22#if !defined(DART_PRECOMPILED_RUNTIME)
40#
if !defined(DART_PRECOMPILED_RUNTIME)
51 const char*
name()
const {
return name_; }
52 const void*
function()
const {
return function_; }
60 const char*
const name_;
61 const void*
const function_;
62 const intptr_t argument_count_;
65 const bool can_lazy_deopt_;
71#define TRACE_RUNTIME_CALL(format, name) \
72 if (FLAG_trace_runtime_calls) { \
73 THR_Print("Runtime call: " format "\n", name); \
76#define TRACE_RUNTIME_CALL(format, name) \
81#if defined(USING_SIMULATOR)
82#define CHECK_SIMULATOR_STACK_OVERFLOW() \
83 if (!OSThread::Current()->HasStackHeadroom()) { \
84 Exceptions::ThrowStackOverflow(); \
87#define CHECK_SIMULATOR_STACK_OVERFLOW()
92#define DEFINE_RUNTIME_ENTRY_IMPL(name, argument_count, can_lazy_deopt) \
93 extern void DRT_##name(NativeArguments arguments); \
94 extern const RuntimeEntry k##name##RuntimeEntry( \
95 "DRT_" #name, reinterpret_cast<const void*>(DRT_##name), argument_count, \
96 false, false, can_lazy_deopt); \
97 static void DRT_Helper##name(Isolate* isolate, Thread* thread, Zone* zone, \
98 NativeArguments arguments); \
99 void DRT_##name(NativeArguments arguments) { \
100 CHECK_STACK_ALIGNMENT; \
102 MSAN_UNPOISON(&arguments, sizeof(arguments)); \
103 ASSERT(arguments.ArgCount() == argument_count); \
104 TRACE_RUNTIME_CALL("%s", "" #name); \
106 Thread* thread = arguments.thread(); \
107 ASSERT(thread == Thread::Current()); \
108 RuntimeCallDeoptScope runtime_call_deopt_scope( \
109 thread, can_lazy_deopt ? RuntimeCallDeoptAbility::kCanLazyDeopt \
110 : RuntimeCallDeoptAbility::kCannotLazyDeopt); \
111 Isolate* isolate = thread->isolate(); \
112 TransitionGeneratedToVM transition(thread); \
113 StackZone zone(thread); \
114 CHECK_SIMULATOR_STACK_OVERFLOW(); \
115 if (FLAG_deoptimize_on_runtime_call_every > 0) { \
116 OnEveryRuntimeEntryCall(thread, "" #name, can_lazy_deopt); \
118 DRT_Helper##name(isolate, thread, zone.GetZone(), arguments); \
121 static void DRT_Helper##name(Isolate* isolate, Thread* thread, Zone* zone, \
122 NativeArguments arguments)
124#define DEFINE_RUNTIME_ENTRY(name, argument_count) \
125 DEFINE_RUNTIME_ENTRY_IMPL(name, argument_count, true)
127#define DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT(name, argument_count) \
128 DEFINE_RUNTIME_ENTRY_IMPL(name, argument_count, false)
130#define DECLARE_RUNTIME_ENTRY(name) \
131 extern const RuntimeEntry k##name##RuntimeEntry; \
132 extern void DRT_##name(NativeArguments arguments);
134#define DEFINE_LEAF_RUNTIME_ENTRY(type, name, argument_count, ...) \
135 extern "C" type DLRT_##name(__VA_ARGS__); \
136 extern const RuntimeEntry k##name##RuntimeEntry( \
137 "DLRT_" #name, reinterpret_cast<const void*>(DLRT_##name), \
138 argument_count, true, false,
false); \
139 type DLRT_##name(__VA_ARGS__) { \
140 CHECK_STACK_ALIGNMENT; \
141 NoSafepointScope no_safepoint_scope;
143#define END_LEAF_RUNTIME_ENTRY }
147#define DEFINE_RAW_LEAF_RUNTIME_ENTRY(name, argument_count, is_float, func) \
148 extern const RuntimeEntry k##name##RuntimeEntry( \
149 "DFLRT_" #name, reinterpret_cast<const void*>(func), argument_count, \
150 true, is_float,
false)
152#define DECLARE_LEAF_RUNTIME_ENTRY(type, name, ...) \
153 extern const RuntimeEntry k##name##RuntimeEntry; \
154 extern "C" type DLRT_##name(__VA_ARGS__);
162 uword* out_entry_point,
163 uword* out_callback_kind);
175 const char* runtime_call_name,
176 bool can_lazy_deopt);
179 const Code& optimized_code,
intptr_t argument_count() const
const void * function() const
const char * name() const
RuntimeEntry(const char *name, const void *function, intptr_t argument_count, bool is_leaf, bool is_float, bool can_lazy_deopt)
uword GetEntryPoint() const
bool can_lazy_deopt() const
void DeoptimizeFunctionsOnStack()
Thread * DLRT_GetFfiCallbackMetadata(FfiCallbackMetadata::Trampoline trampoline, uword *out_entry_point, uword *out_trampoline_type)
double DartModulo(double left, double right)
void(* RuntimeFunction)(NativeArguments arguments)
void DLRT_ExitHandleScope(Thread *thread)
LocalHandle * DLRT_AllocateHandle(ApiLocalScope *scope)
void DLRT_ExitTemporaryIsolate()
ApiLocalScope * DLRT_EnterHandleScope(Thread *thread)
void DeoptimizeAt(Thread *mutator_thread, const Code &optimized_code, StackFrame *frame)
const char * DeoptReasonToCString(ICData::DeoptReasonId deopt_reason)
void OnEveryRuntimeEntryCall(Thread *thread, const char *runtime_call_name, bool can_lazy_deopt)
#define DECLARE_RUNTIME_ENTRY(name)
#define DECLARE_LEAF_RUNTIME_ENTRY(type, name,...)
#define RUNTIME_ENTRY_LIST(V)
#define LEAF_RUNTIME_ENTRY_LIST(V)