Global Metrics
path: .metrics.halstead.difficulty
old: 48.92783505154639
new: 46.666666666666664
path: .metrics.halstead.effort
old: 265840.1806979885
new: 244782.66641276548
path: .metrics.halstead.volume
old: 5433.311742036428
new: 5245.3428517021175
path: .metrics.halstead.length
old: 780.0
new: 775.0
path: .metrics.halstead.estimated_program_length
old: 774.7974835097643
new: 648.1337880512675
path: .metrics.halstead.vocabulary
old: 125.0
new: 109.0
path: .metrics.halstead.purity_ratio
old: 0.9933301070638004
new: 0.8363016620016355
path: .metrics.halstead.time
old: 14768.898927666029
new: 13599.037022931416
path: .metrics.halstead.level
old: 0.02043826380109566
new: 0.02142857142857143
path: .metrics.halstead.n2
old: 97.0
new: 81.0
path: .metrics.halstead.bugs
old: 1.3781373221443771
new: 1.3043651478550933
path: .metrics.halstead.N1
old: 441.0
new: 505.0
path: .metrics.halstead.N2
old: 339.0
new: 270.0
path: .metrics.cognitive.average
old: 10.0
new: 83.0
path: .metrics.cognitive.sum
old: 10.0
new: 83.0
path: .metrics.cyclomatic.sum
old: 10.0
new: 37.0
path: .metrics.cyclomatic.average
old: 5.0
new: 18.5
path: .metrics.mi.mi_sei
old: 11.969639684454574
new: -1.4054820781400146
path: .metrics.mi.mi_visual_studio
old: 25.619010719133897
new: 20.434669547535897
path: .metrics.mi.mi_original
old: 43.80850832971896
new: 34.94328492628638
path: .metrics.nargs.sum
old: 2.0
new: 5.0
path: .metrics.nargs.average
old: 2.0
new: 5.0
path: .metrics.loc.blank
old: 15.0
new: 22.0
path: .metrics.loc.lloc
old: 70.0
new: 94.0
path: .metrics.loc.sloc
old: 141.0
new: 168.0
path: .metrics.loc.cloc
old: 14.0
new: 12.0
path: .metrics.loc.ploc
old: 112.0
new: 134.0
Spaces Data
Minimal test - lines (18, 155)
path: .spaces[0].metrics.cognitive.average
old: 10.0
new: 83.0
path: .spaces[0].metrics.cognitive.sum
old: 10.0
new: 83.0
path: .spaces[0].metrics.mi.mi_sei
old: -5.814677523528388
new: -9.859201491363978
path: .spaces[0].metrics.mi.mi_original
old: 47.80621945670943
new: 38.539972147331895
path: .spaces[0].metrics.mi.mi_visual_studio
old: 27.95685348345581
new: 22.53799540779643
path: .spaces[0].metrics.halstead.vocabulary
old: 119.0
new: 101.0
path: .spaces[0].metrics.halstead.volume
old: 5246.956317877345
new: 5066.8989383741155
path: .spaces[0].metrics.halstead.difficulty
old: 50.46153846153846
new: 49.863013698630134
path: .spaces[0].metrics.halstead.effort
old: 264769.4880405799
new: 252650.851173723
path: .spaces[0].metrics.halstead.estimated_program_length
old: 726.8152500756943
new: 586.4631306158542
path: .spaces[0].metrics.halstead.N1
old: 433.0
new: 501.0
path: .spaces[0].metrics.halstead.bugs
old: 1.3744344613367283
new: 1.3321687928942274
path: .spaces[0].metrics.halstead.level
old: 0.019817073170731708
new: 0.020054945054945057
path: .spaces[0].metrics.halstead.time
old: 14709.416002254438
new: 14036.158398540168
path: .spaces[0].metrics.halstead.n2
old: 91.0
new: 73.0
path: .spaces[0].metrics.halstead.N2
old: 328.0
new: 260.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 0.9550791722413854
new: 0.7706480034373905
path: .spaces[0].metrics.loc.ploc
old: 102.0
new: 126.0
path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[0].metrics.loc.lloc
old: 70.0
new: 94.0
path: .spaces[0].metrics.loc.sloc
old: 113.0
new: 138.0
path: .spaces[0].metrics.nargs.sum
old: 2.0
new: 5.0
path: .spaces[0].metrics.nargs.average
old: 2.0
new: 5.0
path: .spaces[0].metrics.cyclomatic.average
old: 9.0
new: 36.0
path: .spaces[0].metrics.cyclomatic.sum
old: 9.0
new: 36.0
Code
PrepareAndDispatch(nsXPTCStubBase* self, uint64_t methodIndex, uint64_t* args, uint64_t *gprData, double *fprData)
{
#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();
uint64_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)
dp->val.i64 = (int64_t) gprData[iCount++];
else
dp->val.i64 = (int64_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)
dp->val.u64 = (uint64_t) gprData[iCount++];
else
dp->val.u64 = (uint64_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;
}