Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/sljit/dist Import of sljit @ r186.



details:   https://anonhg.NetBSD.org/src/rev/2f93ed439f2c
branches:  trunk
changeset: 782321:2f93ed439f2c
user:      alnsn <alnsn%NetBSD.org@localhost>
date:      Sun Oct 28 09:36:12 2012 +0000

description:
Import of sljit @ r186.

This version adds sparc architecture. Other changes:

r184: NAN to UNORDERED renaming and other fixes.
r180: Common caching in PPC and MIPS.

diffstat:

 sys/external/bsd/sljit/dist/Makefile                            |    39 +-
 sys/external/bsd/sljit/dist/README                              |     4 +
 sys/external/bsd/sljit/dist/sljit_src/sljitLir.c                |    53 +-
 sys/external/bsd/sljit/dist/sljit_src/sljitLir.h                |    20 +-
 sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_Thumb2.c   |    30 +-
 sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_v5.c       |   184 +-
 sys/external/bsd/sljit/dist/sljit_src/sljitNativeMIPS_32.c      |   166 +-
 sys/external/bsd/sljit/dist/sljit_src/sljitNativeMIPS_common.c  |   395 +-
 sys/external/bsd/sljit/dist/sljit_src/sljitNativePPC_32.c       |    94 +-
 sys/external/bsd/sljit/dist/sljit_src/sljitNativePPC_64.c       |   123 +-
 sys/external/bsd/sljit/dist/sljit_src/sljitNativePPC_common.c   |   580 ++--
 sys/external/bsd/sljit/dist/sljit_src/sljitNativeSPARC_32.c     |   163 +
 sys/external/bsd/sljit/dist/sljit_src/sljitNativeSPARC_common.c |  1310 ++++++++++
 sys/external/bsd/sljit/dist/sljit_src/sljitNativeX86_32.c       |     1 -
 sys/external/bsd/sljit/dist/sljit_src/sljitNativeX86_64.c       |     1 -
 sys/external/bsd/sljit/dist/test_src/sljitMain.c                |     2 +-
 sys/external/bsd/sljit/dist/test_src/sljitTest.c                |    72 +-
 17 files changed, 2409 insertions(+), 828 deletions(-)

diffs (truncated from 4826 to 300 lines):

diff -r dad458b4dee5 -r 2f93ed439f2c sys/external/bsd/sljit/dist/Makefile
--- a/sys/external/bsd/sljit/dist/Makefile      Sun Oct 28 02:01:15 2012 +0000
+++ b/sys/external/bsd/sljit/dist/Makefile      Sun Oct 28 09:36:12 2012 +0000
@@ -23,31 +23,40 @@
 CFLAGS += -Isljit_src
 REGEX_CFLAGS = -fshort-wchar
 
+SLJIT_HEADERS = $(SRCDIR)/sljitLir.h $(SRCDIR)/sljitConfig.h $(SRCDIR)/sljitConfigInternal.h
+
+SLJIT_LIR_FILES = $(SRCDIR)/sljitLir.c $(SRCDIR)/sljitExecAllocator.c $(SRCDIR)/sljitUtils.c \
+       $(SRCDIR)/sljitNativeX86_common.c $(SRCDIR)/sljitNativeX86_32.c $(SRCDIR)/sljitNativeX86_64.c \
+       $(SRCDIR)/sljitNativeARM_v5.c $(SRCDIR)/sljitNativeARM_Thumb2.c \
+       $(SRCDIR)/sljitNativePPC_common.c $(SRCDIR)/sljitNativePPC_32.c $(SRCDIR)/sljitNativePPC_64.c \
+       $(SRCDIR)/sljitNativeMIPS_common.c $(SRCDIR)/sljitNativeMIPS_32.c \
+       $(SRCDIR)/sljitNativeSPARC_common.c $(SRCDIR)/sljitNativeSPARC_32.c
+
 all: $(BINDIR) $(TARGET)
 
 $(BINDIR) :
        mkdir $(BINDIR)
 
