- 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:
tchernobog 2006-07-04 22:17:02 +00:00
parent 4108b39c09
commit fcc9e93827
5 changed files with 103 additions and 53 deletions

View File

@ -101,9 +101,16 @@ 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_DLLLOCAL], [Attribute for objects local to current DSO])
AH_TEMPLATE([SG_DLLPUBLIC],[Attribute for DSO public objects]) 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 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_LANG_PUSH([C++])
if test "x$enable_gcc_visibility" = "xyes"; then
AC_COMPILE_IFELSE( AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([], [ AC_LANG_PROGRAM([], [
#if defined __GNUC__ && (__GNUC__) >= 4 #if defined __GNUC__ && (__GNUC__) >= 4
@ -111,7 +118,13 @@ AC_COMPILE_IFELSE(
#else #else
bails out with a compilation error. bails out with a compilation error.
#endif #endif
]),[ ]),
:,
[enable_gcc_visibility="no"])
fi
AC_LANG_POP
if test "x$enable_gcc_visibility" = "xyes"; then
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
AC_DEFINE([SG_DLLIMPORT],[/* intentionally left with no value */]) AC_DEFINE([SG_DLLIMPORT],[/* intentionally left with no value */])
AC_DEFINE([SG_DLLEXPORT],[__attribute__ ((visibility("default")))]) AC_DEFINE([SG_DLLEXPORT],[__attribute__ ((visibility("default")))])
@ -121,14 +134,13 @@ AC_COMPILE_IFELSE(
AC_CHECK_CXXFLAG([VISIB_HIDDEN], [fvisibility=hidden]) AC_CHECK_CXXFLAG([VISIB_HIDDEN], [fvisibility=hidden])
AC_SUBST([VISIB_HIDDEN]) AC_SUBST([VISIB_HIDDEN])
AC_CHECK_CXXFLAG([CXXFLAGS],[fvisibility-inlines-hidden]) AC_CHECK_CXXFLAG([CXXFLAGS],[fvisibility-inlines-hidden])
],[ else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
AC_DEFINE([SG_DLLIMPORT],[/* unsupported */]) AC_DEFINE([SG_DLLIMPORT],[/* unsupported */])
AC_DEFINE([SG_DLLEXPORT],[/* unsupported */]) AC_DEFINE([SG_DLLEXPORT],[/* unsupported */])
AC_DEFINE([SG_DLLLOCAL],[/* unsupported */]) AC_DEFINE([SG_DLLLOCAL],[/* unsupported */])
AC_DEFINE([SG_DLLPUBLIC],[/* unsupported */]) AC_DEFINE([SG_DLLPUBLIC],[/* unsupported */])
]) fi
AC_LANG_POP
dnl check for Doxygen dnl check for Doxygen
AC_CHECK_PROG([HAVE_DOXYGEN],[doxygen],[yes]) AC_CHECK_PROG([HAVE_DOXYGEN],[doxygen],[yes])

View File

@ -111,9 +111,16 @@ 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_DLLLOCAL], [Attribute for objects local to current DSO])
AH_TEMPLATE([SG_DLLPUBLIC],[Attribute for DSO public objects]) 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 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_LANG_PUSH([C++])
if test "x$enable_gcc_visibility" = "xyes"; then
AC_COMPILE_IFELSE( AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([], [ AC_LANG_PROGRAM([], [
#if defined __GNUC__ && (__GNUC__) >= 4 #if defined __GNUC__ && (__GNUC__) >= 4
@ -121,7 +128,13 @@ AC_COMPILE_IFELSE(
#else #else
bails out with a compilation error. bails out with a compilation error.
#endif #endif
]),[ ]),
:,
[enable_gcc_visibility="no"])
fi
AC_LANG_POP
if test "x$enable_gcc_visibility" = "xyes"; then
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
AC_DEFINE([SG_DLLIMPORT],[/* intentionally left with no value */]) AC_DEFINE([SG_DLLIMPORT],[/* intentionally left with no value */])
AC_DEFINE([SG_DLLEXPORT],[__attribute__ ((visibility("default")))]) AC_DEFINE([SG_DLLEXPORT],[__attribute__ ((visibility("default")))])
@ -131,14 +144,14 @@ AC_COMPILE_IFELSE(
AC_CHECK_CXXFLAG([VISIB_HIDDEN], [fvisibility=hidden]) AC_CHECK_CXXFLAG([VISIB_HIDDEN], [fvisibility=hidden])
AC_SUBST([VISIB_HIDDEN]) AC_SUBST([VISIB_HIDDEN])
AC_CHECK_CXXFLAG([CXXFLAGS],[fvisibility-inlines-hidden]) AC_CHECK_CXXFLAG([CXXFLAGS],[fvisibility-inlines-hidden])
],[ else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
AC_DEFINE([SG_DLLIMPORT],[/* unsupported */]) AC_DEFINE([SG_DLLIMPORT],[/* unsupported */])
AC_DEFINE([SG_DLLEXPORT],[/* unsupported */]) AC_DEFINE([SG_DLLEXPORT],[/* unsupported */])
AC_DEFINE([SG_DLLLOCAL],[/* unsupported */]) AC_DEFINE([SG_DLLLOCAL],[/* unsupported */])
AC_DEFINE([SG_DLLPUBLIC],[/* unsupported */]) AC_DEFINE([SG_DLLPUBLIC],[/* unsupported */])
]) fi
AC_LANG_POP
dnl see if we've to compile tests dnl see if we've to compile tests
AC_MSG_CHECKING([whether tests have to be built]) AC_MSG_CHECKING([whether tests have to be built])

View File

@ -100,6 +100,7 @@ PKG_CHECK_MODULES([LIBXML2],
[libxml-2.0 >= $LIBXML2_VERSION], [libxml-2.0 >= $LIBXML2_VERSION],
:, AC_MSG_ERROR([$LIBXML2_PKG_ERRORS])) :, AC_MSG_ERROR([$LIBXML2_PKG_ERRORS]))
dnl use DSO visibility tags for systems that supports it correctly dnl use DSO visibility tags for systems that supports it correctly
dnl (for example, GCC 4.0 and above) dnl (for example, GCC 4.0 and above)
dnl see http://gcc.gnu.org/wiki/Visibility for more informations dnl see http://gcc.gnu.org/wiki/Visibility for more informations
@ -108,9 +109,16 @@ 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_DLLLOCAL], [Attribute for objects local to current DSO])
AH_TEMPLATE([SG_DLLPUBLIC],[Attribute for DSO public objects]) 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 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_LANG_PUSH([C++])
if test "x$enable_gcc_visibility" = "xyes"; then
AC_COMPILE_IFELSE( AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([], [ AC_LANG_PROGRAM([], [
#if defined __GNUC__ && (__GNUC__) >= 4 #if defined __GNUC__ && (__GNUC__) >= 4
@ -118,7 +126,13 @@ AC_COMPILE_IFELSE(
#else #else
bails out with a compilation error. bails out with a compilation error.
#endif #endif
]),[ ]),
:,
[enable_gcc_visibility="no"])
fi
AC_LANG_POP
if test "x$enable_gcc_visibility" = "xyes"; then
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
AC_DEFINE([SG_DLLIMPORT],[/* intentionally left with no value */]) AC_DEFINE([SG_DLLIMPORT],[/* intentionally left with no value */])
AC_DEFINE([SG_DLLEXPORT],[__attribute__ ((visibility("default")))]) AC_DEFINE([SG_DLLEXPORT],[__attribute__ ((visibility("default")))])
@ -128,14 +142,14 @@ AC_COMPILE_IFELSE(
AC_CHECK_CXXFLAG([VISIB_HIDDEN], [fvisibility=hidden]) AC_CHECK_CXXFLAG([VISIB_HIDDEN], [fvisibility=hidden])
AC_SUBST([VISIB_HIDDEN]) AC_SUBST([VISIB_HIDDEN])
AC_CHECK_CXXFLAG([CXXFLAGS],[fvisibility-inlines-hidden]) AC_CHECK_CXXFLAG([CXXFLAGS],[fvisibility-inlines-hidden])
],[ else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
AC_DEFINE([SG_DLLIMPORT],[/* unsupported */]) AC_DEFINE([SG_DLLIMPORT],[/* unsupported */])
AC_DEFINE([SG_DLLEXPORT],[/* unsupported */]) AC_DEFINE([SG_DLLEXPORT],[/* unsupported */])
AC_DEFINE([SG_DLLLOCAL],[/* unsupported */]) AC_DEFINE([SG_DLLLOCAL],[/* unsupported */])
AC_DEFINE([SG_DLLPUBLIC],[/* unsupported */]) AC_DEFINE([SG_DLLPUBLIC],[/* unsupported */])
]) fi
AC_LANG_POP
dnl see if we've to compile tests dnl see if we've to compile tests
AC_MSG_CHECKING([whether tests have to be built]) AC_MSG_CHECKING([whether tests have to be built])

View File

@ -29,7 +29,9 @@
#include <glibmm/thread.h> #include <glibmm/thread.h>
#include <cassert>
#include <memory> #include <memory>
using namespace std; using namespace std;
using namespace sgpem; 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?) // (is it visible enough for you?)
ReadyQueue& ready_queue = new_snapshot->get_sorted_queue(); prepare_ready_queue(*new_snapshot, all_threads);
prepare_ready_queue(ready_queue);
try try
{ {
// Temporarily set the _ready_queue param and the _policy one for // 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; _policy = &cpu_policy;
_ready_queue = &new_snapshot->get_sorted_queue(); _ready_queue = &new_snapshot->get_sorted_queue();
// ?. Use the policy to sort the queue // ?. Use the policy to sort the queue
// FIXME: how does it get 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) catch(UserInterruptException& e)
{ {
// Reset values that the policy doesn't need anymore
_policy = NULL; _policy = NULL;
_ready_queue = 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: // Going up unwinding the stack, tell:
// - the user that the policy sucks // - the user that the policy sucks
@ -232,14 +249,10 @@ Scheduler::step_forward(History& history, Policy& cpu_policy) throw(UserInterrup
// append the new snapshot... // append the new snapshot...
// ...and remember to release the auto_ptr! // ...and remember to release the auto_ptr!
concrete_history.append_new_environment(new_snapshot.release()); concrete_history.append_new_environment(new_snapshot.release());
// Reset values that the policy doesn't need anymore
_policy = NULL; _policy = NULL;
_ready_queue = NULL; _ready_queue = NULL;
} }
void
Scheduler::prepare_ready_queue(ReadyQueue& queue)
{
}

View File

@ -88,8 +88,6 @@ namespace sgpem
Policy& get_policy(); Policy& get_policy();
private: private:
void prepare_ready_queue(ReadyQueue& queue);
Scheduler(); //private constructor. Scheduler(); //private constructor.
ReadyQueue* _ready_queue; ReadyQueue* _ready_queue;