Perform build and magnum tuning

Building o//third_party/python now takes 5 seconds on my PC

This change works towards modifying Python to use runtime dispatching
when appropriate. For example, when loading the magnums in the socket
module, it's a good idea to check if the magnum is zero, because that
means the local system platform doesn't support it.
This commit is contained in:
Justine Tunney 2021-08-10 10:26:13 -07:00
parent ee7e296339
commit d26d7ae0e4
1028 changed files with 6576 additions and 172777 deletions

View file

@ -1,11 +1,13 @@
/* clang-format off */
/*
* _codecs_cn.c: Codecs collection for Mainland Chinese encodings
*
* Written by Hye-Shik Chang <perky@FreeBSD.org>
*/
#include "cjkcodecs.h"
#include "mappings_cn.h"
#include "third_party/python/Modules/cjkcodecs/cjkcodecs.h"
#include "third_party/python/Modules/cjkcodecs/mappings_cn.inc"
/**
* hz is predefined as 100 on AIX. So we undefine it to avoid

View file

@ -1,3 +1,4 @@
/* clang-format off */
/*
* _codecs_hk.c: Codecs collection for encodings from Hong Kong
*
@ -6,8 +7,8 @@
#define USING_IMPORTED_MAPS
#include "cjkcodecs.h"
#include "mappings_hk.h"
#include "third_party/python/Modules/cjkcodecs/cjkcodecs.h"
#include "third_party/python/Modules/cjkcodecs/mappings_hk.inc"
/*
* BIG5HKSCS codec

View file

@ -1,3 +1,4 @@
/* clang-format off */
/*
* _codecs_iso2022.c: Codecs collection for ISO-2022 encodings.
*
@ -10,10 +11,10 @@
#define EMULATE_JISX0213_2000_ENCODE_INVALID MAP_UNMAPPABLE
#define EMULATE_JISX0213_2000_DECODE_INVALID MAP_UNMAPPABLE
#include "cjkcodecs.h"
#include "alg_jisx0201.h"
#include "emu_jisx0213_2000.h"
#include "mappings_jisx0213_pair.h"
#include "third_party/python/Modules/cjkcodecs/cjkcodecs.h"
#include "third_party/python/Modules/cjkcodecs/alg_jisx0201.inc"
#include "third_party/python/Modules/cjkcodecs/emu_jisx0213_2000.inc"
#include "third_party/python/Modules/cjkcodecs/mappings_jisx0213_pair.inc"
/* STATE

View file

@ -1,3 +1,4 @@
/* clang-format off */
/*
* _codecs_jp.c: Codecs collection for Japanese encodings
*
@ -7,11 +8,11 @@
#define USING_BINARY_PAIR_SEARCH
#define EMPBASE 0x20000
#include "cjkcodecs.h"
#include "mappings_jp.h"
#include "mappings_jisx0213_pair.h"
#include "alg_jisx0201.h"
#include "emu_jisx0213_2000.h"
#include "third_party/python/Modules/cjkcodecs/cjkcodecs.h"
#include "third_party/python/Modules/cjkcodecs/mappings_jp.inc"
#include "third_party/python/Modules/cjkcodecs/mappings_jisx0213_pair.inc"
#include "third_party/python/Modules/cjkcodecs/alg_jisx0201.inc"
#include "third_party/python/Modules/cjkcodecs/emu_jisx0213_2000.inc"
/*
* CP932 codec

View file

@ -1,11 +1,12 @@
/* clang-format off */
/*
* _codecs_kr.c: Codecs collection for Korean encodings
*
* Written by Hye-Shik Chang <perky@FreeBSD.org>
*/
#include "cjkcodecs.h"
#include "mappings_kr.h"
#include "third_party/python/Modules/cjkcodecs/cjkcodecs.h"
#include "third_party/python/Modules/cjkcodecs/mappings_kr.inc"
/*
* EUC-KR codec

View file

@ -1,11 +1,12 @@
/* clang-format off */
/*
* _codecs_tw.c: Codecs collection for Taiwan's encodings
*
* Written by Hye-Shik Chang <perky@FreeBSD.org>
*/
#include "cjkcodecs.h"
#include "mappings_tw.h"
#include "third_party/python/Modules/cjkcodecs/cjkcodecs.h"
#include "third_party/python/Modules/cjkcodecs/mappings_tw.inc"
/*
* BIG5 codec

View file

@ -1,3 +1,5 @@
/* clang-format off */
#define JISX0201_R_ENCODE(c, assi) \
if ((c) < 0x80 && (c) != 0x5c && (c) != 0x7e) { \
(assi) = (c); \

View file

@ -1,15 +1,16 @@
#ifndef _CJKCODECS_H_
#define _CJKCODECS_H_
/* clang-format off */
/*
* cjkcodecs.h: common header for cjkcodecs
*
* Written by Hye-Shik Chang <perky@FreeBSD.org>
*/
#ifndef _CJKCODECS_H_
#define _CJKCODECS_H_
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "multibytecodec.h"
#include "third_party/python/Include/Python.h"
#include "third_party/python/Modules/cjkcodecs/multibytecodec.h"
/* a unicode "undefined" code point */

View file

@ -1,3 +1,5 @@
/* clang-format off */
/* These routines may be quite inefficient, but it's used only to emulate old
* standards. */

View file

@ -1,3 +1,5 @@
/* clang-format off */
static const ucs2_t __gb2312_decmap[7482] = {
12288,12289,12290,12539,713,711,168,12291,12293,8213,65374,8214,8230,8216,
8217,8220,8221,12308,12309,12296,12297,12298,12299,12300,12301,12302,12303,

View file

@ -1,3 +1,5 @@
/* clang-format off */
static const ucs2_t __big5hkscs_decmap[6219] = {
17392,19506,17923,17830,17784,29287,19831,17843,31921,19682,31941,15253,18230,
18244,19527,19520,17087,13847,29522,28299,28882,19543,41809,18255,17882,19589,

View file

@ -1,3 +1,4 @@
/* clang-format off */
#define JISX0213_ENCPAIRS 46
#ifdef EXTERN_JISX0213_PAIR
static const struct widedbcs_index *jisx0213_pair_decmap;

View file

@ -1,3 +1,4 @@
/* clang-format off */
static const ucs2_t __jisx0208_decmap[6956] = {
12288,12289,12290,65292,65294,12539,65306,65307,65311,65281,12443,12444,180,
65344,168,65342,65507,65343,12541,12542,12445,12446,12291,20189,12293,12294,

View file

@ -1,3 +1,4 @@
/* clang-format off */
static const ucs2_t __ksx1001_decmap[8264] = {
12288,12289,12290,183,8229,8230,168,12291,173,8213,8741,65340,8764,8216,8217,
8220,8221,12308,12309,12296,12297,12298,12299,12300,12301,12302,12303,12304,

View file

@ -1,3 +1,4 @@
/* clang-format off */
static const ucs2_t __big5_decmap[16702] = {
12288,65292,12289,12290,65294,8226,65307,65306,65311,65281,65072,8230,8229,
65104,65380,65106,183,65108,65109,65110,65111,65372,8211,65073,8212,65075,

View file

@ -1,3 +1,4 @@
/* clang-format off */
/*
* multibytecodec.c: Common Multibyte Codec Implementation
*
@ -5,10 +6,10 @@
*/
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
#include "multibytecodec.h"
#include "clinic/multibytecodec.c.h"
#include "third_party/python/Include/Python.h"
#include "third_party/python/Include/structmember.h"
#include "third_party/python/Modules/cjkcodecs/multibytecodec.h"
#include "third_party/python/Modules/cjkcodecs/clinic/multibytecodec.inc"
/*[clinic input]
module _multibytecodec

View file

@ -1,14 +1,15 @@
/*
* multibytecodec.h: Common Multibyte Codec Implementation
*
* Written by Hye-Shik Chang <perky@FreeBSD.org>
*/
#ifndef _PYTHON_MULTIBYTECODEC_H_
#define _PYTHON_MULTIBYTECODEC_H_
#ifdef __cplusplus
extern "C" {
#endif
/* clang-format off */
/*
* multibytecodec.h: Common Multibyte Codec Implementation
*
* Written by Hye-Shik Chang <perky@FreeBSD.org>
*/
#ifdef uint16_t
typedef uint16_t ucs2_t, DBCHAR;