-$(BINDIR)/sljitLir.o : $(addprefix $(SRCDIR)/, sljitLir.c sljitLir.h sljitConfig.h sljitExecAllocator.c sljitNativeX86_common.c sljitNativeX86_32.c sljitNativeX86_64.c sljitNativeARM_v5.c 
sljitNativeARM_Thumb2.c sljitNativePPC_common.c sljitNativePPC_32.c sljitNativePPC_64.c sljitNativeMIPS_common.c sljitNativeMIPS_32.c) $(BINDIR)
-       $(CC) $(CFLAGS) -c -o $@ $<
+$(BINDIR)/sljitLir.o : $(BINDIR) $(SLJIT_LIR_FILES) $(SLJIT_HEADERS)
+       $(CC) $(CFLAGS) -c -o $@ $(SRCDIR)/sljitLir.c
 
-$(BINDIR)/sljitMain.o : $(TESTDIR)/sljitMain.c $(BINDIR) $(SRCDIR)/sljitLir.h $(SRCDIR)/sljitConfig.h
-       $(CC) $(CFLAGS) -c -o $@ $<
+$(BINDIR)/sljitMain.o : $(TESTDIR)/sljitMain.c $(BINDIR) $(SLJIT_HEADERS)
+       $(CC) $(CFLAGS) -c -o $@ $(TESTDIR)/sljitMain.c
 
-$(BINDIR)/sljitTest.o : $(TESTDIR)/sljitTest.c $(BINDIR) $(SRCDIR)/sljitLir.h $(SRCDIR)/sljitConfig.h
-       $(CC) $(CFLAGS) -c -o $@ $<
+$(BINDIR)/sljitTest.o : $(TESTDIR)/sljitTest.c $(BINDIR) $(SLJIT_HEADERS)
+       $(CC) $(CFLAGS) -c -o $@ $(TESTDIR)/sljitTest.c
 
-$(BINDIR)/regexMain.o : $(REGEXDIR)/regexMain.c $(BINDIR) $(REGEXDIR)/regexJIT.h $(SRCDIR)/sljitConfig.h
-       $(CC) $(CFLAGS) $(REGEX_CFLAGS) -c -o $@ $<
+$(BINDIR)/regexMain.o : $(REGEXDIR)/regexMain.c $(BINDIR) $(SLJIT_HEADERS)
+       $(CC) $(CFLAGS) $(REGEX_CFLAGS) -c -o $@ $(REGEXDIR)/regexMain.c
 
-$(BINDIR)/regexJIT.o : $(REGEXDIR)/regexJIT.c $(BINDIR) $(SRCDIR)/sljitLir.h $(SRCDIR)/sljitConfig.h $(REGEXDIR)/regexJIT.h
-       $(CC) $(CFLAGS) $(REGEX_CFLAGS) -c -o $@ $<
+$(BINDIR)/regexJIT.o : $(REGEXDIR)/regexJIT.c $(BINDIR) $(SLJIT_HEADERS) $(REGEXDIR)/regexJIT.h
+       $(CC) $(CFLAGS) $(REGEX_CFLAGS) -c -o $@ $(REGEXDIR)/regexJIT.c
 
 clean:
