# Global Metrics

path: .metrics.nom.closures
old: 2.0
new: 0.0
path: .metrics.nom.total
old: 99.0
new: 1.0
path: .metrics.nom.functions
old: 97.0
new: 1.0
path: .metrics.mi.mi_sei
old: -288.7955007065229
new: -7.850142330858812
path: .metrics.mi.mi_original
old: -232.0054927160864
new: 34.15032124304594
path: .metrics.mi.mi_visual_studio
old: 0.0
new: 19.9709480953485
path: .metrics.halstead.volume
old: 167622.50942935207
new: 5826.37911365173
path: .metrics.halstead.estimated_program_length
old: 9304.98423620366
new: 624.8673108888682
path: .metrics.halstead.effort
old: 26695706.610422462
new: 301178.9818749202
path: .metrics.halstead.level
old: 0.006279006279006278
new: 0.019345238095238096
path: .metrics.halstead.n1
old: 45.0
new: 28.0
path: .metrics.halstead.vocabulary
old: 965.0
new: 106.0
path: .metrics.halstead.N2
old: 6512.0
new: 288.0
path: .metrics.halstead.purity_ratio
old: 0.5503628222750139
new: 0.7215557862458063
path: .metrics.halstead.N1
old: 10395.0
new: 578.0
path: .metrics.halstead.time
old: 1483094.8116901368
new: 16732.16565971779
path: .metrics.halstead.n2
old: 920.0
new: 78.0
path: .metrics.halstead.difficulty
old: 159.2608695652174
new: 51.69230769230769
path: .metrics.halstead.length
old: 16907.0
new: 866.0
path: .metrics.halstead.bugs
old: 29.7741719686726
new: 1.497712723196856
path: .metrics.cognitive.average
old: 13.404040404040405
new: 68.0
path: .metrics.cognitive.sum
old: 1327.0
new: 68.0
path: .metrics.nargs.average
old: 1.585858585858586
new: 5.0
path: .metrics.nargs.sum
old: 157.0
new: 5.0
path: .metrics.cyclomatic.average
old: 8.811881188118813
new: 17.0
path: .metrics.cyclomatic.sum
old: 890.0
new: 34.0
path: .metrics.nexits.sum
old: 300.0
new: 1.0
path: .metrics.nexits.average
old: 3.0303030303030303
new: 1.0
path: .metrics.loc.ploc
old: 3000.0
new: 128.0
path: .metrics.loc.sloc
old: 4358.0
new: 178.0
path: .metrics.loc.cloc
old: 812.0
new: 7.0
path: .metrics.loc.lloc
old: 1586.0
new: 84.0
path: .metrics.loc.blank
old: 546.0
new: 43.0

# Spaces Data

## Minimal test - lines (12, 144)

path: .spaces[0].metrics.cyclomatic.average
old: 15.0
new: 33.0
path: .spaces[0].metrics.cyclomatic.sum
old: 15.0
new: 33.0
path: .spaces[0].metrics.mi.mi_original
old: 52.79718843280804
new: 39.23341524311069
path: .spaces[0].metrics.mi.mi_sei
old: 35.0796657849169
new: -9.042520178294431
path: .spaces[0].metrics.mi.mi_visual_studio
old: 30.875548791115815
new: 22.94351768602964
path: .spaces[0].metrics.nargs.average
old: 1.5
new: 5.0
path: .spaces[0].metrics.nargs.sum
old: 3.0
new: 5.0
path: .spaces[0].metrics.nexits.average
old: 4.5
new: 1.0
path: .spaces[0].metrics.nexits.sum
old: 9.0
new: 1.0
path: .spaces[0].metrics.loc.ploc
old: 68.0
new: 121.0
path: .spaces[0].metrics.loc.sloc
old: 101.0
new: 133.0
path: .spaces[0].metrics.loc.cloc
old: 22.0
new: 1.0
path: .spaces[0].metrics.loc.lloc
old: 34.0
new: 84.0
path: .spaces[0].metrics.cognitive.average
old: 15.5
new: 68.0
path: .spaces[0].metrics.cognitive.sum
old: 31.0
new: 68.0
path: .spaces[0].metrics.halstead.bugs
old: 0.5307017463934979
new: 1.5244225029453269
path: .spaces[0].metrics.halstead.N2
old: 140.0
new: 280.0
path: .spaces[0].metrics.halstead.difficulty
old: 29.056603773584907
new: 54.44444444444444
path: .spaces[0].metrics.halstead.vocabulary
old: 75.0
new: 100.0
path: .spaces[0].metrics.halstead.N1
old: 211.0
new: 575.0
path: .spaces[0].metrics.halstead.length
old: 351.0
new: 855.0
path: .spaces[0].metrics.halstead.effort
old: 63526.899150200814
new: 309271.50563401345
path: .spaces[0].metrics.halstead.n1
old: 22.0
new: 28.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 401.68727970187007
new: 578.8405379214594
path: .spaces[0].metrics.halstead.time
old: 3529.2721750111564
new: 17181.750313000746
path: .spaces[0].metrics.halstead.level
old: 0.03441558441558441
new: 0.018367346938775512
path: .spaces[0].metrics.halstead.volume
old: 2186.315360364054
new: 5680.49704225739
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.1444082042788322
new: 0.677006477101122
path: .spaces[0].metrics.halstead.n2
old: 53.0
new: 72.0
path: .spaces[0].metrics.nom.total
old: 2.0
new: 1.0
path: .spaces[0].metrics.nom.closures
old: 1.0
new: 0.0

