From: mquinson Date: Fri, 26 Nov 2010 21:43:55 +0000 (+0000) Subject: kill the (unused) lua context factory. Lua does fine with regular contextes. That... X-Git-Tag: v3_5~142 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/c9a06d0b06fb32926954b78006bfe7f886aa757a kill the (unused) lua context factory. Lua does fine with regular contextes. That reduces the coupling between main and bindings git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8689 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/buildtools/Cmake/DefinePackages.cmake b/buildtools/Cmake/DefinePackages.cmake index b4c2639e2a..90ff008cbf 100644 --- a/buildtools/Cmake/DefinePackages.cmake +++ b/buildtools/Cmake/DefinePackages.cmake @@ -319,7 +319,6 @@ set(AMOK_SRC ) set(LUA_SRC - src/simix/smx_context_lua.c src/bindings/lua/simgrid_lua.c src/bindings/lua/lua_stub_generator.c src/bindings/lua/lua_console.c diff --git a/src/bindings/lua/simgrid_lua.c b/src/bindings/lua/simgrid_lua.c index e45013a9de..7682f080ee 100644 --- a/src/bindings/lua/simgrid_lua.c +++ b/src/bindings/lua/simgrid_lua.c @@ -9,6 +9,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(lua, bindings, "Lua Bindings"); +lua_State *simgrid_lua_state; + #define TASK_MODULE_NAME "simgrid.Task" #define HOST_MODULE_NAME "simgrid.Host" // Surf ( bypass XML ) diff --git a/src/simix/private.h b/src/simix/private.h index 9fb1e627ea..824a9326f8 100644 --- a/src/simix/private.h +++ b/src/simix/private.h @@ -224,7 +224,6 @@ int SIMIX_context_select_factory(const char *name); void SIMIX_ctx_thread_factory_init(smx_context_factory_t * factory); void SIMIX_ctx_sysv_factory_init(smx_context_factory_t * factory); -void SIMIX_ctx_lua_factory_init(smx_context_factory_t * factory); void SIMIX_ctx_java_factory_init(smx_context_factory_t * factory); diff --git a/src/simix/smx_context.c b/src/simix/smx_context.c index 3b42c8203f..c3bc15520e 100644 --- a/src/simix/smx_context.c +++ b/src/simix/smx_context.c @@ -11,10 +11,6 @@ #include "xbt/swag.h" #include "private.h" -#ifdef HAVE_LUA -#include -#endif - XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_context, simix, "Context switching mecanism"); @@ -116,14 +112,6 @@ int SIMIX_context_select_factory(const char *name) THROW0(not_found_error, 0, "Factory 'sysv' does not exist: no System V thread support under Windows"); #endif - else if (!strcmp(name, "lua")) -#ifdef HAVE_LUA - SIMIX_ctx_lua_factory_init(factory); -#else - - THROW0(not_found_error, 0, - "Factory 'lua' does not exist: Lua support was not compiled in the SimGrid library"); -#endif /* HAVE_LUA */ else THROW1(not_found_error, 0, "Factory '%s' does not exist", name); diff --git a/src/simix/smx_context_lua.c b/src/simix/smx_context_lua.c deleted file mode 100644 index 33b3ecfb8d..0000000000 --- a/src/simix/smx_context_lua.c +++ /dev/null @@ -1,104 +0,0 @@ -/* context_lua - implementation of context switching with lua coroutines */ - -/* Copyright (c) 2010. The SimGrid Team. - * All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - -#include -#include - -#include "smx_context_private.h" - -/* We don't use that factory at all for now. This may change at some point, - * to reduce the amount of memory per user thread in sysv - */ - -lua_State *simgrid_lua_state; -void SIMIX_ctx_lua_factory_init(smx_context_factory_t * factory) -{ -} - -#ifdef KILLME -/* lua can run with ultra tiny stacks since the user code lives in lua stacks, not the main one */ -//#define CONTEXT_STACK_SIZE 4*1024 - -XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(lua); - - -static smx_context_t -smx_ctx_lua_create_context(xbt_main_func_t code, int argc, char **argv, - void_f_pvoid_t cleanup_func, void *cleanup_arg); - -static int smx_ctx_lua_factory_finalize(smx_context_factory_t * factory); - -static void smx_ctx_lua_free(smx_context_t context); -static void smx_ctx_lua_stop(smx_context_t context); -static void smx_ctx_lua_suspend(smx_context_t context); -static void smx_ctx_lua_resume(smx_context_t new_context); - - -void SIMIX_ctx_lua_factory_init(smx_context_factory_t * factory) -{ - - smx_ctx_base_factory_init(factory); - - (*factory)->create_context = smx_ctx_lua_create_context; - /* don't override (*factory)->finalize */ ; - (*factory)->free = smx_ctx_sysv_free; - (*factory)->stop = smx_ctx_sysv_stop; - (*factory)->suspend = smx_ctx_sysv_suspend; - (*factory)->resume = smx_ctx_sysv_resume; - (*factory)->name = "smx_lua_context_factory"; - - INFO0("Lua Factory created"); -} - -static smx_context_t -smx_ctx_lua_create_context(xbt_main_func_t code, int argc, char **argv, - void_f_pvoid_t cleanup_func, void *cleanup_arg) -{ - - return smx_ctx_sysv_create_context_sized(sizeof(s_smx_ctx_sysv_t), - code, argc, argv, cleanup_func, - cleanup_arg); -} - -#if KILLME -static void smx_ctx_lua_free(smx_context_t context) -{ - - if (context) { - DEBUG1("smx_ctx_lua_free_context(%p)", context); - - } - - smx_ctx_sysv_free(context); -} - -static void smx_ctx_lua_stop(smx_context_t pcontext) -{ - DEBUG1("Stopping '%s' (nothing to do)", pcontext->argv[0]); - smx_ctx_sysv_stop(pcontext); -} - -static void smx_ctx_lua_suspend(smx_context_t pcontext) -{ - smx_ctx_lua_t context = (smx_ctx_lua_t) pcontext; - DEBUG1("Suspending '%s' (using sysv facilities)", - context->super.super.argv[0]); - smx_ctx_sysv_suspend(pcontext); - - DEBUG0("Back from call yielding"); -} - -static void smx_ctx_lua_resume(smx_context_t new_context) -{ - smx_ctx_lua_t context = (smx_ctx_lua_t) new_context; - DEBUG1("Resuming %s", context->super.super.argv[0]); - smx_ctx_sysv_resume(new_context); -} -#endif - -#endif