mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Optimizations, switching CanImplicitlyCast method, new CPU rate checker
This commit is contained in:
parent
39fd8d2624
commit
098ad1ce55
25 changed files with 759 additions and 301 deletions
|
@ -3627,64 +3627,6 @@ String BfTypeUtils::HashEncode64(uint64 val)
|
|||
return outStr;
|
||||
}
|
||||
|
||||
void BfTypeUtils::GetProjectList(BfType* checkType, Array<BfProject*>* projectList, int immutableLength)
|
||||
{
|
||||
if (checkType->IsBoxed())
|
||||
GetProjectList(((BfBoxedType*)checkType)->mElementType, projectList, immutableLength);
|
||||
|
||||
BfTypeInstance* typeInst = checkType->ToTypeInstance();
|
||||
if (typeInst != NULL)
|
||||
{
|
||||
auto genericTypeInst = typeInst->ToGenericTypeInstance();
|
||||
if (genericTypeInst != NULL)
|
||||
{
|
||||
for (auto genericArg : genericTypeInst->mTypeGenericArguments)
|
||||
GetProjectList(genericArg, projectList, immutableLength);
|
||||
}
|
||||
|
||||
BfProject* bfProject = typeInst->mTypeDef->mProject;
|
||||
if (std::find(projectList->begin(), projectList->end(), bfProject) == projectList->end())
|
||||
{
|
||||
bool handled = false;
|
||||
for (int idx = 0; idx < (int)projectList->size(); idx++)
|
||||
{
|
||||
auto checkProject = (*projectList)[idx];
|
||||
bool isBetter = bfProject->ContainsReference(checkProject);
|
||||
bool isWorse = checkProject->ContainsReference(bfProject);
|
||||
if (isBetter == isWorse)
|
||||
continue;
|
||||
if (isBetter)
|
||||
{
|
||||
if (idx >= immutableLength)
|
||||
{
|
||||
// This is even more specific, so replace with this one
|
||||
(*projectList)[idx] = bfProject;
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is less specific, ignore
|
||||
handled = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!handled)
|
||||
{
|
||||
projectList->push_back(bfProject);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (checkType->IsPointer())
|
||||
GetProjectList(((BfPointerType*)checkType)->mElementType, projectList, immutableLength);
|
||||
else if (checkType->IsRef())
|
||||
GetProjectList(((BfPointerType*)checkType)->mElementType, projectList, immutableLength);
|
||||
else if (checkType->IsSizedArray())
|
||||
GetProjectList(((BfSizedArrayType*)checkType)->mElementType, projectList, immutableLength);
|
||||
else if (checkType->IsMethodRef())
|
||||
GetProjectList(((BfMethodRefType*)checkType)->mOwner, projectList, immutableLength);
|
||||
}
|
||||
|
||||
BfPrimitiveType* BfTypeUtils::GetPrimitiveType(BfModule* module, BfTypeCode typeCode)
|
||||
{
|
||||
return module->GetPrimitiveType(typeCode);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue