Global Metrics
path: .metrics.mi.mi_original
old: 63.45023722786999
new: 32.48249701231585
path: .metrics.mi.mi_sei
old: 53.18075838537645
new: -3.198767100965245
path: .metrics.mi.mi_visual_studio
old: 37.10540188764327
new: 18.99561228790401
path: .metrics.nargs.sum
old: 6.0
new: 5.0
path: .metrics.nargs.average
old: 0.6
new: 5.0
path: .metrics.cyclomatic.average
old: 1.1666666666666667
new: 13.333333333333334
path: .metrics.cyclomatic.sum
old: 14.0
new: 40.0
path: .metrics.nom.total
old: 10.0
new: 1.0
path: .metrics.nom.functions
old: 10.0
new: 1.0
path: .metrics.cognitive.sum
old: 3.0
new: 91.0
path: .metrics.cognitive.average
old: 0.3
new: 91.0
path: .metrics.halstead.bugs
old: 0.1927303865233073
new: 1.475204550223711
path: .metrics.halstead.effort
old: 13902.956715463588
new: 294415.21294793417
path: .metrics.halstead.estimated_program_length
old: 217.5800856219931
new: 655.9252021962958
path: .metrics.halstead.n2
old: 31.0
new: 82.0
path: .metrics.halstead.time
old: 772.3864841924216
new: 16356.400719329677
path: .metrics.halstead.volume
old: 883.1796274167443
new: 5845.532073058257
path: .metrics.halstead.difficulty
old: 15.741935483870968
new: 50.36585365853659
path: .metrics.halstead.level
old: 0.06352459016393443
new: 0.019854721549636804
path: .metrics.halstead.vocabulary
old: 47.0
new: 110.0
path: .metrics.halstead.n1
old: 16.0
new: 28.0
path: .metrics.halstead.length
old: 159.0
new: 862.0
path: .metrics.halstead.N1
old: 98.0
new: 567.0
path: .metrics.halstead.purity_ratio
old: 1.3684282114590762
new: 0.7609341092764452
path: .metrics.halstead.N2
old: 61.0
new: 295.0
path: .metrics.loc.cloc
old: 19.0
new: 15.0
path: .metrics.loc.lloc
old: 10.0
new: 100.0
path: .metrics.loc.sloc
old: 71.0
new: 181.0
path: .metrics.loc.ploc
old: 40.0
new: 146.0
path: .metrics.loc.blank
old: 12.0
new: 20.0
path: .metrics.nexits.average
old: 0.5
new: 1.0
path: .metrics.nexits.sum
old: 5.0
new: 1.0
Spaces Data
Minimal test - lines (21, 24)
path: .spaces[0].spaces[0].metrics.nexits.average
old: 0.0
new: null
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 92.40962204246613
new: 78.25311661523071
path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 158.02045369261705
new: 133.81282941204452
path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 152.37629276875444
new: 152.4234667906416
path: .spaces[0].spaces[0].metrics.cognitive.average
old: 0.0
new: null
path: .spaces[0].spaces[0].metrics.loc.sloc
old: 1.0
new: 4.0
path: .spaces[0].spaces[0].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[0].spaces[0].metrics.loc.ploc
old: 1.0
new: 4.0
path: .spaces[0].spaces[0].metrics.nom.total
old: 1.0
new: 0.0
path: .spaces[0].spaces[0].metrics.nom.functions
old: 1.0
new: 0.0
path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 1.6
new: 0.9649839288804954
path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.5
new: 0.6666666666666666
path: .spaces[0].spaces[0].metrics.halstead.time
old: 1.289960052715201
new: 1.3544580553509613
path: .spaces[0].spaces[0].metrics.halstead.effort
old: 23.21928094887362
new: 24.380244996317305
path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.002712967490108627
new: 0.002802662411680566
path: .spaces[0].spaces[0].metrics.halstead.n2
old: 1.0
new: 2.0
path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 2.0
new: 1.5
path: .spaces[0].spaces[0].metrics.halstead.volume
old: 11.60964047443681
new: 16.253496664211536
path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 8.0
new: 6.754887502163468
path: .spaces[0].spaces[0].metrics.halstead.n1
old: 4.0
new: 3.0
path: .spaces[0].spaces[0].metrics.halstead.N2
old: 1.0
new: 2.0
path: .spaces[0].spaces[0].metrics.halstead.N1
old: 4.0
new: 5.0
path: .spaces[0].spaces[0].metrics.halstead.length
old: 5.0
new: 7.0
path: .spaces[0].spaces[0].metrics.nargs.average
old: 0.0
new: null
Code
typedef struct {
uint32_t hi;
uint32_t lo; // have to move 64 bit entities as 32 bit halves since
} DU; // stack slots are not guaranteed 16 byte aligned
Minimal test - lines (19, 168)
path: .spaces[0].metrics.nexits.average
old: 0.5
new: 1.0
path: .spaces[0].metrics.nexits.sum
old: 5.0
new: 1.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.33675137891301
new: 0.7005960930119755
path: .spaces[0].metrics.halstead.time
old: 775.7535902728961
new: 16949.16260740795
path: .spaces[0].metrics.halstead.vocabulary
old: 46.0
new: 102.0
path: .spaces[0].metrics.halstead.N1
old: 98.0
new: 563.0
path: .spaces[0].metrics.halstead.n1
old: 16.0
new: 28.0
path: .spaces[0].metrics.halstead.N2
old: 60.0
new: 285.0
path: .spaces[0].metrics.halstead.difficulty
old: 16.0
new: 53.91891891891892
path: .spaces[0].metrics.halstead.estimated_program_length
old: 211.20671786825557
new: 594.1054868741552
path: .spaces[0].metrics.halstead.bugs
old: 0.19329010033237295
new: 1.510633968710803
path: .spaces[0].metrics.halstead.volume
old: 872.7227890570081
new: 5658.2166899918275
path: .spaces[0].metrics.halstead.length
old: 158.0
new: 848.0
path: .spaces[0].metrics.halstead.effort
old: 13963.56462491213
new: 305084.9269333431
path: .spaces[0].metrics.halstead.n2
old: 30.0
new: 74.0
path: .spaces[0].metrics.halstead.level
old: 0.0625
new: 0.018546365914786967
path: .spaces[0].metrics.cyclomatic.average
old: 1.181818181818182
new: 19.5
path: .spaces[0].metrics.cyclomatic.sum
old: 13.0
new: 39.0
path: .spaces[0].metrics.cognitive.sum
old: 3.0
new: 91.0
path: .spaces[0].metrics.cognitive.average
old: 0.3
new: 91.0
path: .spaces[0].metrics.nargs.average
old: 0.6
new: 5.0
path: .spaces[0].metrics.nargs.sum
old: 6.0
new: 5.0
path: .spaces[0].metrics.loc.ploc
old: 39.0
new: 138.0
path: .spaces[0].metrics.loc.blank
old: 11.0
new: 9.0
path: .spaces[0].metrics.loc.lloc
old: 10.0
new: 100.0
path: .spaces[0].metrics.loc.sloc
old: 53.0
new: 150.0
path: .spaces[0].metrics.mi.mi_original
old: 68.47885757150694
new: 35.92521518025893
path: .spaces[0].metrics.mi.mi_sei
old: 42.431335897884125
new: -9.03372206565748
path: .spaces[0].metrics.mi.mi_visual_studio
old: 40.04611553889294
new: 21.008897766233293
path: .spaces[0].metrics.nom.total
old: 10.0
new: 1.0
path: .spaces[0].metrics.nom.functions
old: 10.0
new: 1.0
Code
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args, uint32_t *gprData, double *fprData)
{
typedef struct {
uint32_t hi;
uint32_t lo; // have to move 64 bit entities as 32 bit halves since
} DU; // stack slots are not guaranteed 16 byte aligned
#define PARAM_GPR_COUNT 7
nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
const nsXPTMethodInfo* info = nullptr;
uint8_t paramCount;
uint8_t i;
NS_ASSERTION(self,"no self");
self->mEntry->GetMethodInfo(uint16_t(methodIndex), &info);
NS_ASSERTION(info,"no method info");
paramCount = info->GetParamCount();
const uint8_t indexOfJSContext = info->IndexOfJSContext();
uint32_t* ap = args;
uint32_t iCount = 0;
uint32_t fpCount = 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 (iCount < PARAM_GPR_COUNT)
iCount++;
else
ap++;
}
if(param.IsOut() || !type.IsArithmetic())
{
if (iCount < PARAM_GPR_COUNT)
dp->val.p = (void*) gprData[iCount++];
else
dp->val.p = (void*) *ap++;
continue;
}
// else
switch(type)
{
case nsXPTType::T_I8 : if (iCount < PARAM_GPR_COUNT)
dp->val.i8 = (int8_t) gprData[iCount++];
else
dp->val.i8 = (int8_t) *ap++;
break;
case nsXPTType::T_I16 : if (iCount < PARAM_GPR_COUNT)
dp->val.i16 = (int16_t) gprData[iCount++];
else
dp->val.i16 = (int16_t) *ap++;
break;
case nsXPTType::T_I32 : if (iCount < PARAM_GPR_COUNT)
dp->val.i32 = (int32_t) gprData[iCount++];
else
dp->val.i32 = (int32_t) *ap++;
break;
case nsXPTType::T_I64 : if (iCount < PARAM_GPR_COUNT)
((DU *)dp)->hi = (int32_t) gprData[iCount++];
else
((DU *)dp)->hi = (int32_t) *ap++;
if (iCount < PARAM_GPR_COUNT)
((DU *)dp)->lo = (uint32_t) gprData[iCount++];
else
((DU *)dp)->lo = (uint32_t) *ap++;
break;
case nsXPTType::T_U8 : if (iCount < PARAM_GPR_COUNT)
dp->val.u8 = (uint8_t) gprData[iCount++];
else
dp->val.u8 = (uint8_t) *ap++;
break;
case nsXPTType::T_U16 : if (iCount < PARAM_GPR_COUNT)
dp->val.u16 = (uint16_t) gprData[iCount++];
else
dp->val.u16 = (uint16_t) *ap++;
break;
case nsXPTType::T_U32 : if (iCount < PARAM_GPR_COUNT)
dp->val.u32 = (uint32_t) gprData[iCount++];
else
dp->val.u32 = (uint32_t) *ap++;
break;
case nsXPTType::T_U64 : if (iCount < PARAM_GPR_COUNT)
((DU *)dp)->hi = (uint32_t) gprData[iCount++];
else
((DU *)dp)->hi = (uint32_t) *ap++;
if (iCount < PARAM_GPR_COUNT)
((DU *)dp)->lo = (uint32_t) gprData[iCount++];
else
((DU *)dp)->lo = (uint32_t) *ap++;
break;
case nsXPTType::T_FLOAT : if (fpCount < 13) {
dp->val.f = (float) fprData[fpCount++];
if (iCount < PARAM_GPR_COUNT)
++iCount;
else
++ap;
}
else
dp->val.f = *((float*) ap++);
break;
case nsXPTType::T_DOUBLE : if (fpCount < 13) {
dp->val.d = (double) fprData[fpCount++];
if (iCount < PARAM_GPR_COUNT)
++iCount;
else
++ap;
if (iCount < PARAM_GPR_COUNT)
++iCount;
else
++ap;
}
else {
dp->val.f = *((double*) ap);
ap += 2;
}
break;
case nsXPTType::T_BOOL : if (iCount < PARAM_GPR_COUNT)
dp->val.b = (bool) gprData[iCount++];
else
dp->val.b = (bool) *ap++;
break;
case nsXPTType::T_CHAR : if (iCount < PARAM_GPR_COUNT)
dp->val.c = (char) gprData[iCount++];
else
dp->val.c = (char) *ap++;
break;
case nsXPTType::T_WCHAR : if (iCount < PARAM_GPR_COUNT)
dp->val.wc = (wchar_t) gprData[iCount++];
else
dp->val.wc = (wchar_t) *ap++;
break;
default:
NS_ERROR("bad type");
break;
}
}
nsresult result = self->mOuter->CallMethod((uint16_t)methodIndex, info,
paramBuffer);
return result;
}