-       rm -f $(BINDIR)/*.o $(addprefix $(BINDIR)/, $(TARGET))
+       rm -f $(BINDIR)/*.o $(BINDIR)/sljit_test $(BINDIR)/regex_test
 
-sljit_test: $(addprefix $(BINDIR)/, sljitMain.o sljitTest.o sljitLir.o)
-       $(CC) $(LDFLAGS) $^ -o $(BINDIR)/$@ -lm
+sljit_test: $(BINDIR)/sljitMain.o $(BINDIR)/sljitTest.o $(BINDIR)/sljitLir.o
+       $(CC) $(LDFLAGS) $(BINDIR)/sljitMain.o $(BINDIR)/sljitTest.o $(BINDIR)/sljitLir.o -o $(BINDIR)/$@ -lm -lpthread
 
-regex_test: $(addprefix $(BINDIR)/, regexMain.o regexJIT.o sljitLir.o)
-       $(CC) $(LDFLAGS) $^ -o $(BINDIR)/$@ -lm
+regex_test: $(BINDIR)/regexMain.o $(BINDIR)/regexJIT.o $(BINDIR)/sljitLir.o
+       $(CC) $(LDFLAGS) $(BINDIR)/regexMain.o $(BINDIR)/regexJIT.o $(BINDIR)/sljitLir.o -o $(BINDIR)/$@ -lm -lpthread
diff -r dad458b4dee5 -r 2f93ed439f2c sys/external/bsd/sljit/dist/README
--- a/sys/external/bsd/sljit/dist/README        Sun Oct 28 02:01:15 2012 +0000
+++ b/sys/external/bsd/sljit/dist/README        Sun Oct 28 09:36:12 2012 +0000
@@ -20,3 +20,7 @@
 
 Contact:
   hzmester%freemail.hu@localhost
+
+Special thanks:
+  Alexander Nasonov
+  Daniel Richard G.
diff -r dad458b4dee5 -r 2f93ed439f2c sys/external/bsd/sljit/dist/sljit_src/sljitLir.c
--- a/sys/external/bsd/sljit/dist/sljit_src/sljitLir.c  Sun Oct 28 02:01:15 2012 +0000
+++ b/sys/external/bsd/sljit/dist/sljit_src/sljitLir.c  Sun Oct 28 09:36:12 2012 +0000
@@ -122,7 +122,7 @@
 #endif
 
 #if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
-       #define IS_CONDITIONAL  0x04
+       #define IS_COND         0x04
        #define IS_BL           0x08
        /* cannot be encoded as branch */
        #define B_TYPE0         0x00
@@ -159,11 +159,33 @@
        #define PATCH_J         0x80
 
        /* instruction types */
-       #define UNMOVABLE_INS   0
+       #define MOVABLE_INS     0
        /* 1 - 31 last destination register */
-       #define FCSR_FCC        32
        /* no destination (i.e: store) */
-       #define MOVABLE_INS     33
+       #define UNMOVABLE_INS   32
+       /* FPU status register */
+       #define FCSR_FCC        33
+#endif
+
+#if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
+       #define IS_MOVABLE      0x04
+       #define IS_COND         0x08
+       #define IS_CALL         0x10
+
+       #define PATCH_B         0x20
+       #define PATCH_CALL      0x40
+
+       /* instruction types */
+       #define MOVABLE_INS     0
+       /* 1 - 31 last destination register */
+       /* no destination (i.e: store) */
+       #define UNMOVABLE_INS   32
+
+       #define DST_INS_MASK    0xff
+
+       /* ICC_SET is the same as SET_FLAGS. */
+       #define ICC_IS_SET      (1 << 23)
+       #define FCC_IS_SET      (1 << 24)
 #endif
 
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
@@ -179,11 +201,6 @@
 #endif
 #endif
 
-#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
-#define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
-#define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_w))
-#endif
-
 #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
 #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
 #if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)
@@ -198,6 +215,16 @@
 #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_w))
 #endif
 
+#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
+#define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
+#define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_w))
+#endif
+
+#if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
+#define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
+#define FIXED_LOCALS_OFFSET (23 * sizeof(sljit_w))
+#endif
+
 #if (defined SLJIT_HAS_VARIABLE_LOCALS_OFFSET && SLJIT_HAS_VARIABLE_LOCALS_OFFSET)
 
 #define ADJUST_LOCAL_OFFSET(p, i) \
@@ -299,6 +326,10 @@
        compiler->delay_slot = UNMOVABLE_INS;
 #endif
 
