Closed
Bug 596458
Opened 14 years ago
Closed 6 years ago
Simple loops can force unnecessary spills
Categories
(Tamarin Graveyard :: Baseline JIT (CodegenLIR), defect)
Tamarin Graveyard
Baseline JIT (CodegenLIR)
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: stejohns, Unassigned)
Details
(Whiteboard: PACMAN)
Given a simple function like this in AS3: function writeloop():int { var v:int = 2; for ( var i:uint=0; i < 100000 ; i++ ) global_var = v; return i; } We are generating LIR such that the loop index variable is spilled and reloaded every time through the loop: 8:jump 22 12:label 13:getlocal1 14:getglobalscope 15:swap 16:setslot 4 18:getlocal2 19:increment 20:convert_u 21:setlocal2 22:getlocal2 23:pushint 100000 25:iflt 12 This will turn into x86 code something like 0x5f2c62: mov -0x58(%ebp),%esi 0x5f2c65: mov -0x28(%ebp),%ebx 0x5f2c68: mov %ebx,0x10(%esi) 0x5f2c6b: mov -0x20(%ebp),%ebx 0x5f2c6e: lea 0x1(%ebx),%ebx 0x5f2c71: mov %ebx,-0x20(%ebp) 0x5f2c74: mov -0x20(%ebp),%ebx 0x5f2c77: mov %ebx,-0x60(%ebp) 0x5f2c7a: cmp $0x186a0,%ebx 0x5f2c80: jb 0x5f2c62 Note the spill and reload of ebx, due to the 8->22 jump at loop start; in this loop, it's totally unnecessary as nothing else needs to touch the register. Ideally, the register allocator in nanojit could be smart enough to detect this and do the right thing. Alternately, perhaps we could restructure the way we emit LIR for simple loops so as to minimize this possibility.
Reporter | ||
Updated•14 years ago
|
Whiteboard: PACMAN
Updated•14 years ago
|
Flags: flashplayer-qrb+
Updated•6 years ago
|
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•