1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Wasm calling convention fixes. IDEHelper/Tests runs on wasm now.

This commit is contained in:
Brian Fiete 2024-10-25 11:20:01 -04:00
parent c0ebcc8fda
commit 31746c1f19
12 changed files with 99 additions and 13 deletions

View file

@ -1801,11 +1801,11 @@ void BfTypeInstance::Dispose()
mTypeDef = NULL;
}
int BfTypeInstance::GetSplatCount()
int BfTypeInstance::GetSplatCount(bool force)
{
if (IsValuelessType())
return 0;
if (!mIsSplattable)
if ((!mIsSplattable) && (!force))
return 1;
int splatCount = 0;
BfTypeUtils::SplatIterate([&](BfType* checkType) { splatCount++; }, this);
@ -2048,6 +2048,30 @@ bool BfTypeInstance::GetLoweredType(BfTypeUsage typeUsage, BfTypeCode* outTypeCo
bool deepCheck = false;
if (mModule->mCompiler->mOptions.mMachineType == BfMachineType_Wasm32)
{
if (IsComposite())
{
if (GetSplatCount(true) == 1)
{
BfType* componentType = NULL;
BfTypeUtils::SplatIterate([&](BfType* checkType) { componentType = checkType; }, this);
if (componentType != NULL)
{
if (componentType->IsPrimitiveType())
{
auto primType = (BfPrimitiveType*)componentType;
if (outTypeCode != NULL)
*outTypeCode = primType->mTypeDef->mTypeCode;
return true;
}
}
}
else
return false;
}
}
if (mModule->mCompiler->mOptions.mPlatformType == BfPlatformType_Windows)
{
// Odd Windows rule: composite returns for non-static methods are always sret