зеркало из https://github.com/mozilla/pjs.git
Bugzilla bug #39712: work around the /GT bug of MSVC 6.0 SP3.
Modified files: WIN32.mk, ntthread.c
This commit is contained in:
Родитель
e134c507f0
Коммит
c905ffa0f8
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче