Revision: 1229
http://vcs.pcre.org/viewvc?view=rev&revision=1229
Author: zherczeg
Date: 2012-12-06 17:51:34 +0000 (Thu, 06 Dec 2012)
Log Message:
-----------
JIT compiler update
Modified Paths:
--------------
code/trunk/config-cmake.h.in
code/trunk/sljit/sljitConfigInternal.h
code/trunk/sljit/sljitLir.h
code/trunk/sljit/sljitNativeMIPS_common.c
code/trunk/sljit/sljitNativeSPARC_common.c
code/trunk/sljit/sljitNativeX86_common.c
Modified: code/trunk/config-cmake.h.in
===================================================================
--- code/trunk/config-cmake.h.in 2012-11-30 11:00:19 UTC (rev 1228)
+++ code/trunk/config-cmake.h.in 2012-12-06 17:51:34 UTC (rev 1229)
@@ -51,4 +51,8 @@
#define MAX_NAME_SIZE 32
#define MAX_NAME_COUNT 10000
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS 1
+#endif
+
/* end config.h for CMake builds */
Modified: code/trunk/sljit/sljitConfigInternal.h
===================================================================
--- code/trunk/sljit/sljitConfigInternal.h 2012-11-30 11:00:19 UTC (rev 1228)
+++ code/trunk/sljit/sljitConfigInternal.h 2012-12-06 17:51:34 UTC (rev 1229)
@@ -104,7 +104,7 @@
#define SLJIT_CONFIG_PPC_64 1
#elif defined(__ppc__) || defined(__powerpc__) || defined(_ARCH_PPC) || defined(_ARCH_PWR) || defined(_ARCH_PWR2) || defined(_POWER)
#define SLJIT_CONFIG_PPC_32 1
-#elif defined(__mips__)
+#elif defined(__mips__) && !defined(_LP64)
#define SLJIT_CONFIG_MIPS_32 1
#elif defined(__sparc__) || defined(__sparc)
#define SLJIT_CONFIG_SPARC_32 1
@@ -173,9 +173,13 @@
#endif /* !defined(SLJIT_LIKELY) && !defined(SLJIT_UNLIKELY) */
#ifndef SLJIT_INLINE
-/* Inline functions. */
+/* Inline functions. Some old compilers do not support them. */
+#if defined(__SUNPRO_C) && __SUNPRO_C <= 0x510
+#define SLJIT_INLINE
+#else
#define SLJIT_INLINE __inline
#endif
+#endif /* !SLJIT_INLINE */
#ifndef SLJIT_CONST
/* Const variables. */
Modified: code/trunk/sljit/sljitLir.h
===================================================================
--- code/trunk/sljit/sljitLir.h 2012-11-30 11:00:19 UTC (rev 1228)
+++ code/trunk/sljit/sljitLir.h 2012-12-06 17:51:34 UTC (rev 1229)
@@ -896,7 +896,7 @@
/* --------------------------------------------------------------------- */
#define SLJIT_MAJOR_VERSION 0
-#define SLJIT_MINOR_VERSION 90
+#define SLJIT_MINOR_VERSION 91
/* Get the human readable name of the platform. Can be useful on platforms
like ARM, where ARM and Thumb2 functions can be mixed, and
Modified: code/trunk/sljit/sljitNativeMIPS_common.c
===================================================================
--- code/trunk/sljit/sljitNativeMIPS_common.c 2012-11-30 11:00:19 UTC (rev 1228)
+++ code/trunk/sljit/sljitNativeMIPS_common.c 2012-12-06 17:51:34 UTC (rev 1229)
@@ -30,7 +30,7 @@
SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void)
{
#if (defined SLJIT_MIPS_32_64 && SLJIT_MIPS_32_64)
- return "MIPS" SLJIT_CPUINFO;
+ return "MIPS(32)" SLJIT_CPUINFO;
#else
return "MIPS III" SLJIT_CPUINFO;
#endif
Modified: code/trunk/sljit/sljitNativeSPARC_common.c
===================================================================
--- code/trunk/sljit/sljitNativeSPARC_common.c 2012-11-30 11:00:19 UTC (rev 1228)
+++ code/trunk/sljit/sljitNativeSPARC_common.c 2012-12-06 17:51:34 UTC (rev 1229)
@@ -35,6 +35,30 @@
static void sparc_cache_flush(sljit_ins *from, sljit_ins *to)
{
+#if defined(__SUNPRO_C) && __SUNPRO_C < 0x590
+ __asm (
+ /* if (from == to) return */
+ "cmp %i0, %i1\n"
+ "be .leave\n"
+ "nop\n"
+
+ /* loop until from >= to */
+ ".mainloop:\n"
+ "flush %i0\n"
+ "add %i0, 8, %i0\n"
+ "cmp %i0, %i1\n"
+ "bcs .mainloop\n"
+ "nop\n"
+
+ /* The comparison was done above. */
+ "bne .leave\n"
+ /* nop is not necessary here, since the
+ sub operation has no side effect. */
+ "sub %i0, 4, %i0\n"
+ "flush %i0\n"
+ ".leave:"
+ );
+#else
if (SLJIT_UNLIKELY(from == to))
return;
@@ -49,12 +73,13 @@
if (from == to) {
/* Flush the last word. */
- to --;
+ from --;
__asm__ volatile (
"flush %0\n"
- : : "r"(to)
+ : : "r"(from)
);
}
+#endif
}
/* TMP_REG2 is not used by getput_arg */
Modified: code/trunk/sljit/sljitNativeX86_common.c
===================================================================
--- code/trunk/sljit/sljitNativeX86_common.c 2012-11-30 11:00:19 UTC (rev 1228)
+++ code/trunk/sljit/sljitNativeX86_common.c 2012-12-06 17:51:34 UTC (rev 1229)
@@ -267,75 +267,46 @@
#endif
static sljit_si cpu_has_cmov = -1;
-#if defined(_MSC_VER) && (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-#if _MSC_VER >= 1400
+#if defined(_MSC_VER) && _MSC_VER >= 1400
#include <intrin.h>
-#else
-#error "MSVC does not support inline assembly in 64 bit mode"
#endif
-#endif /* _MSC_VER && SLJIT_CONFIG_X86_64 */
static void get_cpu_features(void)
{
sljit_ui features;
-#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
+#if defined(_MSC_VER) && _MSC_VER >= 1400
-#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__SUNPRO_C)
- /* AT&T syntax. */
- __asm__ (
- "pushl %%ebx\n"
- "movl $0x1, %%eax\n"
- "cpuid\n"
- "popl %%ebx\n"
- "movl %%edx, %0\n"
- : "=g" (features)
- :
- : "%eax", "%ecx", "%edx"
- );
-#elif defined(_MSC_VER) || defined(__BORLANDC__)
- /* Intel syntax. */
- __asm {
- mov eax, 1
- push ebx
- cpuid
- pop ebx
- mov features, edx
- }
-#else
-# error "SLJIT_DETECT_SSE2 is not implemented for this C compiler"
-#endif
+ int CPUInfo[4];
+ __cpuid(CPUInfo, 1);
+ features = (sljit_ui)CPUInfo[3];
-#else /* SLJIT_CONFIG_X86_32 */
+#elif defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__SUNPRO_C)
-#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__SUNPRO_C)
/* AT&T syntax. */
__asm__ (
- "pushq %%rbx\n"
"movl $0x1, %%eax\n"
"cpuid\n"
- "popq %%rbx\n"
"movl %%edx, %0\n"
: "=g" (features)
:
- : "%rax", "%rcx", "%rdx"
+#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
+ : "%eax", "%ebx", "%ecx", "%edx"
+#else
+ : "%rax", "%rbx", "%rcx", "%rdx"
+#endif
);
-#elif defined(_MSC_VER) && _MSC_VER >= 1400
- int CPUInfo[4];
- __cpuid(CPUInfo, 1);
- features = (sljit_ui)CPUInfo[3];
-#else
+#else /* _MSC_VER && _MSC_VER >= 1400 */
+
+ /* Intel syntax. */
__asm {
mov eax, 1
- push rbx
cpuid
- pop rbx
mov features, edx
}
-#endif
-#endif /* SLJIT_CONFIG_X86_32 */
+#endif /* _MSC_VER && _MSC_VER >= 1400 */
#if (defined SLJIT_SSE2 && SLJIT_SSE2) && (defined SLJIT_DETECT_SSE2 && SLJIT_DETECT_SSE2)
cpu_has_sse2 = (features >> 26) & 0x1;
@@ -650,9 +621,10 @@
This function touches all 4k pages belongs to the requested stack space,
which size is passed in local_size. This is necessary on Windows where
the stack can only grow in 4k steps. However, this function just burn
- CPU cycles if the stack is large enough, but you don't know it in advance.
- I think this is a bad design even if it has some reasons. */
- alloca(local_size);
+ CPU cycles if the stack is large enough. However, you don't know it in
+ advance, so it must always be called. I think this is a bad design in
+ general even if it has some reasons. */
+ *(sljit_si*)alloca(local_size) = 0;
}
#endif