Repository: dotnet/runtime
File: src/coreclr/vm/callstubgenerator.cpp (C++)

Code before:
    }
    else if ((m_currentRoutineType == RoutineType::FPReg128) && (type != RoutineType::FPReg128))
    {
        pRoutines[m_routineIndex++] = GetFPReg128RangeRoutine(m_x1, m_x2);
        m_x1 = NoRange;
        m_currentRoutineType = RoutineType::None;
    }
#endif // TARGET_ARM64
    else if ((m_currentRoutineType == RoutineType::Stack) && (type != RoutineType::Stack))
    {
        pRoutines[m_routineIndex++] = GetStackRoutine();
        pRoutines[m_routineIndex++] = ((int64_t)(m_s2 - m_s1 + 1) << 32) | m_s1;
        m_s1 = NoRange;
        m_currentRoutineType = RoutineType::None;
    }

    return;
}

//---------------------------------------------------------------------------
// isNativePrimitiveStructType:
//    Check if the given struct type is an intrinsic type that should be treated as though
//    it is not a struct at the unmanaged ABI boundary.
//
// Arguments:
//    clsHnd - the handle for the struct type.
//
// Return Value:
//    true if the given struct type should be treated as a primitive for unmanaged calls,
//    false otherwise.
//
bool isNativePrimitiveStructType(MethodTable* pMT)
{
    if (!pMT->IsIntrinsicType())
    {
        return false;
    }
    const char* namespaceName = nullptr;
    const char* typeName      = pMT->GetFullyQualifiedNameInfo(&namespaceName);

    if ((namespaceName == NULL) || (typeName == NULL))
    {
        return false;
    }

    if (strcmp(namespaceName, "System.Runtime.InteropServices") != 0)
    {
        return false;
    }

    return strcmp(typeName, "CLong") == 0 || strcmp(typeName, "CULong") == 0 || strcmp(typeName, "NFloat") == 0;

Review comment (suggestion):
The parameter documentation refers to 'clsHnd' but the actual parameter is named 'pMT'. The documentation should be updated to match the parameter name.
```suggestion
//    pMT - the handle for the struct type.
```

Code after:
    }
    else if ((m_currentRoutineType == RoutineType::FPReg128) && (type != RoutineType::FPReg128))
    {
        pRoutines[m_routineIndex++] = GetFPReg128RangeRoutine(m_x1, m_x2);
        m_x1 = NoRange;
        m_currentRoutineType = RoutineType::None;
    }
#endif // TARGET_ARM64
    else if ((m_currentRoutineType == RoutineType::Stack) && (type != RoutineType::Stack))
    {
        pRoutines[m_routineIndex++] = GetStackRoutine();
        pRoutines[m_routineIndex++] = ((int64_t)(m_s2 - m_s1 + 1) << 32) | m_s1;
        m_s1 = NoRange;
        m_currentRoutineType = RoutineType::None;
    }

    return;
}

//---------------------------------------------------------------------------
// isNativePrimitiveStructType:
//    Check if the given struct type is an intrinsic type that should be treated as though
//    it is not a struct at the unmanaged ABI boundary.
//
// Arguments:
//    pMT - the handle for the struct type.
//
// Return Value:
//    true if the given struct type should be treated as a primitive for unmanaged calls,
//    false otherwise.
//
bool isNativePrimitiveStructType(MethodTable* pMT)
{
    if (!pMT->IsIntrinsicType())
    {
        return false;
    }
    const char* namespaceName = nullptr;
    const char* typeName      = pMT->GetFullyQualifiedNameInfo(&namespaceName);

    if ((namespaceName == NULL) || (typeName == NULL))
    {
        return false;
    }

    if (strcmp(namespaceName, "System.Runtime.InteropServices") != 0)
    {
        return false;
    }

    return strcmp(typeName, "CLong") == 0 || strcmp(typeName, "CULong") == 0 || strcmp(typeName, "NFloat") == 0;