mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 05:42:29 +00:00
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:
parent
ee7e296339
commit
d26d7ae0e4
1028 changed files with 6576 additions and 172777 deletions
21
third_party/python/Modules/_io/_iomodule.c
vendored
21
third_party/python/Modules/_io/_iomodule.c
vendored
|
@ -1,3 +1,4 @@
|
|||
/* clang-format off */
|
||||
/*
|
||||
An implementation of the new I/O lib as defined by PEP 3116 - "New I/O"
|
||||
|
||||
|
@ -8,21 +9,9 @@
|
|||
*/
|
||||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include "Python.h"
|
||||
#include "structmember.h"
|
||||
#include "_iomodule.h"
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif /* HAVE_SYS_TYPES_H */
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif /* HAVE_SYS_STAT_H */
|
||||
|
||||
#ifdef MS_WINDOWS
|
||||
#include <consoleapi.h>
|
||||
#endif
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Modules/_io/_iomodule.h"
|
||||
|
||||
/* Various interned strings */
|
||||
|
||||
|
@ -638,7 +627,7 @@ iomodule_free(PyObject *mod) {
|
|||
* Module definition
|
||||
*/
|
||||
|
||||
#include "clinic/_iomodule.c.h"
|
||||
#include "third_party/python/Modules/_io/clinic/_iomodule.inc"
|
||||
|
||||
static PyMethodDef module_methods[] = {
|
||||
_IO_OPEN_METHODDEF
|
||||
|
|
1
third_party/python/Modules/_io/_iomodule.h
vendored
1
third_party/python/Modules/_io/_iomodule.h
vendored
|
@ -1,3 +1,4 @@
|
|||
/* clang-format off */
|
||||
/*
|
||||
* Declarations shared between the different parts of the io module
|
||||
*/
|
||||
|
|
11
third_party/python/Modules/_io/bufferedio.c
vendored
11
third_party/python/Modules/_io/bufferedio.c
vendored
|
@ -1,3 +1,4 @@
|
|||
/* clang-format off */
|
||||
/*
|
||||
An implementation of Buffered I/O as defined by PEP 3116 - "New I/O"
|
||||
|
||||
|
@ -8,10 +9,10 @@
|
|||
*/
|
||||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include "Python.h"
|
||||
#include "structmember.h"
|
||||
#include "pythread.h"
|
||||
#include "_iomodule.h"
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/pythread.h"
|
||||
#include "third_party/python/Modules/_io/_iomodule.h"
|
||||
|
||||
/*[clinic input]
|
||||
module _io
|
||||
|
@ -2342,7 +2343,7 @@ _io_BufferedRandom___init___impl(buffered *self, PyObject *raw,
|
|||
return 0;
|
||||
}
|
||||
|
||||
#include "clinic/bufferedio.c.h"
|
||||
#include "third_party/python/Modules/_io/clinic/bufferedio.inc"
|
||||
|
||||
|
||||
static PyMethodDef bufferediobase_methods[] = {
|
||||
|
|
9
third_party/python/Modules/_io/bytesio.c
vendored
9
third_party/python/Modules/_io/bytesio.c
vendored
|
@ -1,6 +1,7 @@
|
|||
#include "Python.h"
|
||||
#include "structmember.h" /* for offsetof() */
|
||||
#include "_iomodule.h"
|
||||
/* clang-format off */
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Modules/_io/_iomodule.h"
|
||||
|
||||
/*[clinic input]
|
||||
module _io
|
||||
|
@ -1009,7 +1010,7 @@ bytesio_clear(bytesio *self)
|
|||
}
|
||||
|
||||
|
||||
#include "clinic/bytesio.c.h"
|
||||
#include "third_party/python/Modules/_io/clinic/bytesio.inc"
|
||||
|
||||
static PyGetSetDef bytesio_getsetlist[] = {
|
||||
{"closed", (getter)bytesio_get_closed, NULL,
|
||||
|
|
22
third_party/python/Modules/_io/fileio.c
vendored
22
third_party/python/Modules/_io/fileio.c
vendored
|
@ -1,22 +1,10 @@
|
|||
/* clang-format off */
|
||||
/* Author: Daniel Stutzbach */
|
||||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include "Python.h"
|
||||
#include "structmember.h"
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#ifdef HAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <stddef.h> /* For offsetof */
|
||||
#include "_iomodule.h"
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Modules/_io/_iomodule.h"
|
||||
|
||||
/*
|
||||
* Known likely problems:
|
||||
|
@ -1131,7 +1119,7 @@ fileio_getstate(fileio *self)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#include "clinic/fileio.c.h"
|
||||
#include "third_party/python/Modules/_io/clinic/fileio.inc"
|
||||
|
||||
static PyMethodDef fileio_methods[] = {
|
||||
_IO_FILEIO_READ_METHODDEF
|
||||
|
|
9
third_party/python/Modules/_io/iobase.c
vendored
9
third_party/python/Modules/_io/iobase.c
vendored
|
@ -1,3 +1,4 @@
|
|||
/* clang-format off */
|
||||
/*
|
||||
An implementation of the I/O abstract base classes hierarchy
|
||||
as defined by PEP 3116 - "New I/O"
|
||||
|
@ -9,9 +10,9 @@
|
|||
|
||||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include "Python.h"
|
||||
#include "structmember.h"
|
||||
#include "_iomodule.h"
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Modules/_io/_iomodule.h"
|
||||
|
||||
/*[clinic input]
|
||||
module _io
|
||||
|
@ -758,7 +759,7 @@ _io__IOBase_writelines(PyObject *self, PyObject *lines)
|
|||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
#include "clinic/iobase.c.h"
|
||||
#include "third_party/python/Modules/_io/clinic/iobase.inc"
|
||||
|
||||
static PyMethodDef iobase_methods[] = {
|
||||
{"seek", iobase_seek, METH_VARARGS, iobase_seek_doc},
|
||||
|
|
11
third_party/python/Modules/_io/stringio.c
vendored
11
third_party/python/Modules/_io/stringio.c
vendored
|
@ -1,8 +1,9 @@
|
|||
/* clang-format off */
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include "Python.h"
|
||||
#include "structmember.h"
|
||||
#include "accu.h"
|
||||
#include "_iomodule.h"
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/accu.h"
|
||||
#include "third_party/python/Modules/_io/_iomodule.h"
|
||||
|
||||
/* Implementation note: the buffer is always at least one character longer
|
||||
than the enclosed string, for proper functioning of _PyIO_find_line_ending.
|
||||
|
@ -1010,7 +1011,7 @@ stringio_newlines(stringio *self, void *context)
|
|||
return PyObject_GetAttr(self->decoder, _PyIO_str_newlines);
|
||||
}
|
||||
|
||||
#include "clinic/stringio.c.h"
|
||||
#include "third_party/python/Modules/_io/clinic/stringio.inc"
|
||||
|
||||
static struct PyMethodDef stringio_methods[] = {
|
||||
_IO_STRINGIO_CLOSE_METHODDEF
|
||||
|
|
9
third_party/python/Modules/_io/textio.c
vendored
9
third_party/python/Modules/_io/textio.c
vendored
|
@ -1,3 +1,4 @@
|
|||
/* clang-format off */
|
||||
/*
|
||||
An implementation of Text I/O as defined by PEP 3116 - "New I/O"
|
||||
|
||||
|
@ -7,9 +8,9 @@
|
|||
*/
|
||||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include "Python.h"
|
||||
#include "structmember.h"
|
||||
#include "_iomodule.h"
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Modules/_io/_iomodule.h"
|
||||
|
||||
/*[clinic input]
|
||||
module _io
|
||||
|
@ -2829,7 +2830,7 @@ textiowrapper_chunk_size_set(textio *self, PyObject *arg, void *context)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#include "clinic/textio.c.h"
|
||||
#include "third_party/python/Modules/_io/clinic/textio.inc"
|
||||
|
||||
static PyMethodDef incrementalnewlinedecoder_methods[] = {
|
||||
_IO_INCREMENTALNEWLINEDECODER_DECODE_METHODDEF
|
||||
|
|
19
third_party/python/Modules/_io/winconsoleio.c
vendored
19
third_party/python/Modules/_io/winconsoleio.c
vendored
|
@ -1,3 +1,4 @@
|
|||
/* clang-format off */
|
||||
/*
|
||||
An implementation of Windows console I/O
|
||||
|
||||
|
@ -8,23 +9,7 @@
|
|||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include "Python.h"
|
||||
|
||||
#ifdef MS_WINDOWS
|
||||
|
||||
#include "structmember.h"
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#include <stddef.h> /* For offsetof */
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "_iomodule.h"
|
||||
#include "third_party/python/Modules/_io/_iomodule.h"
|
||||
|
||||
/* BUFSIZ determines how many characters can be typed at the console
|
||||
before it starts blocking. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue