aboutsummaryrefslogtreecommitdiff
path: root/src/lanes.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lanes.c')
-rw-r--r--src/lanes.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/lanes.c b/src/lanes.c
index 6acc711..1d60700 100644
--- a/src/lanes.c
+++ b/src/lanes.c
@@ -3000,6 +3000,7 @@ static volatile long s_initCount = 0;
3000LUAG_FUNC( configure) 3000LUAG_FUNC( configure)
3001{ 3001{
3002 struct s_Universe* U = get_universe( L); 3002 struct s_Universe* U = get_universe( L);
3003 bool_t const from_master_state = (U == NULL);
3003 char const* name = luaL_checkstring( L, lua_upvalueindex( 1)); 3004 char const* name = luaL_checkstring( L, lua_upvalueindex( 1));
3004 _ASSERT_L( L, lua_type( L, 1) == LUA_TTABLE); 3005 _ASSERT_L( L, lua_type( L, 1) == LUA_TTABLE);
3005 3006
@@ -3045,7 +3046,7 @@ LUAG_FUNC( configure)
3045 STACK_CHECK( L); 3046 STACK_CHECK( L);
3046 3047
3047 DEBUGSPEW_CODE( fprintf( stderr, INDENT_BEGIN "%p: lanes.configure() BEGIN\n" INDENT_END, L)); 3048 DEBUGSPEW_CODE( fprintf( stderr, INDENT_BEGIN "%p: lanes.configure() BEGIN\n" INDENT_END, L));
3048 DEBUGSPEW_CODE( ++ U->debugspew_indent_depth); 3049 DEBUGSPEW_CODE( if( U) ++ U->debugspew_indent_depth);
3049 3050
3050 lua_getfield( L, 1, "protect_allocator"); // settings protect_allocator 3051 lua_getfield( L, 1, "protect_allocator"); // settings protect_allocator
3051 if( lua_toboolean( L, -1)) 3052 if( lua_toboolean( L, -1))
@@ -3070,6 +3071,7 @@ LUAG_FUNC( configure)
3070 lua_pushlightuserdata( L, UNIVERSE_REGKEY); // settings UNIVERSE_REGKEY 3071 lua_pushlightuserdata( L, UNIVERSE_REGKEY); // settings UNIVERSE_REGKEY
3071 U = (struct s_Universe*) lua_newuserdata( L, sizeof( struct s_Universe)); // settings UNIVERSE_REGKEY universe 3072 U = (struct s_Universe*) lua_newuserdata( L, sizeof( struct s_Universe)); // settings UNIVERSE_REGKEY universe
3072 memset( U, 0, sizeof( struct s_Universe)); 3073 memset( U, 0, sizeof( struct s_Universe));
3074 DEBUGSPEW_CODE( ++ U->debugspew_indent_depth);
3073 lua_newtable( L); // settings UNIVERSE_REGKEY universe mt 3075 lua_newtable( L); // settings UNIVERSE_REGKEY universe mt
3074 lua_getfield( L, 1, "shutdown_timeout"); // settings UNIVERSE_REGKEY universe mt shutdown_timeout 3076 lua_getfield( L, 1, "shutdown_timeout"); // settings UNIVERSE_REGKEY universe mt shutdown_timeout
3075 lua_pushcclosure( L, selfdestruct_gc, 1); // settings UNIVERSE_REGKEY universe mt selfdestruct_gc 3077 lua_pushcclosure( L, selfdestruct_gc, 1); // settings UNIVERSE_REGKEY universe mt selfdestruct_gc
@@ -3195,9 +3197,15 @@ LUAG_FUNC( configure)
3195 3197
3196 // record all existing C/JIT-fast functions 3198 // record all existing C/JIT-fast functions
3197 // Lua 5.2 no longer has LUA_GLOBALSINDEX: we must push globals table on the stack 3199 // Lua 5.2 no longer has LUA_GLOBALSINDEX: we must push globals table on the stack
3198 lua_pushglobaltable( L); // settings M _G 3200 if( from_master_state)
3199 populate_func_lookup_table( L, -1, NULL); 3201 {
3200 lua_pop( L, 1); // settings M 3202 // don't do this when called during the initialization of a new lane,
3203 // because we will do it after on_state_create() is called,
3204 // and we don't want skip _G because of caching in case globals are created then
3205 lua_pushglobaltable( L); // settings M _G
3206 populate_func_lookup_table( L, -1, NULL);
3207 lua_pop( L, 1); // settings M
3208 }
3201 // set _R[CONFIG_REGKEY] = settings 3209 // set _R[CONFIG_REGKEY] = settings
3202 lua_pushvalue( L, -2); // settings M settings 3210 lua_pushvalue( L, -2); // settings M settings
3203 lua_setfield( L, LUA_REGISTRYINDEX, CONFIG_REGKEY); // settings M 3211 lua_setfield( L, LUA_REGISTRYINDEX, CONFIG_REGKEY); // settings M