Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is just a first pass at trying to gather some insights that might lead to memory savings later. For instance, by compiling SpiderMonkey with this patch, we get these metrics out:
Key(machinst.buffer.data): 0.0: 4 0.5: 412.0315874877959 0.9: 1636.1480687972453 1.0: 110084
Key(machinst.buffer.relocs): 0.0: 0 0.5: 1.9999056357269998 0.9: 9.999149133010329 1.0: 600
Key(machinst.buffer.traps): 0.0: 0 0.5: 11.999920242205052 0.9: 57.00277828432678 1.0: 3833
Key(machinst.buffer.call_sites): 0.0: 0 0.5: 1.9999056357269998 0.9: 9.999149133010329 1.0: 600
Which suggest that the fields in MachBuffer struct could be reduced:
Of course, there's only one MachBuffer per thread compiling code, so the savings here are marginal, but this approach could be used in other parts of the code to find more useful things.
The output formatting at this point is pretty crude as this is merely a proof-of-concept, but something better can be made later if necessary.