* Merged in new atomic instructions (twisti branch).
authorChristian Thalinger <twisti@complang.tuwien.ac.at>
Sat, 5 Jul 2008 10:39:51 +0000 (12:39 +0200)
committerChristian Thalinger <twisti@complang.tuwien.ac.at>
Sat, 5 Jul 2008 10:39:51 +0000 (12:39 +0200)
1  2 
src/threads/Makefile.am
src/threads/posix/lock.c
src/threads/posix/thread-posix.c
src/vm/jit/asmpart.h
src/vm/jit/powerpc64/linux/md-os.c

index 6f69df0f09e869369d210c9546b177f5ffe5a971,882901dd6c8b8eb7b1ad03137aa2c0dc3f23777a..ed23dfe231b3bb994557ad917832d6e33b66446d
@@@ -49,10 -49,12 +49,12 @@@ noinst_LTLIBRARIES = 
  
  if ENABLE_THREADS
  libthreads_la_SOURCES = \
 -      critical.c \
 -      critical.h \
+       atomic.c \
+       atomic.hpp \
 +      condition.hpp \
        lock-common.h \
 -      mutex.h \
 +      removeme.cpp \
 +      mutex.hpp \
        threadlist.c \
        threadlist.h \
        thread.c \
Simple merge
index c4dee854389046808b54bb4639b9440361d814f8,282531bbe7c002ef8aa4c494a24f0555f01c6b82..bfcdc58a7c37ac9a54196457e05b455b117897e6
@@@ -230,20 -229,24 +224,14 @@@ static Mutex* mutex_gc
  #endif
  
  /* global mutex and condition for joining threads on exit */
 -static mutex_t mutex_join;
 -static pthread_cond_t  cond_join;
 -
 -/* this is one of the STOPWORLD_FROM_ constants, telling why the world is     */
 -/* being stopped                                                              */
 -static volatile int stopworldwhere;
 +static Mutex* mutex_join;
 +static Condition* cond_join;
  
  #if defined(ENABLE_GC_CACAO)
 -
  /* semaphore used for acknowleding thread suspension                          */
  static sem_t suspend_ack;
 -#if defined(__IRIX__)
 -static mutex_t suspend_ack_lock = MUTEX_INITIALIZER;
 -static pthread_cond_t suspend_cond = PTHREAD_COND_INITIALIZER;
  #endif
  
- /* mutexes used by the fake atomic instructions                               */
- #if defined(USE_FAKE_ATOMIC_INSTRUCTIONS)
- mutex_t _cas_lock = MUTEX_INITIALIZER;
- mutex_t _mb_lock = MUTEX_INITIALIZER;
- #endif
 -#endif /* ENABLE_GC_CACAO */
--
  
  /* threads_sem_init ************************************************************
   
Simple merge
index d978a70e4d45224e01d61056321422e89e31749c,de3146bbc1f05781d8f2b001226fd4e9c205c276..5a0c0497b3512800e979c59b2adcbe2f7f9cbd12
@@@ -179,6 -180,114 +180,88 @@@ void md_signal_handler_sigusr2(int sig
  #endif
  
  
 -/* md_critical_section_restart *************************************************
 -
 -   Search the critical sections tree for a matching section and set
 -   the PC to the restart point, if necessary.
 -
 -*******************************************************************************/
 -
 -#if defined(ENABLE_THREADS)
 -void md_critical_section_restart(ucontext_t *_uc)
 -{
 -      mcontext_t *_mc;
 -      u1         *pc;
 -      u1         *npc;
 -
 -      _mc = &(_uc->uc_mcontext);
 -
 -      pc = (u1 *) _mc->gp_regs[PT_NIP];
 -
 -      npc = critical_find_restart_point(pc);
 -
 -      if (npc != NULL)
 -              _mc->gp_regs[PT_NIP] = (ptrint) npc;
 -}
 -#endif
 -
 -
+ /* md_executionstate_read ******************************************************
+    Read the given context into an executionstate.
+ *******************************************************************************/
+ void md_executionstate_read(executionstate_t *es, void *context)
+ {
+ #if 0
+       ucontext_t    *_uc;
+       mcontext_t    *_mc;
+       unsigned long *_gregs;
+       s4              i;
+       _uc = (ucontext_t *) context;
+       _mc    = _uc->uc_mcontext.uc_regs;
+       _gregs = _mc->gregs;
+       /* read special registers */
+       es->pc = (u1 *) _gregs[PT_NIP];
+       es->sp = (u1 *) _gregs[REG_SP];
+       es->pv = (u1 *) _gregs[REG_PV];
+       es->ra = (u1 *) _gregs[PT_LNK];
+       /* read integer registers */
+       for (i = 0; i < INT_REG_CNT; i++)
+               es->intregs[i] = _gregs[i];
+       /* read float registers */
+       /* Do not use the assignment operator '=', as the type of
+        * the _mc->fpregs[i] can cause invalid conversions. */
+       assert(sizeof(_mc->fpregs.fpregs) == sizeof(es->fltregs));
+       system_memcpy(&es->fltregs, &_mc->fpregs.fpregs, sizeof(_mc->fpregs.fpregs));
+ #endif
+       vm_abort("md_executionstate_read: IMPLEMENT ME!");
+ }
+ /* md_executionstate_write *****************************************************
+    Write the given executionstate back to the context.
+ *******************************************************************************/
+ void md_executionstate_write(executionstate_t *es, void *context)
+ {
+ #if 0
+       ucontext_t    *_uc;
+       mcontext_t    *_mc;
+       unsigned long *_gregs;
+       s4              i;
+       _uc = (ucontext_t *) context;
+       _mc    = _uc->uc_mcontext.uc_regs;
+       _gregs = _mc->gregs;
+       /* write integer registers */
+       for (i = 0; i < INT_REG_CNT; i++)
+               _gregs[i] = es->intregs[i];
+       /* write float registers */
+       /* Do not use the assignment operator '=', as the type of
+        * the _mc->fpregs[i] can cause invalid conversions. */
+       assert(sizeof(_mc->fpregs.fpregs) == sizeof(es->fltregs));
+       system_memcpy(&_mc->fpregs.fpregs, &es->fltregs, sizeof(_mc->fpregs.fpregs));
+       /* write special registers */
+       _gregs[PT_NIP] = (ptrint) es->pc;
+       _gregs[REG_SP] = (ptrint) es->sp;
+       _gregs[REG_PV] = (ptrint) es->pv;
+       _gregs[PT_LNK] = (ptrint) es->ra;
+ #endif
+       vm_abort("md_executionstate_write: IMPLEMENT ME!");
+ }
  /*
   * These are local overrides for various environment variables in Emacs.
   * Please do not remove this and leave it at the end of the file, where