Last Comment Bug 630445 - JM: shrink JITScript by optimizing the representation of variable-length sections
: JM: shrink JITScript by optimizing the representation of variable-length sect...
Status: RESOLVED FIXED
fixed-in-tracemonkey
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: All All
: -- normal (vote)
: ---
Assigned To: Nicholas Nethercote [:njn]
:
Mentors:
Depends on:
Blocks: JaegerShrink 630738
  Show dependency treegraph
 
Reported: 2011-01-31 20:25 PST by Nicholas Nethercote [:njn]
Modified: 2011-02-06 16:56 PST (History)
7 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (against TM 61287:a6d56af51d69) (40.98 KB, patch)
2011-01-31 20:25 PST, Nicholas Nethercote [:njn]
dvander: review+
dvander: approval2.0+
Details | Diff | Review

Description Nicholas Nethercote [:njn] 2011-01-31 20:25:10 PST
Created attachment 508659 [details] [diff] [review]
patch (against TM 61287:a6d56af51d69)

JITScript has several variable-length sections at its end.  Currently it
holds a pointer to every section and the length of every section.  But only
one or the other is necessary;  this patch removes all the pointers.

This reduces sizeof(JITScript) nicely:

- 32-bits: 120 bytes -> 84 bytes
- 64-bits: 200 bytes -> 128 bytes

Reusing the calculation from bug 619849 comment 0: on a 20-tab cad-comics browser run this reduces peak memory use by ~800 KB on 64-bit platforms and ~400 KB on 32-bit platforms.

It also reduces the cost of adding new sections, which may happen with PICs
(see the last sentence of bug 629601 comment 2).

The patch:
- Changes all the section pointer fields (.nmap, .pics, etc) to methods.

- Removes 'idReg' from PICGenInfo;  it's a dead field.

- Reorders the section lengths in JITScript to match the order of the
  sections as written by finishThisUp().

- Simplifies the writing of sections in finishThisUp().  Most of the
  sections had an "is this zero length?" test that wasn't necessary and just
  increased indentation, so I removed it.
 
The patch is reasonably big but most of the changes are mechanical.  I confirmed with Cachegrind that instruction counts were only negligibly affected by the new section-finding methods, each of which requires multiple adds and multiplies.
Comment 1 Nicholas Nethercote [:njn] 2011-02-03 19:58:12 PST
http://hg.mozilla.org/tracemonkey/rev/a1a8cd4accba
Comment 2 Chris Leary [:cdleary] (not checking bugmail) 2011-02-06 16:56:41 PST
cdleary-bot mozilla-central merge info:
http://hg.mozilla.org/mozilla-central/rev/a1a8cd4accba

Note You need to log in before you can comment on or make changes to this bug.