Commits

Trent Nelson committed 9c53848 Draft

Tweak for release build.

Comments (0)

Files changed (6)

Include/pyparallel.h

 #define Py_PXCTX    (Py_MainThreadId != _Py_get_current_thread_id())
 #define Py_PX(ob)   ((((PyObject*)(ob))->px))
 
-#define Py_ISPX(ob) (                                          \
+#define _Py_ISPX(ob) (                                         \
     Py_PXCTX || (                                              \
         ob != NULL && (                                        \
             ((((PyObject*)(ob))->is_px) == _Py_IS_PARALLEL) && \
     )                                                          \
 )
 
-#define Py_ISPY(ob) (                                          \
+#define Py_ISPX(ob) (                    \
+    Py_PXCTX || (ob != NULL && (         \
+        Py_PXFLAGS(ob) & Py_PXFLAGS_ISPX \
+    ))                                   \
+)
+
+#define Py_ISPY(ob) (                    \
+    Py_PXCTX || (ob != NULL && !(        \
+        Py_PXFLAGS(ob) & Py_PXFLAGS_ISPX \
+    ))                                   \
+)
+
+#define _Py_ISPY(ob) (                                         \
     ob != NULL && (                                            \
         ((((PyObject*)(ob))->is_px) == _Py_NOT_PARALLEL) &&    \
         ((((PyObject*)(ob))->px)    == _Py_NOT_PARALLEL)       \
 #define Px_GUARD_OBJ(o)
 #define Py_GUARD_MEM(p)
 #define Px_GUARD_MEM(p)
+#define PyPx_GUARD_MEM(m)
+#define PyPx_GUARD_OBJ(o)
 
 #endif /* !Py_DEBUG */
 
 #define Px_RETURN_NULL_OP(op)
 #define Py_PXCTX 0
 #define Py_CTX 0
+#define PyPx_GUARD_OBJECT(o)
+#define PyPx_GUARD_MEM(o)
 #endif
 
 #ifdef __cplusplus

Objects/funcobject.c

     a = NULL;
     f = NULL;
     na = PyTuple_Size(arg);
+
+#if defined(Py_DEBUG)
     if (na == -1) {
         assert(PyErr_Occurred());
         return NULL;
                     printf("ERROR! !is_px && !is_py\n");
         }
     }
+#endif
 
     result = PyEval_EvalCodeEx(
         PyFunction_GET_CODE(func),
 void
 _Py_Dealloc(PyObject *op)
 {
-    Px_RETURN(_Px_Dealloc(op))
+    Px_RETURN_VOID_OP(op, _Px_Dealloc(op))
     Py_GUARD_OBJ(op);
     _Py_INC_TPFREES(op) _Py_COUNT_ALLOCS_COMMA
     (*Py_TYPE(op)->tp_dealloc)(op);
 /* #define WITH_READLINE 1 */
 
 /* Use Python's own small-block memory-allocator. */
+#ifdef Py_DEBUG
 #define WITH_PYMALLOC 1
+#else
+#undef WITH_PYMALLOC
+#endif
 
 /* Define if you have clock.  */
 /* #define HAVE_CLOCK */

Python/pyparallel.c

     return (PyVarObject *)init_object(c, v, NULL, nitems);
 }
 
+#ifdef Py_DEBUG
 void *
 _PxObject_Realloc(void *p, size_t nbytes)
 {
             PyObject_Free(p);
     }
 }
+#else /* Py_DEBUG */
+void *
+_PxObject_Realloc(void *p, size_t nbytes)
+{
+    Px_GUARD
+    return _PyHeap_Realloc(ctx, p, nbytes);
+}
+
+void
+_PxObject_Free(void *p)
+{
+    Px_GUARD
+    if (!p)
+        return;
+    _PyHeap_Free(ctx, p);
+}
+#endif
 
 /*
 __inline

Python/pyparallel_private.h

 
 #define Py_ASPX(ob) ((PxObject *)(((PyObject*)(ob))->px))
 
+#define Py_PXOBJ(ob) (                   \
+    ob != NULL && (                      \
+        Py_PXFLAGS(ob) & Py_PXFLAGS_ISPX \
+    )                                    \
+)
+
 #ifdef MS_WINDOWS
 #define PyEvent     HANDLE
 #define PyEventType HANDLE
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.