Initial commit.

This commit is contained in:
2019-07-01 14:33:21 +02:00
parent 92a04d779e
commit baa2e0279d
1624 changed files with 3204958 additions and 0 deletions
@@ -0,0 +1,25 @@
#pragma once
#include <stdint.h>
#include "os/Mutex.h"
struct Il2CppClass;
namespace il2cpp
{
namespace metadata
{
class ArrayMetadata
{
public:
static Il2CppClass* GetBoundedArrayClass(Il2CppClass* elementClass, uint32_t rank, bool bounded);
typedef void(*ArrayTypeWalkCallback)(Il2CppClass* type, void* context);
static void WalkSZArrays(ArrayTypeWalkCallback callback, void* context);
static void WalkArrays(ArrayTypeWalkCallback callback, void* context);
// called as part of Class::Init with lock held
static void SetupArrayInterfaces(Il2CppClass* klass, const il2cpp::os::FastAutoLock& lock);
static void SetupArrayVTable(Il2CppClass* klass, const il2cpp::os::FastAutoLock& lock);
};
} /* namespace vm */
} /* namespace il2cpp */
@@ -0,0 +1,32 @@
#pragma once
#include <stdint.h>
#include <vector>
#include "metadata/Il2CppTypeVector.h"
namespace il2cpp
{
namespace metadata
{
struct SizeAndAlignment
{
size_t size;
uint8_t alignment;
};
class FieldLayout
{
public:
struct FieldLayoutData
{
std::vector<size_t> FieldOffsets;
size_t classSize;
size_t actualClassSize;
uint8_t minimumAlignment;
};
static void LayoutFields(size_t parentSize, size_t actualParentSize, size_t parentAlignment, uint8_t packing, const Il2CppTypeVector& fieldTypes, FieldLayoutData& data);
static SizeAndAlignment GetTypeSizeAndAlignment(const Il2CppType* type);
};
} /* namespace metadata */
} /* namespace il2cpp */
@@ -0,0 +1,45 @@
#pragma once
#include <stdint.h>
#include "il2cpp-metadata.h"
#include "metadata/Il2CppTypeVector.h"
struct Il2CppGenericClass;
struct Il2CppGenericContext;
struct Il2CppGenericInst;
struct Il2CppGenericMethod;
union Il2CppRGCTXData;
struct Il2CppRGCTXDefinition;
struct Il2CppType;
struct MethodInfo;
struct ParameterInfo;
struct Il2CppClass;
namespace il2cpp
{
namespace metadata
{
class GenericMetadata
{
public:
static ParameterInfo* InflateParameters(const ParameterInfo* parameters, uint8_t parameterCount, const Il2CppGenericContext* context, bool inflateMethodVars);
static Il2CppGenericClass* GetGenericClass(const Il2CppClass* elementClass, const Il2CppGenericInst* inst);
static Il2CppGenericClass* GetGenericClass(TypeDefinitionIndex elementClassIndex, const Il2CppGenericInst* inst);
static const MethodInfo* Inflate(const MethodInfo* methodDefinition, Il2CppClass* declaringClass, const Il2CppGenericContext* context);
static const Il2CppGenericMethod* Inflate(const Il2CppGenericMethod* genericMethod, const Il2CppGenericContext* context);
static Il2CppRGCTXData* InflateRGCTX(RGCTXIndex rgctxEntryIndex, int16_t rgctxEntryCount, const Il2CppGenericContext* context);
// temporary while we generate generics
static void RegisterGenericClass(Il2CppGenericClass *gclass);
static const Il2CppType* InflateIfNeeded(const Il2CppType* type, const Il2CppGenericContext* context, bool inflateMethodVars);
typedef void(*GenericClassWalkCallback)(Il2CppClass* type, void* context);
static void WalkAllGenericClasses(GenericClassWalkCallback callback, void* context);
static const int MaximumRuntimeGenericDepth = 8;
};
} /* namespace vm */
} /* namespace il2cpp */
@@ -0,0 +1,25 @@
#pragma once
#include <string>
struct MethodInfo;
struct Il2CppGenericMethod;
struct Il2CppGenericContext;
namespace il2cpp
{
namespace metadata
{
class GenericMethod
{
public:
// exported
public:
//internal
static const MethodInfo* GetMethod(const Il2CppGenericMethod* gmethod);
static const Il2CppGenericContext* GetContext(const Il2CppGenericMethod* gmethod);
static std::string GetFullName(const Il2CppGenericMethod* gmethod);
};
} /* namespace vm */
} /* namespace il2cpp */
@@ -0,0 +1,17 @@
#pragma once
struct Il2CppGenericClass;
struct Il2CppGenericMethod;
namespace il2cpp
{
namespace metadata
{
class GenericSharing
{
public:
static bool IsShareable(Il2CppGenericClass* gclass);
static bool IsShareable(Il2CppGenericMethod* gmethod);
};
} /* namespace metadata */
} /* namespace il2cpp */
@@ -0,0 +1,18 @@
#pragma once
#include "utils/KeyWrapper.h"
struct Il2CppGenericClass;
namespace il2cpp
{
namespace metadata
{
class Il2CppGenericClassCompare
{
public:
bool operator()(const Il2CppGenericClass* t1, const Il2CppGenericClass* t2) const;
static bool Compare(const Il2CppGenericClass* t1, const Il2CppGenericClass* t2);
};
} /* namespace vm */
} /* namespace il2cpp */
@@ -0,0 +1,16 @@
#pragma once
struct Il2CppGenericClass;
namespace il2cpp
{
namespace metadata
{
class Il2CppGenericClassHash
{
public:
size_t operator()(const Il2CppGenericClass* ea) const;
static size_t Hash(const Il2CppGenericClass* t1);
};
} /* namespace vm */
} /* namespace il2cpp */
@@ -0,0 +1,16 @@
#pragma once
struct Il2CppGenericContext;
namespace il2cpp
{
namespace metadata
{
class Il2CppGenericContextCompare
{
public:
bool operator()(const Il2CppGenericContext* t1, const Il2CppGenericContext* t2) const;
static bool Compare(const Il2CppGenericContext* t1, const Il2CppGenericContext* t2);
};
} /* namespace vm */
} /* namespace il2cpp */
@@ -0,0 +1,16 @@
#pragma once
struct Il2CppGenericContext;
namespace il2cpp
{
namespace metadata
{
class Il2CppGenericContextHash
{
public:
size_t operator()(const Il2CppGenericContext* ea) const;
static size_t Hash(const Il2CppGenericContext* t1);
};
} /* namespace vm */
} /* namespace il2cpp */
@@ -0,0 +1,18 @@
#pragma once
#include "utils/KeyWrapper.h"
struct Il2CppGenericInst;
namespace il2cpp
{
namespace metadata
{
class Il2CppGenericInstCompare
{
public:
bool operator()(const KeyWrapper<const Il2CppGenericInst*>& t1, const KeyWrapper<const Il2CppGenericInst*>& t2) const;
static bool Compare(const KeyWrapper<const Il2CppGenericInst*>& t1, const KeyWrapper<const Il2CppGenericInst*>& t2);
};
} /* namespace vm */
} /* namespace il2cpp */
@@ -0,0 +1,16 @@
#pragma once
struct Il2CppGenericInst;
namespace il2cpp
{
namespace metadata
{
class Il2CppGenericInstHash
{
public:
size_t operator()(const Il2CppGenericInst* ea) const;
static size_t Hash(const Il2CppGenericInst* t1);
};
} /* namespace vm */
} /* namespace il2cpp */
@@ -0,0 +1,17 @@
#pragma once
#include "utils/KeyWrapper.h"
struct Il2CppGenericMethod;
namespace il2cpp
{
namespace metadata
{
struct Il2CppGenericMethodCompare
{
bool operator()(const Il2CppGenericMethod* m1, const Il2CppGenericMethod* m2) const;
static bool Equals(const Il2CppGenericMethod* m1, const Il2CppGenericMethod* m2);
};
} /* namespace metadata */
} /* namespace il2cpp */
@@ -0,0 +1,16 @@
#pragma once
struct Il2CppGenericMethod;
namespace il2cpp
{
namespace metadata
{
struct Il2CppGenericMethodHash
{
public:
size_t operator()(const Il2CppGenericMethod* method) const;
static size_t Hash(const Il2CppGenericMethod* method);
};
} /* namespace metadata */
} /* namespace il2cpp */
@@ -0,0 +1,17 @@
#pragma once
#include "utils/dynamic_array.h"
struct Il2CppType;
namespace il2cpp
{
namespace metadata
{
struct Il2CppSignatureCompare
{
bool operator()(const il2cpp::utils::dynamic_array<const Il2CppType*>& s1, const il2cpp::utils::dynamic_array<const Il2CppType*>& s2) const;
static bool Equals(const il2cpp::utils::dynamic_array<const Il2CppType*>& s1, const il2cpp::utils::dynamic_array<const Il2CppType*>& s2);
};
} /* namespace metadata */
} /* namespace il2cpp */
@@ -0,0 +1,18 @@
#pragma once
#include "utils/dynamic_array.h"
struct Il2CppType;
namespace il2cpp
{
namespace metadata
{
struct Il2CppSignatureHash
{
public:
size_t operator()(const il2cpp::utils::dynamic_array<const Il2CppType*>& signature) const;
static size_t Hash(const il2cpp::utils::dynamic_array<const Il2CppType*>& signature);
};
} /* namespace metadata */
} /* namespace il2cpp */
@@ -0,0 +1,24 @@
#pragma once
#include "utils/KeyWrapper.h"
struct Il2CppType;
namespace il2cpp
{
namespace metadata
{
class Il2CppTypeEqualityComparer
{
public:
bool operator()(const Il2CppType* t1, const Il2CppType* t2) const { return AreEqual(t1, t2); }
static bool AreEqual(const Il2CppType* t1, const Il2CppType* t2);
};
class Il2CppTypeLess
{
public:
bool operator()(const Il2CppType* t1, const Il2CppType* t2) const;
};
} /* namespace vm */
} /* namespace il2cpp */
@@ -0,0 +1,16 @@
#pragma once
struct Il2CppType;
namespace il2cpp
{
namespace metadata
{
class Il2CppTypeHash
{
public:
size_t operator()(const Il2CppType* t1) const;
static size_t Hash(const Il2CppType* t1);
};
} /* namespace vm */
} /* namespace il2cpp */
@@ -0,0 +1,12 @@
#pragma once
#include <vector>
struct Il2CppType;
namespace il2cpp
{
namespace metadata
{
typedef std::vector<const Il2CppType*> Il2CppTypeVector;
} /* namespace vm */
} /* namespace il2cpp */