diff --git a/configure.ac b/configure.ac index 790b4b9..cfcf1df 100644 --- a/configure.ac +++ b/configure.ac @@ -101,18 +101,31 @@ AH_TEMPLATE([SG_DLLIMPORT],[Attribute for objects to be imported from DSOs]) AH_TEMPLATE([SG_DLLLOCAL], [Attribute for objects local to current DSO]) AH_TEMPLATE([SG_DLLPUBLIC],[Attribute for DSO public objects]) +AC_ARG_ENABLE([visibility-support], + AS_HELP_STRING([--disable-visibility-support], + [disable the new GCC visibility support]), + [enable_gcc_visibility="$enableval"], + [enable_gcc_visibility="yes"]) +AC_MSG_CHECKING([whether to use new GCC visibility attributes]) + dnl for now it works only with GCC >= 4.0.0 -AC_MSG_CHECKING([whether GCC supports DSO visibility attributes]) AC_LANG_PUSH([C++]) -AC_COMPILE_IFELSE( - AC_LANG_PROGRAM([], [ - #if defined __GNUC__ && (__GNUC__) >= 4 - return 0; - #else - bails out with a compilation error. - #endif - ]),[ - AC_MSG_RESULT([yes]) +if test "x$enable_gcc_visibility" = "xyes"; then + AC_COMPILE_IFELSE( + AC_LANG_PROGRAM([], [ + #if defined __GNUC__ && (__GNUC__) >= 4 + return 0; + #else + bails out with a compilation error. + #endif + ]), + :, + [enable_gcc_visibility="no"]) +fi +AC_LANG_POP + +if test "x$enable_gcc_visibility" = "xyes"; then + AC_MSG_RESULT([yes]) AC_DEFINE([SG_DLLIMPORT],[/* intentionally left with no value */]) AC_DEFINE([SG_DLLEXPORT],[__attribute__ ((visibility("default")))]) AC_DEFINE([SG_DLLLOCAL],[__attribute__ ((visibility("hidden")))]) @@ -121,14 +134,13 @@ AC_COMPILE_IFELSE( AC_CHECK_CXXFLAG([VISIB_HIDDEN], [fvisibility=hidden]) AC_SUBST([VISIB_HIDDEN]) AC_CHECK_CXXFLAG([CXXFLAGS],[fvisibility-inlines-hidden]) - ],[ +else AC_MSG_RESULT([no]) AC_DEFINE([SG_DLLIMPORT],[/* unsupported */]) AC_DEFINE([SG_DLLEXPORT],[/* unsupported */]) AC_DEFINE([SG_DLLLOCAL],[/* unsupported */]) AC_DEFINE([SG_DLLPUBLIC],[/* unsupported */]) -]) -AC_LANG_POP +fi dnl check for Doxygen AC_CHECK_PROG([HAVE_DOXYGEN],[doxygen],[yes]) diff --git a/plugins/pyloader/configure.ac b/plugins/pyloader/configure.ac index f48038a..c0311de 100644 --- a/plugins/pyloader/configure.ac +++ b/plugins/pyloader/configure.ac @@ -111,18 +111,31 @@ AH_TEMPLATE([SG_DLLIMPORT],[Attribute for objects to be imported from DSOs]) AH_TEMPLATE([SG_DLLLOCAL], [Attribute for objects local to current DSO]) AH_TEMPLATE([SG_DLLPUBLIC],[Attribute for DSO public objects]) +AC_ARG_ENABLE([visibility-support], + AS_HELP_STRING([--disable-visibility-support], + [disable the new GCC visibility support]), + [enable_gcc_visibility="$enableval"], + [enable_gcc_visibility="yes"]) +AC_MSG_CHECKING([whether to use new GCC visibility attributes]) + dnl for now it works only with GCC >= 4.0.0 -AC_MSG_CHECKING([whether GCC supports DSO visibility attributes]) AC_LANG_PUSH([C++]) -AC_COMPILE_IFELSE( - AC_LANG_PROGRAM([], [ - #if defined __GNUC__ && (__GNUC__) >= 4 - return 0; - #else - bails out with a compilation error. - #endif - ]),[ - AC_MSG_RESULT([yes]) +if test "x$enable_gcc_visibility" = "xyes"; then + AC_COMPILE_IFELSE( + AC_LANG_PROGRAM([], [ + #if defined __GNUC__ && (__GNUC__) >= 4 + return 0; + #else + bails out with a compilation error. + #endif + ]), + :, + [enable_gcc_visibility="no"]) +fi +AC_LANG_POP + +if test "x$enable_gcc_visibility" = "xyes"; then + AC_MSG_RESULT([yes]) AC_DEFINE([SG_DLLIMPORT],[/* intentionally left with no value */]) AC_DEFINE([SG_DLLEXPORT],[__attribute__ ((visibility("default")))]) AC_DEFINE([SG_DLLLOCAL],[__attribute__ ((visibility("hidden")))]) @@ -131,14 +144,14 @@ AC_COMPILE_IFELSE( AC_CHECK_CXXFLAG([VISIB_HIDDEN], [fvisibility=hidden]) AC_SUBST([VISIB_HIDDEN]) AC_CHECK_CXXFLAG([CXXFLAGS],[fvisibility-inlines-hidden]) - ],[ +else AC_MSG_RESULT([no]) AC_DEFINE([SG_DLLIMPORT],[/* unsupported */]) AC_DEFINE([SG_DLLEXPORT],[/* unsupported */]) AC_DEFINE([SG_DLLLOCAL],[/* unsupported */]) AC_DEFINE([SG_DLLPUBLIC],[/* unsupported */]) -]) -AC_LANG_POP +fi + dnl see if we've to compile tests AC_MSG_CHECKING([whether tests have to be built]) diff --git a/plugins/xmlsave/configure.ac b/plugins/xmlsave/configure.ac index ee78617..879ad06 100644 --- a/plugins/xmlsave/configure.ac +++ b/plugins/xmlsave/configure.ac @@ -100,6 +100,7 @@ PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= $LIBXML2_VERSION], :, AC_MSG_ERROR([$LIBXML2_PKG_ERRORS])) + dnl use DSO visibility tags for systems that supports it correctly dnl (for example, GCC 4.0 and above) dnl see http://gcc.gnu.org/wiki/Visibility for more informations @@ -108,18 +109,31 @@ AH_TEMPLATE([SG_DLLIMPORT],[Attribute for objects to be imported from DSOs]) AH_TEMPLATE([SG_DLLLOCAL], [Attribute for objects local to current DSO]) AH_TEMPLATE([SG_DLLPUBLIC],[Attribute for DSO public objects]) +AC_ARG_ENABLE([visibility-support], + AS_HELP_STRING([--disable-visibility-support], + [disable the new GCC visibility support]), + [enable_gcc_visibility="$enableval"], + [enable_gcc_visibility="yes"]) +AC_MSG_CHECKING([whether to use new GCC visibility attributes]) + dnl for now it works only with GCC >= 4.0.0 -AC_MSG_CHECKING([whether GCC supports DSO visibility attributes]) AC_LANG_PUSH([C++]) -AC_COMPILE_IFELSE( - AC_LANG_PROGRAM([], [ - #if defined __GNUC__ && (__GNUC__) >= 4 - return 0; - #else - bails out with a compilation error. - #endif - ]),[ - AC_MSG_RESULT([yes]) +if test "x$enable_gcc_visibility" = "xyes"; then + AC_COMPILE_IFELSE( + AC_LANG_PROGRAM([], [ + #if defined __GNUC__ && (__GNUC__) >= 4 + return 0; + #else + bails out with a compilation error. + #endif + ]), + :, + [enable_gcc_visibility="no"]) +fi +AC_LANG_POP + +if test "x$enable_gcc_visibility" = "xyes"; then + AC_MSG_RESULT([yes]) AC_DEFINE([SG_DLLIMPORT],[/* intentionally left with no value */]) AC_DEFINE([SG_DLLEXPORT],[__attribute__ ((visibility("default")))]) AC_DEFINE([SG_DLLLOCAL],[__attribute__ ((visibility("hidden")))]) @@ -128,14 +142,14 @@ AC_COMPILE_IFELSE( AC_CHECK_CXXFLAG([VISIB_HIDDEN], [fvisibility=hidden]) AC_SUBST([VISIB_HIDDEN]) AC_CHECK_CXXFLAG([CXXFLAGS],[fvisibility-inlines-hidden]) - ],[ +else AC_MSG_RESULT([no]) AC_DEFINE([SG_DLLIMPORT],[/* unsupported */]) AC_DEFINE([SG_DLLEXPORT],[/* unsupported */]) AC_DEFINE([SG_DLLLOCAL],[/* unsupported */]) AC_DEFINE([SG_DLLPUBLIC],[/* unsupported */]) -]) -AC_LANG_POP +fi + dnl see if we've to compile tests AC_MSG_CHECKING([whether tests have to be built]) diff --git a/src/backend/scheduler.cc b/src/backend/scheduler.cc index 433ade8..65c6523 100644 --- a/src/backend/scheduler.cc +++ b/src/backend/scheduler.cc @@ -29,7 +29,9 @@ #include +#include #include + using namespace std; using namespace sgpem; @@ -56,6 +58,22 @@ collect_threads(const std::vector& procs, } } +static void prepare_ready_queue(ConcreteEnvironment& snapshot, + std::vector& all_threads) +{ + typedef std::vector Threads; + ReadyQueue& queue = snapshot.get_sorted_queue(); + assert(queue.size() == 0); + for(Threads::const_iterator it = all_threads.begin(); + it != all_threads.end(); it++) + { + if((*it)->get_state() == Schedulable::state_ready) + all_threads.push_back(*it); + } +} + + + // --------------------------------------------------------- @@ -201,8 +219,7 @@ Scheduler::step_forward(History& history, Policy& cpu_policy) throw(UserInterrup // (is it visible enough for you?) - ReadyQueue& ready_queue = new_snapshot->get_sorted_queue(); - prepare_ready_queue(ready_queue); + prepare_ready_queue(*new_snapshot, all_threads); try { // Temporarily set the _ready_queue param and the _policy one for @@ -210,7 +227,6 @@ Scheduler::step_forward(History& history, Policy& cpu_policy) throw(UserInterrup _policy = &cpu_policy; _ready_queue = &new_snapshot->get_sorted_queue(); - // ?. Use the policy to sort the queue // FIXME: how does it get the queue? @@ -218,10 +234,11 @@ Scheduler::step_forward(History& history, Policy& cpu_policy) throw(UserInterrup } catch(UserInterruptException& e) { + // Reset values that the policy doesn't need anymore _policy = NULL; _ready_queue = NULL; - // ^^^^^ - // Do we need to update something else? + + // Do we need to update/reset something else? // Going up unwinding the stack, tell: // - the user that the policy sucks @@ -232,14 +249,10 @@ Scheduler::step_forward(History& history, Policy& cpu_policy) throw(UserInterrup // append the new snapshot... // ...and remember to release the auto_ptr! concrete_history.append_new_environment(new_snapshot.release()); + + // Reset values that the policy doesn't need anymore _policy = NULL; _ready_queue = NULL; } - -void -Scheduler::prepare_ready_queue(ReadyQueue& queue) -{ - -} diff --git a/src/backend/scheduler.hh b/src/backend/scheduler.hh index f4a7f49..9de4489 100644 --- a/src/backend/scheduler.hh +++ b/src/backend/scheduler.hh @@ -87,9 +87,7 @@ namespace sgpem */ Policy& get_policy(); - private: - void prepare_ready_queue(ReadyQueue& queue); - + private: Scheduler(); //private constructor. ReadyQueue* _ready_queue;