[py-svn] r17701 - py/dist/py/c-extension/greenlet

jan at codespeak.net jan at codespeak.net
Tue Sep 20 18:17:33 CEST 2005


Author: jan
Date: Tue Sep 20 18:17:32 2005
New Revision: 17701

Modified:
   py/dist/py/c-extension/greenlet/greenlet.c
Log:
Working around compiler optimizations, by forcing calls that it cannot inline.
Necessary for MacOSX, gcc 3.3.


Modified: py/dist/py/c-extension/greenlet/greenlet.c
==============================================================================
--- py/dist/py/c-extension/greenlet/greenlet.c	(original)
+++ py/dist/py/c-extension/greenlet/greenlet.c	Tue Sep 20 18:17:32 2005
@@ -255,6 +255,12 @@
 #endif
 
 
+/* This is a trick to prevent the compiler from inlining or
+   removing the frames */
+int (*_PyGreen_slp_switch) (void);
+int (*_PyGreen_switchstack) (void);
+void (*_PyGreen_initialstub) (void*);
+
 static int g_switchstack(void)
 {
 	/* perform a stack switch according to some global variables
@@ -271,7 +277,7 @@
 		ts_current->top_frame = tstate->frame;
 	}
 	ts_origin = ts_current;
-	err = slp_switch();
+	err = _PyGreen_slp_switch();
 	if (err < 0) {   /* error */
 		Py_XDECREF(ts_passaround);
 		ts_passaround = NULL;
@@ -288,11 +294,6 @@
 	return err;
 }
 
-/* This is a trick to prevent the compiler from inlining or
-   removing the frames */
-int (*_PyGreen_switchstack) (void);
-void (*_PyGreen_initialstub) (void*);
-
 static PyObject* g_switch(PyGreenlet* target, PyObject* args)
 {
 	/* _consumes_ a reference to the args tuple,
@@ -781,6 +782,7 @@
 	PyObject* m;
 	char** p;
 	_PyGreen_switchstack = g_switchstack;
+	_PyGreen_slp_switch = slp_switch;
 	_PyGreen_initialstub = g_initialstub;
 	m = Py_InitModule("greenlet", GreenMethods);
 



More information about the pytest-commit mailing list