You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by gs...@apache.org on 2007/02/22 15:48:49 UTC

svn commit: r510539 - in /harmony/enhanced/drlvm/trunk: build/make/components/vm/port.xml vm/port/include/port_atomic.h vm/port/src/atomic/win/port_atomic.c vm/port/src/atomic/win/port_atomic_em64t.asm

Author: gshimansky
Date: Thu Feb 22 06:48:47 2007
New Revision: 510539

URL: http://svn.apache.org/viewvc?view=rev&rev=510539
Log:
Applied HARMONY-3232 [drlvm][winx64] Add port atomic functions support for Windows x86_64 platform.

Build works on windows x86_64.

I've changed the header port_atomic.h and build rules. I also deleted functions
defined in port_atomic.c.


Added:
    harmony/enhanced/drlvm/trunk/vm/port/src/atomic/win/port_atomic_em64t.asm   (with props)
Modified:
    harmony/enhanced/drlvm/trunk/build/make/components/vm/port.xml
    harmony/enhanced/drlvm/trunk/vm/port/include/port_atomic.h
    harmony/enhanced/drlvm/trunk/vm/port/src/atomic/win/port_atomic.c

Modified: harmony/enhanced/drlvm/trunk/build/make/components/vm/port.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build/make/components/vm/port.xml?view=diff&rev=510539&r1=510538&r2=510539
==============================================================================
--- harmony/enhanced/drlvm/trunk/build/make/components/vm/port.xml (original)
+++ harmony/enhanced/drlvm/trunk/build/make/components/vm/port.xml Thu Feb 22 06:48:47 2007
@@ -82,6 +82,18 @@
             </select>
         </compiler>
 
+        <fileset id="asm.fileset" dir="${build.vm.home}/port/src">
+            <select os="win" arch="em64t">
+                <include name="atomic/win/*.asm" />
+            </select>
+            <select os="win" arch="ia32">
+                <exclude name="**" />
+            </select>
+            <select os="lnx">
+                <exclude name="**" />
+            </select>
+        </fileset>
+
         <compiler id="cpp.compiler" extends="common.cpp.compiler">
             <includepath>
                 <pathelement location="${build.vm.home}/include" />
@@ -118,4 +130,4 @@
             <property name="asm.args" value="-Wa,--fatal-warnings" />
         </select>
     </target>
-</project>
\ No newline at end of file
+</project>

Modified: harmony/enhanced/drlvm/trunk/vm/port/include/port_atomic.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/include/port_atomic.h?view=diff&rev=510539&r1=510538&r2=510539
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/include/port_atomic.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/include/port_atomic.h Thu Feb 22 06:48:47 2007
@@ -121,14 +121,24 @@
 
 #elif defined(_EM64T_) && defined (_WIN64)
 
+#pragma intrinsic(_InterlockedCompareExchange16);
+#pragma intrinsic(_InterlockedCompareExchange64);
+
 APR_DECLARE(uint8) port_atomic_cas8(volatile uint8 * data, 
                                                uint8 value, uint8 comp);
 
-APR_DECLARE(uint16) port_atomic_cas16(volatile uint16 * data, 
-                                                 uint16 value, uint16 comp);
+INLINE uint16 port_atomic_cas16(volatile uint16 * data, 
+                                                 uint16 value, uint16 comp)
+{
+    return _InterlockedCompareExchange16((volatile SHORT *)data, value, comp);
+}    
 
-APR_DECLARE(uint64) port_atomic_cas64(volatile uint64 * data, 
-                                                 uint64 value, uint64 comp);
+INLINE uint64 port_atomic_cas64(volatile uint64 * data, 
+                                                 uint64 value, uint64 comp)
+{
+    return _InterlockedCompareExchange64((volatile LONG64 *)data, value, comp);
+}
+    
 
 #elif defined (PLATFORM_POSIX)  
 

Modified: harmony/enhanced/drlvm/trunk/vm/port/src/atomic/win/port_atomic.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/atomic/win/port_atomic.c?view=diff&rev=510539&r1=510538&r2=510539
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/atomic/win/port_atomic.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/atomic/win/port_atomic.c Thu Feb 22 06:48:47 2007
@@ -20,28 +20,3 @@
  */  
 
 /* All code from this file was inlinied in port_atomic.h */
-
-#include <port_atomic.h>
-#include <assert.h>
-
-#if defined(_EM64T_) && defined(_WIN64)
-// TODO: these functions need to be implemented
-APR_DECLARE(uint8) port_atomic_cas8(volatile uint8 * data, 
-                                               uint8 value, uint8 comp) {
-	assert(0);
-	return 0;
-}
-
-APR_DECLARE(uint16) port_atomic_cas16(volatile uint16 * data, 
-                                                 uint16 value, uint16 comp) {
-	assert(0);
-	return 0;
-}
-
-APR_DECLARE(uint64) port_atomic_cas64(volatile uint64 * data, 
-                                                 uint64 value, uint64 comp) {
-	assert(0);
-	return 0;
-}
-
-#endif

Added: harmony/enhanced/drlvm/trunk/vm/port/src/atomic/win/port_atomic_em64t.asm
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/atomic/win/port_atomic_em64t.asm?view=auto&rev=510539
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/atomic/win/port_atomic_em64t.asm (added)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/atomic/win/port_atomic_em64t.asm Thu Feb 22 06:48:47 2007
@@ -0,0 +1,24 @@
+PUBLIC port_atomic_cas8
+
+_TEXT	SEGMENT
+
+port_atomic_cas8 PROC
+
+;uint8 port_atomic_cas8(volatile uint8 * data , uint8 value, uint8 comp)
+;
+;    rcx - *data - pointer to the byte which shoud be exchanged
+;    rdx - value - new value
+;    r8  - comp  - previous conditional value
+;
+;   It's a leaf function so no prolog and epilog are used.
+
+    mov rax, r8
+    lock cmpxchg [rcx], dl
+    ret
+
+port_atomic_cas8 ENDP
+
+_TEXT	ENDS
+
+END
+

Propchange: harmony/enhanced/drlvm/trunk/vm/port/src/atomic/win/port_atomic_em64t.asm
------------------------------------------------------------------------------
    svn:eol-style = native