Bug 122746 - [sh4] Introduce const pools in LLINT
Summary: [sh4] Introduce const pools in LLINT
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-14 02:44 PDT by Julien Brianceau
Modified: 2013-10-16 00:17 PDT (History)
7 users (show)

See Also:


Attachments
Introduce const pools in sh4 LLINT (12.51 KB, patch)
2013-10-14 02:50 PDT, Julien Brianceau
no flags Details | Formatted Diff | Diff
generated LLIntAssembly.h on r157387 without patch (1.07 MB, application/octet-stream)
2013-10-14 02:54 PDT, Julien Brianceau
no flags Details
generated LLIntAssembly.h on r157387 with patch (1.08 MB, application/octet-stream)
2013-10-14 03:03 PDT, Julien Brianceau
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Brianceau 2013-10-14 02:44:34 PDT
In current implementation of LLINT for sh4, immediate values outside range -128..127 are loaded this way:

            mov.l .label, rx
            bra out
            nop
            .balign 4
            .label: .long immvalue
            out:

These immediate values could be grouped in constant pools placed behind non-return opcodes to avoid useless branches and reduce code size.
Comment 1 Julien Brianceau 2013-10-14 02:50:58 PDT
Created attachment 214139 [details]
Introduce const pools in sh4 LLINT

generated LowLevelInterpreter.o size is 32848 bytes with this patch instead of 33928 bytes without (-3.2%).
Comment 2 Julien Brianceau 2013-10-14 02:54:51 PDT
Created attachment 214140 [details]
generated LLIntAssembly.h on r157387 without patch
Comment 3 Julien Brianceau 2013-10-14 03:03:15 PDT
Created attachment 214141 [details]
generated LLIntAssembly.h on r157387 with patch
Comment 4 Julien Brianceau 2013-10-14 03:05:30 PDT
Ooops, sorry for the size of the patches.. a zip would have been more appropriate.
If there's a way to delete attachments, feel free to delete the 2 generated LLIntAssembly.h, I'll upload a zip file then.
Comment 5 kov's GTK+ EWS bot 2013-10-14 03:21:07 PDT
Comment on attachment 214139 [details]
Introduce const pools in sh4 LLINT

Attachment 214139 [details] did not pass gtk-wk2-ews (gtk-wk2):
Output: http://webkit-queues.appspot.com/results/4004005
Comment 6 Julien Brianceau 2013-10-14 16:09:25 PDT
The ConstPoolEntry class describes a constant: a size (16 or 32 bits), a value, a label (instance of LocalLabel) and a reference on it (instance of LocalLabelReference).
The ConstPool class describes a contant pool: a set of entries (ConstPoolEntry instances) of a specific size (16 or 32 bits).

The sh4LowerConstPool function iterates on all opcodes and handles two constant pools: one for 16 bit constants (currentPool16) and one for 32 bit constants (currentPool32):
- these 2 pools will be filled with constants when needed (case of the "move" opcode with values outside -127..128 range)
- these 2 pools will be flushed (if non empty) after non return opcodes "jmp" and "ret"
- before adding an entry in the pool, we check that there isn't already an entry with the matching value in it (in this case we reuse it instead of creating a new one)
- 16 bit entries are put before 32 bit ones because the max offset between the move opcode and the constant is 512 bytes for 16 bit values, whereas it's 1024 bytes for 32 bit ones
- there is 2 separate pools to avoid space wasted by alignment constraints
Comment 7 WebKit Commit Bot 2013-10-15 11:02:06 PDT
Comment on attachment 214139 [details]
Introduce const pools in sh4 LLINT

Clearing flags on attachment: 214139

Committed r157452: <http://trac.webkit.org/changeset/157452>
Comment 8 WebKit Commit Bot 2013-10-15 11:02:10 PDT
All reviewed patches have been landed.  Closing bug.