mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Add speedups from pyston (#264)
This should make Python go 30% faster. It does that by trading away some debuggability, like _tracemalloc. It can be re-enabled using `make MODE=dbg`.
This commit is contained in:
parent
31dd714081
commit
27f7ffd4fd
15 changed files with 175 additions and 12 deletions
4
third_party/python/Include/abstract.h
vendored
4
third_party/python/Include/abstract.h
vendored
|
@ -36,8 +36,12 @@ PyObject *_PyObject_FastCallKeywords(PyObject *func, PyObject **args,
|
|||
PyObject *_PyObject_Call_Prepend(PyObject *func, PyObject *obj, PyObject *args,
|
||||
PyObject *kwargs);
|
||||
|
||||
#ifdef USE_CHECKFUNCRESULT
|
||||
PyObject *_Py_CheckFunctionResult(PyObject *func, PyObject *result,
|
||||
const char *where);
|
||||
#else
|
||||
#define _Py_CheckFunctionResult(func, result, where) (result)
|
||||
#endif
|
||||
#endif /* Py_LIMITED_API */
|
||||
|
||||
PyObject *PyObject_CallObject(PyObject *callable_object, PyObject *args);
|
||||
|
|
9
third_party/python/Include/cosmo.h
vendored
Normal file
9
third_party/python/Include/cosmo.h
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
#ifndef Py_COSMO_H
|
||||
#define Py_COSMO_H
|
||||
#include "third_party/python/Include/object.h"
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
PyMODINIT_FUNC PyInit_cosmo(void);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !Py_IMPORT_H */
|
5
third_party/python/Include/pyerrors.h
vendored
5
third_party/python/Include/pyerrors.h
vendored
|
@ -318,8 +318,11 @@ void PyErr_BadInternalCall(void);
|
|||
void _PyErr_BadInternalCall(const char *filename, int lineno);
|
||||
/* Mask the old API with a call to the new API for code compiled under
|
||||
Python 2.0: */
|
||||
#ifdef USE_BADINTERNALCALL
|
||||
#define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__)
|
||||
|
||||
#else
|
||||
#define PyErr_BadInternalCall()
|
||||
#endif
|
||||
/* Function to create a new exception */
|
||||
PyObject * PyErr_NewException(
|
||||
const char *name, PyObject *base, PyObject *dict);
|
||||
|
|
5
third_party/python/Include/pymem.h
vendored
5
third_party/python/Include/pymem.h
vendored
|
@ -63,6 +63,11 @@ int _PyTraceMalloc_Untrack(
|
|||
PyObject* _PyTraceMalloc_GetTraceback(
|
||||
_PyTraceMalloc_domain_t domain,
|
||||
uintptr_t ptr);
|
||||
#ifndef MODE_DBG
|
||||
#define _PyTraceMalloc_Track(domain, ptr, size) (-2)
|
||||
#define _PyTraceMalloc_Untrack(domain, ptr) (-2)
|
||||
#define _PyTraceMalloc_GetTraceback(domain, ptr) (&_Py_NoneStruct)
|
||||
#endif
|
||||
|
||||
int _PyMem_IsFreed(void *ptr, size_t size);
|
||||
#endif /* !defined(Py_LIMITED_API) */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue