Source-Changes-HG archive

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

[src/tls-maxphys]: src/sys/external/bsd/sljit/dist Import of sljit @ r186.



details:   https://anonhg.NetBSD.org/src/rev/d769ab7dc583
branches:  tls-maxphys
changeset: 852937:d769ab7dc583
user:      alnsn <alnsn%NetBSD.org@localhost>
date:      Sun Oct 28 09:36:13 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                            |    62 +
 sys/external/bsd/sljit/dist/README                              |    26 +
 sys/external/bsd/sljit/dist/sljit_src/sljitLir.h                |   871 +++
 sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_Thumb2.c   |  1943 +++++++
 sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_v5.c       |  2462 ++++++++++
 sys/external/bsd/sljit/dist/sljit_src/sljitNativeMIPS_32.c      |   403 +
 sys/external/bsd/sljit/dist/sljit_src/sljitNativeMIPS_common.c  |  1846 +++++++
 sys/external/bsd/sljit/dist/sljit_src/sljitNativePPC_32.c       |   264 +
 sys/external/bsd/sljit/dist/sljit_src/sljitNativePPC_64.c       |   422 +
 sys/external/bsd/sljit/dist/sljit_src/sljitNativePPC_common.c   |  1936 +++++++
 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_64.c       |   789 +++
 13 files changed, 12497 insertions(+), 0 deletions(-)

diffs (truncated from 12549 to 300 lines):

diff -r 6c3e661acb57 -r d769ab7dc583 sys/external/bsd/sljit/dist/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/external/bsd/sljit/dist/Makefile      Sun Oct 28 09:36:13 2012 +0000
@@ -0,0 +1,62 @@
+# default compier
+CC = gcc
+
+# Cross compiler for ARM
+#CC = arm-linux-gcc
+
+# Cross compiler for PPC
+#CC = powerpc-linux-gnu-gcc
+
+# Cross compiler for PPC-64
+#CC = powerpc64-unknown-linux-gnu-gcc
+
+CFLAGS = -O2 -Wall -DSLJIT_CONFIG_AUTO=1
+LDFLAGS=
+
+TARGET = sljit_test regex_test
+
+BINDIR = bin
+SRCDIR = sljit_src
+TESTDIR = test_src
+REGEXDIR = regex_src
+
+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 : $(BINDIR) $(SLJIT_LIR_FILES) $(SLJIT_HEADERS)
+       $(CC) $(CFLAGS) -c -o $@ $(SRCDIR)/sljitLir.c
+
+$(BINDIR)/sljitMain.o : $(TESTDIR)/sljitMain.c $(BINDIR) $(SLJIT_HEADERS)
+       $(CC) $(CFLAGS) -c -o $@ $(TESTDIR)/sljitMain.c
+
+$(BINDIR)/sljitTest.o : $(TESTDIR)/sljitTest.c $(BINDIR) $(SLJIT_HEADERS)
+       $(CC) $(CFLAGS) -c -o $@ $(TESTDIR)/sljitTest.c
+
+$(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) $(SLJIT_HEADERS) $(REGEXDIR)/regexJIT.h
+       $(CC) $(CFLAGS) $(REGEX_CFLAGS) -c -o $@ $(REGEXDIR)/regexJIT.c
+
+clean:
+       rm -f $(BINDIR)/*.o $(BINDIR)/sljit_test $(BINDIR)/regex_test
+
+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: $(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 6c3e661acb57 -r d769ab7dc583 sys/external/bsd/sljit/dist/README
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/external/bsd/sljit/dist/README        Sun Oct 28 09:36:13 2012 +0000
@@ -0,0 +1,26 @@
+
+                     SLJIT - Stack Less JIT Compiler
+
+Purpose:
+  A simple machine independent JIT, which suitable for interpreters and
+  other dynamic tools. See sljitLir.h for more information.
+
+Compatible:
+  Any C (C++) compiler. At least I hope so.
+
+Using sljit:
+  Copy sljitLir.c sljitLir.h sljitConfig.h sljitExecAllocator.c and sljitNative*.c
+  files into your project. Add sljitLir.c into your project. The other files are
+  included by sljitLir.c (when required). Define the machine by SLJIT_CONFIG_*
+  selector. See sljitConfig.h for all possible values. For C++ compilers, rename
+  sljitLir.c to sljitLir.cpp.
+
+More info:
+  http://sljit.sourceforge.net/
+
+Contact:
+  hzmester%freemail.hu@localhost
+
+Special thanks:
+  Alexander Nasonov
+  Daniel Richard G.
diff -r 6c3e661acb57 -r d769ab7dc583 sys/external/bsd/sljit/dist/sljit_src/sljitLir.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/external/bsd/sljit/dist/sljit_src/sljitLir.h  Sun Oct 28 09:36:13 2012 +0000
@@ -0,0 +1,871 @@
+/*
+ *    Stack-less Just-In-Time compiler
+ *
+ *    Copyright 2009-2012 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.
+ */
+
+#ifndef _SLJIT_LIR_H_
+#define _SLJIT_LIR_H_
+
+/*
+   ------------------------------------------------------------------------
+    Stack-Less JIT compiler for multiple architectures (x86, ARM, PowerPC)
+   ------------------------------------------------------------------------
+
+   Short description
+    Advantages:
+      - The execution can be continued from any LIR instruction
+        In other words, jump into and out of the code is safe
+      - Both target of (conditional) jump and call instructions
+        and constants can be dynamically modified during runtime
+        - although it is not suggested to do it frequently
+        - very effective to cache an important value once
+      - A fixed stack space can be allocated for local variables
+      - The compiler is thread-safe
+      - The compiler is highly configurable through preprocessor macros.
+        You can disable unneeded features (multithreading in single
+        threaded applications), and you can use your own system functions
+        (including memory allocators). See sljitConfig.h
+    Disadvantages:
+      - Limited number of registers (only 6+4 integer registers, max 3+2
+        temporary, max 3+2 saved and 4 floating point registers)
+    In practice:
+      - This approach is very effective for interpreters
+        - One of the saved registers typically points to a stack interface
+        - It can jump to any exception handler anytime (even for another
+          function. It is safe for SLJIT.)
+        - Fast paths can be modified during runtime reflecting the changes
+          of the fastest execution path of the dynamic language
+        - SLJIT supports complex memory addressing modes
+        - mainly position independent code
+      - Optimizations (perhaps later)
+        - Only for basic blocks (when no labels inserted between LIR instructions)
+
+    For valgrind users:
+      - pass --smc-check=all argument to valgrind, since JIT is a "self-modifying code"
+*/
+
+#if !(defined SLJIT_NO_DEFAULT_CONFIG && SLJIT_NO_DEFAULT_CONFIG)
+#include "sljitConfig.h"
+#endif
+
+/* The following header file defines useful macros for fine tuning
+sljit based code generators. They are listed in the begining
+of sljitConfigInternal.h */
+
+#include "sljitConfigInternal.h"
+
+/* --------------------------------------------------------------------- */
+/*  Error codes                                                          */
+/* --------------------------------------------------------------------- */
+
+/* Indicates no error. */
+#define SLJIT_SUCCESS                  0
+/* After the call of sljit_generate_code(), the error code of the compiler
+   is set to this value to avoid future sljit calls (in debug mode at least).
+   The complier should be freed after sljit_generate_code(). */
+#define SLJIT_ERR_COMPILED             1
+/* Cannot allocate non executable memory. */
+#define SLJIT_ERR_ALLOC_FAILED         2
+/* Cannot allocate executable memory.
+   Only for sljit_generate_code() */
+#define SLJIT_ERR_EX_ALLOC_FAILED      3
+/* return value for SLJIT_CONFIG_UNSUPPORTED empty architecture. */
+#define SLJIT_ERR_UNSUPPORTED          4
+
+/* --------------------------------------------------------------------- */
+/*  Registers                                                            */
+/* --------------------------------------------------------------------- */
+
+#define SLJIT_UNUSED           0
+
+/* Temporary (scratch) registers may not preserve their values across function calls. */
+#define SLJIT_TEMPORARY_REG1   1
+#define SLJIT_TEMPORARY_REG2   2
+#define SLJIT_TEMPORARY_REG3   3
+/* Note: Extra Registers cannot be used for memory addressing. */
+/* Note: on x86-32, these registers are emulated (using stack loads & stores). */
+#define SLJIT_TEMPORARY_EREG1  4
+#define SLJIT_TEMPORARY_EREG2  5
+
+/* Saved registers whose preserve their values across function calls. */
+#define SLJIT_SAVED_REG1       6
+#define SLJIT_SAVED_REG2       7
+#define SLJIT_SAVED_REG3       8
+/* Note: Extra Registers cannot be used for memory addressing. */
+/* Note: on x86-32, these registers are emulated (using stack loads & stores). */
+#define SLJIT_SAVED_EREG1      9
+#define SLJIT_SAVED_EREG2      10
+
+/* Read-only register (cannot be the destination of an operation).
+   Only SLJIT_MEM1(SLJIT_LOCALS_REG) addressing mode is allowed since
+   several ABIs has certain limitations about the stack layout. However
+   sljit_get_local_base() can be used to obtain the offset of a value. */
+#define SLJIT_LOCALS_REG       11
+
+/* Number of registers. */
+#define SLJIT_NO_TMP_REGISTERS 5
+#define SLJIT_NO_GEN_REGISTERS 5
+#define SLJIT_NO_REGISTERS     11
+
+/* Return with machine word. */
+
+#define SLJIT_RETURN_REG       SLJIT_TEMPORARY_REG1
+
+/* x86 prefers specific registers for special purposes. In case of shift
+   by register it supports only SLJIT_TEMPORARY_REG3 for shift argument
+   (which is the src2 argument of sljit_emit_op2). If another register is
+   used, sljit must exchange data between registers which cause a minor
+   slowdown. Other architectures has no such limitation. */
+
+#define SLJIT_PREF_SHIFT_REG   SLJIT_TEMPORARY_REG3
+
+/* --------------------------------------------------------------------- */
+/*  Floating point registers                                             */
+/* --------------------------------------------------------------------- */
+
+/* Note: SLJIT_UNUSED as destination is not valid for floating point
+     operations, since they cannot be used for setting flags. */
+
+/* Floating point operations are performed on double precision values. */
+
+#define SLJIT_FLOAT_REG1       1
+#define SLJIT_FLOAT_REG2       2
+#define SLJIT_FLOAT_REG3       3
+#define SLJIT_FLOAT_REG4       4
+
+/* --------------------------------------------------------------------- */
+/*  Main structures and functions                                        */
+/* --------------------------------------------------------------------- */
+
+struct sljit_memory_fragment {
+       struct sljit_memory_fragment *next;
+       sljit_uw used_size;
+       sljit_ub memory[1];
+};
+
+struct sljit_label {
+       struct sljit_label *next;
+       sljit_uw addr;
+       /* The maximum size difference. */
+       sljit_uw size;
+};
+
+struct sljit_jump {
+       struct sljit_jump *next;
+       sljit_uw addr;
+       sljit_w flags;
+       union {
+               sljit_uw target;
+               struct sljit_label* label;
+       } u;
+};
+
+struct sljit_const {
+       struct sljit_const *next;
+       sljit_uw addr;
+};
+
+struct sljit_compiler {
+       int error;
+
+       struct sljit_label *labels;
+       struct sljit_jump *jumps;
+       struct sljit_const *consts;
+       struct sljit_label *last_label;
+       struct sljit_jump *last_jump;
+       struct sljit_const *last_const;
+
+       struct sljit_memory_fragment *buf;
+       struct sljit_memory_fragment *abuf;



Home | Main Index | Thread Index | Old Index