[mapguide-commits] r7323 - in branches/2.5/MgDev/Oem/DWFTK7.1/develop/global: build/gnu/dwfcore/files src/dwfcore src/dwfcore/x64

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sun Jan 20 04:48:56 PST 2013


Author: jng
Date: 2013-01-20 04:48:56 -0800 (Sun, 20 Jan 2013)
New Revision: 7323

Added:
   branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/x64/Makefile.am
Modified:
   branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/build/gnu/dwfcore/files/configure.in
   branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/Core.h
   branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/Makefile.am
   branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/x64/Core.cpp
   branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/x64/Timer.cpp
Log:
#1657: 64-bit compilation support for DWF Toolkit. The key problem was the lack of a linux 64-bit implementation of DWFTimer and a bad 64-bit platform pre-processor check. The required implementation of DWFTimer was backported from DWF Toolkit 7.7 and Core.h has been updated with the correct 64-bit check

Modified: branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/build/gnu/dwfcore/files/configure.in
===================================================================
--- branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/build/gnu/dwfcore/files/configure.in	2013-01-20 09:24:28 UTC (rev 7322)
+++ branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/build/gnu/dwfcore/files/configure.in	2013-01-20 12:48:56 UTC (rev 7323)
@@ -107,6 +107,6 @@
 rm gccver.txt
 rm gcc32.txt
 
-AC_OUTPUT(Makefile ansi/Makefile mac/Makefile zip/Makefile zlib/Makefile x86/Makefile)
+AC_OUTPUT(Makefile ansi/Makefile mac/Makefile zip/Makefile zlib/Makefile x86/Makefile x64/Makefile)
 
 

Modified: branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/Core.h
===================================================================
--- branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/Core.h	2013-01-20 09:24:28 UTC (rev 7322)
+++ branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/Core.h	2013-01-20 12:48:56 UTC (rev 7323)
@@ -44,7 +44,7 @@
 
 #if     defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686) || defined(_M_IX86)
 #define _DWFCORE_X86_SYSTEM
-#elif   defined(_WIN64)
+#elif   defined(_M_X64) || defined(__x86_64__) //DWFTK 7.7 backport
 #define _DWFCORE_X64_SYSTEM
 #elif   defined(_M_ALPHA)
 #define _DWFCORE_ALPHA_SYSTEM

Modified: branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/Makefile.am
===================================================================
--- branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/Makefile.am	2013-01-20 09:24:28 UTC (rev 7322)
+++ branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/Makefile.am	2013-01-20 12:48:56 UTC (rev 7323)
@@ -1,6 +1,6 @@
 AUTOMAKE_OPTIONS = nostdinc
 INCLUDES = -I..
-SUBDIRS = ansi mac x86 zip zlib
+SUBDIRS = ansi mac x86 x64 zip zlib
 
 
 pkginclude_HEADERS = BufferInputStream.h BufferOutputStream.h Comparator.h Core.h CountedObject.h DecompressingInputStream.h Exception.h File.h FileDescriptor.h FileInputStream.h FileOutputStream.h Hash.h InputStream.h Iterator.h MIME.h MonitoredInputStream.h OutputStream.h Owner.h Pointer.h SkipList.h STL.h StreamFileDescriptor.h String.h Synchronization.h TempFile.h ThreadPool.h Timer.h UnzippingInputStream.h UTF8EncodingOutputStream.h UUID.h Version.h XMLEncodingOutputStream.h ZipFileDescriptor.h ZippingOutputStream.h
@@ -11,4 +11,4 @@
 
 libdwfcore_la_SOURCES = BufferInputStream.cpp BufferOutputStream.cpp DecompressingInputStream.cpp Exception.cpp File.cpp FileInputStream.cpp FileOutputStream.cpp MIME.cpp MonitoredInputStream.cpp Owner.cpp ThreadPool.cpp UnzippingInputStream.cpp UTF8EncodingOutputStream.cpp UUID.cpp XMLEncodingOutputStream.cpp ZipFileDescriptor.cpp ZippingOutputStream.cpp 
 
-libdwfcore_la_LIBADD = $(top_builddir)/ansi/libdwfcoreansi.la $(top_builddir)/mac/libdwfcoremac.la  $(top_builddir)/x86/libdwfcorex86.la $(top_builddir)/zlib/libdwfcorezlib.la $(top_builddir)/zip/libdwfcorezip.la
+libdwfcore_la_LIBADD = $(top_builddir)/ansi/libdwfcoreansi.la $(top_builddir)/mac/libdwfcoremac.la  $(top_builddir)/x86/libdwfcorex86.la $(top_builddir)/x64/libdwfcorex64.la $(top_builddir)/zlib/libdwfcorezlib.la $(top_builddir)/zip/libdwfcorezip.la

Modified: branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/x64/Core.cpp
===================================================================
--- branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/x64/Core.cpp	2013-01-20 09:24:28 UTC (rev 7322)
+++ branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/x64/Core.cpp	2013-01-20 12:48:56 UTC (rev 7323)
@@ -50,14 +50,80 @@
    return InterlockedDecrement((volatile long*)pValue);
 }
 
-#elif _DWFCORE_LINUX_SYSTEM
+#elif defined(_DWFCORE_LINUX_SYSTEM)
 
 //
 //  TODO: Need 64-bit Linux
 //  for AtomicIncrement and AtomicDecrement
 //
 
