Closed Bug 1004790 Opened 10 years ago Closed 10 years ago

Split off a new class FreeList from FreeSpan

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla32

People

(Reporter: n.nethercote, Assigned: n.nethercote)

References

Details

Attachments

(2 files)

FreeSpan is really two types -- some of the operations are only relevant if
it's a freeLists[] value, and some of the operations are only relevant if it's
not. So we should split them.
This patch creates a new class, FreeList, which inherits from FreeSpan. It
moves several of the methods from FreeSpan to FreeList. The moved methods have
the following minimal changes:
- allocate/infallibleAllocate use the new setHead() method.
- isSameNonEmptySpan() now takes a reference instead of a pointer, and the
  callers had their (this,argument) pair switched.
Attachment #8416195 - Flags: review?(wmccloskey)
This patch changes FreeList from "is a FreeSpan" to "has a FreeSpan". This
makes clearer the fact that there isn't that much overlap between the two 
classes -- the only methods present in both classes are isEmpty() and
arenaAddress(). It also allows FreeList's data to be encapsulated (i.e.
private).

The patch also adds some extra assertions, and does other minor clean-ups, such
as removing initAsEmpty's never-used optional parameter.

To make sure that there was no remaining code that cast FreeList to FreeSpan or
vice versa (or anything else like that) I temporarily added some extra fields
before FreeList::head, and this flushed out a couple of places I'd missed.
Attachment #8416196 - Flags: review?(wmccloskey)
Blocks: 1004816
Comment on attachment 8416195 [details] [diff] [review]
(part 1) - Split off a new class FreeList from FreeSpan.

Review of attachment 8416195 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/gc/Heap.h
@@ +388,5 @@
> +     * initialization so to allocate we simply return the first thing in the
> +     * arena and set the free list to point to the second.
> +     */
> +    MOZ_ALWAYS_INLINE void *allocateFromNewArena(uintptr_t arenaAddr, size_t firstThingOffset,
> +                                                size_t thingSize) {

Can you indent this line over one more? It's broken from before.
Attachment #8416195 - Flags: review?(wmccloskey) → review+
Attachment #8416196 - Flags: review?(wmccloskey) → review+
> Can you indent this line over one more? It's broken from before.

I did that in the second patch.

Try server looks good:
https://tbpl.mozilla.org/?tree=Try&rev=ae49f493005a
https://hg.mozilla.org/mozilla-central/rev/21332f87ca19
https://hg.mozilla.org/mozilla-central/rev/41ae09162dd7
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: