- Let the user disable the new GCC 4.0 visibility support
from configure. This is mainly there for buggy compilers / binutils. git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@715 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
4108b39c09
commit
fcc9e93827
38
configure.ac
38
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])
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -29,7 +29,9 @@
|
|||
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
|
||||
using namespace std;
|
||||
using namespace sgpem;
|
||||
|
||||
|
@ -56,6 +58,22 @@ collect_threads(const std::vector<Process*>& procs,
|
|||
}
|
||||
}
|
||||
|
||||
static void prepare_ready_queue(ConcreteEnvironment& snapshot,
|
||||
std::vector<DynamicThread*>& all_threads)
|
||||
{
|
||||
typedef std::vector<DynamicThread*> 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)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -87,9 +87,7 @@ namespace sgpem
|
|||
*/
|
||||
Policy& get_policy();
|
||||
|
||||
private:
|
||||
void prepare_ready_queue(ReadyQueue& queue);
|
||||
|
||||
private:
|
||||
Scheduler(); //private constructor.
|
||||
|
||||
ReadyQueue* _ready_queue;
|
||||
|
|
Loading…
Reference in New Issue