Fix Pyston speedups (#281)

We remove (i.e. hide behind a debug ifdef) the recursion checking methods,
and the memory hooks and memory allocator methods. ASAN mode has no
PYMALLOC, so we need a macro. Fix build break with des.c stack allocation.
This commit is contained in:
Gautham 2021-10-02 13:58:51 +05:30 committed by GitHub
parent 2fe8571010
commit 57f0eed382
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 260 additions and 63 deletions

View file

@ -64,13 +64,15 @@ PyObject* _PyTraceMalloc_GetTraceback(
_PyTraceMalloc_domain_t domain,
uintptr_t ptr);
#ifdef USE_TRACEMALLOC
int _PyMem_IsFreed(void *ptr, size_t size);
#if !IsModeDbg()
#define _PyTraceMalloc_Track(domain, ptr, size) (-2)
#define _PyTraceMalloc_Untrack(domain, ptr) (-2)
#define _PyTraceMalloc_GetTraceback(domain, ptr) (&_Py_NoneStruct)
#define _PyMem_IsFreed(ptr, size) (0)
#endif
int _PyMem_IsFreed(void *ptr, size_t size);
#endif /* !defined(Py_LIMITED_API) */
@ -172,6 +174,7 @@ char * _PyMem_Strdup(const char *str);
#define PyMem_Del PyMem_Free
#define PyMem_DEL PyMem_FREE
#if IsModeDbg()
#ifndef Py_LIMITED_API
typedef enum {
/* PyMem_RawMalloc(), PyMem_RawRealloc() and PyMem_RawFree() */
@ -237,6 +240,7 @@ void PyMem_SetAllocator(PyMemAllocatorDomain domain,
The function does nothing if Python is not compiled is debug mode. */
void PyMem_SetupDebugHooks(void);
#endif
#endif
COSMOPOLITAN_C_END_
#endif /* !Py_PYMEM_H */