[Pcre-svn] [1493] code/trunk/sljit: Minor JIT compiler updat…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1493] code/trunk/sljit: Minor JIT compiler update.
Revision: 1493
          http://vcs.pcre.org/viewvc?view=rev&revision=1493
Author:   zherczeg
Date:     2014-07-09 05:41:15 +0100 (Wed, 09 Jul 2014)


Log Message:
-----------
Minor JIT compiler update.

Modified Paths:
--------------
    code/trunk/sljit/sljitConfigInternal.h
    code/trunk/sljit/sljitLir.c
    code/trunk/sljit/sljitLir.h
    code/trunk/sljit/sljitNativeARM_32.c
    code/trunk/sljit/sljitNativeARM_T2_32.c
    code/trunk/sljit/sljitNativeX86_64.c


Modified: code/trunk/sljit/sljitConfigInternal.h
===================================================================
--- code/trunk/sljit/sljitConfigInternal.h    2014-07-08 16:16:14 UTC (rev 1492)
+++ code/trunk/sljit/sljitConfigInternal.h    2014-07-09 04:41:15 UTC (rev 1493)
@@ -155,10 +155,14 @@
 #undef SLJIT_EXECUTABLE_ALLOCATOR
 #endif


+#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7) \
+    || (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
+#define SLJIT_CONFIG_ARM_32 1
+#endif
+
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
 #define SLJIT_CONFIG_X86 1
-#elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7) \
-    || (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2) || (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
+#elif (defined SLJIT_CONFIG_ARM_32 && SLJIT_CONFIG_ARM_32) || (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
 #define SLJIT_CONFIG_ARM 1
 #elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
 #define SLJIT_CONFIG_PPC 1


Modified: code/trunk/sljit/sljitLir.c
===================================================================
--- code/trunk/sljit/sljitLir.c    2014-07-08 16:16:14 UTC (rev 1492)
+++ code/trunk/sljit/sljitLir.c    2014-07-09 04:41:15 UTC (rev 1493)
@@ -873,6 +873,8 @@
     SLJIT_UNUSED_ARG(args);
     SLJIT_UNUSED_ARG(scratches);
     SLJIT_UNUSED_ARG(saveds);
+    SLJIT_UNUSED_ARG(fscratches);
+    SLJIT_UNUSED_ARG(fsaveds);
     SLJIT_UNUSED_ARG(local_size);


     SLJIT_ASSERT(args >= 0 && args <= 3);
@@ -900,6 +902,8 @@
     SLJIT_UNUSED_ARG(args);
     SLJIT_UNUSED_ARG(scratches);
     SLJIT_UNUSED_ARG(saveds);
+    SLJIT_UNUSED_ARG(fscratches);
+    SLJIT_UNUSED_ARG(fsaveds);
     SLJIT_UNUSED_ARG(local_size);


#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)

Modified: code/trunk/sljit/sljitLir.h
===================================================================
--- code/trunk/sljit/sljitLir.h    2014-07-08 16:16:14 UTC (rev 1492)
+++ code/trunk/sljit/sljitLir.h    2014-07-09 04:41:15 UTC (rev 1493)
@@ -163,9 +163,11 @@
 #define SLJIT_R0    1
 #define SLJIT_R1    2
 #define SLJIT_R2    3
-/* Note: on x86-32, R3 - R6 are emulated (using stack loads & stores),
-   so they cannot be used for memory addressing. There is no such
-   limitation on other CPUs. */
+/* Note: on x86-32, R3 - R6 (same as S3 - S6) are emulated (they
+   are allocated on the stack). These registers are called virtual
+   and cannot be used for memory addressing (cannot be part of
+   any SLJIT_MEM1, SLJIT_MEM2 construct). There is no such
+   limitation on other CPUs. See sljit_get_register_index(). */
 #define SLJIT_R3    4
 #define SLJIT_R4    5
 #define SLJIT_R5    6
@@ -181,9 +183,11 @@
 #define SLJIT_S0    (SLJIT_NUMBER_OF_REGISTERS)
 #define SLJIT_S1    (SLJIT_NUMBER_OF_REGISTERS - 1)
 #define SLJIT_S2    (SLJIT_NUMBER_OF_REGISTERS - 2)
-/* Note: on x86-32, S3 - S6 are emulated (using stack loads & stores),
-   so they cannot be used for memory addressing. There is no such
-   limitation on other CPUs. */
+/* Note: on x86-32, S3 - S6 (same as R3 - R6) are emulated (they
+   are allocated on the stack). These registers are called virtual
+   and cannot be used for memory addressing (cannot be part of
+   any SLJIT_MEM1, SLJIT_MEM2 construct). There is no such
+   limitation on other CPUs. See sljit_get_register_index(). */
 #define SLJIT_S3    (SLJIT_NUMBER_OF_REGISTERS - 3)
 #define SLJIT_S4    (SLJIT_NUMBER_OF_REGISTERS - 4)
 #define SLJIT_S5    (SLJIT_NUMBER_OF_REGISTERS - 5)
@@ -807,15 +811,17 @@
     sljit_si src2, sljit_sw src2w);


/* The following function is a helper function for sljit_emit_op_custom.
- It returns with the real machine register index of any SLJIT_SCRATCH
- SLJIT_SAVED or SLJIT_LOCALS register.
- Note: it returns with -1 for virtual registers (all EREGs on x86-32). */
+ It returns with the real machine register index ( >=0 ) of any SLJIT_R,
+ SLJIT_S and SLJIT_SP registers.

+ Note: it returns with -1 for virtual registers (only on x86-32). */
+
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg);

 /* The following function is a helper function for sljit_emit_op_custom.
    It returns with the real machine register index of any SLJIT_FLOAT register.
-   Note: the index is divided by 2 on ARM 32 bit architectures. */
+   
+   Note: the index is always an even number on ARM (except ARM-64), MIPS, and SPARC. */


SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_float_register_index(sljit_si reg);


Modified: code/trunk/sljit/sljitNativeARM_32.c
===================================================================
--- code/trunk/sljit/sljitNativeARM_32.c    2014-07-08 16:16:14 UTC (rev 1492)
+++ code/trunk/sljit/sljitNativeARM_32.c    2014-07-09 04:41:15 UTC (rev 1493)
@@ -1975,7 +1975,7 @@
 SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_float_register_index(sljit_si reg)
 {
     check_sljit_get_float_register_index(reg);
-    return reg;
+    return reg << 1;
 }


SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *compiler,

Modified: code/trunk/sljit/sljitNativeARM_T2_32.c
===================================================================
--- code/trunk/sljit/sljitNativeARM_T2_32.c    2014-07-08 16:16:14 UTC (rev 1492)
+++ code/trunk/sljit/sljitNativeARM_T2_32.c    2014-07-09 04:41:15 UTC (rev 1493)
@@ -1512,7 +1512,7 @@
 SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_float_register_index(sljit_si reg)
 {
     check_sljit_get_float_register_index(reg);
-    return reg;
+    return reg << 1;
 }


SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *compiler,

Modified: code/trunk/sljit/sljitNativeX86_64.c
===================================================================
--- code/trunk/sljit/sljitNativeX86_64.c    2014-07-08 16:16:14 UTC (rev 1492)
+++ code/trunk/sljit/sljitNativeX86_64.c    2014-07-09 04:41:15 UTC (rev 1493)
@@ -91,7 +91,7 @@
     sljit_si args, sljit_si scratches, sljit_si saveds,
     sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
 {
-    sljit_si i, tmp, size, allocated_size;
+    sljit_si i, tmp, size, saved_register_size;
     sljit_ub *inst;


     CHECK_ERROR();
@@ -107,7 +107,7 @@
 #endif


     /* Including the return address saved by the call instruction. */
-    allocated_size = GET_SAVED_REGISTERS_SIZE(scratches, saveds, 1);
+    saved_register_size = GET_SAVED_REGISTERS_SIZE(scratches, saveds, 1);


     tmp = saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? (SLJIT_S0 + 1 - saveds) : SLJIT_FIRST_SAVED_REG;
     for (i = SLJIT_S0; i >= tmp; i--) {
@@ -172,7 +172,7 @@
 #endif
     }


-    local_size = ((local_size + FIXED_LOCALS_OFFSET + allocated_size + 16 - 1) & ~(16 - 1)) - allocated_size;
+    local_size = ((local_size + FIXED_LOCALS_OFFSET + saved_register_size + 16 - 1) & ~(16 - 1)) - saved_register_size;
     compiler->local_size = local_size;


 #ifdef _WIN64
@@ -185,9 +185,9 @@
         *inst++ = GROUP_BINARY_83;
         *inst++ = MOD_REG | SUB | 4;
         /* Allocated size for registers must be divisible by 8. */
-        SLJIT_ASSERT(!(allocated_size & 0x7));
+        SLJIT_ASSERT(!(saved_register_size & 0x7));
         /* Aligned to 16 byte. */
-        if (allocated_size & 0x8) {
+        if (saved_register_size & 0x8) {
             *inst++ = 5 * sizeof(sljit_sw);
             local_size -= 5 * sizeof(sljit_sw);
         } else {
@@ -246,7 +246,7 @@
     sljit_si args, sljit_si scratches, sljit_si saveds,
     sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
 {
-    sljit_si allocated_size;
+    sljit_si saved_register_size;


     CHECK_ERROR_VOID();
     check_sljit_set_context(compiler, args, scratches, saveds, fscratches, fsaveds, local_size);
@@ -260,8 +260,8 @@
 #endif


     /* Including the return address saved by the call instruction. */
-    allocated_size = GET_SAVED_REGISTERS_SIZE(scratches, saveds, 1);
-    compiler->local_size = ((local_size + FIXED_LOCALS_OFFSET + allocated_size + 16 - 1) & ~(16 - 1)) - allocated_size;
+    saved_register_size = GET_SAVED_REGISTERS_SIZE(scratches, saveds, 1);
+    compiler->local_size = ((local_size + FIXED_LOCALS_OFFSET + saved_register_size + 16 - 1) & ~(16 - 1)) - saved_register_size;
 }


SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)