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 sljit version r313.



details:   https://anonhg.NetBSD.org/src/rev/9c591159e1d4
branches:  trunk
changeset: 345455:9c591159e1d4
user:      alnsn <alnsn%NetBSD.org@localhost>
date:      Sun May 29 17:00:35 2016 +0000

description:
Import sljit version r313.

Changes since the last import:

r313 Fix a racing condition reported by Mozilla.
r312 Support Android ARM64 cacheflush. Patch by Tavian Barnes.
r311 Update opcode dump.
r310 Better type specification for integer operations and conditional types.
r309 Better type specification for long mul and divide operators.
r308 Better type specification for floating point operations.
r307 Change d and s postfixes to f64 and f32.
r306 Change b,h,i postifxes to 8,16,32.
r305 Fix a wrong immediate number. Reported by Michael McConville.
r304 Make file patch by Michael McConville.
r303 Landed changes created by Michael McConville.
r302 Add support for cmov on x86.
r301 Tile-Gx fixes by Walter Lee
r300 Add WinCE support.
r299 Add a tutorial for SLJIT. Contributed by Wen Xichang.
r298 Improve integer division.
r297 Start reworking the integer division.
r296 Add an overview for SLJIT.
r295 Small optimizations for x86 and ARM64.
r294 Fix ARM64 SP alignment.
r293 Add a new sljit_set_compiler_memory_error function.
r292 Add missing argument on ARM32.
r291 Minor fixes and NOINLINE support.
r290 Support custom memory allocators.
r289 Add SLJIT_DOUBLE_ALIGNMENT support and emit_op_custom size check.
r288 Add suport for SLJIT_ARGUMENT_CHECKS on all architectures.
r287 Add SLJIT_ARGUMENT_CHECKS compiler option and lots of cleanups.
r286 Support the new naming on PPC and MIPS.
r285 Support the new naming on ARM and SPARC.
r284 Move the type letter to the beggining of the floating point opcodes.
r283 Add i_ s_ d_ froms to compare types.
r282 Fix an incorrect form of mul on x86-64.
r281 Refactoring sljitConfigInternal.h header.
r280 Remove variable locals offset.
r279 Test skips are not reported if verbose is disabled.
r278 Add options to sljit_emit_enter and sljit_set_context.
r277 Reindexing opX opcodes.
r276 Some comments are fixed and minor refactors were done.
r275 Minor optimizations.
r274 Extend the register set on ARM.
r273 Extend the register set on PPC, MIPS, SPARC.
r272 Allow remapping of any registers: not just scratch->saved, but saved->scratch as well.
r271 Renaming floating point registers to support more of them.
r270 Extend the register set on x86.
r269 Renaming integer registers for preparing the support of any all machine registers.
r268 Refactor a macro to work when debug is disabled.
r267 Introduce architecture macros without 32/64 bit postfix.
r266 The floating point conversion operators are finished on PPC, and they are supported on all architectures now.
r265 FPU operations support locals access now. CONW is supported on PPC now.
r264 Continue code refactoring, MOVS/MOVD are optimized on all architectures.
r263 SPARC implementation of floating point operators.
r262 Small refactorings.
r261 MIPS implementation of floating point conversion operators.
r260 ARM implementation of floating point operators.
r259 x86 implementation of floating point conversion operators.
r258 Refactoring sljit_emit_fop1 opcodes, inserting placeholders for new ones.

diffstat:

 sys/external/bsd/sljit/dist/API_CHANGES                      |   38 +
 sys/external/bsd/sljit/dist/Makefile                         |   12 +-
 sys/external/bsd/sljit/dist/README                           |    3 +
 sys/external/bsd/sljit/dist/doc/overview.txt                 |  226 ++++
 sys/external/bsd/sljit/dist/doc/tutorial/99bottles.bf        |  247 ++++
 sys/external/bsd/sljit/dist/doc/tutorial/README              |    3 +
 sys/external/bsd/sljit/dist/doc/tutorial/array_access.c      |   70 +
 sys/external/bsd/sljit/dist/doc/tutorial/brainfuck.c         |  260 ++++
 sys/external/bsd/sljit/dist/doc/tutorial/branch.c            |   77 +
 sys/external/bsd/sljit/dist/doc/tutorial/first_program.c     |   53 +
 sys/external/bsd/sljit/dist/doc/tutorial/func_call.c         |   80 +
 sys/external/bsd/sljit/dist/doc/tutorial/hello.bf            |   21 +
 sys/external/bsd/sljit/dist/doc/tutorial/loop.c              |   76 +
 sys/external/bsd/sljit/dist/doc/tutorial/sljit_tutorial.html |  584 +++++++++++
 sys/external/bsd/sljit/dist/doc/tutorial/struct_access.c     |   84 +
 sys/external/bsd/sljit/dist/doc/tutorial/temp_var.c          |   74 +
 sys/external/bsd/sljit/dist/hist                             |   60 +
 sys/external/bsd/sljit/dist/regex_src/regexJIT.c             |  156 +-
 sys/external/bsd/sljit/dist/regex_src/regexMain.c            |    7 +-
 19 files changed, 2044 insertions(+), 87 deletions(-)

