Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill the (unused) lua context factory. Lua does fine with regular contextes. That...
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 26 Nov 2010 21:43:55 +0000 (21:43 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 26 Nov 2010 21:43:55 +0000 (21:43 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8689 48e7efb5-ca39-0410-a469-dd3cf9ba447f

buildtools/Cmake/DefinePackages.cmake
src/bindings/lua/simgrid_lua.c
src/simix/private.h
src/simix/smx_context.c
src/simix/smx_context_lua.c [deleted file]

index b4c2639..90ff008 100644 (file)
@@ -319,7 +319,6 @@ set(AMOK_SRC
 )
 
 set(LUA_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
        src/bindings/lua/simgrid_lua.c
        src/bindings/lua/lua_stub_generator.c
        src/bindings/lua/lua_console.c
index e45013a..7682f08 100644 (file)
@@ -9,6 +9,8 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(lua, bindings, "Lua Bindings");
 
 
 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 )
 #define TASK_MODULE_NAME "simgrid.Task"
 #define HOST_MODULE_NAME "simgrid.Host"
 // Surf ( bypass XML )
index 9fb1e62..824a932 100644 (file)
@@ -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_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);
 
 
 void SIMIX_ctx_java_factory_init(smx_context_factory_t * factory);
index 3b42c82..c3bc155 100644 (file)
 #include "xbt/swag.h"
 #include "private.h"
 
 #include "xbt/swag.h"
 #include "private.h"
 
-#ifdef HAVE_LUA
-#include <lauxlib.h>
-#endif
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_context, simix,
                                 "Context switching mecanism");
 
 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
     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);
 
   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 (file)
index 33b3ecf..0000000
+++ /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 <lauxlib.h>
-#include <lualib.h>
-
-#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