2023-11-08 19:09:13 +08:00
|
|
|
#include "RuntimeApi.h"
|
2023-10-23 13:13:33 +08:00
|
|
|
|
|
|
|
|
#include "codegen/il2cpp-codegen.h"
|
2023-11-08 19:09:13 +08:00
|
|
|
#include "vm/InternalCalls.h"
|
|
|
|
|
#include "vm/Array.h"
|
|
|
|
|
#include "vm/Exception.h"
|
|
|
|
|
|
2023-10-23 13:13:33 +08:00
|
|
|
#include "metadata/MetadataModule.h"
|
|
|
|
|
#include "Config.h"
|
|
|
|
|
|
2023-11-08 19:09:13 +08:00
|
|
|
namespace hybridclr
|
2023-10-23 13:13:33 +08:00
|
|
|
{
|
2023-11-08 19:09:13 +08:00
|
|
|
void RuntimeApi::RegisterInternalCalls()
|
|
|
|
|
{
|
|
|
|
|
il2cpp::vm::InternalCalls::Add("HybridCLR.RuntimeApi::LoadMetadataForAOTAssembly(System.Byte[],HybridCLR.HomologousImageMode)", (Il2CppMethodPointer)LoadMetadataForAOTAssembly);
|
|
|
|
|
il2cpp::vm::InternalCalls::Add("HybridCLR.RuntimeApi::GetInterpreterThreadObjectStackSize()", (Il2CppMethodPointer)GetInterpreterThreadObjectStackSize);
|
|
|
|
|
il2cpp::vm::InternalCalls::Add("HybridCLR.RuntimeApi::SetInterpreterThreadObjectStackSize(System.Int32)", (Il2CppMethodPointer)SetInterpreterThreadObjectStackSize);
|
|
|
|
|
il2cpp::vm::InternalCalls::Add("HybridCLR.RuntimeApi::GetInterpreterThreadFrameStackSize()", (Il2CppMethodPointer)GetInterpreterThreadFrameStackSize);
|
|
|
|
|
il2cpp::vm::InternalCalls::Add("HybridCLR.RuntimeApi::SetInterpreterThreadFrameStackSize(System.Int32)", (Il2CppMethodPointer)SetInterpreterThreadFrameStackSize);
|
|
|
|
|
il2cpp::vm::InternalCalls::Add("HybridCLR.RuntimeApi::GetInterpreterThreadExceptionFlowSize()", (Il2CppMethodPointer)GetInterpreterThreadExceptionFlowSize);
|
|
|
|
|
il2cpp::vm::InternalCalls::Add("HybridCLR.RuntimeApi::SetInterpreterThreadExceptionFlowSize(System.Int32)", (Il2CppMethodPointer)SetInterpreterThreadExceptionFlowSize);
|
|
|
|
|
}
|
2023-10-23 13:13:33 +08:00
|
|
|
|
2023-11-08 19:09:13 +08:00
|
|
|
int32_t RuntimeApi::LoadMetadataForAOTAssembly(Il2CppArray* dllBytes, int32_t mode)
|
2023-10-23 13:13:33 +08:00
|
|
|
{
|
2023-11-08 19:09:13 +08:00
|
|
|
if (!dllBytes)
|
|
|
|
|
{
|
|
|
|
|
il2cpp::vm::Exception::RaiseNullReferenceException();
|
|
|
|
|
}
|
|
|
|
|
return (int32_t)hybridclr::metadata::MetadataModule::LoadMetadataForAOTAssembly(il2cpp::vm::Array::GetFirstElementAddress(dllBytes), il2cpp::vm::Array::GetByteLength(dllBytes), (hybridclr::metadata::HomologousImageMode)mode);
|
2023-10-23 13:13:33 +08:00
|
|
|
}
|
|
|
|
|
|
2023-11-08 19:09:13 +08:00
|
|
|
uint32_t RuntimeApi::GetInterpreterThreadObjectStackSize()
|
2023-10-23 13:13:33 +08:00
|
|
|
{
|
|
|
|
|
return hybridclr::Config::GetIns().GetInterpreterThreadObjectStackSize();
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-08 19:09:13 +08:00
|
|
|
void RuntimeApi::SetInterpreterThreadObjectStackSize(uint32_t size)
|
2023-10-23 13:13:33 +08:00
|
|
|
{
|
|
|
|
|
hybridclr::Config::GetIns().SetInterpreterThreadObjectStackSize(size);
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-08 19:09:13 +08:00
|
|
|
uint32_t RuntimeApi::GetInterpreterThreadFrameStackSize()
|
2023-10-23 13:13:33 +08:00
|
|
|
{
|
|
|
|
|
return hybridclr::Config::GetIns().GetInterpreterThreadFrameStackSize();
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-08 19:09:13 +08:00
|
|
|
void RuntimeApi::SetInterpreterThreadFrameStackSize(uint32_t size)
|
2023-10-23 13:13:33 +08:00
|
|
|
{
|
|
|
|
|
hybridclr::Config::GetIns().SetInterpreterThreadFrameStackSize(size);
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-08 19:09:13 +08:00
|
|
|
uint32_t RuntimeApi::GetInterpreterThreadExceptionFlowSize()
|
2023-10-23 13:13:33 +08:00
|
|
|
{
|
|
|
|
|
return hybridclr::Config::GetIns().GetInterpreterThreadExceptionFlowSize();
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-08 19:09:13 +08:00
|
|
|
void RuntimeApi::SetInterpreterThreadExceptionFlowSize(uint32_t size)
|
2023-10-23 13:13:33 +08:00
|
|
|
{
|
|
|
|
|
hybridclr::Config::GetIns().SetInterpreterThreadExceptionFlowSize(size);
|
|
|
|
|
}
|
2023-11-08 19:09:13 +08:00
|
|
|
|
2023-10-23 13:13:33 +08:00
|
|
|
}
|