Re: stackless implementation (was Re: New stackless proposal)

Christian Tismer <[email protected]>
Newsgroups gmane.comp.lang.prothon.user
Message-ID <[email protected]>
Mark Hahn wrote:

> Christian Tismer wrote:
> 
> 
>> From the above, isn't it easy to deduce that you are talking of C
>>stacks, especially if there is a "real switch". That's how it came.
> 
> 
> It is my fault.  I should define what I meant by a real stack.  I was being
> defensive of my code.
> 
> 
>>>How does your stackless implement the multiple tasklets?  Does it
>>>allow C extensions in a tasklet?
>>
>>Yes, sure. It doesn't like it very much, things become slower,
>>assembly is involved, but it works.
>>If this is not necessary, everything is done by stack avoidance,
>>no assembly.
> 
> 
> Hmmm.  I have a big problem.  I keep forgetting that my implementation of
> Thread does not allow C extensions. People will want C extensions in their
> co-routines.  Having C extensions only allowed in one special main Thread is
> very bad.  It would be very non-symmetric.
> 
> Does your assembly only work on X86 machines?  I may ask to steal your
> assembly code.

Sure. Here an excerpt of slp_platformselect.h .
There are a few more, not yet in the trunk.

/*
  * Platform Selection for Stackless Python
  */

#if   defined(MS_WIN32) && !defined(MS_WIN64) && defined(_M_IX86)
#include "switch_x86_msvc.h" /* MS Visual Studio on X86 */
#elif defined(__GNUC__) && defined(__i386__)
#include "switch_x86_unix.h" /* gcc on X86 */
#elif defined(__GNUC__) && defined(__PPC__) && defined(__linux__)
#include "switch_ppc_unix.h" /* gcc on PowerPC */
#elif defined(__GNUC__) && defined(__ppc__) && defined(__APPLE__)
#include "switch_ppc_macosx.h" /* Apple MacOS X on PowerPC */
#elif defined(__GNUC__) && defined(sparc) && defined(sun)
#include "switch_sparc_sun_gcc.h" /* SunOS sparc with gcc */
#elif defined(__GNUC__) && defined(__s390__) && defined(__linux__)
#include "switch_s390_unix.h"	/* Linux/S390 */
#elif defined(__GNUC__) && defined(__s390x__) && defined(__linux__)
#include "switch_s390_unix.h"	/* Linux/S390 zSeries (identical) */
#endif

/* default definitions if not defined in above files */

ciao - chris

-- 
Christian Tismer             :^)   <mailto:[email protected]>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  mobile +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.