Bugzilla bug #39712: work around the /GT bug of MSVC 6.0 SP3.

Modified files: WIN32.mk, ntthread.c
This commit is contained in:
wtc%netscape.com 2000-05-30 22:51:39 +00:00
Родитель e134c507f0
Коммит c905ffa0f8
2 изменённых файлов: 22 добавлений и 7 удалений

Просмотреть файл

@ -53,14 +53,7 @@ OS_CFLAGS = -W3 -nologo -GF -Gy
ifdef BUILD_OPT
OS_CFLAGS += -MD
# The -O2 optimization of MSVC 6.0 SP3 appears to generate
# code that is unsafe for our use of fibers and static thread
# local storage. We temporarily work around this problem by
# turning off global optimizations (-Og).
OPTIMIZER = -O2
ifeq ($(OS_TARGET),WINNT)
OPTIMIZER += -Og-
endif
DEFINES = -UDEBUG -U_DEBUG -DNDEBUG
DLLFLAGS = -OUT:"$@"
OBJDIR_TAG = _OPT

Просмотреть файл

@ -430,6 +430,19 @@ _PR_MD_SWITCH_CONTEXT(PRThread *thread)
_PR_Schedule();
}
/*
* The /GT option of MSVC 6.0 SP3 fails to prevent compiler optimizations
* that are unsafe for fibers' access to static thread local storage.
* We work around this problem by moving all the code after the
* SwitchToFiber() call to a separate function. (Bugzilla bug #39712)
*/
static void
PostSwitchWork(void)
{
POST_SWITCH_WORK();
}
void
_PR_MD_RESTORE_CONTEXT(PRThread *thread)
{
@ -447,7 +460,16 @@ _PR_MD_RESTORE_CONTEXT(PRThread *thread)
_PR_MD_SET_LAST_THREAD(me);
thread->no_sched = 1;
SwitchToFiber(thread->md.fiber_id);
#if 0
POST_SWITCH_WORK();
#else
/*
* Move the code after SwitchToFiber() to another function so
* that it is not jointly optimized with the code before the
* SwitchToFiber() call. See comments before PostSwitchWork().
*/
PostSwitchWork();
#endif
}
}