diffs (truncated from 2608 to 300 lines):

diff -r 8217ae397a93 -r 9c591159e1d4 sys/external/bsd/sljit/dist/API_CHANGES
--- a/sys/external/bsd/sljit/dist/API_CHANGES   Sun May 29 16:12:58 2016 +0000
+++ b/sys/external/bsd/sljit/dist/API_CHANGES   Sun May 29 17:00:35 2016 +0000
@@ -1,5 +1,43 @@
 This file is the short summary of the API changes:
 
+29.02.2016 - Non-backward compatible
+    Several types and instructions are renamed to improve
+    readability. In general byte, half, and int are renamed
+    to 8, 16, and 32. Floating point types are also renamed
+    from d and s to f64 and f32.
+
+      [s|u]b -> [s|u]8    (8 bit values)
+      [s|u]h -> [s|u]16   (16 bit values)
+      [s|u]i -> [s|u]32   (32 bit values)
+      d -> f64            (64 bit floating point value)
+      s -> f32            (32 bit floating point value)
+
+18.05.2015 - Non-backward compatible
+    SLJIT_[I|]L[U|S]DIV is renamed to SLJIT_[I|][U|S]DIVMOD
+
+29.09.2014 - Non-backward compatible
+    The sljit_create_compiler, sljit_allocate_stack, and
+    sljit_free_stack functions have an allocator_data
+    argument now.
+
+19.09.2014 - Non-backward compatible
+    Using I, D, S prefixes in conditional and floating
+    point operations. And an L prefix to long multiplication
+    and division (op0 opcodes).
+
+11.08.2014 - Non-backward compatible
+    A currently unused options parameter is added to sljit_emit_enter
+    and sljit_set_context.
+
+06.07.2014 - Non-backward compatible
+    SCRATCH registers are renamed to Rx and SAVED registers
+    are renamed to Sx. See the explanation of these registers
+    in sljitLir.h.
+
+31.05.2014 - Non-backward compatible
+    SLJIT_TEMPORARY_EREGx registers were not renamed to
+    SLJIT_SCRATCH_EREGx when the change was done on 08.11.2012
+
 05.03.2014 - Backward compatible
     The sljit_set_target now supports those jumps, which
     does not created with SLJIT_REWRITABLE_JUMP flag.
diff -r 8217ae397a93 -r 9c591159e1d4 sys/external/bsd/sljit/dist/Makefile
--- a/sys/external/bsd/sljit/dist/Makefile      Sun May 29 16:12:58 2016 +0000
+++ b/sys/external/bsd/sljit/dist/Makefile      Sun May 29 17:00:35 2016 +0000
@@ -1,8 +1,10 @@
-ifndef CROSS_COMPILER
+ifdef CROSS_COMPILER
+CC = $(CROSS_COMPILER)
+else
+ifndef CC
 # default compier
 CC = gcc
-else
-CC = $(CROSS_COMPILER)
+endif
 endif
 
 ifndef EXTRA_CPPFLAGS
@@ -14,8 +16,8 @@
 endif
 
 CPPFLAGS = $(EXTRA_CPPFLAGS) -DSLJIT_CONFIG_AUTO=1 -Isljit_src
-CFLAGS = -O2 -Wall
-REGEX_CFLAGS = -fshort-wchar
+CFLAGS += -O2 -Wall
+REGEX_CFLAGS += $(CFLAGS) -fshort-wchar
 LDFLAGS = $(EXTRA_LDFLAGS)
 
 TARGET = sljit_test regex_test
