Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : 

http://hackage.haskell.org/trac/ghc/changeset/226541c418258e486399a6ebe3814bdac99af461

>---------------------------------------------------------------

commit 226541c418258e486399a6ebe3814bdac99af461
Author: Karel Gardas <[email protected]>
Date:   Tue Jul 5 20:12:14 2011 +0200

    make StgReturn and cas functions Thumb friendly

>---------------------------------------------------------------

 includes/stg/SMP.h |    2 ++
 rts/StgCRun.c      |   15 ++++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/includes/stg/SMP.h b/includes/stg/SMP.h
index 0b7592d..4770db9 100644
--- a/includes/stg/SMP.h
+++ b/includes/stg/SMP.h
@@ -216,8 +216,10 @@ cas(StgVolatilePtr p, StgWord o, StgWord n)
         "1:     ldrex   %1, [%2]\n"
         "       mov     %0, #0\n"
         "       teq     %1, %3\n"
+        "       it      eq\n"
         "       strexeq %0, %4, [%2]\n"
         "       teq     %0, #1\n"
+        "       it      eq\n"
         "       beq     1b\n"
                 : "=&r"(tmp), "=&r"(result)
                 : "r"(p), "r"(o), "r"(n)
diff --git a/rts/StgCRun.c b/rts/StgCRun.c
index 9e976ef..6182775 100644
--- a/rts/StgCRun.c
+++ b/rts/StgCRun.c
@@ -1,6 +1,6 @@
 /* 
-----------------------------------------------------------------------------
  *
- * (c) The GHC Team, 1998-2003
+ * (c) The GHC Team, 1998-2011
  *
  * STG-to-C glue.
  *
@@ -982,6 +982,13 @@ StgRun(StgFunPtr f, StgRegTable *basereg)
    -------------------------------------------------------------------------- 
*/
 
 #ifdef arm_HOST_ARCH
+
+#if defined(__thumb__)
+#define THUMB_FUNC ".thumb\n\t.thumb_func\n\t"
+#else
+#define THUMB_FUNC
+#endif
+
 StgRegTable *
 StgRun(StgFunPtr f, StgRegTable *basereg) {
     StgRegTable * r;
@@ -1003,9 +1010,11 @@ StgRun(StgFunPtr f, StgRegTable *basereg) {
         /*
          * Jump to function argument.
          */
-        "mov pc, %1\n\t"
+        "bx %1\n\t"
 
-       ".global " STG_RETURN "\n"
+       ".global " STG_RETURN "\n\t"
+        THUMB_FUNC
+        ".type " STG_RETURN ", %%function\n"
                STG_RETURN ":\n\t"
         /*
          * Free the space we allocated



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to