[PATCH 7/7] Add support for MSVC

Mike Hommey mh+jemalloc at glandium.org
Wed May 2 00:21:25 PDT 2012


Hi,

Thanks for applying the MSVC patches. When applying this one, you left
out the following hunk:

> @@ -296,7 +309,7 @@ static const bool config_ivsalloc =
>   * In addition, this controls the spacing of cacheline-spaced size classes.
>   */
>  #define	LG_CACHELINE		6
> -#define	CACHELINE		((size_t)(1U << LG_CACHELINE))
> +#define	CACHELINE		64
>  #define	CACHELINE_MASK		(CACHELINE - 1)
>  
>  /* Return the smallest cacheline multiple that is >= s. */

This wasn't a mistake that slipped in there. It is meant to be changed,
and there's unfortunately no other way: __declspec(align()) only takes
constants. Not calculated constants.

You can add a static assertion if you want to ensure CACHELINE matches
LG_CACHELINE (like static const int foo[CACHELINE == 1 << LG_CACHELINE
? 1 : -1]);

Mike



More information about the jemalloc-discuss mailing list