### Code

    PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex,
                       uint32_t* a_gpr, uint64_t *a_fpr, uint32_t *a_ov)
    {

        nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
        const nsXPTMethodInfo* info;
        uint8_t paramCount;
        uint8_t i;

        NS_ASSERTION(self,"no self");

        self->mEntry->GetMethodInfo(uint16_t(methodIndex), &info);
        NS_ASSERTION(info,"no info");

        paramCount = info->GetParamCount();

        const uint8_t indexOfJSContext = info->IndexOfJSContext();

        uint32_t gpr = 1, fpr = 0;

        for(i = 0; i < paramCount; i++)
        {
            const nsXPTParamInfo& param = info->GetParam(i);
            const nsXPTType& type = param.GetType();
            nsXPTCMiniVariant* dp = ¶mBuffer[i];

            if (i == indexOfJSContext) {
                if (gpr < 5)
                    a_gpr++, gpr++;
                else
                    a_ov++;
            }

            if(param.IsOut() || !type.IsArithmetic())
            {
                if (gpr < 5)
                    dp->val.p = (void*) *a_gpr++, gpr++;
                else
                    dp->val.p = (void*) *a_ov++;
                continue;
            }
            // else
            switch(type)
            {
            case nsXPTType::T_I8     :
                if (gpr < 5)
                    dp->val.i8  = *((int32_t*) a_gpr), a_gpr++, gpr++;
                else
                    dp->val.i8  = *((int32_t*) a_ov ), a_ov++;
                break;
            case nsXPTType::T_I16    :
                if (gpr < 5)
                    dp->val.i16 = *((int32_t*) a_gpr), a_gpr++, gpr++;
                else
                    dp->val.i16 = *((int32_t*) a_ov ), a_ov++;
                break;
            case nsXPTType::T_I32    :
                if (gpr < 5)
                    dp->val.i32 = *((int32_t*) a_gpr), a_gpr++, gpr++;
                else
                    dp->val.i32 = *((int32_t*) a_ov ), a_ov++;
                break;
            case nsXPTType::T_I64    :
                if (gpr < 4)
                    dp->val.i64 = *((int64_t*) a_gpr), a_gpr+=2, gpr+=2;
                else
                    dp->val.i64 = *((int64_t*) a_ov ), a_ov+=2, gpr=5;
                break;
            case nsXPTType::T_U8     :
                if (gpr < 5)
                    dp->val.u8  = *((uint32_t*)a_gpr), a_gpr++, gpr++;
                else
                    dp->val.u8  = *((uint32_t*)a_ov ), a_ov++;
                break;
            case nsXPTType::T_U16    :
                if (gpr < 5)
                    dp->val.u16 = *((uint32_t*)a_gpr), a_gpr++, gpr++;
                else
                    dp->val.u16 = *((uint32_t*)a_ov ), a_ov++;
                break;
            case nsXPTType::T_U32    :
                if (gpr < 5)
                    dp->val.u32 = *((uint32_t*)a_gpr), a_gpr++, gpr++;
                else
                    dp->val.u32 = *((uint32_t*)a_ov ), a_ov++;
                break;
            case nsXPTType::T_U64    :
                if (gpr < 4)
                    dp->val.u64 = *((uint64_t*)a_gpr), a_gpr+=2, gpr+=2;
                else
                    dp->val.u64 = *((uint64_t*)a_ov ), a_ov+=2, gpr=5;
                break;
            case nsXPTType::T_FLOAT  :
                if (fpr < 2)
                    dp->val.f   = *((float*)   a_fpr), a_fpr++, fpr++;
                else
                    dp->val.f   = *((float*)   a_ov ), a_ov++;
                break;
            case nsXPTType::T_DOUBLE :
                if (fpr < 2)
                    dp->val.d   = *((double*)  a_fpr), a_fpr++, fpr++;
                else
                    dp->val.d   = *((double*)  a_ov ), a_ov+=2;
                break;
            case nsXPTType::T_BOOL   :
                if (gpr < 5)
                    dp->val.b   = *((uint32_t*)a_gpr), a_gpr++, gpr++;
                else
                    dp->val.b   = *((uint32_t*)a_ov ), a_ov++;
                break;
            case nsXPTType::T_CHAR   :
                if (gpr < 5)
                    dp->val.c   = *((uint32_t*)a_gpr), a_gpr++, gpr++;
                else
                    dp->val.c   = *((uint32_t*)a_ov ), a_ov++;
                break;
            case nsXPTType::T_WCHAR  :
                if (gpr < 5)
                    dp->val.wc  = *((uint32_t*)a_gpr), a_gpr++, gpr++;
                else
                    dp->val.wc  = *((uint32_t*)a_ov ), a_ov++;
                break;
            default:
                NS_ERROR("bad type");
                break;
            }
        }

        nsresult result = self->mOuter->CallMethod((uint16_t)methodIndex, info,
                                                   paramBuffer);

        return result;
    }