[runtime] Convert more icalls to use handles. (#15862)
[mono-project.git] / mono / metadata / icall-decl.h
blobc697877abd69828a367d52760fe37bc4a4df3355
1 /**
2 * \file
3 * Copyright 2018 Microsoft
4 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
5 */
6 #ifndef __MONO_METADATA_ICALL_H__
7 #define __MONO_METADATA_ICALL_H__
9 #include "appdomain-icalls.h"
10 #include "class.h"
11 #include "console-io.h"
12 #include "environment.h"
13 #include "file-mmap.h"
14 #include "filewatcher.h"
15 #include "gc-internals.h"
16 #include "handle-decl.h"
17 #include "handle.h"
18 #include "locales.h"
19 #include "marshal.h"
20 #include "monitor.h"
21 #include "mono-perfcounters.h"
22 #include "mono-route.h"
23 #include "object-forward.h"
24 #include "object-internals.h"
25 #include "rand.h"
26 #include "reflection.h"
27 #include "security-core-clr.h"
28 #include "security-manager.h"
29 #include "security.h"
30 #include "string-icalls.h"
31 #include "threadpool-io.h"
32 #include "threadpool.h"
33 #include "mono/utils/mono-digest.h"
34 #include "mono/utils/mono-forward-internal.h"
35 #include "w32event.h"
36 #include "w32file.h"
37 #include "w32mutex.h"
38 #include "w32process.h"
39 #include "w32semaphore.h"
40 #include "w32socket.h"
41 #include "mono/utils/mono-proclib.h"
43 /* From MonoProperty.cs */
44 typedef enum {
45 PInfo_Attributes = 1,
46 PInfo_GetMethod = 1 << 1,
47 PInfo_SetMethod = 1 << 2,
48 PInfo_ReflectedType = 1 << 3,
49 PInfo_DeclaringType = 1 << 4,
50 PInfo_Name = 1 << 5
51 } PInfo;
53 #include "icall-table.h"
55 #define NOHANDLES(inner) inner
56 #define HANDLES_REUSE_WRAPPER(...) /* nothing */
58 // Generate prototypes for coop icall wrappers and coop icalls.
59 #define MONO_HANDLE_REGISTER_ICALL(func, ret, nargs, argtypes) \
60 MONO_HANDLE_DECLARE (,,func ## _impl, ret, nargs, argtypes); \
61 MONO_HANDLE_REGISTER_ICALL_DECLARE_RAW (func, ret, nargs, argtypes);
62 #define ICALL_TYPE(id, name, first) /* nothing */
63 #define ICALL(id, name, func) /* nothing */
64 #define HANDLES(id, name, func, ret, nargs, argtypes) \
65 MONO_HANDLE_DECLARE_RAW (id, name, func, ret, nargs, argtypes); \
66 MONO_HANDLE_DECLARE (id, name, func, ret, nargs, argtypes);
67 #include "icall-def.h"
68 #undef ICALL_TYPE
69 #undef ICALL
70 #undef HANDLES
71 #undef HANDLES_REUSE_WRAPPER
72 #undef NOHANDLES
73 #undef MONO_HANDLE_REGISTER_ICALL
75 // This is sorted.
76 // grep ICALL_EXPORT | sort | uniq
77 ICALL_EXPORT MonoAssemblyName* ves_icall_System_Reflection_AssemblyName_GetNativeName (MonoAssembly*);
78 ICALL_EXPORT MonoBoolean ves_icall_RuntimeTypeHandle_is_subclass_of (MonoType*, MonoType*);
79 ICALL_EXPORT MonoBoolean ves_icall_System_Environment_GetIs64BitOperatingSystem (void);
80 ICALL_EXPORT MonoBoolean ves_icall_System_Environment_get_HasShutdownStarted (void);
81 ICALL_EXPORT MonoBoolean ves_icall_System_GCHandle_CheckCurrentDomain (guint32 gchandle);
82 ICALL_EXPORT MonoBoolean ves_icall_System_IO_DriveInfo_GetDiskFreeSpace (const gunichar2*, gint32, guint64*, guint64*, guint64*, gint32*);
83 ICALL_EXPORT MonoBoolean ves_icall_System_Reflection_AssemblyName_ParseAssemblyName (const char*, MonoAssemblyName*, MonoBoolean*, MonoBoolean* is_token_defined_arg);
84 ICALL_EXPORT MonoBoolean ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_SufficientExecutionStack (void);
85 ICALL_EXPORT MonoBoolean ves_icall_System_Threading_Thread_YieldInternal (void);
86 ICALL_EXPORT MonoObject* ves_icall_InternalExecute (MonoReflectionMethod*, MonoObject*, MonoArray*, MonoArray**);
87 ICALL_EXPORT MonoObject* ves_icall_InternalInvoke (MonoReflectionMethod*, MonoObject*, MonoArray*, MonoException**);
88 ICALL_EXPORT MonoObject* ves_icall_RuntimeFieldInfo_GetRawConstantValue (MonoReflectionField* rfield);
89 ICALL_EXPORT MonoObject* ves_icall_RuntimeFieldInfo_GetValueInternal (MonoReflectionField* field, MonoObject* obj);
90 ICALL_EXPORT MonoObject* ves_icall_property_info_get_default_value (MonoReflectionProperty*);
91 ICALL_EXPORT void ves_icall_System_ArgIterator_Setup (MonoArgIterator*, char*, char*);
92 ICALL_EXPORT MonoType* ves_icall_System_ArgIterator_IntGetNextArgType (MonoArgIterator*);
93 ICALL_EXPORT void ves_icall_System_ArgIterator_IntGetNextArg (MonoArgIterator*, MonoTypedRef*);
94 ICALL_EXPORT void ves_icall_System_ArgIterator_IntGetNextArgWithType (MonoArgIterator*, MonoTypedRef*, MonoType*);
95 ICALL_EXPORT double ves_icall_System_Math_Abs_double (double);
96 ICALL_EXPORT double ves_icall_System_Math_Acos (double);
97 ICALL_EXPORT double ves_icall_System_Math_Acosh (double);
98 ICALL_EXPORT double ves_icall_System_Math_Asin (double);
99 ICALL_EXPORT double ves_icall_System_Math_Asinh (double);
100 ICALL_EXPORT double ves_icall_System_Math_Atan (double);
101 ICALL_EXPORT double ves_icall_System_Math_Atan2 (double, double);
102 ICALL_EXPORT double ves_icall_System_Math_Atanh (double);
103 ICALL_EXPORT double ves_icall_System_Math_Cbrt (double);
104 ICALL_EXPORT double ves_icall_System_Math_Ceiling (double);
105 ICALL_EXPORT double ves_icall_System_Math_Cos (double);
106 ICALL_EXPORT double ves_icall_System_Math_Cosh (double);
107 ICALL_EXPORT double ves_icall_System_Math_Exp (double);
108 ICALL_EXPORT double ves_icall_System_Math_FMod (double, double);
109 ICALL_EXPORT double ves_icall_System_Math_Floor (double);
110 ICALL_EXPORT double ves_icall_System_Math_Log (double);
111 ICALL_EXPORT double ves_icall_System_Math_Log10 (double);
112 ICALL_EXPORT double ves_icall_System_Math_ModF (double, double*);
113 ICALL_EXPORT double ves_icall_System_Math_Pow (double, double);
114 ICALL_EXPORT double ves_icall_System_Math_Round (double);
115 ICALL_EXPORT double ves_icall_System_Math_Sin (double);
116 ICALL_EXPORT double ves_icall_System_Math_Sinh (double);
117 ICALL_EXPORT double ves_icall_System_Math_Sqrt (double);
118 ICALL_EXPORT double ves_icall_System_Math_Tan (double);
119 ICALL_EXPORT double ves_icall_System_Math_Tanh (double);
120 ICALL_EXPORT float ves_icall_System_MathF_Acos (float);
121 ICALL_EXPORT float ves_icall_System_MathF_Acosh (float);
122 ICALL_EXPORT float ves_icall_System_MathF_Asin (float);
123 ICALL_EXPORT float ves_icall_System_MathF_Asinh (float);
124 ICALL_EXPORT float ves_icall_System_MathF_Atan (float);
125 ICALL_EXPORT float ves_icall_System_MathF_Atan2 (float, float);
126 ICALL_EXPORT float ves_icall_System_MathF_Atanh (float);
127 ICALL_EXPORT float ves_icall_System_MathF_Cbrt (float);
128 ICALL_EXPORT float ves_icall_System_MathF_Ceiling (float);
129 ICALL_EXPORT float ves_icall_System_MathF_Cos (float);
130 ICALL_EXPORT float ves_icall_System_MathF_Cosh (float);
131 ICALL_EXPORT float ves_icall_System_MathF_Exp (float);
132 ICALL_EXPORT float ves_icall_System_MathF_FMod (float, float);
133 ICALL_EXPORT float ves_icall_System_MathF_Floor (float);
134 ICALL_EXPORT float ves_icall_System_MathF_Log (float);
135 ICALL_EXPORT float ves_icall_System_MathF_Log10 (float);
136 ICALL_EXPORT float ves_icall_System_MathF_ModF (float, float*);
137 ICALL_EXPORT float ves_icall_System_MathF_Pow (float, float);
138 ICALL_EXPORT float ves_icall_System_MathF_Sin (float);
139 ICALL_EXPORT float ves_icall_System_MathF_Sinh (float);
140 ICALL_EXPORT float ves_icall_System_MathF_Sqrt (float);
141 ICALL_EXPORT float ves_icall_System_MathF_Tan (float);
142 ICALL_EXPORT float ves_icall_System_MathF_Tanh (float);
143 ICALL_EXPORT float ves_icall_System_Math_Abs_single (float);
144 #if ENABLE_NETCORE
145 ICALL_EXPORT gint32 ves_icall_System_Math_ILogB (double);
146 ICALL_EXPORT double ves_icall_System_Math_Log2 (double);
147 ICALL_EXPORT double ves_icall_System_Math_ScaleB (double, gint32);
148 ICALL_EXPORT double ves_icall_System_Math_FusedMultiplyAdd (double, double, double);
149 ICALL_EXPORT gint32 ves_icall_System_MathF_ILogB (float);
150 ICALL_EXPORT float ves_icall_System_MathF_Log2 (float);
151 ICALL_EXPORT float ves_icall_System_MathF_ScaleB (float, gint32);
152 ICALL_EXPORT float ves_icall_System_MathF_FusedMultiplyAdd (float, float, float);
153 #endif
154 ICALL_EXPORT gint ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetOffsetToStringData (void);
155 ICALL_EXPORT gint32 ves_icall_System_Environment_get_ProcessorCount (void);
156 ICALL_EXPORT gint32 ves_icall_System_Environment_get_TickCount (void);
157 #if ENABLE_NETCORE
158 ICALL_EXPORT gint64 ves_icall_System_Environment_get_TickCount64 (void);
159 #endif
160 ICALL_EXPORT gint64 ves_icall_System_DateTime_GetSystemTimeAsFileTime (void);
161 ICALL_EXPORT gint64 ves_icall_System_Diagnostics_Process_GetProcessData (int, gint32, MonoProcessError*);
162 ICALL_EXPORT gint64 ves_icall_System_Diagnostics_Stopwatch_GetTimestamp (void);
163 ICALL_EXPORT gint64 ves_icall_System_GC_GetTotalMemory (MonoBoolean forceCollection);
164 ICALL_EXPORT gint64 ves_icall_System_Threading_Timer_GetTimeMonotonic (void);
165 ICALL_EXPORT gpointer ves_icall_System_GCHandle_GetAddrOfPinnedObject (guint32 handle);
166 ICALL_EXPORT int ves_icall_Interop_Sys_DoubleToString (double, char*, char*, int);
167 ICALL_EXPORT int ves_icall_System_Environment_get_Platform (void);
168 ICALL_EXPORT int ves_icall_System_GC_GetCollectionCount (int);
169 ICALL_EXPORT int ves_icall_System_GC_GetMaxGeneration (void);
170 ICALL_EXPORT gint64 ves_icall_System_GC_GetAllocatedBytesForCurrentThread (void);
171 ICALL_EXPORT int ves_icall_System_Threading_Thread_SystemMaxStackSize (void);
172 ICALL_EXPORT int ves_icall_get_method_attributes (MonoMethod* method);
173 ICALL_EXPORT void ves_icall_Mono_Runtime_RegisterReportingForNativeLib (const char*, const char*);
174 ICALL_EXPORT void ves_icall_System_Array_GetGenericValueImpl (MonoArray*, guint32, gpointer);
175 ICALL_EXPORT void ves_icall_System_Array_SetGenericValueImpl (MonoArray*, guint32, gpointer);
176 ICALL_EXPORT void ves_icall_System_Buffer_MemcpyInternal (gpointer dest, gconstpointer src, gint32 count);
177 ICALL_EXPORT void ves_icall_System_Environment_Exit (int);
178 ICALL_EXPORT void ves_icall_System_GCHandle_FreeHandle (guint32 handle);
179 ICALL_EXPORT void ves_icall_System_GC_InternalCollect (int generation);
180 ICALL_EXPORT void ves_icall_System_GC_RecordPressure (gint64);
181 ICALL_EXPORT void ves_icall_System_GC_WaitForPendingFinalizers (void);
182 #if !ENABLE_NETCORE
183 ICALL_EXPORT void ves_icall_System_IO_LogcatTextWriter_Log (const char*, gint32, const char*);
184 #endif
185 ICALL_EXPORT void ves_icall_System_NumberFormatter_GetFormatterTables (guint64 const**, gint32 const**, gunichar2 const**, gunichar2 const**, gint64 const**, gint32 const**);
186 #if ENABLE_NETCORE
187 ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_Memmove (guint8*, guint8*, size_t);
188 ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_RhBulkMoveWithWriteBarrier (guint8*, guint8*, size_t);
189 #else
190 ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_Memmove (guint8*, guint8*, guint);
191 ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_Memmove_wbarrier (guint8*, guint8*, guint, MonoType*);
192 #endif
193 #if ENABLE_NETCORE
194 ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_ZeroMemory (guint8*, size_t);
195 #else
196 ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_ZeroMemory (guint8*, guint);
197 #endif
198 ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_ecvt_s(char*, size_t, double, int, int*, int*);
199 #if defined(ENABLE_MONODROID) || defined(ENABLE_MONOTOUCH) || defined(TARGET_WASM)
200 ICALL_EXPORT gpointer ves_icall_System_IO_Compression_DeflateStreamNative_CreateZStream (gint32 compress, MonoBoolean gzip, gpointer feeder, gpointer data);
201 ICALL_EXPORT gint32 ves_icall_System_IO_Compression_DeflateStreamNative_CloseZStream (gpointer stream);
202 ICALL_EXPORT gint32 ves_icall_System_IO_Compression_DeflateStreamNative_Flush (gpointer stream);
203 ICALL_EXPORT gint32 ves_icall_System_IO_Compression_DeflateStreamNative_ReadZStream (gpointer stream, gpointer buffer, gint32 length);
204 ICALL_EXPORT gint32 ves_icall_System_IO_Compression_DeflateStreamNative_WriteZStream (gpointer stream, gpointer buffer, gint32 length);
205 #endif
206 #if defined(ENABLE_MONODROID)
207 ICALL_EXPORT gpointer ves_icall_System_Net_NetworkInformation_LinuxNetworkChange_CreateNLSocket (void);
208 ICALL_EXPORT gint32 ves_icall_System_Net_NetworkInformation_LinuxNetworkChange_ReadEvents (gpointer sock, gpointer buffer, gint32 count, gint32 size);
209 ICALL_EXPORT gpointer ves_icall_System_Net_NetworkInformation_LinuxNetworkChange_CloseNLSocket (gpointer sock);
210 #endif
212 #endif // __MONO_METADATA_ICALL_H__