[Stackless] stacklesslib & tealet

Kristján Valur Jónsson kristjan at ccpgames.com
Thu Apr 18 11:33:48 CEST 2013



> -----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





More information about the Stackless mailing list