[Vm-dev] [commit][3680] Fix slowdown of update on 64-bit x64 by using int variables for the tides in

commits at squeakvm.org commits at squeakvm.org
Fri Apr 22 23:26:28 UTC 2016


Revision: 3680
Author:   eliot
Date:     2016-04-22 16:26:26 -0700 (Fri, 22 Apr 2016)
Log Message:
-----------
Fix slowdown of update on 64-bit x64 by using int variables for the tides in
sqExternalSemaphores.c and inline assembler for the sqCompareAndSwap in
sqAtomicOps.h.

Modified Paths:
--------------
    branches/Cog/platforms/Cross/vm/sqAtomicOps.h
    branches/Cog/platforms/Cross/vm/sqExternalSemaphores.c

Property Changed:
----------------
    branches/Cog/platforms/Cross/vm/sqSCCSVersion.h

Modified: branches/Cog/platforms/Cross/vm/sqAtomicOps.h
===================================================================
--- branches/Cog/platforms/Cross/vm/sqAtomicOps.h	2016-04-22 21:01:09 UTC (rev 3679)
+++ branches/Cog/platforms/Cross/vm/sqAtomicOps.h	2016-04-22 23:26:26 UTC (rev 3680)
@@ -236,18 +236,20 @@
 #	define sqCompareAndSwap(var,old,new) \
 	__sync_bool_compare_and_swap(&(var), old, new)
 
-# elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_X86_)
-	/* support for gcc 3.x; 32-bit only */
+# elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_X86_) \
+    || defined(x86_64) || defined(__x86_64) || defined(__x86_64__)
+	/* support for gcc 3.x, clang; 32-bit only */
 	/* N.B.  One cannot test the result of this expression.  If you need that
 	 * you'll have to wrap the code in a function and return the result.  This
 			sete %%al;movzbl %%al,%%eax
 	 * can be used to set al based on the condition code & extend it to 32-bits.
 	 */
 #	define sqCompareAndSwap(var,old,new) \
-	asm volatile ("movl %1, %%eax; lock cmpxchg %2, %0"\
+	(assert(sizeof(var) == 4), \
+	 asm volatile ("movl %1, %%eax; lock cmpxchg %2, %0"\
 						: "=m"(var) \
 						: "g"(old), "r"(new), "m"(var) \
-						: "memory", "%eax")
+						: "memory", "%eax"))
 # endif
 
 #else

Modified: branches/Cog/platforms/Cross/vm/sqExternalSemaphores.c
===================================================================
--- branches/Cog/platforms/Cross/vm/sqExternalSemaphores.c	2016-04-22 21:01:09 UTC (rev 3679)
+++ branches/Cog/platforms/Cross/vm/sqExternalSemaphores.c	2016-04-22 23:26:26 UTC (rev 3680)
@@ -80,8 +80,8 @@
  * save significant lengths of time.
  */
 static volatile int useTideA = 1;
-static volatile sqInt lowTideA = (usqInt)-1 >> 1, highTideA = -1;
-static volatile sqInt lowTideB = (usqInt)-1 >> 1, highTideB = -1;
+static volatile int lowTideA = (usqInt)-1 >> 1, highTideA = -1;
+static volatile int lowTideB = (usqInt)-1 >> 1, highTideB = -1;
 
 int
 ioGetMaxExtSemTableSize(void) { return numSignalRequests; }


Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
   - Fri Apr 22 13:58:55 PDT 2016
   + Fri Apr 22 16:25:13 PDT 2016



More information about the Vm-dev mailing list