diff -r 8217ae397a93 -r 9c591159e1d4 sys/external/bsd/sljit/dist/README
--- a/sys/external/bsd/sljit/dist/README        Sun May 29 16:12:58 2016 +0000
+++ b/sys/external/bsd/sljit/dist/README        Sun May 29 17:00:35 2016 +0000
@@ -27,3 +27,6 @@
   Daniel Richard G.
   Giuseppe D'Angelo
   Jiong Wang (TileGX support)
+  Michael McConville
+  Walter Lee
+  Wen Xichang
diff -r 8217ae397a93 -r 9c591159e1d4 sys/external/bsd/sljit/dist/doc/overview.txt
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/external/bsd/sljit/dist/doc/overview.txt      Sun May 29 17:00:35 2016 +0000
@@ -0,0 +1,226 @@
+The following text is a brief overview of those key
+principles which are useful to know when generating code
+with SLJIT. Further details can be found in sljitLir.h.
+
+----------------------------------------------------------------
+  What is SLJIT?
+----------------------------------------------------------------
+
+SLJIT is a platform independent assembler which
+  - provides access to common CPU features
+  - can be easily ported to wide-spread CPU
+    architectures (e.g. x86, ARM, POWER, MIPS, SPARC)
+
+The key challenge of this project is finding a common
+subset of CPU features which
+  - covers traditional assembly level programming
+  - can be translated to machine code efficiently
+
+This aim is achieved by selecting those instructions / CPU
+features which are either available on all platforms or
+simulating them has a low performance overhead.
+
+For example, some SLJIT instructions support base register
+pre-update when [base+offs] memory accessing mode is used.
+Although this feature is only available on ARM and POWER
+CPUs, the simulation overhead is low on other CPUs.
+
+----------------------------------------------------------------
+  The generic CPU model of SLJIT
+----------------------------------------------------------------
+
+The CPU has
+  - integer registers, which can store either an
+    int32_t (4 byte) or intptr_t (4 or 8 byte) value
+  - floating point registers, which can store either a
+    single (4 byte) or double (8 byte) precision value
+  - boolean status flags
+
+*** Integer registers:
+
+The most important rule is: when a source operand of
+an instruction is a register, the data type of the
+register must match the data type expected by an
+instruction.
+
+For example, the following code snippet
+is a valid instruction sequence:
+
+    sljit_emit_op1(compiler, SLJIT_IMOV,
+        SLJIT_R0, 0, SLJIT_MEM1(SLJIT_R1), 0);
+    // An int32_t value is loaded into SLJIT_R0
+    sljit_emit_op1(compiler, SLJIT_INEG,
+        SLJIT_R0, 0, SLJIT_R0, 0);
+    // the int32_t value in SLJIT_R0 is negated
+    // and the type of the result is still int32_t
+
+The next code snippet is not allowed:
+
+    sljit_emit_op1(compiler, SLJIT_MOV,
+        SLJIT_R0, 0, SLJIT_MEM1(SLJIT_R1), 0);
+    // An intptr_t value is loaded into SLJIT_R0
+    sljit_emit_op1(compiler, SLJIT_INEG,
+        SLJIT_R0, 0, SLJIT_R0, 0);
+    // The result of SLJIT_INEG instruction
+    // is undefined. Even crash is possible
+    // (e.g. on MIPS-64).
+
+However, it is always allowed to overwrite a
+register regardless its previous value:
+
+    sljit_emit_op1(compiler, SLJIT_MOV,
+        SLJIT_R0, 0, SLJIT_MEM1(SLJIT_R1), 0);
+    // An intptr_t value is loaded into SLJIT_R0
+    sljit_emit_op1(compiler, SLJIT_IMOV,
+        SLJIT_R0, 0, SLJIT_MEM1(SLJIT_R2), 0);
+    // From now on SLJIT_R0 contains an int32_t
+    // value. The previous value is discarded.
+
+Type conversion instructions are provided to convert an
+int32_t value to an intptr_t value and vice versa. In
+certain architectures these conversions are nops (no
+instructions are emitted).
+
+Memory accessing:
+
+Registers arguments of SLJIT_MEM1 / SLJIT_MEM2 addressing
+modes must contain intptr_t data.
+
+Signed / unsigned values:
+
+Most operations are executed in the same way regardless
+the value is signed or unsigned. These operations have
+only one instruction form (e.g. SLJIT_ADD / SLJIT_MUL).
+Instructions where the result depends on the sign have
+two forms (e.g. integer division, long multiply).
+
+*** Floating point registers
+
+Floating point registers can either contain a single
+or double precision value. Similar to integer registers,
+the data type of the value stored in a source register
+must match the data type expected by the instruction.
+Otherwise the result is undefined (even crash is possible).
+
+Rounding:
+
+Similar to standard C, floating point computation
+results are rounded toward zero.
+
+*** Boolean status flags:
+
+Conditional branches usually depend on the value
+of CPU status flags. These status flags are boolean
+values and can be set by certain instructions.
+
+To achive maximum efficiency and portability, the
+following rules were introduced:
+  - Most instructions can freely modify these status
+    flags except if SLJIT_KEEP_FLAGS is passed.
+  - The SLJIT_KEEP_FLAGS option may have a performance
+    overhead, so it should only be used when necessary.
+  - The SLJIT_SET_E, SLJIT_SET_U, etc. options can
+    force an instruction to correctly set the
+    specified status flags. However, all other
+    status flags are undefined. This rule must
+    always be kept in mind!
+  - Status flags cannot be controlled directly
+    (there are no set/clear/invert operations)
+
+The last two rules allows efficent mapping of status flags.
+For example the arithmetic and multiply overflow flag is
+mapped to the same overflow flag bit on x86. This is allowed,
+since no instruction can set both of these flags. When
+either of them is set by an instruction, the other can
+have any value (this satisfies the "all other flags are
+undefined" rule). Therefore mapping two SLJIT flags to the
+same CPU flag is possible. Even though SLJIT supports
+a dozen status flags, they can be efficiently mapped
+to CPUs with only 4 status flags (e.g. ARM or SPARC).
+
+----------------------------------------------------------------
+  Complex instructions
+----------------------------------------------------------------
+
+We noticed, that introducing complex instructions for common
+tasks can improve performance. For example, compare and
+branch instruction sequences can be optimized if certain
+conditions apply, but these conditions depend on the target
+CPU. SLJIT can do these optimizations, but it needs to
+understand the "purpose" of the generated code. Static
+instruction analysis has a large performance overhead
+however, so we choose another approach: we introduced
+complex instruction forms for certain non-atomic tasks.
+SLJIT can optimize these "instructions" more efficiently
+since the "purpose" is known to the compiler. These complex
+instruction forms can often be assembled from other SLJIT
+instructions, but we recommended to use them since the
+compiler can optimize them on certain CPUs.
+
+----------------------------------------------------------------
+  Generating functions
+----------------------------------------------------------------
+
+SLJIT is often used for generating function bodies which are
+called from C. SLJIT provides two complex instructions for
+generating function entry and return: sljit_emit_enter and
+sljit_emit_return. The sljit_emit_enter also initializes the
+"compiling context" which specify the current register mapping,
+local space size, etc. configurations. The sljit_set_context
+can also set this context without emitting any machine
+instructions.
+
+This context is important since it affects the compiler, so
+the first instruction after a compiler is created must be
+either sljit_emit_enter or sljit_set_context. The context can
+be changed by calling sljit_emit_enter or sljit_set_context
+again.
+
+----------------------------------------------------------------
+  All-in-one building
+----------------------------------------------------------------
+
+Instead of using a separate library, the whole SLJIT
+compiler infrastructure can be directly included:
+
+#define SLJIT_CONFIG_STATIC 1
+#include "sljitLir.c"
+
+This approach is useful for single file compilers.
+
+Advantages:
+  - Everything provided by SLJIT is available
+    (no need to include anything else).
+  - Configuring SLJIT is easy
+    (e.g. redefining SLJIT_MALLOC / SLJIT_FREE).
+  - The SLJIT compiler API is hidden from the
+    world which improves securtity.
+  - The C compiler can optimize the SLJIT code
+    generator (e.g. removing unused functions).
+
+----------------------------------------------------------------
+  Types and macros
+----------------------------------------------------------------
+
+The sljitConfig.h contains those defines, which controls
+the compiler. The beginning of sljitConfigInternal.h
+lists architecture specific types and macros provided
+by SLJIT. Some of these macros:
+
+SLJIT_DEBUG : enabled by default
+  Enables assertions. Should be disabled in release mode.



Home | Main Index | Thread Index | Old Index