dotgnu-pnet
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Pnet-developers] [patch #3119] jit_flush_exec () for x86


From: Miroslaw Dobrzanski-Neumann
Subject: Re: [Pnet-developers] [patch #3119] jit_flush_exec () for x86
Date: Tue, 8 Jun 2004 14:06:07 +0200
User-agent: Mutt/1.4i

On Tue, Jun 08, 2004 at 07:54:42AM +1000, Rhys Weatherley wrote:
> On Tuesday 08 June 2004 07:31 am, Miroslaw Dobrzanski-Neumann wrote:
> 
> > Summary:  jit_flush_exec () for x86
> >
> > Original Submission:  cache flush for x86 processors that supports it.
> 
> Actually, none of the x86 processors "need" cache flushing according to the 
> documentation.  It helps performance a little, but it isn't required.

I am just reading "Pthreads programming" O'Reilly 1996
Chapter 5/Multiprocessor Memry Synchronization  p. 191

-------------- citation --------------
"The Pthreads standard requires library implementors to synchronize memory
writes (with respect to reads and other writes) for a subset of Pthreads and
POSIX.1 functions.
...
The end result is that any threads's view of memory is the same as that
of any other thread in the same process, regardless of which CPUs the threads
are running on.

The function that must synchronize memory operations include:

pthread_cond_broadcast
pthread_cond_signal
pthread_cond_timedwait
pthread_cond_wait
pthread_create
pthread_join
pthread_mutex_trylock
pthread_mutex_lock
pthread_mutex_unlock
sem_post
sem_trywait
sem_wait
fork
wait
waitpid
"
-------------- citation --------------

In my understanding:

Because libjit uses pthreads when available and the code generation is
enclosed in jit_mutex_lock/jit_mutex_unlock which translates to
pthread_mutex_lock/pthread_mutex_unlock the jit_flush_exec() needn't do
anything. jit_mutex_unlock/pthread_mutex_unlock in jit_function_compile ()
will trigger any actions to synchronize memory. So it can be left to the
operating system which can do it better.

So I just suggest the following modification:

void jit_flush_exec(void *ptr, unsigned int size)
{
#if defined (JIT_THREADS_PTHREAD)
        /* noop */
#else
        /* dirty hacks with assembler sequences */
#endif
}

Regards,
        Mirosław
-- 
Mirosław Dobrzański-Neumann
E-mail: address@hidden

This message is utf-8 encoded


reply via email to

[Prev in Thread] Current Thread [Next in Thread]