Closed Bug 1413475 Opened 7 years ago Closed 7 years ago

Miscellaneous code cleanups in mozjemalloc

Categories

(Core :: Memory Allocator, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: glandium, Assigned: glandium)

References

Details

Attachments

(10 files)

59 bytes, text/x-review-board-request
n.nethercote
: review+
Details
59 bytes, text/x-review-board-request
n.nethercote
: review+
Details
59 bytes, text/x-review-board-request
n.nethercote
: review+
Details
59 bytes, text/x-review-board-request
n.nethercote
: review+
Details
59 bytes, text/x-review-board-request
n.nethercote
: review+
Details
59 bytes, text/x-review-board-request
n.nethercote
: review+
Details
59 bytes, text/x-review-board-request
n.nethercote
: review+
Details
59 bytes, text/x-review-board-request
n.nethercote
: review+
Details
59 bytes, text/x-review-board-request
n.nethercote
: review+
Details
59 bytes, text/x-review-board-request
n.nethercote
: review+
Details
      No description provided.
Attachment #8924100 - Flags: review?(n.nethercote)
Note, there are some formatting decisions from clang-format that I don't really like, but I guess I can live with the resulting code.
Comment on attachment 8924094 [details]
Bug 1413475 - Remove ssize_t definition from mozjemalloc.cpp.

https://reviewboard.mozilla.org/r/195314/#review200724
Attachment #8924094 - Flags: review?(n.nethercote) → review+
Comment on attachment 8924095 [details]
Bug 1413475 - Inline _CRT_SPINCOUNT in mozjemalloc.cpp.

https://reviewboard.mozilla.org/r/195316/#review200728
Attachment #8924095 - Flags: review?(n.nethercote) → review+
Comment on attachment 8924097 [details]
Bug 1413475 - Move MALLOC_DECOMMIT definition closer to that of MALLOC_DOUBLE_PURGE.

https://reviewboard.mozilla.org/r/195320/#review200732
Attachment #8924097 - Flags: review?(n.nethercote) → review+
Comment on attachment 8924096 [details]
Bug 1413475 - Reorganize #includes in mozjemalloc.cpp.

https://reviewboard.mozilla.org/r/195318/#review200730

::: memory/build/mozjemalloc.cpp:110
(Diff revision 1)
>  //
>  // *****************************************************************************
>  
>  #include "mozmemory_wrap.h"
>  #include "mozjemalloc.h"
> +#include "mozjemalloc_types.h"

Blank line after this one? (To make the sectioning clearer.)

::: memory/build/mozjemalloc.cpp:124
(Diff revision 1)
> +#endif
> +#ifdef XP_DARWIN
> +#include <libkern/OSAtomic.h>
> +#include <mach/mach_init.h>
> +#include <mach/vm_map.h>
> +#endif

ditto
Attachment #8924096 - Flags: review?(n.nethercote) → review+
Comment on attachment 8924098 [details]
Bug 1413475 - Remove unused MAP_NOSYNC definition in mozjemalloc.cpp.

https://reviewboard.mozilla.org/r/195322/#review200734
Attachment #8924098 - Flags: review?(n.nethercote) → review+
Comment on attachment 8924099 [details]
Bug 1413475 - Inline STRERROR_BUF in mozjemalloc.cpp.

https://reviewboard.mozilla.org/r/195324/#review200736

It's only used once because you previously commoned up the uses of strerror_r! Nice.
Attachment #8924099 - Flags: review?(n.nethercote) → review+
Comment on attachment 8924100 [details]
Bug 1413475 - Replace SIZEOF_INT_2POW with LOG2(sizeof(int)).

https://reviewboard.mozilla.org/r/195326/#review200738

This is fine, but `LOG2(sizeof(int)) + 3` is so common I wonder if it's worth putting it in a constant instead.
Attachment #8924100 - Flags: review?(n.nethercote) → review+
Comment on attachment 8924101 [details]
Bug 1413475 - Normalize license boilerplates in memory/build/.

https://reviewboard.mozilla.org/r/195328/#review200740
Attachment #8924101 - Flags: review?(n.nethercote) → review+
(In reply to Nicholas Nethercote [:njn] from comment #22)
> Comment on attachment 8924100 [details]
> Bug 1413475 - Replace SIZEOF_INT_2POW with LOG2(sizeof(int)).
> 
> https://reviewboard.mozilla.org/r/195326/#review200738
> 
> This is fine, but `LOG2(sizeof(int)) + 3` is so common I wonder if it's
> worth putting it in a constant instead.

That's the kind of code that will go away when arena_run_t gains some methods, so I wouldn't worry too much about this for now.
Comment on attachment 8924102 [details]
Bug 1413475 - Change comments to use C++ style // instead of /* */ in memory/build/.

https://reviewboard.mozilla.org/r/195330/#review200746
Attachment #8924102 - Flags: review?(n.nethercote) → review+
Comment on attachment 8924103 [details]
Bug 1413475 - Run clang-format on all files in memory/build/.

https://reviewboard.mozilla.org/r/195332/#review200748

The lack of indenting for preprocessor directives is a shame. Then again, the Mozilla codebase is horribly inconsistent about how to do that...
Attachment #8924103 - Flags: review?(n.nethercote) → review+
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/9d00b2fff848
Remove ssize_t definition from mozjemalloc.cpp. r=njn
https://hg.mozilla.org/integration/autoland/rev/b16212b3d834
Inline _CRT_SPINCOUNT in mozjemalloc.cpp. r=njn
https://hg.mozilla.org/integration/autoland/rev/5d39a3d4c19b
Reorganize #includes in mozjemalloc.cpp. r=njn
https://hg.mozilla.org/integration/autoland/rev/567d3623e78f
Move MALLOC_DECOMMIT definition closer to that of MALLOC_DOUBLE_PURGE. r=njn
https://hg.mozilla.org/integration/autoland/rev/dd8f08e3a25e
Remove unused MAP_NOSYNC definition in mozjemalloc.cpp. r=njn
https://hg.mozilla.org/integration/autoland/rev/622a6b764ea7
Inline STRERROR_BUF in mozjemalloc.cpp. r=njn
https://hg.mozilla.org/integration/autoland/rev/d5fa1c46befc
Replace SIZEOF_INT_2POW with LOG2(sizeof(int)). r=njn
https://hg.mozilla.org/integration/autoland/rev/1823bf65f460
Normalize license boilerplates in memory/build/. r=njn
https://hg.mozilla.org/integration/autoland/rev/bdf6c8f64bfa
Change comments to use C++ style // instead of /* */ in memory/build/. r=njn
https://hg.mozilla.org/integration/autoland/rev/8f7809346a83
Run clang-format on all files in memory/build/. r=njn
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: