[Stackless] stacklesslib & tealet

Kristján Valur Jónsson kristjan at ccpgames.com
Thu Apr 18 20:00:53 CEST 2013


Ok, fixed the issue.  It was a gcc compiler problem.  The optimizer would assume that a memory value wouldn't change across the switch call.
Fixed with a  "volatile" attribute.
I also recreated the repo, this time with the latest stuff and also the pytealet project, which brings python into play.

K

-----Original Message-----
From: stackless-bounces at stackless.com [mailto:stackless-bounces at stackless.com] On Behalf Of Kristján Valur Jónsson
Sent: 18. apríl 2013 15:38
To: The Stackless Python Mailing List
Subject: Re: [Stackless] stacklesslib & tealet

There is some weirdness going on.  I'm drilling down with print statements, but the problem is that those do affect optimization.
Also, I realized that I uploaded an old version of the lib to the repo.  I will put a newer version in place, one that actually includes the pytealet project :) K

> -----Original Message-----
> From: stackless-bounces at stackless.com [mailto:stackless- 
> bounces at stackless.com] On Behalf Of Kristján Valur Jónsson
> Sent: 18. apríl 2013 11:27
> To: The Stackless Python Mailing List
> Subject: Re: [Stackless] stacklesslib & tealet
> 
> installed mingw (no simple feat) and reproed your problem.
> However, it does not seem to include any debug symbols.  I didn´t find 
> any way to make sure those were gerenrated.  So debugging with visual 
> studio is off.
> I'll try some print statements.
> How do you make sure your .exe is linked with debug symbols?
> K
> 
> > -----Original Message-----
> > From: stackless-bounces at stackless.com [mailto:stackless- 
> > bounces at stackless.com] On Behalf Of Kristján Valur Jónsson
> > Sent: 18. apríl 2013 09:34
> > To: The Stackless Python Mailing List
> > Subject: Re: [Stackless] stacklesslib & tealet
> >
> >
> >
> > > -----Original Message-----
> > >
> > > What is the license of tealets?  Has it been derived from any 
> > > parts of Stckless, which might force an derivative usage Python license on it?
> > >
> > I don't understand, is this some lawyer talk?  My education is in 
> > the natural sciences.
> > the 'platf_slp' folder is copied verbatim from stackless.  I added 
> > that as a fallback since stackless supports more platforms than the 
> > original tealet version.
> > However, a better way would be to take some of the greenlet stuff 
> > since that is receiving more active support these days.
> >
> > > Do you have any future plans for it?
> > One of the plans was to use this as the hard-switching engine in 
> > Stackless Python.
> > It would provide a clear api and separation of responsibility, and 
> > possibly simplify Stackless too to boot.
> >
> > >
> > > It compiles okay on mingw / Windows 7 (64 bit), but tests do not 
> > > do so
> well:
> > >
> > > $ make tests
> > > gcc -g -o run_tests_static_g tealet.c tests.c run_tests_static_g
> > > +++ Running tests with newmode = 0 Running test 0... +++ Running 
> > > +++ test 1... +++ Running test 2... +++ Running test 3... +++ 
> > > +++ Running test 4... +++ Running test 5... +++ Running test 6... 
> > > +++ +++ All ok. +++ Running tests with newmode = -1 Running test 
> > > +++ 0... +++ Running test 1... +++ Running test 2... +++ Running 
> > > +++ test 3... +++ Running test 4... +++ Running test 5... +++ 
> > > +++ Running test 6... +++ All ok. +++
> > > gcc -g -O2 -o run_tests_static_o tealet.c tests.c 
> > > run_tests_static_o
> > > +++ Running tests with newmode = 0 Running test 0... +++ Running 
> > > +++ test 1... +++
> > > Assertion failed: g_main->g_current == (tealet_sub_t *)g_main, 
> > > file tealet.c, li ne 625
> > >
> > > Thoughts? :-)
> > Well, I confess to developing this with windows and visual c only.
> > Optimizations, always pesky.  You can see code such as this:
> >
> > /* set up the following field with an indirection, which is needed
> >      to prevent any inlining */
> >     _tealet_initialstub = tealet_initialstub;
> >     _tealet_switchstack = tealet_switchstack;
> >
> > Perhaps this is failing?  Inlining and modification of functions 
> > will do damage.....
> >
> > Test 1 is simple:
> >
> > tealet_t *test_simple_run(tealet_t *t1, void *arg) {
> >   assert(t1 != g_main);
> >   status = 1;
> >   return g_main;
> > }
> >
> > void test_simple(void)
> > {
> >   init_test();
> >   tealet_new(g_main, test_simple_run, NULL);
> >   assert(status == 1);
> >   fini_test();
> > }
> >
> > The assertion that is failing (why are the assertions being 
> > triggered in a O2 build, btw?) is this:
> >
> > void tealet_finalize(tealet_t *tealet) {
> >     tealet_main_t *g_main = TEALET_GET_MAIN(tealet);
> >     assert(TEALET_IS_MAIN_STACK(g_main));
> >     assert(g_main->g_current == (tealet_sub_t *)g_main);
> >     tealet_free(g_main, g_main);
> > }
> >
> > It is asserting that the current tealet is the main tealet.  If it 
> > isn't, then something failed in switching back.
> > Since this is the simplest of all tests, newmode is 0, it should be 
> > very easy to analyse.
> >
> > I'll see if I can give this mingw of which you speak  a spin.
> >
> > K
> >
> >
> >
> > _______________________________________________
> > Stackless mailing list
> > Stackless at stackless.com
> > http://www.stackless.com/mailman/listinfo/stackless
> 
> 
> 
> _______________________________________________
> Stackless mailing list
> Stackless at stackless.com
> http://www.stackless.com/mailman/listinfo/stackless



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





More information about the Stackless mailing list