Global Metrics
path: .metrics.cognitive.average
old: 0.5294117647058824
new: 10.5
path: .metrics.cognitive.sum
old: 9.0
new: 21.0
path: .metrics.nexits.average
old: 0.2352941176470588
new: 1.0
path: .metrics.nexits.sum
old: 4.0
new: 2.0
path: .metrics.cyclomatic.average
old: 1.3333333333333333
new: 9.75
path: .metrics.cyclomatic.sum
old: 32.0
new: 39.0
path: .metrics.mi.mi_sei
old: 5.758663417273549
new: 16.025394807960875
path: .metrics.mi.mi_original
old: 36.37365058340154
new: 40.61551412355084
path: .metrics.mi.mi_visual_studio
old: 21.271140692047684
new: 23.751762645351366
path: .metrics.nom.functions
old: 17.0
new: 2.0
path: .metrics.nom.total
old: 17.0
new: 2.0
path: .metrics.halstead.purity_ratio
old: 1.5536025309837738
new: 0.7896628775433338
path: .metrics.halstead.estimated_program_length
old: 770.5868553679518
new: 445.3698629344402
path: .metrics.halstead.n1
old: 22.0
new: 28.0
path: .metrics.halstead.length
old: 496.0
new: 564.0
path: .metrics.halstead.volume
old: 3443.487194648263
new: 3585.6593306045993
path: .metrics.halstead.level
old: 0.04568068747173225
new: 0.02366345311130587
path: .metrics.halstead.difficulty
old: 21.89108910891089
new: 42.25925925925926
path: .metrics.halstead.time
old: 4187.87139019104
new: 8418.183737077876
path: .metrics.halstead.n2
old: 101.0
new: 54.0
path: .metrics.halstead.N1
old: 295.0
new: 401.0
path: .metrics.halstead.bugs
old: 0.5948251270281496
new: 0.9474130204868472
path: .metrics.halstead.N2
old: 201.0
new: 163.0
path: .metrics.halstead.vocabulary
old: 123.0
new: 82.0
path: .metrics.halstead.effort
old: 75381.68502343871
new: 151527.30726740175
path: .metrics.loc.lloc
old: 41.0
new: 89.0
path: .metrics.loc.blank
old: 31.0
new: 6.0
path: .metrics.loc.ploc
old: 135.0
new: 103.0
path: .metrics.loc.cloc
old: 23.0
new: 21.0
path: .metrics.loc.sloc
old: 189.0
new: 130.0
path: .metrics.nargs.average
old: 0.29411764705882354
new: 2.5
Spaces Data
Minimal test - lines (71, 130)
path: .spaces[1].metrics.nexits.sum
old: 4.0
new: 1.0
path: .spaces[1].metrics.nexits.average
old: 0.26666666666666666
new: 1.0
path: .spaces[1].metrics.cyclomatic.average
old: 1.263157894736842
new: 10.0
path: .spaces[1].metrics.cyclomatic.sum
old: 24.0
new: 20.0
path: .spaces[1].metrics.halstead.level
old: 0.04394942805538832
new: 0.033639143730886854
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.4210973860678602
new: 0.902716729993167
path: .spaces[1].metrics.halstead.estimated_program_length
old: 549.9646884082618
new: 350.2540912373488
path: .spaces[1].metrics.halstead.vocabulary
old: 95.0
new: 68.0
path: .spaces[1].metrics.halstead.bugs
old: 0.4986025018781509
new: 0.5673192100504675
path: .spaces[1].metrics.halstead.n1
old: 22.0
new: 24.0
path: .spaces[1].metrics.halstead.effort
old: 57851.358548279335
new: 70213.9032224071
path: .spaces[1].metrics.halstead.length
old: 387.0
new: 388.0
path: .spaces[1].metrics.halstead.N2
old: 151.0
new: 109.0
path: .spaces[1].metrics.halstead.n2
old: 73.0
new: 44.0
path: .spaces[1].metrics.halstead.time
old: 3213.9643637932963
new: 3900.772401244839
path: .spaces[1].metrics.halstead.N1
old: 236.0
new: 279.0
path: .spaces[1].metrics.halstead.volume
old: 2542.5341204240767
new: 2361.935582405132
path: .spaces[1].metrics.halstead.difficulty
old: 22.753424657534246
new: 29.727272727272727
path: .spaces[1].metrics.nom.functions
old: 15.0
new: 1.0
path: .spaces[1].metrics.nom.total
old: 15.0
new: 1.0
path: .spaces[1].metrics.cognitive.sum
old: 5.0
new: 14.0
path: .spaces[1].metrics.cognitive.average
old: 0.3333333333333333
new: 14.0
path: .spaces[1].metrics.mi.mi_sei
old: 13.979468607185623
new: 41.99480791635484
path: .spaces[1].metrics.mi.mi_visual_studio
old: 26.88787894763716
new: 34.90174685829679
path: .spaces[1].metrics.mi.mi_original
old: 45.97827300045954
new: 59.681987127687506
path: .spaces[1].metrics.nargs.average
old: 0.3333333333333333
new: 3.0
path: .spaces[1].metrics.nargs.sum
old: 5.0
new: 3.0
path: .spaces[1].metrics.loc.sloc
old: 129.0
new: 60.0
path: .spaces[1].metrics.loc.lloc
old: 36.0
new: 51.0
path: .spaces[1].metrics.loc.ploc
old: 96.0
new: 50.0
path: .spaces[1].metrics.loc.blank
old: 23.0
new: 0.0
Code
extern "C" uint32_t
invoke_copy_to_stack(uint32_t* d, uint32_t paramCount, nsXPTCVariant* s)
{
/*
We need to copy the parameters for this function to locals and use them
from there since the parameters occupy the same stack space as the stack
we're trying to populate.
*/
uint32_t *l_d = d;
nsXPTCVariant *l_s = s;
uint32_t l_paramCount = paramCount;
uint32_t regCount = 0; // return the number of registers to load from the stack
typedef struct {
uint32_t hi;
uint32_t lo;
} DU; // have to move 64 bit entities as 32 bit halves since
// stack slots are not guaranteed 16 byte aligned
for(uint32_t i = 0; i < l_paramCount; i++, l_d++, l_s++)
{
if (regCount < 5) regCount++;
if(l_s->IsPtrData())
{
if(l_s->type == nsXPTType::T_JSVAL)
{
// On SPARC, we need to pass a pointer to HandleValue
*((void**)l_d) = &l_s->ptr;
} else
{
*((void**)l_d) = l_s->ptr;
}
continue;
}
switch(l_s->type)
{
case nsXPTType::T_I8 : *((int32_t*) l_d) = l_s->val.i8; break;
case nsXPTType::T_I16 : *((int32_t*) l_d) = l_s->val.i16; break;
case nsXPTType::T_I32 : *((int32_t*) l_d) = l_s->val.i32; break;
case nsXPTType::T_I64 :
case nsXPTType::T_U64 :
case nsXPTType::T_DOUBLE : *((uint32_t*) l_d++) = ((DU *)l_s)->hi;
if (regCount < 5) regCount++;
*((uint32_t*) l_d) = ((DU *)l_s)->lo;
break;
case nsXPTType::T_U8 : *((uint32_t*) l_d) = l_s->val.u8; break;
case nsXPTType::T_U16 : *((uint32_t*) l_d) = l_s->val.u16; break;
case nsXPTType::T_U32 : *((uint32_t*) l_d) = l_s->val.u32; break;
case nsXPTType::T_FLOAT : *((float*) l_d) = l_s->val.f; break;
case nsXPTType::T_BOOL : *((uint32_t*) l_d) = l_s->val.b; break;
case nsXPTType::T_CHAR : *((uint32_t*) l_d) = l_s->val.c; break;
case nsXPTType::T_WCHAR : *((int32_t*) l_d) = l_s->val.wc; break;
default:
// all the others are plain pointer types
*((void**)l_d) = l_s->val.p;
break;
}
}
return regCount;
}
Minimal test - lines (19, 69)
path: .spaces[0].metrics.nargs.average
old: 0.0
new: 2.0
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 2.0
path: .spaces[0].metrics.loc.blank
old: 6.0
new: 0.0
path: .spaces[0].metrics.loc.lloc
old: 5.0
new: 38.0
path: .spaces[0].metrics.loc.cloc
old: 6.0
new: 4.0
path: .spaces[0].metrics.loc.ploc
old: 21.0
new: 48.0
path: .spaces[0].metrics.loc.sloc
old: 33.0
new: 51.0
path: .spaces[0].metrics.nom.functions
old: 2.0
new: 1.0
path: .spaces[0].metrics.nom.total
old: 2.0
new: 1.0
path: .spaces[0].metrics.cognitive.average
old: 2.0
new: 6.0
path: .spaces[0].metrics.cognitive.sum
old: 4.0
new: 6.0
path: .spaces[0].metrics.mi.mi_original
old: 81.20450753974957
new: 67.93071519046657
path: .spaces[0].metrics.mi.mi_sei
old: 72.84390583012409
new: 45.05224788284568
path: .spaces[0].metrics.mi.mi_visual_studio
old: 47.488016105116714
new: 39.72556443886934
path: .spaces[0].metrics.halstead.level
old: 0.09375
new: 0.045289855072463775
path: .spaces[0].metrics.halstead.N1
old: 52.0
new: 116.0
path: .spaces[0].metrics.halstead.difficulty
old: 10.666666666666666
new: 22.08
path: .spaces[0].metrics.halstead.vocabulary
old: 35.0
new: 48.0
path: .spaces[0].metrics.halstead.N2
old: 32.0
new: 48.0
path: .spaces[0].metrics.halstead.volume
old: 430.8597734233772
new: 915.9338501182696
path: .spaces[0].metrics.halstead.bugs
old: 0.09214148207443967
new: 0.247431049742375
path: .spaces[0].metrics.halstead.effort
old: 4595.83758318269
new: 20223.81941061139
path: .spaces[0].metrics.halstead.time
old: 255.32431017681608
new: 1123.545522811744
path: .spaces[0].metrics.halstead.estimated_program_length
old: 145.54163478716043
new: 220.13832973367943
path: .spaces[0].metrics.halstead.n1
old: 14.0
new: 23.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.7326385093709575
new: 1.3423068886199965
path: .spaces[0].metrics.halstead.length
old: 84.0
new: 164.0
path: .spaces[0].metrics.halstead.n2
old: 21.0
new: 25.0
path: .spaces[0].metrics.nexits.average
old: 0.0
new: 1.0
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.75
new: 17.0
path: .spaces[0].metrics.cyclomatic.sum
old: 7.0
new: 17.0
Code
extern "C" uint32_t
invoke_count_words(uint32_t paramCount, nsXPTCVariant* s)
{
uint32_t result = 0;
for(uint32_t i = 0; i < paramCount; i++, s++)
{
if(s->IsPtrData())
{
result++;
continue;
}
switch(s->type)
{
case nsXPTType::T_I8 :
case nsXPTType::T_I16 :
case nsXPTType::T_I32 :
result++;
break;
case nsXPTType::T_I64 :
result+=2;
break;
case nsXPTType::T_U8 :
case nsXPTType::T_U16 :
case nsXPTType::T_U32 :
result++;
break;
case nsXPTType::T_U64 :
result+=2;
break;
case nsXPTType::T_FLOAT :
result++;
break;
case nsXPTType::T_DOUBLE :
result+=2;
break;
case nsXPTType::T_BOOL :
case nsXPTType::T_CHAR :
case nsXPTType::T_WCHAR :
result++;
break;
default:
// all the others are plain pointer types
result++;
break;
}
}
// nuts, I know there's a cooler way of doing this, but it's late
// now and it'll probably come to me in the morning.
if (result & 0x3) result += 4 - (result & 0x3); // ensure q-word alignment
return result;
}
Minimal test - lines (84, 87)
path: .spaces[1].spaces[0].metrics.nargs.average
old: 0.0
new: null
path: .spaces[1].spaces[0].metrics.halstead.volume
old: 358.15198247445016
new: 16.253496664211536
path: .spaces[1].spaces[0].metrics.halstead.level
old: 0.08755760368663595
new: 0.6666666666666666
path: .spaces[1].spaces[0].metrics.halstead.bugs
old: 0.08525654719510457
new: 0.002802662411680566
path: .spaces[1].spaces[0].metrics.halstead.N1
old: 40.0
new: 5.0
path: .spaces[1].spaces[0].metrics.halstead.purity_ratio
old: 1.8875153755525995
new: 0.9649839288804954
path: .spaces[1].spaces[0].metrics.halstead.effort
old: 4090.472641945036
new: 24.380244996317305
path: .spaces[1].spaces[0].metrics.halstead.n1
old: 14.0
new: 3.0
path: .spaces[1].spaces[0].metrics.halstead.n2
old: 19.0
new: 2.0
path: .spaces[1].spaces[0].metrics.halstead.difficulty
old: 11.421052631578949
new: 1.5
path: .spaces[1].spaces[0].metrics.halstead.estimated_program_length
old: 134.01359166423458
new: 6.754887502163468
path: .spaces[1].spaces[0].metrics.halstead.time
old: 227.24848010805755
new: 1.3544580553509613
path: .spaces[1].spaces[0].metrics.halstead.length
old: 71.0
new: 7.0
path: .spaces[1].spaces[0].metrics.halstead.vocabulary
old: 33.0
new: 5.0
path: .spaces[1].spaces[0].metrics.halstead.N2
old: 31.0
new: 2.0
path: .spaces[1].spaces[0].metrics.cognitive.average
old: 2.0
new: null
path: .spaces[1].spaces[0].metrics.cognitive.sum
old: 2.0
new: 0.0
path: .spaces[1].spaces[0].metrics.cyclomatic.sum
old: 3.0
new: 1.0
path: .spaces[1].spaces[0].metrics.cyclomatic.average
old: 3.0
new: 1.0
path: .spaces[1].spaces[0].metrics.nom.functions
old: 1.0
new: 0.0
path: .spaces[1].spaces[0].metrics.nom.total
old: 1.0
new: 0.0
path: .spaces[1].spaces[0].metrics.loc.sloc
old: 23.0
new: 4.0
path: .spaces[1].spaces[0].metrics.loc.lloc
old: 6.0
new: 0.0
path: .spaces[1].spaces[0].metrics.loc.ploc
old: 16.0
new: 4.0
path: .spaces[1].spaces[0].metrics.loc.cloc
old: 5.0
new: 0.0
path: .spaces[1].spaces[0].metrics.loc.blank
old: 2.0
new: 0.0
path: .spaces[1].spaces[0].metrics.nexits.average
old: 0.0
new: null
path: .spaces[1].spaces[0].metrics.mi.mi_sei
old: 85.96544123566457
new: 117.45207326746916
path: .spaces[1].spaces[0].metrics.mi.mi_original
old: 88.93401507445498
new: 133.81282941204452
path: .spaces[1].spaces[0].metrics.mi.mi_visual_studio
old: 52.008195949973675
new: 78.25311661523071
Code
typedef struct {
uint32_t hi;
uint32_t lo;
} DU; // have to move 64 bit entities as 32 bit halves since