diff options
author | Benoit Germain <bnt.germain@gmail.com> | 2018-11-15 11:20:14 +0100 |
---|---|---|
committer | Benoit Germain <bnt.germain@gmail.com> | 2018-11-15 11:20:14 +0100 |
commit | 01f83215a2ad235fbf306f591c6c0547b1bb7047 (patch) | |
tree | 51d1edff1c3f684bac388c64d91ee30d8f6fbbf2 /src/lanes.c | |
parent | 55acf8e19728ac39581c35f1324debf9449bd185 (diff) | |
download | lanes-01f83215a2ad235fbf306f591c6c0547b1bb7047.tar.gz lanes-01f83215a2ad235fbf306f591c6c0547b1bb7047.tar.bz2 lanes-01f83215a2ad235fbf306f591c6c0547b1bb7047.zip |
Deep userdata must embed DeepPrelude to save an allocation (also changes Deep protocol)
Diffstat (limited to 'src/lanes.c')
-rw-r--r-- | src/lanes.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lanes.c b/src/lanes.c index f2e3065..037e44f 100644 --- a/src/lanes.c +++ b/src/lanes.c | |||
@@ -733,7 +733,10 @@ static int selfdestruct_gc( lua_State* L) | |||
733 | // necessary so that calling free_deep_prelude doesn't crash because linda_id expects a linda lightuserdata at absolute slot 1 | 733 | // necessary so that calling free_deep_prelude doesn't crash because linda_id expects a linda lightuserdata at absolute slot 1 |
734 | lua_settop( L, 0); | 734 | lua_settop( L, 0); |
735 | // no need to mutex-protect this as all threads in the universe are gone at that point | 735 | // no need to mutex-protect this as all threads in the universe are gone at that point |
736 | -- U->timer_deep->refcount; // should be 0 now | 736 | if( U->timer_deep != NULL) // test ins case some early internal error prevented Lanes from creating the deep timer |
737 | { | ||
738 | -- U->timer_deep->refcount; // should be 0 now | ||
739 | } | ||
737 | free_deep_prelude( L, (DeepPrelude*) U->timer_deep); | 740 | free_deep_prelude( L, (DeepPrelude*) U->timer_deep); |
738 | U->timer_deep = NULL; | 741 | U->timer_deep = NULL; |
739 | 742 | ||
@@ -2162,7 +2165,6 @@ LUAG_FUNC( configure) | |||
2162 | 2165 | ||
2163 | // Proxy userdata contents is only a 'DEEP_PRELUDE*' pointer | 2166 | // Proxy userdata contents is only a 'DEEP_PRELUDE*' pointer |
2164 | U->timer_deep = *(DeepPrelude**) lua_touserdata( L, -1); | 2167 | U->timer_deep = *(DeepPrelude**) lua_touserdata( L, -1); |
2165 | ASSERT_L( U->timer_deep && (U->timer_deep->refcount == 1) && U->timer_deep->deep && U->timer_deep->idfunc == linda_id); | ||
2166 | // increment refcount that this linda remains alive as long as the universe is. | 2168 | // increment refcount that this linda remains alive as long as the universe is. |
2167 | ++ U->timer_deep->refcount; | 2169 | ++ U->timer_deep->refcount; |
2168 | lua_pop( L, 1); // settings | 2170 | lua_pop( L, 1); // settings |