+#if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
+       compiler->delay_slot = UNMOVABLE_INS;
+#endif
+
 #if (defined SLJIT_NEEDS_COMPILER_INIT && SLJIT_NEEDS_COMPILER_INIT)
        if (!compiler_initialized) {
                init_compiler();
@@ -1092,7 +1123,7 @@
 
        SLJIT_ASSERT(sljit_is_fpu_available());
        SLJIT_ASSERT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP)));
-       SLJIT_ASSERT((type & 0xff) >= SLJIT_C_FLOAT_EQUAL && (type & 0xff) <= SLJIT_C_FLOAT_NOT_NAN);
+       SLJIT_ASSERT((type & 0xff) >= SLJIT_C_FLOAT_EQUAL && (type & 0xff) <= SLJIT_C_FLOAT_ORDERED);
 #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
        FUNCTION_FCHECK(src1, src1w);
        FUNCTION_FCHECK(src2, src2w);
@@ -1255,6 +1286,8 @@
        #include "sljitNativePPC_common.c"
 #elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
        #include "sljitNativeMIPS_common.c"
+#elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
+       #include "sljitNativeSPARC_common.c"
 #endif
 
 #if !(defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
diff -r dad458b4dee5 -r 2f93ed439f2c sys/external/bsd/sljit/dist/sljit_src/sljitLir.h
--- a/sys/external/bsd/sljit/dist/sljit_src/sljitLir.h  Sun Oct 28 02:01:15 2012 +0000
+++ b/sys/external/bsd/sljit/dist/sljit_src/sljitLir.h  Sun Oct 28 09:36:12 2012 +0000
@@ -260,6 +260,12 @@
        sljit_w cache_argw;
 #endif
 
+#if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
+       int delay_slot;
+       int cache_arg;
+       sljit_w cache_argw;
+#endif
+
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
        FILE* verbose;
 #endif
