[Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/pickling prickelpit.c, 1.79, 1.80 safe_pickle.c, 1.4, 1.5

Christian Tismer tismer at centera.de
Wed May 12 17:33:58 CEST 2004


Update of /home/cvs/slpdev/src/2.3/dev/Stackless/pickling
In directory centera.de:/tmp/cvs-serv16151/dev/Stackless/pickling

Modified Files:
	prickelpit.c safe_pickle.c 
Log Message:
This is a major update.
Channels got a complete overhaul. They have garbage collection,
they are soft-switched, and they are simplified very much.
Exception handling has changed completely and is much simpler now.
Instead of taking care of exceptions immediately, they are now tuned
into "bomb" objects, which can be passed around. A tasklet that
hold as bomb when getting activated will explode the bomb as an exception.
This also made send_exception much cleaner. We just send a bomb.
Also cured a bug with tasklet destruction and hard-switching.

The enable_softswitch() function now controls completely whether
attempts for stackless calls are made. This is besides speed comparison
a nice way for testing, since you can "switch the cstack on" for debugging.

Soon to come:
channel transfer (coroutine-like)
channel pickling
getting rid of the tasklet runner (internal stuff no longer needed)
new "caller" property for tasklets which defines where to return to
after tasklet.run etc.
Exposing new properties for scheduling control on channels and tasklets.
Re-introducing stack saving, because stackless behavior can be disabled.


Index: prickelpit.c
===================================================================
RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/pickling/prickelpit.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -C2 -d -r1.79 -r1.80
*** prickelpit.c	4 May 2004 18:47:35 -0000	1.79
--- prickelpit.c	12 May 2004 15:33:56 -0000	1.80
***************
*** 491,496 ****
  			int p = PyInt_AS_LONG(pos);
  			if (p >= 0 && p < length) {
! 				Py_XDECREF(start[p]);
  				start[p] = NULL;
  			}
  		}
--- 491,497 ----
  			int p = PyInt_AS_LONG(pos);
  			if (p >= 0 && p < length) {
! 				PyObject *hold = start[p];
  				start[p] = NULL;
+ 				Py_XDECREF(hold);
  			}
  		}

Index: safe_pickle.c
===================================================================
RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/pickling/safe_pickle.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** safe_pickle.c	29 Apr 2004 18:13:42 -0000	1.4
--- safe_pickle.c	12 May 2004 15:33:56 -0000	1.5
***************
*** 21,25 ****
  		return NULL;
  	ret = cPickle_save(self, args, pers_save);
! 	cur->tempval = PyInt_FromLong(ret);
  	/* jump back */
  	ts->frame = f->f_back;
--- 21,30 ----
  		return NULL;
  	ret = cPickle_save(self, args, pers_save);
! 	retval = PyInt_FromLong(ret);
! 	if (retval == NULL) {
! 		Py_INCREF(Py_None);
! 		retval = Py_None;
! 	}
! 	TASKLET_SETVAL_OWN(cur, retval);
  	/* jump back */
  	ts->frame = f->f_back;
***************
*** 44,47 ****
--- 49,53 ----
  	PyBaseFrameObject *bf = NULL;
  	PyCStackObject *cst;
+ 	PyObject *curval;
  
  	cPickle_save = save;
***************
*** 55,59 ****
  		goto finally;
  
! 	cur->tempval = cb_args;
  	bf = slp_baseframe_new(pickle_callback, 1, 0);
  	if (bf == NULL)
--- 61,67 ----
  		goto finally;
  
! 	curval = cur->tempval;
! 	Py_INCREF(curval);
! 	TASKLET_SETVAL(cur, cb_args);
  	bf = slp_baseframe_new(pickle_callback, 1, 0);
  	if (bf == NULL)
***************
*** 67,71 ****
  	cur->cstate = cst;
  	retval = cur->tempval;
! 	cur->tempval = NULL;
  	if (retval == NULL)
  		goto finally;
--- 75,80 ----
  	cur->cstate = cst;
  	retval = cur->tempval;
! 	Py_INCREF(retval);
! 	TASKLET_SETVAL(cur, curval);
  	if (retval == NULL)
  		goto finally;


_______________________________________________
Stackless-checkins mailing list
Stackless-checkins at stackless.com
http://www.stackless.com/mailman/listinfo/stackless-checkins



More information about the Stackless-checkins mailing list