Closed Bug 1170811 Opened 9 years ago Closed 3 years ago

Copy the backtracking allocator for testing regalloc modifications

Categories

(Core :: JavaScript Engine: JIT, defect, P5)

defect

Tracking

()

RESOLVED INCOMPLETE
Tracking Status
firefox41 --- affected

People

(Reporter: bhackett1024, Assigned: bhackett1024)

References

Details

Attachments

(2 files)

Changing the register allocator's behavior affects the speed of all code we Ion compile.  Sometimes these effects aren't predictable, and it would be nice to have a way to see these effects without running tests locally (which is time consuming and unreliable), as well as a place to stage allocator changes that have regressions which need to be fixed.

One way of doing this is to have a second copy of the backtracking allocator in the tree, which new changes can be made to.  With --ion-regalloc or the JIT_OPTION_forcedRegisterAllocator environment variable this allocator can be selected, and its behavior shown on AWFY.  Allocator changes with potential negative performance effects can be landed to this allocator first, and then landed to the main allocator if performance is acceptable.  Allocator bug fixes would need to be landed to both allocators.

This is kind of clunky but I don't see a good alternative.  The status quo makes changing the allocator very stressful and leaves me with little appetite to continue working on it.
BacktrackingAllocator.h has lots of classes --- LiveRange, VirtualRegister, etc. --- that are only used by the allocator but are in the js::jit namespace.  If the allocator is copied we'll have namespace conflicts without renaming all these classes in the copy, which is a pain.  The attached patch moves all these classes into BacktrackingAllocator itself, and uses typedefs in the .cpp so that a copied allocator will only have to change a few lines to create a totally different allocator that can coexist with the main BacktrackingAllocator.
Assignee: nobody → bhackett1024
Attachment #8614384 - Flags: review?(sunfish)
Oh, and the above patch also removes a bunch of dead code for JSON/C1 spew of regalloc info.
Add a copy of BacktrackingAllocator, TestbedBacktrackingAllocator, which can be selected with --ion-regalloc=testbed and is only compiled on nightly builds.
Attachment #8614402 - Flags: review?(sunfish)
Depends on: 1170840
Having two copies in the tree is annoying because we'll need to keep them in sync. How feasible would it be to just add new regalloc features under control of a flag, and have --ion-regalloc=testbed be an option which just sets that flag?
(In reply to Dan Gohman [:sunfish] from comment #4)
> Having two copies in the tree is annoying because we'll need to keep them in
> sync. How feasible would it be to just add new regalloc features under
> control of a flag, and have --ion-regalloc=testbed be an option which just
> sets that flag?

It depends on how complicated/invasive the new features are, but at least for now we can try this.  I'll add a mechanism for this in bug 1170840.
Attachment #8614384 - Flags: review?(sunfish)
Attachment #8614402 - Flags: review?(sunfish)
Priority: -- → P5
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: