Closed Bug 1967689 Opened 1 year ago Closed 1 year ago

Refactoring in PHC

Categories

(Core :: Memory Allocator, task)

task

Tracking

()

RESOLVED FIXED
142 Branch
Tracking Status
firefox142 --- fixed

People

(Reporter: pbone, Assigned: pbone)

References

(Blocks 1 open bug)

Details

Attachments

(14 files, 4 obsolete files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

I started working on Bug 1867191 by doing some refactoring, but it's significant enough that it should be a new bug.

Summary: Some refactoring in PHC → Refactoring in PHC

Move this class to the top level.

Depends on: 1967891
Attachment #9489622 - Attachment description: WIP: Bug 1967689 - pt 3. Move some code into new methods of AllocPageInfo → WIP: Bug 1967689 - pt 4. Move some code into new methods of AllocPageInfo
Blocks: 1968178
No longer blocks: 1968178
Duplicate of this bug: 1968178

This was previously a macro, making it a function allows us to
forward-declare it and write the implementation later in the file.

A lot of code from outside the PHC class accesses data/methods within it
through the sPHC global. Instead move this code into the PHC class.
Some functions can be moved directly, others are split up and part of
them is moved.

  • Move functions into the PHC class
  • Move ReuseDelay into the class definition.
  • Merge MaybePageRealloc into its caller.
Attachment #9492648 - Attachment is obsolete: true
Attachment #9489620 - Attachment description: WIP: Bug 1967689 - pt 1. Fix a comment → Bug 1967689 - pt 1. Fix a comment r=glandium
Attachment #9489621 - Attachment description: WIP: Bug 1967689 - pt 2. Move AllocPageInfo class definition → Bug 1967689 - pt 2. Move AllocPageInfo class definition r=glandium
Attachment #9489873 - Attachment description: WIP: Bug 1967689 - pt 3. Move mFreeTime into AllocPageInfo → Bug 1967689 - pt 3. Move mFreeTime into AllocPageInfo r=glandium
Attachment #9489622 - Attachment description: WIP: Bug 1967689 - pt 4. Move some code into new methods of AllocPageInfo → Bug 1967689 - pt 4. Move some code into new methods of AllocPageInfo r=glandium
Attachment #9489874 - Attachment description: WIP: Bug 1967689 - pt 5. Use MOZ_REQUIRES lock annotations in PHC → Bug 1967689 - pt 5. Use MOZ_REQUIRES lock annotations in PHC r=glandium
Attachment #9492644 - Attachment description: WIP: Bug 1967689 - pt 6. Add a va_list version of FdPrintf → Bug 1967689 - pt 6. Add a va_list version of FdPrintf r=glandium
Attachment #9492645 - Attachment description: WIP: Bug 1967689 - pt 7. Make PHC's debug logging a function → Bug 1967689 - pt 7. Make PHC's debug logging a function r=glandium
Attachment #9492646 - Attachment description: WIP: Bug 1967689 - pt 8. Create a fast lookup for PHC's region bounds → WIP: Bug 1967689 - pt 8. Move sRegion into PHC
Attachment #9492649 - Attachment description: WIP: Bug 1967689 - pt 11. Move more code into the PHC class → WIP: Bug 1967689 - pt 10. Move more code into the PHC class

FragmentationBytes() and GetPageStats() now take the lock instead of
requiring their callers to do it.

Attachment #9492646 - Attachment description: WIP: Bug 1967689 - pt 8. Move sRegion into PHC → WIP: Bug 1967689 - pt 8. Statically allocate PHC::sRegion

Use a simplie bounds check on the hot path before deciding what kind of
PHC pointer a particular pointer is.

Attachment #9492647 - Attachment description: WIP: Bug 1967689 - pt 9. Add branch annotations to PHC's hottest paths → WIP: Bug 1967689 - pt 10. Add branch annotations to PHC's hottest paths
Attachment #9492649 - Attachment description: WIP: Bug 1967689 - pt 10. Move more code into the PHC class → WIP: Bug 1967689 - pt 11. Move more code into the PHC class
Attachment #9493197 - Attachment description: WIP: Bug 1967689 - pt 11. Move some locking responsability ihn PHC → WIP: Bug 1967689 - pt 12. Move some locking responsability in PHC
Attachment #9493198 - Attachment description: WIP: Bug 1967689 - pt 12. Make more PHC state private within the PHC class → WIP: Bug 1967689 - pt 13. Make more PHC state private within the PHC class
Attachment #9493200 - Attachment description: WIP: Bug 1967689 - pt 13. Use mfbt/Array for PHC's page info → WIP: Bug 1967689 - pt 14. Use mfbt/Array for PHC's page info
Attachment #9492644 - Attachment description: Bug 1967689 - pt 6. Add a va_list version of FdPrintf r=glandium → Bug 1967689 - pt 6. Add more versions of FdPrintf r=glandium
Attachment #9492646 - Attachment description: WIP: Bug 1967689 - pt 8. Statically allocate PHC::sRegion → Bug 1967689 - pt 8. Statically allocate PHC::sRegion r=glandium
Attachment #9494008 - Attachment description: WIP: Bug 1967689 - pt 9. Simplify PHC's free hotpath → Bug 1967689 - pt 9. Simplify PHC's free hotpath r=glandium
Attachment #9492647 - Attachment description: WIP: Bug 1967689 - pt 10. Add branch annotations to PHC's hottest paths → Bug 1967689 - pt 10. Add branch annotations to PHC's hottest paths r=glandium
Attachment #9492649 - Attachment description: WIP: Bug 1967689 - pt 11. Move more code into the PHC class → Bug 1967689 - pt 11. Move more code into the PHC class r=glandium
Attachment #9493197 - Attachment description: WIP: Bug 1967689 - pt 12. Move some locking responsability in PHC → Bug 1967689 - pt 12. Move some locking responsability in PHC r=glandium
Attachment #9493198 - Attachment description: WIP: Bug 1967689 - pt 13. Make more PHC state private within the PHC class → Bug 1967689 - pt 13. Make more PHC state private within the PHC class r=glandium
Attachment #9493200 - Attachment description: WIP: Bug 1967689 - pt 14. Use mfbt/Array for PHC's page info → Bug 1967689 - pt 14. Use mfbt/Array for PHC's page info r=glandium
Attachment #9493198 - Attachment is obsolete: true
Attachment #9492649 - Attachment description: Bug 1967689 - pt 11. Move more code into the PHC class r=glandium → Bug 1967689 - pt 9. Move more code into the PHC class r=glandium
Attachment #9493197 - Attachment description: Bug 1967689 - pt 12. Move some locking responsability in PHC r=glandium → Bug 1967689 - pt 10. Move some locking responsability in PHC r=glandium
Attachment #9493200 - Attachment description: Bug 1967689 - pt 14. Use mfbt/Array for PHC's page info r=glandium → Bug 1967689 - pt 11. Use mfbt/Array for PHC's page info r=glandium
Attachment #9494826 - Attachment description: Bug 1967689 - pt 15. Remove duplicate include r=glandium → Bug 1967689 - pt 12. Remove duplicate include r=glandium
Attachment #9494827 - Attachment description: Bug 1967689 - pt 16. AllocVirtualAddresses can fail gracefully r=glandium → Bug 1967689 - pt 13. AllocVirtualAddresses can fail gracefully r=glandium
Attachment #9494008 - Attachment description: Bug 1967689 - pt 9. Simplify PHC's free hotpath r=glandium → Bug 1967689 - pt X. Simplify PHC's free hotpath r=glandium
Attachment #9492647 - Attachment description: Bug 1967689 - pt 10. Add branch annotations to PHC's hottest paths r=glandium → Bug 1967689 - pt X. Add branch annotations to PHC's hottest paths r=glandium
Attachment #9494008 - Attachment description: Bug 1967689 - pt X. Simplify PHC's free hotpath r=glandium → Bug 1967689 - pt X. Simplify PHC's free hotpath
Attachment #9492647 - Attachment description: Bug 1967689 - pt X. Add branch annotations to PHC's hottest paths r=glandium → Bug 1967689 - pt X. Add branch annotations to PHC's hottest paths
Attachment #9492647 - Attachment is obsolete: true

Comment on attachment 9494008 [details]
Bug 1967689 - pt X. Simplify PHC's free hotpath

Revision D253289 was moved to bug 1867191. Setting attachment 9494008 [details] to obsolete.

Attachment #9494008 - Attachment is obsolete: true
Pushed by pbone@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/b3b936fe2101 https://hg.mozilla.org/integration/autoland/rev/8b8bc8c68966 pt 1. Fix a comment r=glandium https://github.com/mozilla-firefox/firefox/commit/5bc69022a4dd https://hg.mozilla.org/integration/autoland/rev/09a2d6cde40d pt 2. Move AllocPageInfo class definition r=glandium https://github.com/mozilla-firefox/firefox/commit/074fe97ce65c https://hg.mozilla.org/integration/autoland/rev/32ad4c49183b pt 3. Move mFreeTime into AllocPageInfo r=glandium https://github.com/mozilla-firefox/firefox/commit/1989d98c86c0 https://hg.mozilla.org/integration/autoland/rev/f09f259858f0 pt 4. Move some code into new methods of AllocPageInfo r=glandium https://github.com/mozilla-firefox/firefox/commit/cea9a5efbe1e https://hg.mozilla.org/integration/autoland/rev/ed97bd6c14ee pt 5. Use MOZ_REQUIRES lock annotations in PHC r=glandium https://github.com/mozilla-firefox/firefox/commit/e76b04bcd843 https://hg.mozilla.org/integration/autoland/rev/f61fc6f4c805 pt 6. Add more versions of FdPrintf r=glandium https://github.com/mozilla-firefox/firefox/commit/8255d726b455 https://hg.mozilla.org/integration/autoland/rev/87c39ac9ef52 pt 7. Make PHC's debug logging a function r=glandium https://github.com/mozilla-firefox/firefox/commit/0284c1c2b634 https://hg.mozilla.org/integration/autoland/rev/350e9c2e5b7d pt 8. Statically allocate PHC::sRegion r=glandium https://github.com/mozilla-firefox/firefox/commit/be83f650b58b https://hg.mozilla.org/integration/autoland/rev/565624be9973 pt 9. Move more code into the PHC class r=glandium https://github.com/mozilla-firefox/firefox/commit/56035619e2db https://hg.mozilla.org/integration/autoland/rev/4ca2601fcc2a pt 10. Move some locking responsability in PHC r=glandium https://github.com/mozilla-firefox/firefox/commit/a51600df5b77 https://hg.mozilla.org/integration/autoland/rev/8d2c4c757634 pt 11. Use mfbt/Array for PHC's page info r=glandium https://github.com/mozilla-firefox/firefox/commit/f306a05c62c3 https://hg.mozilla.org/integration/autoland/rev/b7f918e45523 pt 12. Remove duplicate include r=glandium https://github.com/mozilla-firefox/firefox/commit/7b59f77af93a https://hg.mozilla.org/integration/autoland/rev/b006227ddb8b pt 13. AllocVirtualAddresses can fail gracefully r=glandium https://github.com/mozilla-firefox/firefox/commit/114976a21f82 https://hg.mozilla.org/integration/autoland/rev/d8ccae6defca pt 14. Use FastIsPHCPtr in more places r=glandium
Blocks: 1975906
QA Whiteboard: [qa-triage-done-c143/b142]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: