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 Update sljit to version 0.93 (sv...



details:   https://anonhg.NetBSD.org/src/rev/1ed7f1e48a97
branches:  trunk
changeset: 447664:1ed7f1e48a97
user:      alnsn <alnsn%NetBSD.org@localhost>
date:      Sun Jan 20 22:44:25 2019 +0000

description:
Update sljit to version 0.93 (svn revision r333).

Changes since the last import:

r333 More x86 fixes and a new stack test.
r332 Improve stack allocation on x86.
r331 Make sljit_free_unused_memory_exec public, PPC flush takes priority.
r330 Reverse the stack utility to top-down.
r329 Add sljit_set_current_flags function.
r328 Add two more virtual registers to x86/32, ARM-32 refactor.
r327 Remove value caching on ARM-32.
r326 Remove value caching on ARM-Thumb2.
r325 Move with update rework.
r324 Arm32 store fixes.
r323 Update macros and remove copyright years.
r322 Reworking flags, removing keep flags.
r321 Quick fix for regexjit.
r320 Improve protected executable allocator. Patch insipred by Christian Persch.
r319 Fully support dynamic code modifications again.
r318 Support protected allocator on all architectures except TILEGX.
r317 Rework protected allocator, only x86 linux is supported now.
r316 Add protected executable allocator.
r315 Remove SLJIT_MEMMOVE.
r314 Fix unaligned accesses on x86. Patch by Marc Mutz.

diffstat:

 sys/external/bsd/sljit/dist/API_CHANGES                        |   15 +
 sys/external/bsd/sljit/dist/Makefile                           |    2 +-
 sys/external/bsd/sljit/dist/README                             |    2 +
 sys/external/bsd/sljit/dist/regex_src/regexJIT.c               |   16 +-
 sys/external/bsd/sljit/dist/regex_src/regexJIT.h               |    2 +-
 sys/external/bsd/sljit/dist/regex_src/regexMain.c              |    6 +-
 sys/external/bsd/sljit/dist/sljit_src/sljitProtExecAllocator.c |  421 ++++++++++
 7 files changed, 454 insertions(+), 10 deletions(-)

diffs (truncated from 586 to 300 lines):

diff -r ebf6268962bd -r 1ed7f1e48a97 sys/external/bsd/sljit/dist/API_CHANGES
--- a/sys/external/bsd/sljit/dist/API_CHANGES   Sun Jan 20 21:26:13 2019 +0000
+++ b/sys/external/bsd/sljit/dist/API_CHANGES   Sun Jan 20 22:44:25 2019 +0000
@@ -1,5 +1,20 @@
 This file is the short summary of the API changes:
 
+27.03.2017 - Non-backward compatible
+    JIT stack is changed from bottom-up to top-town.
+
+15.01.2017 - Non-backward compatible
+    Move with update may modifiy flags, the base register
+    can only be used once and [reg+reg<<shift] addressing
+    mode where shift > 0 is not supported anymore.
+
+12.01.2017 - Non-backward compatible
+    Introducing a new flag mechanism which provides better
+    compatibility with CPUs without flags. Only two flags
+    remain: zero and variable. The current type of the
+    variable flag is specified by the arithmetic operator.
+    The SLJIT_KEEP_FLAGS is removed.
+
 29.02.2016 - Non-backward compatible
     Several types and instructions are renamed to improve
     readability. In general byte, half, and int are renamed
diff -r ebf6268962bd -r 1ed7f1e48a97 sys/external/bsd/sljit/dist/Makefile
--- a/sys/external/bsd/sljit/dist/Makefile      Sun Jan 20 21:26:13 2019 +0000
+++ b/sys/external/bsd/sljit/dist/Makefile      Sun Jan 20 22:44:25 2019 +0000
@@ -2,7 +2,7 @@
 CC = $(CROSS_COMPILER)
 else
 ifndef CC
-# default compier
+# default compiler
 CC = gcc
 endif
 endif
diff -r ebf6268962bd -r 1ed7f1e48a97 sys/external/bsd/sljit/dist/README
--- a/sys/external/bsd/sljit/dist/README        Sun Jan 20 21:26:13 2019 +0000
+++ b/sys/external/bsd/sljit/dist/README        Sun Jan 20 22:44:25 2019 +0000
@@ -24,9 +24,11 @@
 
 Special thanks:
   Alexander Nasonov
+  Christian Persch
   Daniel Richard G.
   Giuseppe D'Angelo
   Jiong Wang (TileGX support)
+  Marc Mutz
   Michael McConville
   Walter Lee
   Wen Xichang
diff -r ebf6268962bd -r 1ed7f1e48a97 sys/external/bsd/sljit/dist/regex_src/regexJIT.c
--- a/sys/external/bsd/sljit/dist/regex_src/regexJIT.c  Sun Jan 20 21:26:13 2019 +0000
+++ b/sys/external/bsd/sljit/dist/regex_src/regexJIT.c  Sun Jan 20 22:44:25 2019 +0000
@@ -1,7 +1,7 @@
 /*
  *    Stack-less Just-In-Time compiler
  *
- *    Copyright 2009-2010 Zoltan Herczeg (hzmester%freemail.hu@localhost). All rights reserved.
+ *    Copyright Zoltan Herczeg (hzmester%freemail.hu@localhost). All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without modification, are
  * permitted provided that the following conditions are met:
@@ -27,6 +27,8 @@
 #include "sljitLir.h"
 #include "regexJIT.h"
 
+#include <stdlib.h>
+
 #ifdef REGEX_MATCH_VERBOSE
 #include <stdio.h>
 #endif
@@ -1449,9 +1451,9 @@
                                        EMIT_LABEL(label1);
                                        sljit_set_label(jump1, label1);
 
-                                       EMIT_OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, SLJIT_MEM1(R_NEXT_STATE), offset + 2 * sizeof(sljit_sw), R_TEMP, 0);
+                                       EMIT_OP2(SLJIT_SUB | SLJIT_SET_Z | SLJIT_SET_LESS, SLJIT_UNUSED, 0, SLJIT_MEM1(R_NEXT_STATE), offset + 2 * sizeof(sljit_sw), R_TEMP, 0);
                                        EMIT_JUMP(jump1, SLJIT_LESS);
-                                       EMIT_JUMP(jump3, SLJIT_GREATER);
+                                       EMIT_JUMP(jump3, SLJIT_NOT_EQUAL); /* Greater. */
 
                                        /* Old index == index. */
                                        EMIT_OP1(SLJIT_MOV, R_TEMP, 0, SLJIT_MEM1(R_CURR_STATE), TERM_OFFSET_OF(curr_index, 3));
@@ -1463,7 +1465,7 @@
                                                sljit_set_label(jump4, label1);
                                        }
 
-                                       EMIT_OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, SLJIT_MEM1(R_NEXT_STATE), offset + 3 * sizeof(sljit_sw), R_TEMP, 0);
+                                       EMIT_OP2(SLJIT_SUB | SLJIT_SET_GREATER_EQUAL, SLJIT_UNUSED, 0, SLJIT_MEM1(R_NEXT_STATE), offset + 3 * sizeof(sljit_sw), R_TEMP, 0);
                                        EMIT_JUMP(jump4, SLJIT_GREATER_EQUAL);
                                        EMIT_JUMP(jump5, SLJIT_JUMP);
 
@@ -2022,7 +2024,7 @@
        }
 
        /* Loading the next character. */
-       EMIT_OP2(SLJIT_SUB | SLJIT_SET_E, R_LENGTH, 0, R_LENGTH, 0, SLJIT_IMM, 1);
+       EMIT_OP2(SLJIT_SUB | SLJIT_SET_Z, R_LENGTH, 0, R_LENGTH, 0, SLJIT_IMM, 1);
        EMIT_JUMP(length_is_zero_jump, SLJIT_EQUAL);
 
        EMIT_OP1(SLJIT_MOV, R_TEMP, 0, R_STRING, 0);
@@ -2110,7 +2112,7 @@
 
                /* Fast forward mainloop. */
                EMIT_LABEL(label);
-               EMIT_OP2(SLJIT_SUB | SLJIT_SET_E, R_NEXT_STATE, 0, R_NEXT_STATE, 0, SLJIT_IMM, 1);
+               EMIT_OP2(SLJIT_SUB | SLJIT_SET_Z, R_NEXT_STATE, 0, R_NEXT_STATE, 0, SLJIT_IMM, 1);
                EMIT_JUMP(fast_forward_jump, SLJIT_EQUAL);
 
 #ifdef REGEX_USE_8BIT_CHARS
@@ -2378,7 +2380,7 @@
                break;
 
        default:
-               SLJIT_ASSERT_STOP();
+               SLJIT_UNREACHABLE();
                break;
        }
 
diff -r ebf6268962bd -r 1ed7f1e48a97 sys/external/bsd/sljit/dist/regex_src/regexJIT.h
--- a/sys/external/bsd/sljit/dist/regex_src/regexJIT.h  Sun Jan 20 21:26:13 2019 +0000
+++ b/sys/external/bsd/sljit/dist/regex_src/regexJIT.h  Sun Jan 20 22:44:25 2019 +0000
@@ -1,7 +1,7 @@
 /*
  *    Stack-less Just-In-Time compiler
  *
- *    Copyright 2009-2010 Zoltan Herczeg (hzmester%freemail.hu@localhost). All rights reserved.
+ *    Copyright Zoltan Herczeg (hzmester%freemail.hu@localhost). All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without modification, are
  * permitted provided that the following conditions are met:
diff -r ebf6268962bd -r 1ed7f1e48a97 sys/external/bsd/sljit/dist/regex_src/regexMain.c
--- a/sys/external/bsd/sljit/dist/regex_src/regexMain.c Sun Jan 20 21:26:13 2019 +0000
+++ b/sys/external/bsd/sljit/dist/regex_src/regexMain.c Sun Jan 20 22:44:25 2019 +0000
@@ -1,7 +1,7 @@
 /*
  *    Stack-less Just-In-Time compiler
  *
- *    Copyright 2009-2010 Zoltan Herczeg (hzmester%freemail.hu@localhost). All rights reserved.
+ *    Copyright Zoltan Herczeg (hzmester%freemail.hu@localhost). All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without modification, are
  * permitted provided that the following conditions are met:
@@ -25,6 +25,7 @@
  */
 
 /* Must be the first one. Must not depend on any other include. */
+#include "sljitLir.h"
 #include "regexJIT.h"
 
 #include <stdio.h>
@@ -325,5 +326,8 @@
 /*     verbose_test("((a|b|c)*(xy)+)+", "asbcxyxy"); */
 
        run_tests(tests, has_arg && argv[1][1] == 'v', has_arg && argv[1][1] == 's');
+
+       sljit_free_unused_memory_exec();
+
        return 0;
 }
diff -r ebf6268962bd -r 1ed7f1e48a97 sys/external/bsd/sljit/dist/sljit_src/sljitProtExecAllocator.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/external/bsd/sljit/dist/sljit_src/sljitProtExecAllocator.c    Sun Jan 20 22:44:25 2019 +0000
@@ -0,0 +1,421 @@
+/*
+ *    Stack-less Just-In-Time compiler
+ *
+ *    Copyright Zoltan Herczeg (hzmester%freemail.hu@localhost). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above copyright notice, this list of
+ *      conditions and the following disclaimer.
+ *
+ *   2. Redistributions in binary form must reproduce the above copyright notice, this list
+ *      of conditions and the following disclaimer in the documentation and/or other materials
+ *      provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE COPYRIGHT HOLDER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+   This file contains a simple executable memory allocator
+
+   It is assumed, that executable code blocks are usually medium (or sometimes
+   large) memory blocks, and the allocator is not too frequently called (less
+   optimized than other allocators). Thus, using it as a generic allocator is
+   not suggested.
+
+   How does it work:
+     Memory is allocated in continuous memory areas called chunks by alloc_chunk()
+     Chunk format:
+     [ block ][ block ] ... [ block ][ block terminator ]
+
+   All blocks and the block terminator is started with block_header. The block
+   header contains the size of the previous and the next block. These sizes
+   can also contain special values.
+     Block size:
+       0 - The block is a free_block, with a different size member.
+       1 - The block is a block terminator.
+       n - The block is used at the moment, and the value contains its size.
+     Previous block size:
+       0 - This is the first block of the memory chunk.
+       n - The size of the previous block.
+
+   Using these size values we can go forward or backward on the block chain.
+   The unused blocks are stored in a chain list pointed by free_blocks. This
+   list is useful if we need to find a suitable memory area when the allocator
+   is called.
+
+   When a block is freed, the new free block is connected to its adjacent free
+   blocks if possible.
+
+     [ free block ][ used block ][ free block ]
+   and "used block" is freed, the three blocks are connected together:
+     [           one big free block           ]
+*/
+
+/* --------------------------------------------------------------------- */
+/*  System (OS) functions                                                */
+/* --------------------------------------------------------------------- */
+
+/* 64 KByte. */
+#define CHUNK_SIZE     0x10000
+
+struct chunk_header {
+       void *executable;
+       int fd;
+};
+
+/*
+   alloc_chunk / free_chunk :
+     * allocate executable system memory chunks
+     * the size is always divisible by CHUNK_SIZE
+   allocator_grab_lock / allocator_release_lock :
+     * make the allocator thread safe
+     * can be empty if the OS (or the application) does not support threading
+     * only the allocator requires this lock, sljit is fully thread safe
+       as it only uses local variables
+*/
+
+#include <fcntl.h>
+
+#ifndef O_NOATIME
+#define O_NOATIME 0
+#endif
+
+#ifdef __O_TMPFILE
+#ifndef O_TMPFILE
+#define O_TMPFILE      (__O_TMPFILE | O_DIRECTORY)
+#endif
+#endif
+
+int mkostemp(char *template, int flags);
+char *secure_getenv(const char *name);
+
+static SLJIT_INLINE int create_tempfile(void)
+{
+       int fd;
+
+       char tmp_name[256];
+       size_t tmp_name_len;
+       char *dir;
+       size_t len;
+
+#ifdef P_tmpdir
+       len = (P_tmpdir != NULL) ? strlen(P_tmpdir) : 0;
+
+       if (len > 0 && len < sizeof(tmp_name)) {
+               strcpy(tmp_name, P_tmpdir);
+               tmp_name_len = len;
+       }
+       else {
+               strcpy(tmp_name, "/tmp");
+               tmp_name_len = 4;
+       }
+#else
+       strcpy(tmp_name, "/tmp");
+       tmp_name_len = 4;
+#endif
+
+       dir = secure_getenv("TMPDIR");
+       if (dir) {
+               len = strlen(dir);
+               if (len > 0 && len < sizeof(tmp_name)) {
+                       strcpy(tmp_name, dir);
+                       tmp_name_len = len;
+               }
+       }
+



Home | Main Index | Thread Index | Old Index