Add test support for types and objects creation

* test_support::TypeInfoHolder to create TypeInfo given payload description
* test_support::Object<Payload> to create objects with Payload and to get them from ObjHeader* after checking that their type_info are layout compatible.
* test_support::*Array<Count> to create various arrays with given length and similarly get them from ArrayHeader*.
This commit is contained in:
Alexander Shabalin
2021-03-15 11:25:04 +00:00
committed by Space
parent aff49c76a9
commit f51c85a63f
17 changed files with 1041 additions and 241 deletions
@@ -116,6 +116,11 @@ extern "C" void RestoreMemory(MemoryState*) {
// TODO: Remove when legacy MM is gone.
}
extern "C" void ClearMemoryForTests(MemoryState* state) {
auto* threadData = FromMemoryState(state)->Get();
threadData->ClearForTests();
}
extern "C" RUNTIME_NOTHROW OBJ_GETTER(AllocInstance, const TypeInfo* typeInfo) {
auto* threadData = mm::ThreadRegistry::Instance().CurrentThreadData();
RETURN_RESULT_OF(mm::AllocateObject, threadData, typeInfo);