+// NOTE: Backported from DWF Toolkit 7.7
+
+#ifdef  HAVE_CONFIG_H
+		#include "dwfcore/config.h"
+
+			#if !defined( _DWFCORE_USE_ASM_ATOMIC_H ) && !defined( _DWFCORE_USE_ALSA_IATOMIC_H )
+
+				#if     defined( HAVE_ASM_ATOMIC_H )
+				#include <asm/atomic.h>
+				#elif   defined( HAVE_ALSA_IATOMIC_H )
+				#include <alsa/iatomic.h>
+				#else
+				#error  Missing header file - cannot continue
+				#endif
+
+
+				//
+				// change LOCK to _DWFCORE_ATOMIC_LOCK
+				// to prevent any unexpected redefinitions
+				//
+				#ifdef __SMP__
+				#define _DWFCORE_ATOMIC_LOCK "lock ; "
+				#else
+				#define _DWFCORE_ATOMIC_LOCK ""
+				#endif
+
+				namespace DWFCore
+				{
+
+					_DWFCORE_API
+						int
+						AtomicIncrement( volatile int* pValue )
+						throw()
+					{
+						atomic_t tValue;
+						atomic_set( &tValue, *pValue );
+
+						__asm__ __volatile__(
+							_DWFCORE_ATOMIC_LOCK "incl %0"
+							:"=m" (tValue.counter)
+							:"m" (tValue.counter));
+
+						*pValue = atomic_read( &tValue );
+						return *pValue;
+					}
+
+					_DWFCORE_API
+						int
+						AtomicDecrement( volatile int* pValue )
+						throw()
+					{
+						atomic_t tValue;
+						atomic_set( &tValue, *pValue );
+
+						__asm__ __volatile__(
+							_DWFCORE_ATOMIC_LOCK "decl %0"
+							:"=m" (tValue.counter)
+							:"m" (tValue.counter));
+
+						*pValue = atomic_read( &tValue );
+						return *pValue;
+					}
+
+				}
 #endif
+#endif
+#endif
 
 #endif
 

Added: branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/x64/Makefile.am
===================================================================
--- branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/x64/Makefile.am	                        (rev 0)
+++ branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/x64/Makefile.am	2013-01-20 12:48:56 UTC (rev 7323)
@@ -0,0 +1,7 @@
+AUTOMAKE_OPTIONS = nostdinc
+INCLUDES = -I../..
+
+noinst_LTLIBRARIES =  libdwfcorex64.la
+libdwfcorex64_la_LDFLAGS = -avoid-version 
+
+libdwfcorex64_la_SOURCES =  Core.cpp Timer.cpp

Modified: branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/x64/Timer.cpp
===================================================================
--- branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/x64/Timer.cpp	2013-01-20 09:24:28 UTC (rev 7322)
+++ branches/2.5/MgDev/Oem/DWFTK7.1/develop/global/src/dwfcore/x64/Timer.cpp	2013-01-20 12:48:56 UTC (rev 7323)
@@ -131,12 +131,138 @@
     return _nTick;
 }
 
-#elif _DWFCORE_LINUX_SYSTEM
+#elif defined(_DWFCORE_LINUX_SYSTEM)
 
 //
 //  TODO: Need 64-bit Linux
 //
 
+// NOTE: Implementation backported from DWF Toolkit 7.7
+
+_DWFCORE_API
+DWFTimer::DWFTimer()
+throw()
+: _nTick( 0 )
+{
+	;
+}
+
+_DWFCORE_API
+DWFTimer::DWFTimer( const DWFTimer& rTimer )
+throw()
+: _nTick( rTimer._nTick )
+{
+	;
+}
+
+_DWFCORE_API
+DWFTimer&
+DWFTimer::operator=( const DWFTimer& rTimer )
+throw()
+{
+	_nTick = rTimer._nTick;
+	return *this;
+}
+
+_DWFCORE_API
+DWFTimer::~DWFTimer()
+throw()
+{
+}
+
+_DWFCORE_API
+unsigned long
+DWFTimer::Tick32()
+throw()
+{
+	unsigned long eax = 0L;
+
+	__asm__ __volatile__( ".byte 15, 49" : : : "eax", "edx" );
+	__asm__ __volatile__( "movq %%rax, %0" : "=r"(eax) );
+
+	//
+	// gcc is checking no return
+	//
+	return eax;
+
+	//
+	// lower 32-bits in eax
+	//
+}
+
+_DWFCORE_API
+uint64_t
+DWFTimer::Tick64()
+throw()
+{
+	unsigned long eax = 0L;
+	unsigned long edx = 0L;
+
+	__asm__ __volatile__( ".byte 15, 49" : : : "eax", "edx" );
+	__asm__ __volatile__( "movq %%rax, %0; movq %%rdx, %1": "=r"(eax), "=r"(edx) );
+
+	//
+	// gcc is checking no return
+	//
+	uint64_t nTick64 = edx;
+	nTick64 <<= 32;
+	nTick64 |= eax;
+	return nTick64;
+
+	//
+	// lower 32-bits in eax
+	// upper 32-bits in edx
+	//
+}
+
+_DWFCORE_API
+void
+DWFTimer::start()
+throw()
+{
+	_nTick = Tick64();
+}
+
+_DWFCORE_API
+unsigned long
+DWFTimer::tick32()
+throw()
+{
+	return (Tick32() - (unsigned long)(0x00000000ffffffff & _nTick));
+}
+
+_DWFCORE_API
+uint64_t
+DWFTimer::tick64()
+throw()
+{
+	return (Tick64() - _nTick);
+}
+
+_DWFCORE_API
+void
+DWFTimer::stop()
+throw()
+{
+	_nTick = (Tick64() - _nTick);
+}
+
+_DWFCORE_API
+unsigned long
+DWFTimer::timer32()
+throw()
+{
+	return (unsigned long)(0x00000000ffffffff & _nTick);
+}
+
+_DWFCORE_API
+uint64_t
+DWFTimer::timer64()
+throw()
+{
+	return _nTick;
+}
+
 #endif
 
 



More information about the mapguide-commits mailing list