Optimize managed memory allocations

This commit is contained in:
Wojtek Figat
2021-05-30 14:09:24 +02:00
parent 8a5f50dc49
commit 1bd109395a
5 changed files with 24 additions and 34 deletions

View File

@@ -12,6 +12,15 @@ namespace UtilsInternal
{
Platform::MemoryCopy(destination, source, length);
}
MonoObject* ExtractArrayFromList(MonoObject* obj)
{
auto klass = mono_object_get_class(obj);
auto field = mono_class_get_field_from_name(klass, "_items");
MonoObject* o;
mono_field_get_value(obj, field, &o);
return o;
}
}
namespace DebugLogHandlerInternal
@@ -70,6 +79,7 @@ void registerFlaxEngineInternalCalls()
{
AnimGraphExecutor::initRuntime();
ADD_INTERNAL_CALL("FlaxEngine.Utils::MemoryCopy", &UtilsInternal::MemoryCopy);
ADD_INTERNAL_CALL("FlaxEngine.Utils::Internal_ExtractArrayFromList", &UtilsInternal::ExtractArrayFromList);
ADD_INTERNAL_CALL("FlaxEngine.DebugLogHandler::Internal_LogWrite", &DebugLogHandlerInternal::LogWrite);
ADD_INTERNAL_CALL("FlaxEngine.DebugLogHandler::Internal_Log", &DebugLogHandlerInternal::Log);
ADD_INTERNAL_CALL("FlaxEngine.DebugLogHandler::Internal_LogException", &DebugLogHandlerInternal::LogException);