aboutsummaryrefslogtreecommitdiff
path: root/externals/grill
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2005-05-10 10:56:47 +0000
committerThomas Grill <xovo@users.sourceforge.net>2005-05-10 10:56:47 +0000
commite73b9183f3f60fba1dfc6ae7130b3a41e6a8c506 (patch)
tree37d1eea3d42353c101c2b04ba4b604e2127e2d54 /externals/grill
parent620adaeeb584611e6a13932083bf388f8a26b99f (diff)
better c++ compliance
fixes for MinGW fixes for older compilers added X86-64 code for lockfree fifos svn path=/trunk/; revision=2935
Diffstat (limited to 'externals/grill')
-rw-r--r--externals/grill/flext/source/flcontainers.h66
-rw-r--r--externals/grill/flext/source/flmap.h8
-rw-r--r--externals/grill/flext/source/flstdc.h8
3 files changed, 75 insertions, 7 deletions
diff --git a/externals/grill/flext/source/flcontainers.h b/externals/grill/flext/source/flcontainers.h
index e1121b63..0e248ffb 100644
--- a/externals/grill/flext/source/flcontainers.h
+++ b/externals/grill/flext/source/flcontainers.h
@@ -180,9 +180,71 @@ public:
:"memory", "edx");
return n;
}
-#elif defined(__GNUC__) && FLEXT_CPU == FLEXT_CPU_X64_64
+#elif defined(__GNUC__) && FLEXT_CPU == FLEXT_CPU_X86_64
+/* attention - this only works for EMT64 or newer revisions of AMD 64-bit cpus */
-#error x86-64 architecture not supported yet
+ inline void Push(Cell *cl)
+ {
+ __asm__ __volatile__ (
+ "# LFPUSH \n\t"
+ "push %%rbx \n\t"
+ "push %%rcx \n\t"
+ "mov 0(%%rsi), %%rax \n\t"
+ "mov 8(%%rsi), %%rdx \n"
+ "1: \t"
+ "mov %%rax, %%rbx \n\t"
+ "inc %%rbx \n\t"
+ "mov %%rdx, (%%rcx) \n\t"
+ SMPLOCK "cmpxchg16b (%%rsi) \n\t"
+ "jnz 1b \n\t"
+ "pop %%rcx \n\t"
+ "pop %%rbx \n\t"
+ :/* no output */
+ :"S" (this), "c" (cl)
+ :"memory", "rax", "rdx");
+ }
+
+ inline Cell *Pop()
+ {
+ Cell *v=0;
+ __asm__ __volatile__ (
+ "# LFPOP \n\t"
+ "push %%rbx \n\t"
+ "push %%rcx \n\t"
+ "mov 8(%%rsi), %%rdx \n\t"
+ "mov (%%rsi), %%rax \n\t"
+ "test %%rax, %%rax \n\t"
+ "jz 20f \n"
+ "10: \t"
+ "mov (%%rax), %%rbx \n\t"
+ "mov %%rdx, %%rcx \n\t"
+ "inc %%rcx \n\t"
+ SMPLOCK "cmpxchg16b (%%rsi) \n\t"
+ "jz 20f \n\t"
+ "test %%rax, %%rax \n\t"
+ "jnz 10b \n"
+ "20: \t"
+ "pop %%rcx \n\t"
+ "pop %%rbx \n\t"
+ :"=a" (v)
+ :"S" (&this->top)
+ :"memory", "rdx");
+ return v;
+ }
+
+ inline size_t Size() const
+ {
+ size_t n;
+ __asm__ __volatile__ (
+ "# LFSIZE \n\t"
+ "mov 16(%%rsi), %%rdx \n\t"
+ "mov (%%rsi), %%rax \n\t"
+ "sub %%rdx, %%rax \n\t"
+ :"=a" (n)
+ :"S" (this)
+ :"memory", "rdx");
+ return n;
+ }
#elif defined(__GNUC__) && FLEXT_CPU == FLEXT_CPU_PPC
inline void Push(register Cell *cl)
diff --git a/externals/grill/flext/source/flmap.h b/externals/grill/flext/source/flmap.h
index 8d249776..e748356c 100644
--- a/externals/grill/flext/source/flmap.h
+++ b/externals/grill/flext/source/flmap.h
@@ -178,6 +178,11 @@ public:
void _getsmall(Data &dt);
void _getbig(Data &dt);
+
+private:
+ // hide, so that it can't be used.....
+ explicit TableAnyMap(const TableAnyMap &): data(NULL) {}
+ TableAnyMap &operator =(const TableAnyMap &) { return *this; }
};
template <typename K,typename T,int N = 8>
@@ -240,6 +245,9 @@ protected:
int count;
Data slots[N];
+
+private:
+ explicit TablePtrMap(const TableAnyMap &p) {}
};
//! @} // FLEXT_SUPPORT
diff --git a/externals/grill/flext/source/flstdc.h b/externals/grill/flext/source/flstdc.h
index b8eef0d5..d0c2c163 100644
--- a/externals/grill/flext/source/flstdc.h
+++ b/externals/grill/flext/source/flstdc.h
@@ -26,11 +26,9 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <math.h>
#endif
-#ifdef FLEXT_DEBUG
-#if FLEXT_OS == FLEXT_OS_WIN
+#ifdef _MSC_VER
#include <crtdbg.h>
#endif
-#endif
// PD stuff
@@ -231,7 +229,7 @@ typedef t_symbol *t_symptr;
#ifdef FLEXT_LOGGING
/* If FLEXT_LOGGING is defined implement logging */
-#if FLEXT_OS == FLEXT_OS_WIN
+#ifdef _MSC_VER
#define FLEXT_LOG(s) _CrtDbgReport(_CRT_WARN,__FILE__,__LINE__,"flext",s)
#define FLEXT_LOG1(s,v1) _CrtDbgReport(_CRT_WARN,__FILE__,__LINE__,"flext",s,v1)
#define FLEXT_LOG2(s,v1,v2) _CrtDbgReport(_CRT_WARN,__FILE__,__LINE__,"flext",s,v1,v2)
@@ -272,7 +270,7 @@ typedef t_symbol *t_symptr;
#endif
#ifdef FLEXT_DEBUG
-#if FLEXT_OS == FLEXT_OS_WIN
+#ifdef _MSC_VER
#define FLEXT_ASSERT(b) (!(b)?_CrtDbgReport(_CRT_ASSERT,__FILE__,__LINE__,"flext",#b):1)
#define FLEXT_WARN(str) _CrtDbgReport(_CRT_WARN,__FILE__,__LINE__,"flext",NULL)
#define FLEXT_ERROR(str) _CrtDbgReport(_CRT_ERROR,__FILE__,__LINE__,"flext",NULL)