il2cpp-config.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. #pragma once
  2. #include <string.h>
  3. #include "hybridclr/generated/UnityVersion.h"
  4. /* first setup platform defines*/
  5. #include "os/c-api/il2cpp-config-platforms.h"
  6. #include "os/c-api/il2cpp-config-api-platforms.h"
  7. #include "il2cpp-config-api.h"
  8. #include "il2cpp-sanitizers.h"
  9. #ifdef LIBIL2CPP_EXPORT_CODEGEN_API
  10. # define LIBIL2CPP_CODEGEN_API IL2CPP_EXPORT
  11. #elif LIBIL2CPP_IMPORT_CODEGEN_API
  12. # define LIBIL2CPP_CODEGEN_API IL2CPP_IMPORT
  13. #else
  14. # define LIBIL2CPP_CODEGEN_API
  15. #endif
  16. #if defined(__ARMCC_VERSION)
  17. #include <wchar.h>
  18. #include <ctype.h>
  19. #define INTPTR_MAX 2147483647
  20. #endif
  21. #ifndef IL2CPP_METHOD_ATTR
  22. #define IL2CPP_METHOD_ATTR
  23. #endif
  24. #if defined(_MSC_VER)
  25. #define IL2CPP_CXX_ABI_MSVC 1
  26. #else
  27. #define IL2CPP_CXX_ABI_MSVC 0
  28. #endif
  29. typedef void (STDCALL *SynchronizationContextCallback)(intptr_t arg);
  30. typedef void (STDCALL *CultureInfoChangedCallback)(const Il2CppChar* arg);
  31. #if defined(__cplusplus)
  32. #define IL2CPP_EXTERN_C extern "C"
  33. #define IL2CPP_EXTERN_C_CONST extern "C" const
  34. #define IL2CPP_EXTERN_C_BEGIN extern "C" {
  35. #define IL2CPP_EXTERN_C_END }
  36. #else
  37. #define IL2CPP_EXTERN_C
  38. #define IL2CPP_EXTERN_C_CONST extern const
  39. #define IL2CPP_EXTERN_C_BEGIN
  40. #define IL2CPP_EXTERN_C_END
  41. #endif
  42. #if IL2CPP_COMPILER_MSVC || defined(__ARMCC_VERSION)
  43. #define IL2CPP_NO_INLINE __declspec(noinline)
  44. #define IL2CPP_NO_ALIAS __declspec(noalias)
  45. #define IL2CPP_PARAMETER_RESTRICT __restrict
  46. #define IL2CPP_METHOD_RESTRICT __declspec(restrict)
  47. #define IL2CPP_ASSUME(x) __assume(x)
  48. #else
  49. #define IL2CPP_NO_INLINE __attribute__ ((noinline))
  50. #define IL2CPP_NO_ALIAS
  51. #define IL2CPP_PARAMETER_RESTRICT
  52. #define IL2CPP_METHOD_RESTRICT
  53. #define IL2CPP_ASSUME(x)
  54. #endif
  55. #if IL2CPP_COMPILER_MSVC
  56. #define NOVTABLE __declspec(novtable)
  57. #else
  58. #define NOVTABLE
  59. #endif
  60. #define IL2CPP_ENABLE_MONO_BUG_EMULATION 1
  61. #ifndef ALIGN_OF // Baselib header can also define this - if so use their definition.
  62. #if defined(__GNUC__) || defined(__SNC__) || defined(__clang__)
  63. #define ALIGN_OF(T) __alignof__(T)
  64. #define ALIGN_TYPE(val) __attribute__((aligned(val)))
  65. #define ALIGN_FIELD(val) ALIGN_TYPE(val)
  66. #define IL2CPP_FORCE_INLINE inline __attribute__ ((always_inline))
  67. #define IL2CPP_MANAGED_FORCE_INLINE IL2CPP_FORCE_INLINE
  68. #elif defined(_MSC_VER)
  69. #define ALIGN_OF(T) __alignof(T)
  70. #if _MSC_VER >= 1900 && defined(__cplusplus)
  71. #define ALIGN_TYPE(val) alignas(val)
  72. #else
  73. #define ALIGN_TYPE(val) __declspec(align(val))
  74. #endif
  75. #define ALIGN_FIELD(val) __declspec(align(val))
  76. #define IL2CPP_FORCE_INLINE __forceinline
  77. #define IL2CPP_MANAGED_FORCE_INLINE inline
  78. #else
  79. #define ALIGN_TYPE(size)
  80. #define ALIGN_FIELD(size)
  81. #define IL2CPP_FORCE_INLINE inline
  82. #define IL2CPP_MANAGED_FORCE_INLINE IL2CPP_FORCE_INLINE
  83. #endif
  84. #endif
  85. #define IL2CPP_PAGE_SIZE 4096
  86. // 64-bit types are aligned to 8 bytes on 64-bit platforms
  87. #define IL2CPP_ENABLE_INTERLOCKED_64_REQUIRED_ALIGNMENT (IL2CPP_SIZEOF_VOID_P == 8)
  88. /* Debugging */
  89. #ifndef IL2CPP_DEBUG
  90. #define IL2CPP_DEBUG 0
  91. #endif
  92. #ifndef IL2CPP_DEVELOPMENT
  93. #define IL2CPP_DEVELOPMENT 0
  94. #endif
  95. #define IL2CPP_THREADS_ALL_ACCESS (!IL2CPP_THREADS_STD && IL2CPP_TARGET_XBOXONE)
  96. #if (IL2CPP_SUPPORT_THREADS && (!IL2CPP_THREADS_STD && !IL2CPP_THREADS_PTHREAD && !IL2CPP_THREADS_WIN32 && !IL2CPP_THREADS_XBOXONE && !IL2CPP_THREADS_N3DS && !IL2CPP_THREADS_PS4 && !IL2CPP_THREADS_PSP2 && !IL2CPP_THREADS_SWITCH && !IL2CPP_THREADS_CUSTOM))
  97. #error "No thread implementation defined"
  98. #endif
  99. /* Platform support to cleanup attached threads even when native threads are not exited cleanly */
  100. #define IL2CPP_HAS_NATIVE_THREAD_CLEANUP (IL2CPP_THREADS_PTHREAD || IL2CPP_THREADS_WIN32 || IL2CPP_TARGET_SWITCH)
  101. #define IL2CPP_THREAD_IMPL_HAS_COM_APARTMENTS IL2CPP_TARGET_WINDOWS
  102. #if !defined(IL2CPP_ENABLE_PLATFORM_THREAD_STACKSIZE) && IL2CPP_TARGET_IOS
  103. #define IL2CPP_ENABLE_PLATFORM_THREAD_STACKSIZE 1
  104. #endif
  105. #if IL2CPP_TINY
  106. #if IL2CPP_TINY_DEBUG_METADATA || IL2CPP_TINY_DEBUGGER
  107. #define IL2CPP_ENABLE_STACKTRACES 1
  108. #else
  109. #define IL2CPP_ENABLE_STACKTRACES 0
  110. #endif // IL2CPP_TINY_DEBUG_METADATA
  111. #else
  112. #define IL2CPP_ENABLE_STACKTRACES 1
  113. #endif // IL2CPP_TINY
  114. #ifndef IL2CPP_DISABLE_GC
  115. #if IL2CPP_TINY && IL2CPP_TARGET_JAVASCRIPT
  116. #define IL2CPP_DISABLE_GC 1
  117. #endif
  118. #endif
  119. #ifndef FORCE_PINVOKE_INTERNAL
  120. #if IL2CPP_TINY && IL2CPP_TARGET_IOS
  121. #define FORCE_PINVOKE_INTERNAL 1
  122. #endif
  123. #endif
  124. #ifndef HOST_WASM
  125. #if IL2CPP_TINY_DEBUGGER && IL2CPP_TARGET_JAVASCRIPT
  126. #define HOST_WASM 1
  127. #endif
  128. #endif
  129. /* Platforms which use OS specific implementation to extract stracktrace */
  130. #if !defined(IL2CPP_ENABLE_NATIVE_STACKTRACES)
  131. #define IL2CPP_ENABLE_NATIVE_STACKTRACES (IL2CPP_TARGET_WINDOWS || IL2CPP_TARGET_LINUX || IL2CPP_TARGET_DARWIN || IL2CPP_TARGET_IOS || IL2CPP_TARGET_ANDROID || IL2CPP_TARGET_LUMIN)
  132. #endif
  133. /* Platforms which support native IP emission to crash reporting to enable server-side reconstruction of C# exception stack trace line numbers */
  134. #if !defined(IL2CPP_ENABLE_NATIVE_INSTRUCTION_POINTER_EMISSION)
  135. #define IL2CPP_ENABLE_NATIVE_INSTRUCTION_POINTER_EMISSION (IL2CPP_TARGET_WINDOWS || IL2CPP_TARGET_LINUX || IL2CPP_TARGET_DARWIN || IL2CPP_TARGET_IOS || IL2CPP_TARGET_ANDROID)
  136. #endif
  137. #if IL2CPP_ENABLE_STACKTRACES
  138. /* Platforms which use stacktrace sentries */
  139. #if !defined(IL2CPP_ENABLE_STACKTRACE_SENTRIES)
  140. #define IL2CPP_ENABLE_STACKTRACE_SENTRIES (IL2CPP_TARGET_JAVASCRIPT || IL2CPP_TARGET_N3DS || IL2CPP_TARGET_SWITCH)
  141. #endif
  142. #endif // IL2CPP_ENABLE_STACKTRACES
  143. #if (IL2CPP_ENABLE_STACKTRACES && !IL2CPP_ENABLE_NATIVE_STACKTRACES && !IL2CPP_ENABLE_STACKTRACE_SENTRIES)
  144. #error "If stacktraces are supported, then either native stack traces must be supported, or usage of stacktrace sentries must be enabled!"
  145. #endif
  146. #if (IL2CPP_ENABLE_NATIVE_STACKTRACES + IL2CPP_ENABLE_STACKTRACE_SENTRIES) > 1
  147. #error "Only one type of stacktraces are allowed"
  148. #endif
  149. #define IL2CPP_CAN_USE_MULTIPLE_SYMBOL_MAPS IL2CPP_TARGET_IOS
  150. /* GC defines*/
  151. #define IL2CPP_GC_BOEHM 1
  152. #define IL2CPP_GC_NULL !IL2CPP_GC_BOEHM
  153. #define IL2CPP_ENABLE_DEFERRED_GC IL2CPP_TARGET_JAVASCRIPT
  154. /* we always need to NULL pointer free memory with our current allocators */
  155. #define NEED_TO_ZERO_PTRFREE 1
  156. #define IL2CPP_HAS_GC_DESCRIPTORS 1
  157. #if defined(_MSC_VER)
  158. #define IL2CPP_ZERO_LEN_ARRAY 0
  159. #else
  160. #define IL2CPP_ZERO_LEN_ARRAY 0
  161. #endif
  162. #if defined(_MSC_VER)
  163. #define IL2CPP_HAS_CXX_CONSTEXPR (_MSC_VER >= 1900)
  164. #else
  165. #define IL2CPP_HAS_CXX_CONSTEXPR (__has_feature (cxx_constexpr))
  166. #endif
  167. #if IL2CPP_HAS_CXX_CONSTEXPR
  168. #define COMPILE_TIME_CONST constexpr
  169. #else
  170. #define COMPILE_TIME_CONST const
  171. #endif
  172. /* clang specific __has_builtin check */
  173. #ifndef __has_builtin
  174. #define __has_builtin(x) 0 // Compatibility with non-clang compilers.
  175. #endif
  176. #if _MSC_VER
  177. #define IL2CPP_UNREACHABLE __assume(0)
  178. #elif __has_builtin(__builtin_unreachable)
  179. #define IL2CPP_UNREACHABLE __builtin_unreachable()
  180. #else
  181. #define IL2CPP_UNREACHABLE
  182. #endif
  183. typedef uint16_t Il2CppMethodSlot;
  184. static const uint16_t kInvalidIl2CppMethodSlot = 65535;
  185. /* Debug macros */
  186. #if defined(_MSC_VER) && _MSC_VER >= 1900 // UTF-8 literals are only supported in VS2015+
  187. // On MSVC, __FILE__ will expand to ANSI string literal and will fail to compile if there are unicode characters in the path
  188. // So we specify it to be UTF-8 literal explicitly
  189. #define MAKE_UTF8_LITERAL_HELPER(x) u8 ## x
  190. #define MAKE_UTF8_LITERAL(x) MAKE_UTF8_LITERAL_HELPER(x)
  191. #else
  192. #define MAKE_UTF8_LITERAL(x) x
  193. #endif
  194. #define __FILE_UTF8__ MAKE_UTF8_LITERAL(__FILE__)
  195. #define STRINGIZE(L) #L
  196. #define MAKE_STRING(M, L) M(L)
  197. #define $Line MAKE_STRING( STRINGIZE, __LINE__ )
  198. #define FIXME "FIXME: "
  199. #define ICALLMESSAGE(name) __FILE_UTF8__ "(" $Line ") : FIXME: Missing internal call implementation: " name
  200. #define RUNTIMEMESSAGE(name) __FILE_UTF8__ "(" $Line ") : FIXME: Missing runtime implementation: " name
  201. #define NOTSUPPORTEDICALLMESSAGE(target, name, reason) __FILE_UTF8__ "(" $Line ") : Unsupported internal call for " target ":" name " - " reason
  202. // Keeping this for future usage if needed.
  203. //#if defined(_MSC_VER)
  204. // #define PRAGMA_MESSAGE(value) __pragma(message(value))
  205. //#else
  206. // #define PRAGMA_MESSAGE(value) _Pragma(STRINGIZE(value))
  207. //#endif
  208. #define PRAGMA_MESSAGE(value)
  209. #if !defined(__EMSCRIPTEN__)
  210. #define IL2CPP_NOT_IMPLEMENTED_ICALL(func) \
  211. PRAGMA_MESSAGE(ICALLMESSAGE(#func)) \
  212. IL2CPP_ASSERT(0 && #func)
  213. #define IL2CPP_NOT_IMPLEMENTED_ICALL_NO_ASSERT(func, reason) \
  214. PRAGMA_MESSAGE(ICALLMESSAGE(#func))
  215. #define IL2CPP_NOT_IMPLEMENTED(func) \
  216. PRAGMA_MESSAGE(RUNTIMEMESSAGE(#func)) \
  217. IL2CPP_ASSERT(0 && #func)
  218. #define IL2CPP_NOT_IMPLEMENTED_NO_ASSERT(func, reason) \
  219. PRAGMA_MESSAGE(RUNTIMEMESSAGE(#func))
  220. #else
  221. #include <stdio.h>
  222. #include <emscripten/emscripten.h>
  223. // emscripten's assert will throw an exception in js.
  224. // For now, we don't want that, so just printf and move on.
  225. #define IL2CPP_NOT_IMPLEMENTED_ICALL(func) \
  226. PRAGMA_MESSAGE(message(ICALLMESSAGE(#func))) \
  227. emscripten_log(EM_LOG_NO_PATHS | EM_LOG_CONSOLE | EM_LOG_ERROR | EM_LOG_JS_STACK, "Not implemented icall: %s\n", #func);
  228. #define IL2CPP_NOT_IMPLEMENTED_ICALL_NO_ASSERT(func, reason) \
  229. PRAGMA_MESSAGE(message(ICALLMESSAGE(#func)))
  230. #define IL2CPP_NOT_IMPLEMENTED(func) \
  231. PRAGMA_MESSAGE(message(RUNTIMEMESSAGE(#func))) \
  232. printf("Not implemented: %s\n", #func);
  233. #define IL2CPP_NOT_IMPLEMENTED_NO_ASSERT(func, reason) \
  234. PRAGMA_MESSAGE(message(RUNTIMEMESSAGE(#func)))
  235. #endif
  236. #if !RUNTIME_TINY
  237. #define NOT_SUPPORTED_IL2CPP(func, reason) \
  238. il2cpp::vm::Exception::Raise (il2cpp::vm::Exception::GetNotSupportedException ( NOTSUPPORTEDICALLMESSAGE ("IL2CPP", #func, #reason) ))
  239. #define NOT_SUPPORTED_SRE(func) \
  240. il2cpp::vm::Exception::Raise (il2cpp::vm::Exception::GetNotSupportedException ( NOTSUPPORTEDICALLMESSAGE ("IL2CPP", #func, "System.Reflection.Emit is not supported.") ))
  241. #define NOT_SUPPORTED_REMOTING(func) \
  242. il2cpp::vm::Exception::Raise (il2cpp::vm::Exception::GetNotSupportedException ( NOTSUPPORTEDICALLMESSAGE ("IL2CPP", #func, "System.Runtime.Remoting is not supported.") ))
  243. #if IL2CPP_TARGET_JAVASCRIPT
  244. #define NOT_SUPPORTED_WEBGL(func, reason) \
  245. il2cpp::vm::Exception::Raise (il2cpp::vm::Exception::GetNotSupportedException ( NOTSUPPORTEDICALLMESSAGE ("WebGL", #func, #reason) ))
  246. #else
  247. #define NOT_SUPPORTED_WEBGL(func, reason)
  248. #endif
  249. #else
  250. #define NOT_SUPPORTED_IL2CPP(func, reason)
  251. #define NOT_SUPPORTED_SRE(func)
  252. #define NOT_SUPPORTED_REMOTING(func)
  253. #define NOT_SUPPORTED_WEBGL(func, reason)
  254. #endif // #if !RUNTIME_TINY
  255. #if IL2CPP_COMPILER_MSVC
  256. #define IL2CPP_DIR_SEPARATOR '\\' /* backslash */
  257. #else
  258. #define IL2CPP_DIR_SEPARATOR '/' /* forward slash */
  259. #endif
  260. #ifndef IL2CPP_DISABLE_FULL_MESSAGES
  261. #define IL2CPP_DISABLE_FULL_MESSAGES 1
  262. #endif
  263. #if IL2CPP_COMPILER_MSVC
  264. #define IL2CPP_USE_GENERIC_SOCKET_IMPL 0
  265. #else
  266. #define IL2CPP_USE_GENERIC_SOCKET_IMPL !(IL2CPP_TARGET_POSIX || IL2CPP_TARGET_SWITCH || IL2CPP_SUPPORT_SOCKETS_POSIX_API)
  267. #endif
  268. #ifndef IL2CPP_USE_GENERIC_SOCKET_BRIDGE
  269. #define IL2CPP_USE_GENERIC_SOCKET_BRIDGE !IL2CPP_TARGET_JAVASCRIPT
  270. #endif
  271. /* set by platforms that require special handling of SIGPIPE signalling during socket sends */
  272. #ifndef IL2CPP_USE_SEND_NOSIGNAL
  273. #define IL2CPP_USE_SEND_NOSIGNAL 0
  274. #endif
  275. #ifndef IL2CPP_USE_GENERIC_ENVIRONMENT
  276. #define IL2CPP_USE_GENERIC_ENVIRONMENT (!IL2CPP_TARGET_WINDOWS && !IL2CPP_TARGET_POSIX)
  277. #endif
  278. #define IL2CPP_USE_GENERIC_COM (!IL2CPP_TARGET_WINDOWS || IL2CPP_TARGET_WINDOWS_GAMES)
  279. #define IL2CPP_USE_GENERIC_COM_SAFEARRAYS (!IL2CPP_TARGET_WINDOWS || IL2CPP_TARGET_XBOXONE || IL2CPP_TARGET_WINDOWS_GAMES)
  280. #define IL2CPP_USE_GENERIC_WINDOWSRUNTIME (!IL2CPP_TARGET_WINDOWS || RUNTIME_NONE || IL2CPP_TINY || IL2CPP_TARGET_WINDOWS_GAMES)
  281. #ifndef IL2CPP_USE_GENERIC_MEMORY_MAPPED_FILE
  282. #define IL2CPP_USE_GENERIC_MEMORY_MAPPED_FILE (IL2CPP_TARGET_XBOXONE || IL2CPP_TARGET_WINDOWS_GAMES || IL2CPP_TARGET_JAVASCRIPT || (!IL2CPP_TARGET_WINDOWS && !IL2CPP_TARGET_POSIX))
  283. #endif
  284. #ifndef IL2CPP_HAS_CLOSE_EXEC
  285. #define IL2CPP_HAS_CLOSE_EXEC (IL2CPP_TARGET_POSIX && !IL2CPP_TARGET_PS4)
  286. #endif
  287. #ifndef IL2CPP_HAS_DUP
  288. #define IL2CPP_HAS_DUP (IL2CPP_TARGET_POSIX && !IL2CPP_TARGET_PS4)
  289. #endif
  290. #ifndef IL2CPP_USE_GENERIC_FILE
  291. #define IL2CPP_USE_GENERIC_FILE (!IL2CPP_TARGET_WINDOWS && !IL2CPP_TARGET_DARWIN)
  292. #endif
  293. #ifndef IL2CPP_USE_GENERIC_DEBUG_LOG
  294. #define IL2CPP_USE_GENERIC_DEBUG_LOG !IL2CPP_TARGET_WINDOWS
  295. #endif
  296. #ifndef IL2CPP_USE_GENERIC_PROCESS
  297. #define IL2CPP_USE_GENERIC_PROCESS !IL2CPP_TARGET_LUMIN
  298. #endif
  299. #ifndef IL2CPP_USE_GENERIC_THREAD
  300. #define IL2CPP_USE_GENERIC_THREAD (!IL2CPP_TARGET_WINDOWS && !IL2CPP_TARGET_POSIX && !IL2CPP_TARGET_DARWIN)
  301. #endif
  302. #define IL2CPP_SIZEOF_STRUCT_WITH_NO_INSTANCE_FIELDS 1
  303. #define IL2CPP_VALIDATE_FIELD_LAYOUT 0
  304. #ifndef IL2CPP_USE_POSIX_COND_TIMEDWAIT_REL
  305. #define IL2CPP_USE_POSIX_COND_TIMEDWAIT_REL ( IL2CPP_TARGET_DARWIN || IL2CPP_TARGET_PSP2 || ( IL2CPP_TARGET_ANDROID && __ANDROID_API__ < 21 ) )
  306. #endif
  307. #if IL2CPP_MONO_DEBUGGER
  308. #define STORE_SEQ_POINT(storage, seqPoint) (storage).currentSequencePoint = seqPoint;
  309. #define STORE_TRY_ID(storage, id) (storage).tryId = id;
  310. #define CHECK_SEQ_POINT(storage, seqPoint) il2cpp_codegen_check_sequence_point(&(storage), seqPoint);
  311. #define CHECK_METHOD_ENTRY_SEQ_POINT(storage, seqPoint) il2cpp_codegen_check_sequence_point_entry(&(storage), seqPoint);
  312. #define CHECK_METHOD_EXIT_SEQ_POINT(name, storage, seqPoint) MethodExitSequencePointChecker name(&(storage), seqPoint);
  313. #define DECLARE_METHOD_THIS(variableName, thisAddress) void* variableName[] = { thisAddress }
  314. #define DECLARE_METHOD_PARAMS(variableName, ...) void* variableName[] = { __VA_ARGS__ }
  315. #define DECLARE_METHOD_LOCALS(variableName, ...) void* variableName[] = { __VA_ARGS__ }
  316. #define DECLARE_METHOD_EXEC_CTX(ctxVariable, method, thisVariable, paramsVariable, localsVariable) Il2CppSequencePointExecutionContext ctxVariable(method, thisVariable, paramsVariable, localsVariable)
  317. #define CHECK_PAUSE_POINT il2cpp_codegen_check_pause_point()
  318. #else
  319. #define STORE_SEQ_POINT(storage, seqPoint)
  320. #define STORE_TRY_ID(storage, id)
  321. #define CHECK_SEQ_POINT(storage, seqPoint)
  322. #define CHECK_METHOD_ENTRY_SEQ_POINT(storage, seqPoint)
  323. #define CHECK_METHOD_EXIT_SEQ_POINT(name, storage, seqPoint)
  324. #define DECLARE_METHOD_THIS(variableName, thisAddress)
  325. #define DECLARE_METHOD_PARAMS(variableName, ...)
  326. #define DECLARE_METHOD_LOCALS(variableName, ...)
  327. #define DECLARE_METHOD_EXEC_CTX(ctxVariable, method, thisVariable, paramsVariable, localsVariable)
  328. #define CHECK_PAUSE_POINT
  329. #endif
  330. #ifdef __cplusplus
  331. template<bool value>
  332. struct Il2CppStaticAssertHelper;
  333. template<>
  334. struct Il2CppStaticAssertHelper<true>
  335. {
  336. };
  337. #define Assert(x) do { (void)(x); IL2CPP_ASSERT(x); } while (false)
  338. #define Il2CppStaticAssert(...) do { Il2CppStaticAssertHelper<(__VA_ARGS__)>(); } while (false)
  339. #endif
  340. static const int32_t kIl2CppInt32Min = INT32_MIN;
  341. static const int32_t kIl2CppInt32Max = INT32_MAX;
  342. static const uint32_t kIl2CppUInt32Max = UINT32_MAX;
  343. static const int64_t kIl2CppInt64Min = INT64_MIN;
  344. static const int64_t kIl2CppInt64Max = INT64_MAX;
  345. static const uint64_t kIl2CppUInt64Max = UINT64_MAX;
  346. #if IL2CPP_SIZEOF_VOID_P == 8
  347. static const intptr_t kIl2CppIntPtrMin = INT64_MIN;
  348. static const intptr_t kIl2CppIntPtrMax = INT64_MAX;
  349. static const uintptr_t kIl2CppUIntPtrMax = UINT64_MAX;
  350. #else
  351. static const intptr_t kIl2CppIntPtrMin = INT32_MIN;
  352. static const intptr_t kIl2CppIntPtrMax = INT32_MAX;
  353. static const uintptr_t kIl2CppUIntPtrMax = UINT32_MAX;
  354. #endif
  355. static const int ipv6AddressSize = 16;
  356. #if !defined(IL2CPP_SUPPORT_IPV6)
  357. #define IL2CPP_SUPPORT_IPV6 !IL2CPP_TARGET_PS4 && !IL2CPP_TARGET_SWITCH
  358. #endif
  359. #define IL2CPP_SUPPORT_IPV6_SUPPORT_QUERY (IL2CPP_SUPPORT_IPV6 && IL2CPP_TARGET_LINUX)
  360. #if !defined(IL2CPP_SUPPORT_SEND_FILE)
  361. #define IL2CPP_SUPPORT_SEND_FILE (!IL2CPP_TARGET_SWITCH)
  362. #endif
  363. #if !defined(IL2CPP_SUPPORT_RECV_MSG)
  364. #define IL2CPP_SUPPORT_RECV_MSG (!IL2CPP_TARGET_SWITCH)
  365. #endif
  366. #if !defined(IL2CPP_SUPPORT_SEND_MSG)
  367. #define IL2CPP_SUPPORT_SEND_MSG (!IL2CPP_TARGET_SWITCH)
  368. #endif
  369. #ifndef IL2CPP_USE_NETWORK_ACCESS_HANDLER
  370. #define IL2CPP_USE_NETWORK_ACCESS_HANDLER 0
  371. #endif
  372. // Android: "There is no support for locales in the C library" https://code.google.com/p/android/issues/detail?id=57313
  373. // PS4/PS2: strtol_d doesn't exist
  374. #if !defined(IL2CPP_SUPPORT_LOCALE_INDEPENDENT_PARSING)
  375. #define IL2CPP_SUPPORT_LOCALE_INDEPENDENT_PARSING (!IL2CPP_TARGET_ANDROID && !IL2CPP_TARGET_PS4 && !IL2CPP_TARGET_PSP2 && !IL2CPP_TARGET_LUMIN)
  376. #endif
  377. #define NO_UNUSED_WARNING(expr) (void)(expr)
  378. typedef int32_t il2cpp_hresult_t;
  379. // Sorted numerically!
  380. #define IL2CPP_S_OK ((il2cpp_hresult_t)0)
  381. #define IL2CPP_S_FALSE ((il2cpp_hresult_t)1)
  382. #define IL2CPP_E_BOUNDS ((il2cpp_hresult_t)0x8000000B)
  383. #define IL2CPP_E_CHANGED_STATE ((il2cpp_hresult_t)0x8000000C)
  384. #define IL2CPP_E_ILLEGAL_METHOD_CALL ((il2cpp_hresult_t)0x8000000E)
  385. #define IL2CPP_RO_E_CLOSED ((il2cpp_hresult_t)0x80000013)
  386. #define IL2CPP_E_NOTIMPL ((il2cpp_hresult_t)0x80004001)
  387. #define IL2CPP_E_NOINTERFACE ((il2cpp_hresult_t)0x80004002)
  388. #define IL2CPP_E_POINTER ((il2cpp_hresult_t)0x80004003)
  389. #define IL2CPP_E_ABORT ((il2cpp_hresult_t)0x80004004)
  390. #define IL2CPP_E_FAIL ((il2cpp_hresult_t)0x80004005)
  391. #define IL2CPP_E_UNEXPECTED ((il2cpp_hresult_t)0x8000FFFF)
  392. #define IL2CPP_RPC_E_DISCONNECTED ((il2cpp_hresult_t)0x80010108)
  393. #define IL2CPP_RPC_E_WRONG_THREAD ((il2cpp_hresult_t)0x8001010E)
  394. #define IL2CPP_DISP_E_PARAMNOTFOUND ((il2cpp_hresult_t)0x80020004)
  395. #define IL2CPP_REGDB_E_CLASSNOTREG ((il2cpp_hresult_t)0x80040154)
  396. #define IL2CPP_E_FILE_NOT_FOUND ((il2cpp_hresult_t)0x80070002)
  397. #define IL2CPP_E_ACCESS_DENIED ((il2cpp_hresult_t)0x80070005)
  398. #define IL2CPP_E_OUTOFMEMORY ((il2cpp_hresult_t)0x8007000E)
  399. #define IL2CPP_E_INVALIDARG ((il2cpp_hresult_t)0x80070057)
  400. #define IL2CPP_COR_E_EXCEPTION ((il2cpp_hresult_t)0x80131500)
  401. #define IL2CPP_COR_E_EXECUTIONENGINE ((il2cpp_hresult_t)0x80131506)
  402. #define IL2CPP_COR_E_INVALIDOPERATION ((il2cpp_hresult_t)0x80131509)
  403. #define IL2CPP_COR_E_PLATFORMNOTSUPPORTED ((il2cpp_hresult_t)0x80131539)
  404. #define IL2CPP_COR_E_OPERATIONCANCELED ((il2cpp_hresult_t)0x8013153B)
  405. #define IL2CPP_COR_E_OBJECTDISPOSED ((il2cpp_hresult_t)0x80131622)
  406. #define IL2CPP_HR_SUCCEEDED(hr) (((il2cpp_hresult_t)(hr)) >= 0)
  407. #define IL2CPP_HR_FAILED(hr) (((il2cpp_hresult_t)(hr)) < 0)
  408. #define IL2CPP_LITTLE_ENDIAN 1
  409. #define IL2CPP_BIG_ENDIAN 2
  410. #define IL2CPP_BYTE_ORDER IL2CPP_LITTLE_ENDIAN
  411. #if (defined(_MSC_VER) && _MSC_VER > 1600) || (__has_feature(cxx_override_control))
  412. #define IL2CPP_OVERRIDE override
  413. #define IL2CPP_FINAL final
  414. #else
  415. #define IL2CPP_OVERRIDE
  416. #define IL2CPP_FINAL
  417. #endif
  418. #if (__has_feature(cxx_deleted_functions) || (defined(_MSC_VER) && _MSC_VER >= 1800))
  419. #define IL2CPP_HAS_DELETED_FUNCTIONS 1
  420. #else
  421. #define IL2CPP_HAS_DELETED_FUNCTIONS 0
  422. #endif
  423. #if IL2CPP_TARGET_WINDOWS
  424. static const Il2CppChar kIl2CppNewLine[] = { '\r', '\n', '\0' };
  425. #else
  426. static const Il2CppChar kIl2CppNewLine[] = { '\n', '\0' };
  427. #endif
  428. #define MAXIMUM_NESTED_GENERICS_EXCEPTION_MESSAGE "IL2CPP encountered a managed type which it cannot convert ahead-of-time. The type uses generic or array types which are nested beyond the maximum depth which can be converted. Consider increasing the --maximum-recursive-generic-depth=%d argument"
  429. #if IL2CPP_COMPILER_MSVC
  430. #define IL2CPP_ATTRIBUTE_WEAK
  431. #else
  432. #define IL2CPP_ATTRIBUTE_WEAK __attribute__((weak))
  433. #endif
  434. #if IL2CPP_TARGET_XBOXONE || IL2CPP_TARGET_WINRT || IL2CPP_TARGET_ANDROID || IL2CPP_TARGET_PS4 || IL2CPP_TARGET_PSP2
  435. #define IL2CPP_USE_GENERIC_CPU_INFO 1
  436. #else
  437. #define IL2CPP_USE_GENERIC_CPU_INFO 0
  438. #endif
  439. #if !defined(IL2CPP_CAN_CHECK_EXECUTABLE)
  440. #define IL2CPP_CAN_CHECK_EXECUTABLE IL2CPP_TARGET_WINDOWS || (IL2CPP_TARGET_POSIX && !IL2CPP_TARGET_PS4)
  441. #endif
  442. #if IL2CPP_MONO_DEBUGGER
  443. #define IL2CPP_DEBUG_BREAK() il2cpp::utils::Debugger::UserBreak()
  444. #else
  445. #ifdef _MSC_VER
  446. #define IL2CPP_DEBUG_BREAK() __debugbreak()
  447. #else
  448. #define IL2CPP_DEBUG_BREAK()
  449. #endif
  450. #endif
  451. #if defined(__cplusplus)
  452. template<typename Type, size_t Size>
  453. char(*il2cpp_array_size_helper(Type(&array)[Size]))[Size];
  454. #define IL2CPP_ARRAY_SIZE(array) (sizeof(*il2cpp_array_size_helper(array)))
  455. #endif // __cplusplus
  456. #ifndef IL2CPP_MUTATE_METHOD_POINTERS
  457. #define IL2CPP_MUTATE_METHOD_POINTERS !IL2CPP_TARGET_PS4
  458. #endif
  459. #define IL2CPP_USE_GENERIC_ASSERT !(IL2CPP_TARGET_WINDOWS || IL2CPP_TARGET_XBOXONE || IL2CPP_TARGET_WINRT || IL2CPP_TARGET_PS4 || IL2CPP_TARGET_PS5)
  460. #ifndef IL2CPP_USE_SPARSEHASH
  461. #define IL2CPP_USE_SPARSEHASH (IL2CPP_TARGET_ANDROID || IL2CPP_TARGET_IOS)
  462. #endif
  463. #if !IL2CPP_DEBUG
  464. #define IL2CPP_ASSERT(expr) void(0)
  465. #else
  466. #if defined(__cplusplus)
  467. #define IL2CPP_ASSERT(expr) (static_cast<bool>(expr) ? void(0) : il2cpp_assert(#expr, __FILE__, __LINE__))
  468. #else
  469. #define IL2CPP_ASSERT(expr) (expr) ? void(0) : il2cpp_assert(#expr, __FILE__, __LINE__))
  470. #endif
  471. extern void il2cpp_assert(const char* assertion, const char* file, unsigned int line);
  472. #endif
  473. #if !defined(IL2CPP_SUPPORTS_BROKERED_FILESYSTEM)
  474. #define IL2CPP_SUPPORTS_BROKERED_FILESYSTEM IL2CPP_TARGET_WINRT
  475. #endif