##// END OF EJS Templates
packaging: support building Inno installer with PyOxidizer...
packaging: support building Inno installer with PyOxidizer We want to start distributing Mercurial on Python 3 on Windows. PyOxidizer will be our vehicle for achieving that. This commit implements basic support for producing Inno installers using PyOxidizer. While it is an eventual goal of PyOxidizer to produce installers, those features aren't yet implemented. So our strategy for producing Mercurial installers is similar to what we've been doing with py2exe: invoke a build system to produce files then stage those files into a directory so they can be turned into an installer. We had to make significant alterations to the pyoxidizer.bzl config file to get it to produce the files that we desire for a Windows install. This meant differentiating the build targets so we can target Windows specifically. We've added a new module to hgpackaging to deal with interacting with PyOxidizer. It is similar to pyexe: we invoke a build process then copy files to a staging directory. Ideally these extra files would be defined in pyoxidizer.bzl. But I don't think it is worth doing at this time, as PyOxidizer's config files are lacking some features to make this turnkey. The rest of the change is introducing a variant of the Inno installer code that invokes PyOxidizer instead of py2exe. Comparing the Python 2.7 based Inno installers with this one, the following changes were observed: * No lib/*.{pyd, dll} files * No Microsoft.VC90.CRT.manifest * No msvc{m,p,r}90.dll files * python27.dll replaced with python37.dll * Add vcruntime140.dll file The disappearance of the .pyd and .dll files is acceptable, as PyOxidizer has embedded these in hg.exe and loads them from memory. The disappearance of the *90* files is acceptable because those provide the Visual C++ 9 runtime, as required by Python 2.7. Similarly, the appearance of vcruntime140.dll is a requirement of Python 3.7. Differential Revision: https://phab.mercurial-scm.org/D8473

File last commit:

