This change fixes performance degradation reported in PR24667. The reason
of the problem is leaving module after each header, even if the next header
is of the same module. With this fix module state record counts the number of
headers parsed within particular module. Macro update starts when this number
reaches the number of headers specified in the module descriptor.
Using script from PR24667 the performance measurement gives numbers (compile
time vs number of headers):
128 0.0362679958344
256 0.0517950057983
512 0.0877501964569
1024 0.171896934509
2048 0.393149137497
4096 1.02584791183
8192 3.1531829834
While without the fix compiler demonstrates quadratic compile time:
128 0.0541491508484
256 0.121176958084
512 0.330996990204
1024 1.10708594322
2048 4.06581497192
4096 16.0358121395
8192 66.6967120171