forked from focus-creative-games/il2cpp_plus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathil2cpp-codegen-common.cpp
More file actions
48 lines (37 loc) · 1.55 KB
/
il2cpp-codegen-common.cpp
File metadata and controls
48 lines (37 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "il2cpp-config.h"
#if !RUNTIME_TINY
#include "utils/Runtime.h"
#include "gc/GarbageCollector.h"
// This function exists to help with generation of callstacks for exceptions
// on iOS and MacOS x64 with clang 6.0 (newer versions of clang don't have this
// problem on x64). There we call the backtrace function, which does not play nicely
// with NORETURN, since the compiler eliminates the method prologue code setting up
// the address of the return frame (which makes sense). So on iOS we need to make
// the NORETURN define do nothing, then we use this dummy method which has the
// attribute for clang on iOS defined to prevent clang compiler errors for
// method that end by throwing a managed exception.
REAL_NORETURN IL2CPP_NO_INLINE void il2cpp_codegen_no_return()
{
IL2CPP_UNREACHABLE;
}
REAL_NORETURN void il2cpp_codegen_abort()
{
il2cpp::utils::Runtime::Abort();
il2cpp_codegen_no_return();
}
#if IL2CPP_ENABLE_WRITE_BARRIERS
void Il2CppCodeGenWriteBarrier(void** targetAddress, void* object)
{
il2cpp::gc::GarbageCollector::SetWriteBarrier(targetAddress);
}
#endif
#endif // !RUNTIME_TINY
#if IL2CPP_TINY
#include <cstdio>
int il2cpp_codegen_double_to_string(double value, uint8_t* format, uint8_t* buffer, int bufferLength)
{
// return number of characters written to the buffer. if the return value greater than bufferLength
// means the number of characters would be written to the buffer if there is enough space
return snprintf(reinterpret_cast<char*>(buffer), bufferLength, reinterpret_cast<char*>(format), value);
}
#endif