r44446:de783805 default
r45256:9965d6c3 default
Show More
compiler.h
159 lines | 5.4 KiB | text/x-c | CLexer
Gregory Szorc
zstandard: vendor python-zstandard 0.9.0...
r37513 /*
* Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
*/
#ifndef ZSTD_COMPILER_H
#define ZSTD_COMPILER_H
/*-*******************************************************
* Compiler specifics
*********************************************************/
/* force inlining */
Gregory Szorc
zstandard: vendor python-zstandard 0.11...
r42237
#if !defined(ZSTD_NO_INLINE)
Gregory Szorc
zstandard: vendor python-zstandard 0.9.0...
r37513 #if defined (__GNUC__) || defined(__cplusplus) || defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
# define INLINE_KEYWORD inline
#else
# define INLINE_KEYWORD
#endif
Gregory Szorc
zstandard: vendor python-zstandard 0.12...
r43207 #if defined(__GNUC__) || defined(__ICCARM__)
Gregory Szorc
zstandard: vendor python-zstandard 0.9.0...
r37513 # define FORCE_INLINE_ATTR __attribute__((always_inline))
#elif defined(_MSC_VER)
# define FORCE_INLINE_ATTR __forceinline
#else
# define FORCE_INLINE_ATTR
#endif
Gregory Szorc
zstandard: vendor python-zstandard 0.11...
r42237 #else
#define INLINE_KEYWORD
#define FORCE_INLINE_ATTR
#endif
Gregory Szorc
zstandard: vendor python-zstandard 0.9.0...
r37513 /**
* FORCE_INLINE_TEMPLATE is used to define C "templates", which take constant
Gregory Szorc
zstandard: vendor python-zstandard 0.12...
r43207 * parameters. They must be inlined for the compiler to eliminate the constant
Gregory Szorc
zstandard: vendor python-zstandard 0.9.0...
r37513 * branches.
*/
#define FORCE_INLINE_TEMPLATE static INLINE_KEYWORD FORCE_INLINE_ATTR
/**
* HINT_INLINE is used to help the compiler generate better code. It is *not*
* used for "templates", so it can be tweaked based on the compilers
* performance.
*
* gcc-4.8 and gcc-4.9 have been shown to benefit from leaving off the
* always_inline attribute.
*
* clang up to 5.0.0 (trunk) benefit tremendously from the always_inline
* attribute.
*/
#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8 && __GNUC__ < 5
# define HINT_INLINE static INLINE_KEYWORD
#else
# define HINT_INLINE static INLINE_KEYWORD FORCE_INLINE_ATTR
#endif
Gregory Szorc
zstandard: vendor python-zstandard 0.13.0...
r44446 /* UNUSED_ATTR tells the compiler it is okay if the function is unused. */
#if defined(__GNUC__)
# define UNUSED_ATTR __attribute__((unused))
#else
# define UNUSED_ATTR
#endif
Gregory Szorc
zstandard: vendor python-zstandard 0.9.0...
r37513 /* force no inlining */
#ifdef _MSC_VER
# define FORCE_NOINLINE static __declspec(noinline)
#else
Gregory Szorc
zstandard: vendor python-zstandard 0.12...
r43207 # if defined(__GNUC__) || defined(__ICCARM__)
Gregory Szorc
zstandard: vendor python-zstandard 0.9.0...
r37513 # define FORCE_NOINLINE static __attribute__((__noinline__))
# else
# define FORCE_NOINLINE static
# endif
#endif
/* target attribute */
#ifndef __has_attribute
#define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
#endif
Gregory Szorc
zstandard: vendor python-zstandard 0.12...
r43207 #if defined(__GNUC__) || defined(__ICCARM__)
Gregory Szorc
zstandard: vendor python-zstandard 0.9.0...
r37513 # define TARGET_ATTRIBUTE(target) __attribute__((__target__(target)))
#else
# define TARGET_ATTRIBUTE(target)
#endif
/* Enable runtime BMI2 dispatch based on the CPU.
* Enabled for clang & gcc >=4.8 on x86 when BMI2 isn't enabled by default.
*/
#ifndef DYNAMIC_BMI2
Gregory Szorc
zstandard: vendor python-zstandard 0.10.1...
r40157 #if ((defined(__clang__) && __has_attribute(__target__)) \
Gregory Szorc
zstandard: vendor python-zstandard 0.9.0...
r37513 || (defined(__GNUC__) \
Gregory Szorc
zstandard: vendor python-zstandard 0.10.1...
r40157 && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))) \
Gregory Szorc
zstandard: vendor python-zstandard 0.9.0...
r37513 && (defined(__x86_64__) || defined(_M_X86)) \
&& !defined(__BMI2__)
# define DYNAMIC_BMI2 1
#else
# define DYNAMIC_BMI2 0
#endif
#endif
Gregory Szorc
zstandard: vendor python-zstandard 0.10.1...
r40157 /* prefetch
Gregory Szorc
zstandard: vendor python-zstandard 0.11...
r42237 * can be disabled, by declaring NO_PREFETCH build macro */
Gregory Szorc
zstandard: vendor python-zstandard 0.10.1...
r40157 #if defined(NO_PREFETCH)
Gregory Szorc
zstandard: vendor python-zstandard 0.11...
r42237 # define PREFETCH_L1(ptr) (void)(ptr) /* disabled */
# define PREFETCH_L2(ptr) (void)(ptr) /* disabled */
Gregory Szorc
zstandard: vendor python-zstandard 0.9.0...
r37513 #else
Gregory Szorc
zstandard: vendor python-zstandard 0.10.1...
r40157 # if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) /* _mm_prefetch() is not defined outside of x86/x64 */
# include <mmintrin.h> /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */
Gregory Szorc
zstandard: vendor python-zstandard 0.11...
r42237 # define PREFETCH_L1(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0)
# define PREFETCH_L2(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T1)
Gregory Szorc
zstandard: vendor python-zstandard 0.10.1...
r40157 # elif defined(__GNUC__) && ( (__GNUC__ >= 4) || ( (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) ) )
Gregory Szorc
zstandard: vendor python-zstandard 0.11...
r42237 # define PREFETCH_L1(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */)
# define PREFETCH_L2(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */)
Gregory Szorc
zstandard: vendor python-zstandard 0.10.1...
r40157 # else
Gregory Szorc
zstandard: vendor python-zstandard 0.11...
r42237 # define PREFETCH_L1(ptr) (void)(ptr) /* disabled */
# define PREFETCH_L2(ptr) (void)(ptr) /* disabled */
Gregory Szorc
zstandard: vendor python-zstandard 0.10.1...
r40157 # endif
#endif /* NO_PREFETCH */
#define CACHELINE_SIZE 64
#define PREFETCH_AREA(p, s) { \
const char* const _ptr = (const char*)(p); \
size_t const _size = (size_t)(s); \
size_t _pos; \
for (_pos=0; _pos<_size; _pos+=CACHELINE_SIZE) { \
Gregory Szorc
zstandard: vendor python-zstandard 0.11...
r42237 PREFETCH_L2(_ptr + _pos); \
Gregory Szorc
zstandard: vendor python-zstandard 0.10.1...
r40157 } \
}
Gregory Szorc
zstandard: vendor python-zstandard 0.9.0...
r37513
Gregory Szorc
zstandard: vendor python-zstandard 0.13.0...
r44446 /* vectorization
* older GCC (pre gcc-4.3 picked as the cutoff) uses a different syntax */
Gregory Szorc
zstandard: vendor python-zstandard 0.12...
r43207 #if !defined(__clang__) && defined(__GNUC__)
Gregory Szorc
zstandard: vendor python-zstandard 0.13.0...
r44446 # if (__GNUC__ == 4 && __GNUC_MINOR__ > 3) || (__GNUC__ >= 5)
# define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize")))
# else
# define DONT_VECTORIZE _Pragma("GCC optimize(\"no-tree-vectorize\")")
# endif
Gregory Szorc
zstandard: vendor python-zstandard 0.12...
r43207 #else
# define DONT_VECTORIZE
#endif
Gregory Szorc
zstandard: vendor python-zstandard 0.9.0...
r37513 /* disable warnings */
#ifdef _MSC_VER /* Visual Studio */
# include <intrin.h> /* For Visual 2005 */
# pragma warning(disable : 4100) /* disable: C4100: unreferenced formal parameter */
# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */
# pragma warning(disable : 4204) /* disable: C4204: non-constant aggregate initializer */
# pragma warning(disable : 4214) /* disable: C4214: non-int bitfields */
# pragma warning(disable : 4324) /* disable: C4324: padded structure */
#endif
#endif /* ZSTD_COMPILER_H */