Closed Bug 1351756 Opened 7 years ago Closed 7 years ago

Add a testing function to dump arena cell layout information

Categories

(Core :: JavaScript: GC, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: jonco, Assigned: jonco)

Details

Attachments

(1 file)

Here's a patch to add a testing function to dump out the cell sizes and related information for all GC things.  I find myself wanting to do this often enough that re-rolling this patch every time is becoming annoying.  I made it conditional on JS_GC_ZEAL.

The output looks like this:

Arena header size: 40

GC thing kinds:
               AllocKind:    Size:   Count: Padding:
                 FUNCTION       64       63       24
        FUNCTION_EXTENDED       80       50       56
                  OBJECT0       32      126       24
       OBJECT0_BACKGROUND       32      126       24
                  OBJECT2       48       84       24
       OBJECT2_BACKGROUND       48       84       24
                  OBJECT4       64       63       24
       OBJECT4_BACKGROUND       64       63       24
                  OBJECT8       96       42       24
       OBJECT8_BACKGROUND       96       42       24
                 OBJECT12      128       31       88
      OBJECT12_BACKGROUND      128       31       88
                 OBJECT16      160       25       56
      OBJECT16_BACKGROUND      160       25       56
                   SCRIPT      144       28       24
              LAZY_SCRIPT       72       56       24
                    SHAPE       40      101       16
           ACCESSOR_SHAPE       56       72       24
               BASE_SHAPE       32      126       24
             OBJECT_GROUP       48       84       24
        FAT_INLINE_STRING       32      126       24
                   STRING       24      169        0
          EXTERNAL_STRING       24      169        0
          FAT_INLINE_ATOM       40      101       16
                     ATOM       32      126       24
                   SYMBOL       24      169        0
                  JITCODE       48       84       24
                    SCOPE       32      126       24
           REG_EXP_SHARED      128       31       88
Attachment #8852589 - Flags: review?(sphink)
Comment on attachment 8852589 [details] [diff] [review]
print-arena-size-information

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

::: js/src/jsgc.cpp
@@ +1077,5 @@
> +FOR_EACH_ALLOCKIND(EXPAND_THING_NAME)
> +#undef EXPAND_THING_NAME
> +    };
> +    size_t i = size_t(kind);
> +    MOZ_ASSERT(ArrayLength(names) == size_t(AllocKind::LIMIT));

Could that be a static_assert?
Attachment #8852589 - Flags: review?(sphink) → review+
Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/22da1d2e0f4e
Add a testing function to dump arena cell layout information r=sfink
https://hg.mozilla.org/mozilla-central/rev/22da1d2e0f4e
https://hg.mozilla.org/mozilla-central/rev/fa0ee3d5ae34
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: