mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +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
12
third_party/python/Parser/acceler.c
vendored
12
third_party/python/Parser/acceler.c
vendored
|
@ -1,4 +1,4 @@
|
|||
|
||||
/* clang-format off */
|
||||
/* Parser accelerator module */
|
||||
|
||||
/* The parser as originally conceived had disappointing performance.
|
||||
|
@ -10,11 +10,11 @@
|
|||
are not part of the static data structure written on graminit.[ch]
|
||||
by the parser generator. */
|
||||
|
||||
#include "pgenheaders.h"
|
||||
#include "grammar.h"
|
||||
#include "node.h"
|
||||
#include "token.h"
|
||||
#include "parser.h"
|
||||
#include "third_party/python/Include/pgenheaders.h"
|
||||
#include "third_party/python/Include/grammar.h"
|
||||
#include "third_party/python/Include/node.h"
|
||||
#include "third_party/python/Include/token.h"
|
||||
#include "third_party/python/Parser/parser.h"
|
||||
|
||||
/* Forward references */
|
||||
static void fixdfa(grammar *, dfa *);
|
||||
|
|
5
third_party/python/Parser/bitset.c
vendored
5
third_party/python/Parser/bitset.c
vendored
|
@ -1,8 +1,9 @@
|
|||
/* clang-format off */
|
||||
|
||||
/* Bitset primitives used by the parser generator */
|
||||
|
||||
#include "pgenheaders.h"
|
||||
#include "bitset.h"
|
||||
#include "third_party/python/Include/pgenheaders.h"
|
||||
#include "third_party/python/Include/bitset.h"
|
||||
|
||||
bitset
|
||||
newbitset(int nbits)
|
||||
|
|
7
third_party/python/Parser/firstsets.c
vendored
7
third_party/python/Parser/firstsets.c
vendored
|
@ -1,9 +1,10 @@
|
|||
/* clang-format off */
|
||||
|
||||
/* Computation of FIRST stets */
|
||||
|
||||
#include "pgenheaders.h"
|
||||
#include "grammar.h"
|
||||
#include "token.h"
|
||||
#include "third_party/python/Include/pgenheaders.h"
|
||||
#include "third_party/python/Include/grammar.h"
|
||||
#include "third_party/python/Include/token.h"
|
||||
|
||||
extern int Py_DebugFlag;
|
||||
|
||||
|
|
12
third_party/python/Parser/grammar.c
vendored
12
third_party/python/Parser/grammar.c
vendored
|
@ -1,13 +1,11 @@
|
|||
/* clang-format off */
|
||||
|
||||
/* Grammar implementation */
|
||||
|
||||
#include "Python.h"
|
||||
#include "pgenheaders.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "token.h"
|
||||
#include "grammar.h"
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/pgenheaders.h"
|
||||
#include "third_party/python/Include/token.h"
|
||||
#include "third_party/python/Include/grammar.h"
|
||||
|
||||
extern int Py_DebugFlag;
|
||||
|
||||
|
|
9
third_party/python/Parser/grammar1.c
vendored
9
third_party/python/Parser/grammar1.c
vendored
|
@ -1,10 +1,11 @@
|
|||
/* clang-format off */
|
||||
|
||||
/* Grammar subroutines needed by parser */
|
||||
|
||||
#include "Python.h"
|
||||
#include "pgenheaders.h"
|
||||
#include "grammar.h"
|
||||
#include "token.h"
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/pgenheaders.h"
|
||||
#include "third_party/python/Include/grammar.h"
|
||||
#include "third_party/python/Include/token.h"
|
||||
|
||||
/* Return the DFA for the given type */
|
||||
|
||||
|
|
7
third_party/python/Parser/listnode.c
vendored
7
third_party/python/Parser/listnode.c
vendored
|
@ -1,9 +1,10 @@
|
|||
/* clang-format off */
|
||||
|
||||
/* List a node on a file */
|
||||
|
||||
#include "pgenheaders.h"
|
||||
#include "token.h"
|
||||
#include "node.h"
|
||||
#include "third_party/python/Include/pgenheaders.h"
|
||||
#include "third_party/python/Include/token.h"
|
||||
#include "third_party/python/Include/node.h"
|
||||
|
||||
/* Forward */
|
||||
static void list1node(FILE *, node *);
|
||||
|
|
10
third_party/python/Parser/metagrammar.c
vendored
10
third_party/python/Parser/metagrammar.c
vendored
|
@ -1,8 +1,10 @@
|
|||
/* clang-format off */
|
||||
|
||||
#include "third_party/python/Include/pgenheaders.h"
|
||||
#include "third_party/python/Include/metagrammar.h"
|
||||
#include "third_party/python/Include/grammar.h"
|
||||
#include "third_party/python/Include/pgen.h"
|
||||
|
||||
#include "pgenheaders.h"
|
||||
#include "metagrammar.h"
|
||||
#include "grammar.h"
|
||||
#include "pgen.h"
|
||||
static arc arcs_0_0[3] = {
|
||||
{2, 0},
|
||||
{3, 0},
|
||||
|
|
10
third_party/python/Parser/myreadline.c
vendored
10
third_party/python/Parser/myreadline.c
vendored
|
@ -1,3 +1,4 @@
|
|||
/* clang-format off */
|
||||
|
||||
/* Readline interface for tokenizer.c and [raw_]input() in bltinmodule.c.
|
||||
By default, or when stdin is not a tty device, we have a super
|
||||
|
@ -9,17 +10,12 @@
|
|||
- a malloc'ed string ending in \n normally
|
||||
*/
|
||||
|
||||
#include "Python.h"
|
||||
#ifdef MS_WINDOWS
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include "windows.h"
|
||||
#endif /* MS_WINDOWS */
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
|
||||
PyThreadState* _PyOS_ReadlineTState;
|
||||
|
||||
#ifdef WITH_THREAD
|
||||
#include "pythread.h"
|
||||
#include "third_party/python/Include/pythread.h"
|
||||
static PyThread_type_lock _PyOS_ReadlineLock = NULL;
|
||||
#endif
|
||||
|
||||
|
|
9
third_party/python/Parser/node.c
vendored
9
third_party/python/Parser/node.c
vendored
|
@ -1,10 +1,11 @@
|
|||
/* Parse tree node implementation */
|
||||
/* clang-format off */
|
||||
|
||||
#include "Python.h"
|
||||
#include "node.h"
|
||||
/* Parse tree node implementation */
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/node.h"
|
||||
#include "libc/nexgen32e/bsr.h"
|
||||
#include "errcode.h"
|
||||
#include "third_party/python/Include/errcode.h"
|
||||
|
||||
node *
|
||||
PyNode_New(int type)
|
||||
|
|
15
third_party/python/Parser/parser.c
vendored
15
third_party/python/Parser/parser.c
vendored
|
@ -1,3 +1,4 @@
|
|||
/* clang-format off */
|
||||
|
||||
/* Parser implementation */
|
||||
|
||||
|
@ -5,13 +6,13 @@
|
|||
|
||||
/* XXX To do: error recovery */
|
||||
|
||||
#include "Python.h"
|
||||
#include "pgenheaders.h"
|
||||
#include "token.h"
|
||||
#include "grammar.h"
|
||||
#include "node.h"
|
||||
#include "parser.h"
|
||||
#include "errcode.h"
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/pgenheaders.h"
|
||||
#include "third_party/python/Include/token.h"
|
||||
#include "third_party/python/Include/grammar.h"
|
||||
#include "third_party/python/Include/node.h"
|
||||
#include "third_party/python/Parser/parser.h"
|
||||
#include "third_party/python/Include/errcode.h"
|
||||
|
||||
|
||||
#ifdef Py_DEBUG
|
||||
|
|
17
third_party/python/Parser/parsetok.c
vendored
17
third_party/python/Parser/parsetok.c
vendored
|
@ -1,14 +1,15 @@
|
|||
/* clang-format off */
|
||||
|
||||
/* Parser-tokenizer link implementation */
|
||||
|
||||
#include "pgenheaders.h"
|
||||
#include "tokenizer.h"
|
||||
#include "node.h"
|
||||
#include "grammar.h"
|
||||
#include "parser.h"
|
||||
#include "parsetok.h"
|
||||
#include "errcode.h"
|
||||
#include "graminit.h"
|
||||
#include "third_party/python/Include/pgenheaders.h"
|
||||
#include "third_party/python/Parser/tokenizer.h"
|
||||
#include "third_party/python/Include/node.h"
|
||||
#include "third_party/python/Include/grammar.h"
|
||||
#include "third_party/python/Parser/parser.h"
|
||||
#include "third_party/python/Include/parsetok.h"
|
||||
#include "third_party/python/Include/errcode.h"
|
||||
#include "third_party/python/Include/graminit.h"
|
||||
|
||||
|
||||
/* Forward */
|
||||
|
|
2
third_party/python/Parser/parsetok_pgen.c
vendored
2
third_party/python/Parser/parsetok_pgen.c
vendored
|
@ -1,2 +1,2 @@
|
|||
#define PGEN
|
||||
#include "parsetok.c"
|
||||
#include "third_party/python/Parser/parsetok.c"
|
||||
|
|
16
third_party/python/Parser/pgen.c
vendored
16
third_party/python/Parser/pgen.c
vendored
|
@ -1,14 +1,16 @@
|
|||
/* clang-format off */
|
||||
|
||||
/* Parser generator */
|
||||
|
||||
/* For a description, see the comments at end of this file */
|
||||
|
||||
#include "Python.h"
|
||||
#include "pgenheaders.h"
|
||||
#include "token.h"
|
||||
#include "node.h"
|
||||
#include "grammar.h"
|
||||
#include "metagrammar.h"
|
||||
#include "pgen.h"
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/pgenheaders.h"
|
||||
#include "third_party/python/Include/token.h"
|
||||
#include "third_party/python/Include/node.h"
|
||||
#include "third_party/python/Include/grammar.h"
|
||||
#include "third_party/python/Include/metagrammar.h"
|
||||
#include "third_party/python/Include/pgen.h"
|
||||
|
||||
extern int Py_DebugFlag;
|
||||
extern int Py_IgnoreEnvironmentFlag; /* needed by Py_GETENV */
|
||||
|
|
13
third_party/python/Parser/pgenmain.c
vendored
13
third_party/python/Parser/pgenmain.c
vendored
|
@ -1,3 +1,4 @@
|
|||
/* clang-format off */
|
||||
|
||||
/* Parser generator main program */
|
||||
|
||||
|
@ -15,12 +16,12 @@
|
|||
|
||||
#define PGEN
|
||||
|
||||
#include "Python.h"
|
||||
#include "pgenheaders.h"
|
||||
#include "grammar.h"
|
||||
#include "node.h"
|
||||
#include "parsetok.h"
|
||||
#include "pgen.h"
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/pgenheaders.h"
|
||||
#include "third_party/python/Include/grammar.h"
|
||||
#include "third_party/python/Include/node.h"
|
||||
#include "third_party/python/Include/parsetok.h"
|
||||
#include "third_party/python/Include/pgen.h"
|
||||
|
||||
int Py_DebugFlag;
|
||||
int Py_VerboseFlag;
|
||||
|
|
5
third_party/python/Parser/printgrammar.c
vendored
5
third_party/python/Parser/printgrammar.c
vendored
|
@ -1,10 +1,11 @@
|
|||
/* clang-format off */
|
||||
|
||||
/* Print a bunch of C initializers that represent a grammar */
|
||||
|
||||
#define PGEN
|
||||
|
||||
#include "pgenheaders.h"
|
||||
#include "grammar.h"
|
||||
#include "third_party/python/Include/pgenheaders.h"
|
||||
#include "third_party/python/Include/grammar.h"
|
||||
|
||||
/* Forward */
|
||||
static void printarcs(int, dfa *, FILE *);
|
||||
|
|
22
third_party/python/Parser/tokenizer.c
vendored
22
third_party/python/Parser/tokenizer.c
vendored
|
@ -1,21 +1,19 @@
|
|||
/* clang-format off */
|
||||
|
||||
/* Tokenizer implementation */
|
||||
|
||||
#include "Python.h"
|
||||
#include "pgenheaders.h"
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/pgenheaders.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "tokenizer.h"
|
||||
#include "errcode.h"
|
||||
#include "third_party/python/Parser/tokenizer.h"
|
||||
#include "third_party/python/Include/errcode.h"
|
||||
|
||||
#ifndef PGEN
|
||||
#include "unicodeobject.h"
|
||||
#include "bytesobject.h"
|
||||
#include "fileobject.h"
|
||||
#include "codecs.h"
|
||||
#include "abstract.h"
|
||||
#include "third_party/python/Include/unicodeobject.h"
|
||||
#include "third_party/python/Include/bytesobject.h"
|
||||
#include "third_party/python/Include/fileobject.h"
|
||||
#include "third_party/python/Include/codecs.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#endif /* PGEN */
|
||||
|
||||
#define is_potential_identifier_start(c) (\
|
||||
|
|
9
third_party/python/Parser/tokenizer.h
vendored
9
third_party/python/Parser/tokenizer.h
vendored
|
@ -1,14 +1,11 @@
|
|||
#ifndef Py_TOKENIZER_H
|
||||
#define Py_TOKENIZER_H
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/token.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "object.h"
|
||||
|
||||
/* Tokenizer interface */
|
||||
|
||||
#include "token.h" /* For token types */
|
||||
/* clang-format off */
|
||||
|
||||
#define MAXINDENT 100 /* Max indentation level */
|
||||
|
||||
|
|
3
third_party/python/Parser/tokenizer_pgen.c
vendored
3
third_party/python/Parser/tokenizer_pgen.c
vendored
|
@ -1,2 +1,3 @@
|
|||
/* clang-format off */
|
||||
#define PGEN
|
||||
#include "tokenizer.c"
|
||||
#include "third_party/python/Parser/tokenizer.c"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue