* How to keep gcc haifa from moving userlevel thread lock function?
@ 2000-02-02 3:26 Kevin Hendricks
2000-02-02 3:57 ` David Edelsohn
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Hendricks @ 2000-02-02 3:26 UTC (permalink / raw)
To: linuxppc-dev
Hi,
The green_threads implementation of the JDK sets a schedule lock that prevents
any green thread (not a linuxthread) from yielding (think of green_threads
as userland cooperative threads that run in a single process).
Here is the routine:
/*
* Lock the thread scheduler
*/
void
_sched_lock()
{
++_scheduling_lock;
}
where _scheduling_lock is a global integer.
The problem is that the calls to _sched_lock seems to be moved by the haifa
scheduler just enough to force me to compile many things with -O0 to prevent
problems.
I *think* gcc is inlining the call and then the haifa scheduler seems to want
to move this around abit since it does not directly impact the code around it.
What is the correct way to keep the gcc (haifa) from moving this around?
I have already tried:
"-O2 -fno-schedule-insns -fno-schedule-insns2"
but that does not seem to do the trick.
I am sure there must be some indicator (like volatile) that I should be using.
Any help would be greatly appreciated.
Thanks,
Kevin
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to keep gcc haifa from moving userlevel thread lock function?
2000-02-02 3:26 How to keep gcc haifa from moving userlevel thread lock function? Kevin Hendricks
@ 2000-02-02 3:57 ` David Edelsohn
0 siblings, 0 replies; 2+ messages in thread
From: David Edelsohn @ 2000-02-02 3:57 UTC (permalink / raw)
To: khendricks; +Cc: linuxppc-dev
Is _scheduling_lock delared volatile? You should not disable
scheduling or other optimizations to solve this problem. You should look
for the appropriate attribute for the variable and/or function to prevent
GCC from moving the code.
David
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-02-02 3:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-02-02 3:26 How to keep gcc haifa from moving userlevel thread lock function? Kevin Hendricks
2000-02-02 3:57 ` David Edelsohn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).