Global Metrics
path: .metrics.cyclomatic.average
old: 1.736842105263158
new: 17.5
path: .metrics.cyclomatic.sum
old: 33.0
new: 35.0
path: .metrics.cognitive.average
old: 0.6666666666666666
new: 69.0
path: .metrics.cognitive.sum
old: 2.0
new: 69.0
path: .metrics.mi.mi_original
old: 34.53825031152553
new: 25.88664708015
path: .metrics.mi.mi_visual_studio
old: 20.197807199722533
new: 15.138390105350876
path: .metrics.mi.mi_sei
old: 6.473944203902221
new: -6.994596937161624
path: .metrics.nom.total
old: 3.0
new: 1.0
path: .metrics.nom.functions
old: 3.0
new: 1.0
path: .metrics.loc.cloc
old: 29.0
new: 43.0
path: .metrics.loc.sloc
old: 182.0
new: 297.0
path: .metrics.loc.ploc
old: 133.0
new: 160.0
path: .metrics.loc.blank
old: 20.0
new: 94.0
path: .metrics.loc.lloc
old: 31.0
new: 85.0
path: .metrics.halstead.bugs
old: 0.818371378740192
new: 1.1509074646860888
path: .metrics.halstead.length
old: 723.0
new: 788.0
path: .metrics.halstead.vocabulary
old: 157.0
new: 131.0
path: .metrics.halstead.n2
old: 137.0
new: 104.0
path: .metrics.halstead.time
old: 6758.262016454875
new: 11271.195618098409
path: .metrics.halstead.n1
old: 20.0
new: 27.0
path: .metrics.halstead.purity_ratio
old: 1.4645490418580074
new: 1.0472432655394508
path: .metrics.halstead.effort
old: 121648.71629618776
new: 202881.52112577137
path: .metrics.halstead.estimated_program_length
old: 1058.868957263339
new: 825.2276932450872
path: .metrics.halstead.difficulty
old: 23.065693430656935
new: 36.60576923076923
path: .metrics.halstead.N1
old: 407.0
new: 506.0
path: .metrics.halstead.N2
old: 316.0
new: 282.0
path: .metrics.halstead.level
old: 0.04335443037974683
new: 0.027318098240084052
path: .metrics.halstead.volume
old: 5274.010801448646
new: 5542.337325211511
path: .metrics.nexits.sum
old: 3.0
new: 1.0
path: .metrics.nargs.sum
old: 2.0
new: 5.0
path: .metrics.nargs.average
old: 0.6666666666666666
new: 5.0
Spaces Data
Minimal test - lines (18, 180)
path: .spaces[0].metrics.loc.cloc
old: 3.0
new: 12.0
path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 84.0
path: .spaces[0].metrics.loc.blank
old: 0.0
new: 26.0
path: .spaces[0].metrics.loc.ploc
old: 6.0
new: 125.0
path: .spaces[0].metrics.loc.sloc
old: 7.0
new: 163.0
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[0].metrics.nexits.average
old: null
new: 1.0
path: .spaces[0].metrics.halstead.length
old: 22.0
new: 745.0
path: .spaces[0].metrics.halstead.N2
old: 10.0
new: 248.0
path: .spaces[0].metrics.halstead.volume
old: 81.40967379910403
new: 4927.9588338658305
path: .spaces[0].metrics.halstead.level
old: 0.32
new: 0.02120669056152927
path: .spaces[0].metrics.halstead.bugs
old: 0.013383286324790354
new: 1.2599158123918528
path: .spaces[0].metrics.halstead.effort
old: 254.4052306222001
new: 232377.5517715887
path: .spaces[0].metrics.halstead.time
old: 14.13362392345556
new: 12909.863987310486
path: .spaces[0].metrics.halstead.difficulty
old: 3.125
new: 47.15492957746479
path: .spaces[0].metrics.halstead.n1
old: 5.0
new: 27.0
path: .spaces[0].metrics.halstead.n2
old: 8.0
new: 71.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 35.60964047443681
new: 565.0140080432461
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.6186200215653097
new: 0.7584080644875787
path: .spaces[0].metrics.halstead.vocabulary
old: 13.0
new: 98.0
path: .spaces[0].metrics.halstead.N1
old: 12.0
new: 497.0
path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 68.0
path: .spaces[0].metrics.cognitive.average
old: null
new: 68.0
path: .spaces[0].metrics.nargs.average
old: null
new: 5.0
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 5.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 33.0
path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 33.0
path: .spaces[0].metrics.mi.mi_sei
old: 134.73829869482554
new: 0.9769966143852038
path: .spaces[0].metrics.mi.mi_visual_studio
old: 68.05198024568763
new: 21.44871927385577
path: .spaces[0].metrics.mi.mi_original
old: 116.36888622012586
new: 36.67730995829336
path: .spaces[0].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[0].metrics.nom.total
old: 0.0
new: 1.0
Code
extern "C" nsresult __attribute__((__used__))
PrepareAndDispatch(nsXPTCStubBase * self, uint32_t methodIndex,
uint64_t * args, uint64_t * gprData, double *fprData)
{
//
// "this" pointer is first parameter, so parameter count is 3.
//
#define PARAM_GPR_COUNT 3
#define PARAM_FPR_COUNT 3
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();
//
// setup variant array pointer
//
const uint8_t indexOfJSContext = info->IndexOfJSContext();
uint64_t* ap = args;
uint32_t iCount = 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 (iCount < PARAM_FPR_COUNT)
// The value in xmm register is already prepared to
// be retrieved as a float. Therefore, we pass the
// value verbatim, as a double without conversion.
dp->val.d = (double)fprData[iCount++];
else
dp->val.f = *((float*)ap++);
break;
case nsXPTType::T_DOUBLE:
if (iCount < PARAM_FPR_COUNT)
dp->val.d = (double)fprData[iCount++];
else
dp->val.d = *((double*)ap++);
break;
case nsXPTType::T_BOOL:
if (iCount < PARAM_GPR_COUNT)
// We need the cast to uint8_t to remove garbage on upper 56-bit
// at first.
dp->val.b = (bool)(uint8_t)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_ASSERTION(0, "bad type");
break;
}
}
nsresult result = self->mOuter->CallMethod((uint16_t)methodIndex, info,
paramBuffer);
return result;
}