@@ -542,7 +548,9 @@
 /* Flags: I | E | O | K */
 #define SLJIT_NEG                      21
 /* Count leading zeroes
-   Flags: I | E | K */
+   Flags: I | E | K
+   Important note! Sparc 32 does not support K flag, since
+   the required popc instruction is introduced only in sparc 64. */
 #define SLJIT_CLZ                      22
 
 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op1(struct sljit_compiler *compiler, int op,
@@ -617,7 +625,7 @@
 SLJIT_API_FUNC_ATTRIBUTE int sljit_is_fpu_available(void);
 
 /* Note: dst is the left and src is the right operand for SLJIT_FCMP.
-   Note: NaN check is always performed. If SLJIT_C_FLOAT_NAN is set,
+   Note: NaN check is always performed. If SLJIT_C_FLOAT_UNORDERED is set,
          the comparison result is unpredictable.
    Flags: E | S (see SLJIT_C_FLOAT_*) */
 #define SLJIT_FCMP                     34
@@ -677,8 +685,8 @@
 #define SLJIT_C_FLOAT_GREATER_EQUAL    17
 #define SLJIT_C_FLOAT_GREATER          18
 #define SLJIT_C_FLOAT_LESS_EQUAL       19
-#define SLJIT_C_FLOAT_NAN              20
-#define SLJIT_C_FLOAT_NOT_NAN          21
+#define SLJIT_C_FLOAT_UNORDERED                20
+#define SLJIT_C_FLOAT_ORDERED          21
 
 #define SLJIT_JUMP                     22
 #define SLJIT_FAST_CALL                        23
@@ -716,7 +724,7 @@
    sljit_emit_jump. However some architectures (i.e: MIPS) may employ
    special optimizations here. It is suggested to use this comparison form
    when appropriate.
-    type must be between SLJIT_C_FLOAT_EQUAL and SLJIT_C_FLOAT_NOT_NAN
+    type must be between SLJIT_C_FLOAT_EQUAL and SLJIT_C_FLOAT_ORDERED
     type can be combined (or'ed) with SLJIT_REWRITABLE_JUMP
    Flags: destroy flags.
    Note: if either operand is NaN, the behaviour is undefined for
@@ -741,7 +749,7 @@
 
 /* If op == SLJIT_MOV:
      Set dst to 1 if condition is fulfilled, 0 otherwise
-       type must be between SLJIT_C_EQUAL and SLJIT_C_FLOAT_NOT_NAN
+       type must be between SLJIT_C_EQUAL and SLJIT_C_FLOAT_ORDERED
      Flags: - (never set any flags)
    If op == SLJIT_OR
      Dst is used as src as well, and set its lowest bit to 1 if
diff -r dad458b4dee5 -r 2f93ed439f2c sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_Thumb2.c
--- a/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_Thumb2.c     Sun Oct 28 02:01:15 2012 +0000
+++ b/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_Thumb2.c     Sun Oct 28 09:36:12 2012 +0000
@@ -29,6 +29,9 @@
        return "ARM-Thumb2" SLJIT_CPUINFO;
 }
 
+/* Length of an instruction word. */
+typedef sljit_ui sljit_ins;
+
 /* Last register + 1. */
 #define TMP_REG1       (SLJIT_NO_REGISTERS + 1)
 #define TMP_REG2       (SLJIT_NO_REGISTERS + 2)
@@ -40,7 +43,7 @@
 
 /* See sljit_emit_enter and sljit_emit_op0 if you want to change them. */
 static SLJIT_CONST sljit_ub reg_map[SLJIT_NO_REGISTERS + 5] = {
-  0, 0, 1, 2, 12, 5, 6, 7, 8, 10, 11, 13, 3, 4, 14, 15
+       0, 0, 1, 2, 12, 5, 6, 7, 8, 10, 11, 13, 3, 4, 14, 15
 };
 
 #define COPY_BITS(src, from, to, bits) \
@@ -75,8 +78,6 @@
 #define IMM12(imm) \
        (COPY_BITS(imm, 11, 26, 1) | COPY_BITS(imm, 8, 12, 3) | (imm & 0xff))
 
-typedef sljit_ui sljit_ins;
-
 /* --------------------------------------------------------------------- */
 /*  Instrucion forms                                                     */
 /* --------------------------------------------------------------------- */
@@ -234,7 +235,7 @@
                diff = ((sljit_w)(code + jump->u.label->size) - (sljit_w)(code_ptr + 2)) >> 1;
        }
 
-       if (jump->flags & IS_CONDITIONAL) {
+       if (jump->flags & IS_COND) {
                SLJIT_ASSERT(!(jump->flags & IS_BL));
                if (diff <= 127 && diff >= -128) {
                        jump->flags |= B_TYPE1;
@@ -303,24 +304,24 @@
        switch (type) {
        case 1:
                /* Encoding T1 of 'B' instruction */
-               SLJIT_ASSERT(diff <= 127 && diff >= -128 && (jump->flags & IS_CONDITIONAL));
+               SLJIT_ASSERT(diff <= 127 && diff >= -128 && (jump->flags & IS_COND));
                jump_inst[0] = 0xd000 | (jump->flags & 0xf00) | (diff & 0xff);
                return;
        case 2:
                /* Encoding T3 of 'B' instruction */
-               SLJIT_ASSERT(diff <= 524287 && diff >= -524288 && (jump->flags & IS_CONDITIONAL));
+               SLJIT_ASSERT(diff <= 524287 && diff >= -524288 && (jump->flags & IS_COND));
                jump_inst[0] = 0xf000 | COPY_BITS(jump->flags, 8, 6, 4) | COPY_BITS(diff, 11, 0, 6) | COPY_BITS(diff, 19, 10, 1);
                jump_inst[1] = 0x8000 | COPY_BITS(diff, 17, 13, 1) | COPY_BITS(diff, 18, 11, 1) | (diff & 0x7ff);
                return;
        case 3:
-               SLJIT_ASSERT(jump->flags & IS_CONDITIONAL);
+               SLJIT_ASSERT(jump->flags & IS_COND);



Home | Main Index | Thread Index | Old Index