JM: shrink JITScript by optimizing the representation of variable-length sections

RESOLVED FIXED

Status

()

Core
JavaScript Engine
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: njn, Assigned: njn)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 attachment)

(Assignee)

Description

6 years ago
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.
Attachment #508659 - Flags: review?(dvander)
(Assignee)

Updated

6 years ago
Blocks: 615199
(Assignee)

Updated

6 years ago
Blocks: 630738
(Assignee)

Updated

6 years ago
Summary: JM: shrink JITScript some more → JM: shrink JITScript by optimizing the representation of variable-length sections
Attachment #508659 - Flags: review?(dvander) → review+
(Assignee)

Updated

6 years ago
Attachment #508659 - Flags: approval2.0?
Attachment #508659 - Flags: approval2.0? → approval2.0+
(Assignee)

Comment 1

6 years ago
http://hg.mozilla.org/tracemonkey/rev/a1a8cd4accba
Whiteboard: fixed-in-tracemonkey
cdleary-bot mozilla-central merge info:
http://hg.mozilla.org/mozilla-central/rev/a1a8cd4accba
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.