Import upstream 10.22 release
authorMatthew Vernon <matthew@debian.org>
Tue, 2 Aug 2016 17:07:01 +0000 (18:07 +0100)
committerMatthew Vernon <matthew@debian.org>
Tue, 2 Aug 2016 17:07:01 +0000 (18:07 +0100)
118 files changed:
CMakeLists.txt
ChangeLog
HACKING
Makefile.am
Makefile.in
NEWS
README
RunGrepTest
RunTest
RunTest.bat
aclocal.m4
configure
configure.ac
doc/html/README.txt
doc/html/index.html
doc/html/pcre2_code_copy.html [new file with mode: 0644]
doc/html/pcre2_get_error_message.html
doc/html/pcre2api.html
doc/html/pcre2build.html
doc/html/pcre2demo.html
doc/html/pcre2grep.html
doc/html/pcre2jit.html
doc/html/pcre2pattern.html
doc/html/pcre2posix.html
doc/html/pcre2sample.html
doc/html/pcre2serialize.html
doc/html/pcre2test.html
doc/html/pcre2unicode.html
doc/index.html.src
doc/pcre2.txt
doc/pcre2_code_copy.3 [new file with mode: 0644]
doc/pcre2_get_error_message.3
doc/pcre2api.3
doc/pcre2build.3
doc/pcre2demo.3
doc/pcre2grep.1
doc/pcre2grep.txt
doc/pcre2jit.3
doc/pcre2pattern.3
doc/pcre2posix.3
doc/pcre2sample.3
doc/pcre2serialize.3
doc/pcre2test.1
doc/pcre2test.txt
doc/pcre2unicode.3
src/config.h.generic
src/config.h.in
src/pcre2.h.generic
src/pcre2.h.in
src/pcre2_auto_possess.c
src/pcre2_compile.c
src/pcre2_config.c
src/pcre2_dfa_match.c
src/pcre2_error.c
src/pcre2_internal.h
src/pcre2_intmodedep.h
src/pcre2_jit_compile.c
src/pcre2_jit_match.c
src/pcre2_jit_test.c
src/pcre2_match.c
src/pcre2_printint.c
src/pcre2_serialize.c
src/pcre2_study.c
src/pcre2_substring.c
src/pcre2demo.c
src/pcre2grep.c
src/pcre2posix.c
src/pcre2posix.h
src/pcre2test.c
src/sljit/sljitConfig.h
src/sljit/sljitConfigInternal.h
src/sljit/sljitExecAllocator.c
src/sljit/sljitLir.c
src/sljit/sljitLir.h
src/sljit/sljitNativeARM_32.c
src/sljit/sljitNativeARM_64.c
src/sljit/sljitNativeARM_T2_32.c
src/sljit/sljitNativeMIPS_32.c
src/sljit/sljitNativeMIPS_64.c
src/sljit/sljitNativeMIPS_common.c
src/sljit/sljitNativePPC_32.c
src/sljit/sljitNativePPC_64.c
src/sljit/sljitNativePPC_common.c
src/sljit/sljitNativeSPARC_32.c
src/sljit/sljitNativeSPARC_common.c
src/sljit/sljitNativeTILEGX_64.c
src/sljit/sljitNativeX86_32.c
src/sljit/sljitNativeX86_64.c
src/sljit/sljitNativeX86_common.c
src/sljit/sljitUtils.c
testdata/grepinput
testdata/grepoutput
testdata/grepoutputC [new file with mode: 0644]
testdata/testinput17
testdata/testinput18
testdata/testinput2
testdata/testinput20
testdata/testinput22
testdata/testinput6
testdata/testinput8
testdata/testoutput17
testdata/testoutput18
testdata/testoutput2
testdata/testoutput20
testdata/testoutput22-16
testdata/testoutput22-32
testdata/testoutput22-8
testdata/testoutput6
testdata/testoutput8-16-2
testdata/testoutput8-16-3
testdata/testoutput8-32-2
testdata/testoutput8-32-3
testdata/testoutput8-32-4
testdata/testoutput8-8-2
testdata/testoutput8-8-3
testdata/testoutput8-8-4
testdata/valgrind-jit.supp
testdata/wintestoutput3

index 2c84b054d92a1717d334b2c07a602aee97e7df46..ced3df2fffb354fa0b2df6e236f11e8bedfd4282 100644 (file)
@@ -71,6 +71,9 @@
 # 2015-07-16 PH updated for new pcre2_find_bracket source module
 # 2015-08-24 PH correct C_FLAGS setting (patch from Roy Ivy III)
 # 2015-10=16 PH added support for never-backslash-C
+# 2016-03-01 PH applied Chris Wilson's patch for MSVC static
+# 2016-06-24 PH applied Chris Wilson's second patch, putting the first under
+#            a new option instead of being unconditional.
 
 PROJECT(PCRE2 C)
 
@@ -157,6 +160,9 @@ SET(PCRE2_SUPPORT_JIT OFF CACHE BOOL
 SET(PCRE2_SUPPORT_PCRE2GREP_JIT ON CACHE BOOL
     "Enable use of Just-in-time compiling in pcre2grep.")
 
+SET(PCRE2_SUPPORT_PCRE2GREP_CALLOUT ON CACHE BOOL
+    "Enable callout string support in pcre2grep.")
+
 SET(PCRE2_SUPPORT_UNICODE ON CACHE BOOL
     "Enable support for Unicode and UTF-8/UTF-16/UTF-32 encoding.")
 
@@ -184,6 +190,9 @@ IF (MINGW)
 ENDIF(MINGW)
 
 IF(MSVC)
+  OPTION(PCRE_STATIC_RUNTIME OFF CACHE BOOL
+       "ON=Compile against the static runtime (/MT)."
+       OFF)
   OPTION(INSTALL_MSVC_PDB
          "ON=Install .pdb files built by MSVC, if generated"
          OFF)
@@ -272,6 +281,10 @@ IF(PCRE2_SUPPORT_PCRE2GREP_JIT)
         SET(SUPPORT_PCRE2GREP_JIT 1)
 ENDIF(PCRE2_SUPPORT_PCRE2GREP_JIT)
 
+IF(PCRE2_SUPPORT_PCRE2GREP_CALLOUT)
+        SET(SUPPORT_PCRE2GREP_CALLOUT 1)
+ENDIF(PCRE2_SUPPORT_PCRE2GREP_CALLOUT)
+
 IF(PCRE2_SUPPORT_VALGRIND)
         SET(SUPPORT_VALGRIND 1)
 ENDIF(PCRE2_SUPPORT_VALGRIND)
@@ -456,6 +469,18 @@ SET(PCRE2POSIX_SOURCES
 ENDIF (EXISTS ${PROJECT_SOURCE_DIR}/pcre2posix.rc)
 ENDIF(MSVC AND NOT PCRE2_STATIC)
 
+# Fix static compilation with MSVC: https://bugs.exim.org/show_bug.cgi?id=1681
+# This code was taken from the CMake wiki, not from WebM.
+
+IF(MSVC AND PCRE2_STATIC_RUNTIME)
+  MESSAGE(STATUS "** MSVC and PCRE2_STATIC_RUNTIME: modifying compiler flags to use static runtime library")
+  foreach(flag_var
+          CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
+          CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
+    string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
+  endforeach()
+ENDIF(MSVC AND PCRE2_STATIC_RUNTIME)
+
 # Build setup
 
 ADD_DEFINITIONS(-DHAVE_CONFIG_H)
@@ -740,6 +765,7 @@ IF(PCRE2_SHOW_REPORT)
   MESSAGE(STATUS "  Build static libs ............... : ${BUILD_STATIC_LIBS}")
   MESSAGE(STATUS "  Build pcre2grep ................. : ${PCRE2_BUILD_PCRE2GREP}")
   MESSAGE(STATUS "  Enable JIT in pcre2grep ......... : ${PCRE2_SUPPORT_PCRE2GREP_JIT}")
+  MESSAGE(STATUS "  Enable callouts in pcre2grep .... : ${PCRE2_SUPPORT_PCRE2GREP_CALLOUT}")
   MESSAGE(STATUS "  Buffer size for pcre2grep ....... : ${PCRE2GREP_BUFSIZE}")
   MESSAGE(STATUS "  Build tests (implies pcre2test  . : ${PCRE2_BUILD_TESTS}")
   MESSAGE(STATUS "               and pcre2grep)")
index 2035490c661a18fa9b2b7e9a12d8055c8bd05960..3dcebb9548727a28a2bfaa1e58f85b60bc96882e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,182 @@
 Change Log for PCRE2
 --------------------
 
+
+Version 10.22 29-July-2016
+--------------------------
+
+1. Applied Jason Hood's patches to RunTest.bat and testdata/wintestoutput3
+to fix problems with running the tests under Windows.
+
+2. Implemented a facility for quoting literal characters within hexadecimal
+patterns in pcre2test, to make it easier to create patterns with just a few
+non-printing characters.
+
+3. Binary zeros are not supported in pcre2test input files. It now detects them
+and gives an error.
+
+4. Updated the valgrind parameters in RunTest: (a) changed smc-check=all to
+smc-check=all-non-file; (b) changed obj:* in the suppression file to obj:??? so
+that it matches only unknown objects.
+
+5. Updated the maintenance script maint/ManyConfigTests to make it easier to
+select individual groups of tests.
+
+6. When the POSIX wrapper function regcomp() is called, the REG_NOSUB option
+used to set PCRE2_NO_AUTO_CAPTURE when calling pcre2_compile(). However, this
+disables the use of back references (and subroutine calls), which are supported
+by other implementations of regcomp() with RE_NOSUB. Therefore, REG_NOSUB no
+longer causes PCRE2_NO_AUTO_CAPTURE to be set, though it still ignores nmatch
+and pmatch when regexec() is called.
+
+7. Because of 6 above, pcre2test has been modified with a new modifier called
+posix_nosub, to call regcomp() with REG_NOSUB. Previously the no_auto_capture
+modifier had this effect. That option is now ignored when the POSIX API is in
+use.
+
+8. Minor tidies to the pcre2demo.c sample program, including more comments
+about its 8-bit-ness.
+
+9. Detect unmatched closing parentheses and give the error in the pre-scan
+instead of later. Previously the pre-scan carried on and could give a
+misleading incorrect error message. For example, /(?J)(?'a'))(?'a')/ gave a
+message about invalid duplicate group names.
+
+10. It has happened that pcre2test was accidentally linked with another POSIX
+regex library instead of libpcre2-posix. In this situation, a call to regcomp()
+(in the other library) may succeed, returning zero, but of course putting its
+own data into the regex_t block. In one example the re_pcre2_code field was
+left as NULL, which made pcre2test think it had not got a compiled POSIX regex,
+so it treated the next line as another pattern line, resulting in a confusing
+error message. A check has been added to pcre2test to see if the data returned
+from a successful call of regcomp() are valid for PCRE2's regcomp(). If they
+are not, an error message is output and the pcre2test run is abandoned. The
+message points out the possibility of a mis-linking. Hopefully this will avoid
+some head-scratching the next time this happens.
+
+11. A pattern such as /(?<=((?C)0))/, which has a callout inside a lookbehind
+assertion, caused pcre2test to output a very large number of spaces when the
+callout was taken, making the program appearing to loop.
+
+12. A pattern that included (*ACCEPT) in the middle of a sufficiently deeply
+nested set of parentheses of sufficient size caused an overflow of the
+compiling workspace (which was diagnosed, but of course is not desirable).
+
+13. Detect missing closing parentheses during the pre-pass for group
+identification.
+
+14. Changed some integer variable types and put in a number of casts, following
+a report of compiler warnings from Visual Studio 2013 and a few tests with
+gcc's -Wconversion (which still throws up a lot).
+
+15. Implemented pcre2_code_copy(), and added pushcopy and #popcopy to pcre2test
+for testing it.
+
+16. Change 66 for 10.21 introduced the use of snprintf() in PCRE2's version of
+regerror(). When the error buffer is too small, my version of snprintf() puts a
+binary zero in the final byte. Bug #1801 seems to show that other versions do
+not do this, leading to bad output from pcre2test when it was checking for
+buffer overflow. It no longer assumes a binary zero at the end of a too-small
+regerror() buffer.
+
+17. Fixed typo ("&&" for "&") in pcre2_study(). Fortunately, this could not
+actually affect anything, by sheer luck.
+
+18. Two minor fixes for MSVC compilation: (a) removal of apparently incorrect
+"const" qualifiers in pcre2test and (b) defining snprintf as _snprintf for
+older MSVC compilers. This has been done both in src/pcre2_internal.h for most
+of the library, and also in src/pcre2posix.c, which no longer includes
+pcre2_internal.h (see 24 below).
+
+19. Applied Chris Wilson's patch (Bugzilla #1681) to CMakeLists.txt for MSVC
+static compilation. Subsequently applied Chris Wilson's second patch, putting
+the first patch under a new option instead of being unconditional when
+PCRE_STATIC is set.
+
+20. Updated pcre2grep to set stdout as binary when run under Windows, so as not
+to convert \r\n at the ends of reflected lines into \r\r\n. This required
+ensuring that other output that is written to stdout (e.g. file names) uses the
+appropriate line terminator: \r\n for Windows, \n otherwise.
+
+21. When a line is too long for pcre2grep's internal buffer, show the maximum
+length in the error message.
+
+22. Added support for string callouts to pcre2grep (Zoltan's patch with PH
+additions).
+
+23. RunTest.bat was missing a "set type" line for test 22.
+
+24. The pcre2posix.c file was including pcre2_internal.h, and using some
+"private" knowledge of the data structures. This is unnecessary; the code has
+been re-factored and no longer includes pcre2_internal.h.
+
+25. A racing condition is fixed in JIT reported by Mozilla.
+
+26. Minor code refactor to avoid "array subscript is below array bounds"
+compiler warning.
+
+27. Minor code refactor to avoid "left shift of negative number" warning.
+
+28. Add a bit more sanity checking to pcre2_serialize_decode() and document
+that it expects trusted data.
+
+29. Fix typo in pcre2_jit_test.c
+
+30. Due to an oversight, pcre2grep was not making use of JIT when available.
+This is now fixed.
+
+31. The RunGrepTest script is updated to use the valgrind suppressions file
+when testing with JIT under valgrind (compare 10.21/51 below). The suppressions
+file is updated so that is now the same as for PCRE1: it suppresses the
+Memcheck warnings Addr16 and Cond in unknown objects (that is, JIT-compiled
+code). Also changed smc-check=all to smc-check=all-non-file as was done for
+RunTest (see 4 above).
+
+32. Implemented the PCRE2_NO_JIT option for pcre2_match().
+
+33. Fix typo that gave a compiler error when JIT not supported.
+
+34. Fix comment describing the returns from find_fixedlength().
+
+35. Fix potential negative index in pcre2test.
+
+36. Calls to pcre2_get_error_message() with error numbers that are never
+returned by PCRE2 functions were returning empty strings. Now the error code
+PCRE2_ERROR_BADDATA is returned. A facility has been added to pcre2test to
+show the texts for given error numbers (i.e. to call pcre2_get_error_message()
+and display what it returns) and a few representative error codes are now
+checked in RunTest.
+
+37. Added "&& !defined(__INTEL_COMPILER)" to the test for __GNUC__ in
+pcre2_match.c, in anticipation that this is needed for the same reason it was
+recently added to pcrecpp.cc in PCRE1.
+
+38. Using -o with -M in pcre2grep could cause unnecessary repeated output when
+the match extended over a line boundary, as it tried to find more matches "on
+the same line" - but it was already over the end.
+
+39. Allow \C in lookbehinds and DFA matching in UTF-32 mode (by converting it
+to the same code as '.' when PCRE2_DOTALL is set).
+
+40. Fix two clang compiler warnings in pcre2test when only one code unit width
+is supported.
+
+41. Upgrade RunTest to automatically re-run test 2 with a large (64M) stack if
+it fails when running the interpreter with a 16M stack (and if changing the
+stack size via pcre2test is possible). This avoids having to manually set a
+large stack size when testing with clang.
+
+42. Fix register overwite in JIT when SSE2 acceleration is enabled.
+
+43. Detect integer overflow in pcre2test pattern and data repetition counts.
+
+44. In pcre2test, ignore "allcaptures" after DFA matching.
+
+45. Fix unaligned accesses on x86. Patch by Marc Mutz.
+
+46. Fix some more clang compiler warnings.
+
+
 Version 10.21 12-January-2016
 -----------------------------
 
@@ -371,7 +547,7 @@ space or a #-type comment that was followed by (?-x), which turns off
 PCRE2_EXTENDED, and there was no subsequent (?x) to turn it on again,
 pcre2_compile() assumed that (?-x) applied to the whole pattern and
 consequently mis-compiled it. This bug was found by the LLVM fuzzer. The fix
-for this bug means that a setting of any of the (?imsxU) options at the start
+for this bug means that a setting of any of the (?imsxJU) options at the start
 of a pattern is no longer transferred to the options that are returned by
 PCRE2_INFO_ALLOPTIONS. In fact, this was an anachronism that should have
 changed when the effects of those options were all moved to compile time.
diff --git a/HACKING b/HACKING
index 051520c2828da296c443c5afac6f93e54a5fcdfd..883aa64a837883775a7fd18bab0549d493fe1dfa 100644 (file)
--- a/HACKING
+++ b/HACKING
@@ -228,6 +228,11 @@ OP_ASSERT_ACCEPT is used when (*ACCEPT) is encountered within an assertion.
 This ends the assertion, not the entire pattern match. The assertion (?!) is 
 always optimized to OP_FAIL.
 
+OP_ALLANY is used for '.' when PCRE2_DOTALL is set. It is also used for \C in
+non-UTF modes and in UTF-32 mode (since one code unit still equals one 
+character). Another use is for [^] when empty classes are permitted
+(PCRE2_ALLOW_EMPTY_CLASS is set).
+
 
 Backtracking control verbs with optional data
 ---------------------------------------------
@@ -601,4 +606,4 @@ not a real opcode, but is used to check that tables indexed by opcode are the
 correct length, in order to catch updating errors.
 
 Philip Hazel
-June 2015
+June 2016
index 5977ba06b90005bd1c5a96d28147b6cb6bcfddb6..38f1d41b8a734c29410a540fbd5a347c3dcfd5c8 100644 (file)
@@ -25,6 +25,7 @@ dist_html_DATA = \
   doc/html/pcre2-config.html \
   doc/html/pcre2.html \
   doc/html/pcre2_callout_enumerate.html \
+  doc/html/pcre2_code_copy.html \
   doc/html/pcre2_code_free.html \
   doc/html/pcre2_compile.html \
   doc/html/pcre2_compile_context_copy.html \
@@ -105,6 +106,7 @@ dist_man_MANS = \
   doc/pcre2-config.1 \
   doc/pcre2.3 \
   doc/pcre2_callout_enumerate.3 \
+  doc/pcre2_code_copy.3 \
   doc/pcre2_code_free.3 \
   doc/pcre2_compile.3 \
   doc/pcre2_compile_context_copy.3 \
@@ -568,6 +570,7 @@ EXTRA_DIST += \
   testdata/greplist \
   testdata/grepoutput \
   testdata/grepoutput8 \
+  testdata/grepoutputC \
   testdata/grepoutputN \
   testdata/greppatN4 \
   testdata/testinput1 \
index d86120b5b00fa89f75a1ed3dd084fae292fe043f..ddc5132701fd7261c850d7a11ddd77f54a175855 100644 (file)
@@ -831,6 +831,7 @@ dist_html_DATA = \
   doc/html/pcre2-config.html \
   doc/html/pcre2.html \
   doc/html/pcre2_callout_enumerate.html \
+  doc/html/pcre2_code_copy.html \
   doc/html/pcre2_code_free.html \
   doc/html/pcre2_compile.html \
   doc/html/pcre2_compile_context_copy.html \
@@ -911,6 +912,7 @@ dist_man_MANS = \
   doc/pcre2-config.1 \
   doc/pcre2.3 \
   doc/pcre2_callout_enumerate.3 \
+  doc/pcre2_code_copy.3 \
   doc/pcre2_code_free.3 \
   doc/pcre2_compile.3 \
   doc/pcre2_compile_context_copy.3 \
@@ -1052,16 +1054,17 @@ EXTRA_DIST = m4/ax_pthread.m4 m4/pcre2_visibility.m4 \
        testdata/grepfilelist testdata/grepinput testdata/grepinput3 \
        testdata/grepinput8 testdata/grepinputv testdata/grepinputx \
        testdata/greplist testdata/grepoutput testdata/grepoutput8 \
-       testdata/grepoutputN testdata/greppatN4 testdata/testinput1 \
-       testdata/testinput2 testdata/testinput3 testdata/testinput4 \
-       testdata/testinput5 testdata/testinput6 testdata/testinput7 \
-       testdata/testinput8 testdata/testinput9 testdata/testinput10 \
-       testdata/testinput11 testdata/testinput12 testdata/testinput13 \
-       testdata/testinput14 testdata/testinput15 testdata/testinput16 \
-       testdata/testinput17 testdata/testinput18 testdata/testinput19 \
-       testdata/testinput20 testdata/testinput21 testdata/testinput22 \
-       testdata/testinput23 testdata/testinputEBC \
-       testdata/testoutput1 testdata/testoutput2 testdata/testoutput3 \
+       testdata/grepoutputC testdata/grepoutputN testdata/greppatN4 \
+       testdata/testinput1 testdata/testinput2 testdata/testinput3 \
+       testdata/testinput4 testdata/testinput5 testdata/testinput6 \
+       testdata/testinput7 testdata/testinput8 testdata/testinput9 \
+       testdata/testinput10 testdata/testinput11 testdata/testinput12 \
+       testdata/testinput13 testdata/testinput14 testdata/testinput15 \
+       testdata/testinput16 testdata/testinput17 testdata/testinput18 \
+       testdata/testinput19 testdata/testinput20 testdata/testinput21 \
+       testdata/testinput22 testdata/testinput23 \
+       testdata/testinputEBC testdata/testoutput1 \
+       testdata/testoutput2 testdata/testoutput3 \
        testdata/testoutput3A testdata/testoutput3B \
        testdata/testoutput4 testdata/testoutput5 testdata/testoutput6 \
        testdata/testoutput7 testdata/testoutput8-16-2 \
diff --git a/NEWS b/NEWS
index aaeee5c24232061d8c19300df3be761ea5a253c1..602e324250f509a1821f3ad1f5037fb182f65581 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,28 @@
 News about PCRE2 releases
 -------------------------
 
+Version 10.22 29-July-2016
+--------------------------
+
+1. ChangeLog has the details of a number of bug fixes.
+
+2. The POSIX wrapper function regcomp() did not used to support back references
+and subroutine calls if called with the REG_NOSUB option. It now does.
+
+3. A new function, pcre2_code_copy(), is added, to make a copy of a compiled
+pattern.
+
+4. Support for string callouts is added to pcre2grep.
+
+5. Added the PCRE2_NO_JIT option to pcre2_match().
+
+6. The pcre2_get_error_message() function now returns with a negative error
+code if the error number it is given is unknown.
+
+7. Several updates have been made to pcre2test and test scripts (see
+ChangeLog).
+
+
 Version 10.21 12-January-2016
 -----------------------------
 
diff --git a/README b/README
index 48d2ffdd7cbcacdd5dee1af65e2f52b84b3201cb..03d67f65f6b23435fc9b652f437dd5adc32c25ce 100644 (file)
--- a/README
+++ b/README
@@ -168,15 +168,12 @@ library. They are also documented in the pcre2build man page.
   built. If you want only the 16-bit or 32-bit library, use --disable-pcre2-8
   to disable building the 8-bit library.
 
-. If you want to include support for just-in-time compiling, which can give
-  large performance improvements on certain platforms, add --enable-jit to the
-  "configure" command. This support is available only for certain hardware
+. If you want to include support for just-in-time (JIT) compiling, which can
+  give large performance improvements on certain platforms, add --enable-jit to
+  the "configure" command. This support is available only for certain hardware
   architectures. If you try to enable it on an unsupported architecture, there
   will be a compile time error.
 
-. When JIT support is enabled, pcre2grep automatically makes use of it, unless
-  you add --disable-pcre2grep-jit to the "configure" command.
-
 . If you do not want to make use of the support for UTF-8 Unicode character
   strings in the 8-bit library, UTF-16 Unicode character strings in the 16-bit
   library, or UTF-32 Unicode character strings in the 32-bit library, you can
@@ -324,6 +321,14 @@ library. They are also documented in the pcre2build man page.
   running "make" to build PCRE2. There is more information about coverage
   reporting in the "pcre2build" documentation.
 
+. When JIT support is enabled, pcre2grep automatically makes use of it, unless
+  you add --disable-pcre2grep-jit to the "configure" command.
+
+. On non-Windows sytems there is support for calling external scripts during
+  matching in the pcre2grep command via PCRE2's callout facility with string
+  arguments. This support can be disabled by adding --disable-pcre2grep-callout
+  to the "configure" command.
+
 . The pcre2grep program currently supports only 8-bit data files, and so
   requires the 8-bit PCRE2 library. It is possible to compile pcre2grep to use
   libz and/or libbz2, in order to read .gz and .bz2 files (respectively), by
@@ -840,4 +845,4 @@ The distribution should contain the files listed below.
 Philip Hazel
 Email local part: ph10
 Email domain: cam.ac.uk
-Last updated: 16 October 2015
+Last updated: 01 April 2016
index 67d672ba37bea642b3756e655871427fdafccbcd..a3e13120c3c7dbc8ccab1b8225f3ee63738abb10 100755 (executable)
@@ -34,17 +34,22 @@ fi
 valgrind=
 while [ $# -gt 0 ] ; do
   case $1 in
-    valgrind) valgrind="valgrind -q --leak-check=no --smc-check=all";;
+    valgrind) valgrind="valgrind -q --leak-check=no --smc-check=all-non-file";;
     *) echo "RunGrepTest: Unknown argument $1"; exit 1;;
   esac
   shift
 done
 
+vjs=
 pcre2grep_version=`$pcre2grep -V`
 if [ "$valgrind" = "" ] ; then
   echo "Testing $pcre2grep_version"
 else
   echo "Testing $pcre2grep_version using valgrind"
+  $pcre2test -C jit >/dev/null
+  if [ $? -ne 0 ]; then
+    vjs="--suppressions=./testdata/valgrind-jit.supp"
+  fi
 fi
 
 # Set up a suitable "diff" command for comparison. Some systems have a diff
@@ -101,253 +106,253 @@ checkspecial()
 echo "Testing pcre2grep main features"
 
 echo "---------------------------- Test 1 ------------------------------" >testtrygrep
-(cd $srcdir; $valgrind $pcre2grep PATTERN ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep PATTERN ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 2 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep '^PATTERN' ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep '^PATTERN' ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 3 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -in PATTERN ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -in PATTERN ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 4 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -ic PATTERN ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -ic PATTERN ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 5 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -in PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -in PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 6 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -inh PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -inh PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 7 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -il PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -il PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 8 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -l PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -l PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 9 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -q PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -q PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 10 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -q NEVER-PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -q NEVER-PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 11 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -vn pattern ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -vn pattern ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 12 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -ix pattern ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -ix pattern ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 13 -----------------------------" >>testtrygrep
 echo seventeen >testtemp1grep
-(cd $srcdir; $valgrind $pcre2grep -f./testdata/greplist -f $builddir/testtemp1grep ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -f./testdata/greplist -f $builddir/testtemp1grep ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 14 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -w pat ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -w pat ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 15 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep 'abc^*' ./testdata/grepinput) 2>>testtrygrep >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep 'abc^*' ./testdata/grepinput) 2>>testtrygrep >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 16 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep abc ./testdata/grepinput ./testdata/nonexistfile) 2>>testtrygrep >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep abc ./testdata/grepinput ./testdata/nonexistfile) 2>>testtrygrep >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 17 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -M 'the\noutput' ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -M 'the\noutput' ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 18 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -Mn '(the\noutput|dog\.\n--)' ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -Mn '(the\noutput|dog\.\n--)' ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 19 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -Mix 'Pattern' ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -Mix 'Pattern' ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 20 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -Mixn 'complete pair\nof lines' ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -Mixn 'complete pair\nof lines' ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 21 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -nA3 'four' ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -nA3 'four' ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 22 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -nB3 'four' ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -nB3 'four' ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 23 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -C3 'four' ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -C3 'four' ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 24 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -A9 'four' ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -A9 'four' ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 25 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -nB9 'four' ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -nB9 'four' ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 26 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -A9 -B9 'four' ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -A9 -B9 'four' ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 27 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -A10 'four' ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -A10 'four' ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 28 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -nB10 'four' ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -nB10 'four' ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 29 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -C12 -B10 'four' ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -C12 -B10 'four' ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 30 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -inB3 'pattern' ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -inB3 'pattern' ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 31 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -inA3 'pattern' ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -inA3 'pattern' ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 32 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -L 'fox' ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -L 'fox' ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 33 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep 'fox' ./testdata/grepnonexist) >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep 'fox' ./testdata/grepnonexist) >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 34 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -s 'fox' ./testdata/grepnonexist) >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep -s 'fox' ./testdata/grepnonexist) >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 35 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -L -r --include=grepinputx --include grepinput8 --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include=grepinputx --include grepinput8 --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 36 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -L -r --include=grepinput --exclude 'grepinput$' --exclude=grepinput8 --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include=grepinput --exclude 'grepinput$' --exclude=grepinput8 --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 37 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep  '^(a+)*\d' ./testdata/grepinput) >>testtrygrep 2>teststderrgrep
+(cd $srcdir; $valgrind $vjs $pcre2grep  '^(a+)*\d' ./testdata/grepinput) >>testtrygrep 2>teststderrgrep
 echo "RC=$?" >>testtrygrep
 echo "======== STDERR ========" >>testtrygrep
 cat teststderrgrep >>testtrygrep
 
 echo "---------------------------- Test 38 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep '>\x00<' ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep '>\x00<' ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 39 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -A1 'before the binary zero' ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -A1 'before the binary zero' ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 40 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -B1 'after the binary zero' ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -B1 'after the binary zero' ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 41 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -B1 -o '\w+ the binary zero' ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -B1 -o '\w+ the binary zero' ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 42 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -B1 -onH '\w+ the binary zero' ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -B1 -onH '\w+ the binary zero' ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 43 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -on 'before|zero|after' ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -on 'before|zero|after' ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 44 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -on -e before -ezero -e after ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -on -e before -ezero -e after ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 45 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -on -f ./testdata/greplist -e binary ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -on -f ./testdata/greplist -e binary ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 46 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -eabc -e '(unclosed' ./testdata/grepinput) 2>>testtrygrep >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -eabc -e '(unclosed' ./testdata/grepinput) 2>>testtrygrep >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 47 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -Fx "AB.VE
+(cd $srcdir; $valgrind $vjs $pcre2grep -Fx "AB.VE
 elephant" ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 48 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -F "AB.VE
+(cd $srcdir; $valgrind $vjs $pcre2grep -F "AB.VE
 elephant" ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 49 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -F -e DATA -e "AB.VE
+(cd $srcdir; $valgrind $vjs $pcre2grep -F -e DATA -e "AB.VE
 elephant" ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 50 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 51 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -Mv "brown\sfox" ./testdata/grepinputv) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -Mv "brown\sfox" ./testdata/grepinputv) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 52 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --colour=always jumps ./testdata/grepinputv) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep --colour=always jumps ./testdata/grepinputv) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 53 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --file-offsets 'before|zero|after' ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep --file-offsets 'before|zero|after' ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 54 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --line-offsets 'before|zero|after' ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep --line-offsets 'before|zero|after' ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 55 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -f./testdata/greplist --color=always ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -f./testdata/greplist --color=always ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 56 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -c lazy ./testdata/grepinput*) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -c lazy ./testdata/grepinput*) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 57 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -c -l lazy ./testdata/grepinput*) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -c -l lazy ./testdata/grepinput*) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 58 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --regex=PATTERN ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep --regex=PATTERN ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 59 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --regexp=PATTERN ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep --regexp=PATTERN ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 60 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --regex PATTERN ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep --regex PATTERN ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 61 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --regexp PATTERN ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep --regexp PATTERN ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 62 -----------------------------" >>testtrygrep
@@ -359,196 +364,208 @@ echo "---------------------------- Test 63 -----------------------------" >>test
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 64 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -o1 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -o1 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 65 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -o2 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -o2 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 66 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -o3 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -o3 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 67 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -o12 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -o12 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 68 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --only-matching=2 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep --only-matching=2 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 69 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -vn --colour=always pattern ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -vn --colour=always pattern ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 70 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --color=always -M "triple:\t.*\n\n" ./testdata/grepinput3) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep --color=always -M "triple:\t.*\n\n" ./testdata/grepinput3) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 71 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -o "^01|^02|^03" ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -o "^01|^02|^03" ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 72 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --color=always "^01|^02|^03" ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep --color=always "^01|^02|^03" ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 73 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -o --colour=always "^01|^02|^03" ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -o --colour=always "^01|^02|^03" ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 74 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -o "^01|02|^03" ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -o "^01|02|^03" ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 75 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --color=always "^01|02|^03" ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep --color=always "^01|02|^03" ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 76 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -o --colour=always "^01|02|^03" ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -o --colour=always "^01|02|^03" ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 77 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -o "^01|^02|03" ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -o "^01|^02|03" ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 78 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --color=always "^01|^02|03" ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep --color=always "^01|^02|03" ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 79 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -o --colour=always "^01|^02|03" ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -o --colour=always "^01|^02|03" ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 80 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -o "\b01|\b02" ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -o "\b01|\b02" ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 81 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --color=always "\\b01|\\b02" ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep --color=always "\\b01|\\b02" ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 82 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -o --colour=always "\\b01|\\b02" ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -o --colour=always "\\b01|\\b02" ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 83 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --buffer-size=100 "^a" ./testdata/grepinput3) >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep --buffer-size=100 "^a" ./testdata/grepinput3) >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 84 -----------------------------" >>testtrygrep
 echo testdata/grepinput3 >testtemp1grep
-(cd $srcdir; $valgrind $pcre2grep --file-list ./testdata/grepfilelist --file-list $builddir/testtemp1grep "fox|complete|t7") >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep --file-list ./testdata/grepfilelist --file-list $builddir/testtemp1grep "fox|complete|t7") >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 85 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --file-list=./testdata/grepfilelist "dolor" ./testdata/grepinput3) >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep --file-list=./testdata/grepfilelist "dolor" ./testdata/grepinput3) >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 86 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 87 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep "cat" ./testdata/grepbinary) >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep "cat" ./testdata/grepbinary) >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 88 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -v "cat" ./testdata/grepbinary) >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep -v "cat" ./testdata/grepbinary) >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 89 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -I "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep -I "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 90 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --binary-files=without-match "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep --binary-files=without-match "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 91 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -a "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep -a "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 92 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --binary-files=text "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep --binary-files=text "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 93 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --text "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep --text "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 94 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -L -r --include=grepinputx --include grepinput8 'fox' ./testdata/grepinput* | sort) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include=grepinputx --include grepinput8 'fox' ./testdata/grepinput* | sort) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 95 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --file-list ./testdata/grepfilelist --exclude grepinputv "fox|complete") >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep --file-list ./testdata/grepfilelist --exclude grepinputv "fox|complete") >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 96 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -L -r --include-dir=testdata --exclude '^(?!grepinput)' 'fox' ./test* | sort) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include-dir=testdata --exclude '^(?!grepinput)' 'fox' ./test* | sort) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 97 -----------------------------" >>testtrygrep
 echo "grepinput$" >testtemp1grep
 echo "grepinput8" >>testtemp1grep
-(cd $srcdir; $valgrind $pcre2grep -L -r --include=grepinput --exclude-from $builddir/testtemp1grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include=grepinput --exclude-from $builddir/testtemp1grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 98 -----------------------------" >>testtrygrep
 echo "grepinput$" >testtemp1grep
 echo "grepinput8" >>testtemp1grep
-(cd $srcdir; $valgrind $pcre2grep -L -r --exclude=grepinput3 --include=grepinput --exclude-from $builddir/testtemp1grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --exclude=grepinput3 --include=grepinput --exclude-from $builddir/testtemp1grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 99 -----------------------------" >>testtrygrep
 echo "grepinput$" >testtemp1grep
 echo "grepinput8" >testtemp2grep
-(cd $srcdir; $valgrind $pcre2grep -L -r --include grepinput --exclude-from $builddir/testtemp1grep --exclude-from=$builddir/testtemp2grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include grepinput --exclude-from $builddir/testtemp1grep --exclude-from=$builddir/testtemp2grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 100 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -Ho2 --only-matching=1 -o3 '(\w+) binary (\w+)(\.)?' ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -Ho2 --only-matching=1 -o3 '(\w+) binary (\w+)(\.)?' ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 101 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -o3 -Ho2 -o12 --only-matching=1 -o3 --colour=always --om-separator='|' '(\w+) binary (\w+)(\.)?' ./testdata/grepinput) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -o3 -Ho2 -o12 --only-matching=1 -o3 --colour=always --om-separator='|' '(\w+) binary (\w+)(\.)?' ./testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 102 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -n "^$" ./testdata/grepinput3) >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep -n "^$" ./testdata/grepinput3) >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 103 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --only-matching "^$" ./testdata/grepinput3) >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep --only-matching "^$" ./testdata/grepinput3) >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 104 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -n --only-matching "^$" ./testdata/grepinput3) >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep -n --only-matching "^$" ./testdata/grepinput3) >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 105 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep --colour=always "ipsum|" ./testdata/grepinput3) >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep --colour=always "ipsum|" ./testdata/grepinput3) >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 106 -----------------------------" >>testtrygrep
-(cd $srcdir; echo "a" | $valgrind $pcre2grep -M "|a" ) >>testtrygrep 2>&1
+(cd $srcdir; echo "a" | $valgrind $vjs $pcre2grep -M "|a" ) >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 107 -----------------------------" >>testtrygrep
 echo "a" >testtemp1grep
 echo "aaaaa" >>testtemp1grep
-(cd $srcdir; $valgrind $pcre2grep  --line-offsets '(?<=\Ka)' $builddir/testtemp1grep) >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep  --line-offsets '(?<=\Ka)' $builddir/testtemp1grep) >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 108 ------------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -lq PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -lq PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 109 -----------------------------" >>testtrygrep
-(cd $srcdir; $valgrind $pcre2grep -cq lazy ./testdata/grepinput*) >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep -cq lazy ./testdata/grepinput*) >>testtrygrep
+echo "RC=$?" >>testtrygrep
+
+echo "---------------------------- Test 110 -----------------------------" >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep --om-separator / -Mo0 -o1 -o2 'match (\d+):\n (.)\n' testdata/grepinput) >>testtrygrep
+echo "RC=$?" >>testtrygrep
+
+echo "---------------------------- Test 111 -----------------------------" >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep --line-offsets -M 'match (\d+):\n (.)\n' testdata/grepinput) >>testtrygrep
+echo "RC=$?" >>testtrygrep
+
+echo "---------------------------- Test 112 -----------------------------" >>testtrygrep
+(cd $srcdir; $valgrind $vjs $pcre2grep --file-offsets -M 'match (\d+):\n (.)\n' testdata/grepinput) >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 # Now compare the results.
@@ -563,15 +580,15 @@ if [ $utf8 -ne 0 ] ; then
   echo "Testing pcre2grep UTF-8 features"
 
   echo "---------------------------- Test U1 ------------------------------" >testtrygrep
-  (cd $srcdir; $valgrind $pcre2grep -n -u --newline=any "^X" ./testdata/grepinput8) >>testtrygrep
+  (cd $srcdir; $valgrind $vjs $pcre2grep -n -u --newline=any "^X" ./testdata/grepinput8) >>testtrygrep
   echo "RC=$?" >>testtrygrep
 
   echo "---------------------------- Test U2 ------------------------------" >>testtrygrep
-  (cd $srcdir; $valgrind $pcre2grep -n -u -C 3 --newline=any "Match" ./testdata/grepinput8) >>testtrygrep
+  (cd $srcdir; $valgrind $vjs $pcre2grep -n -u -C 3 --newline=any "Match" ./testdata/grepinput8) >>testtrygrep
   echo "RC=$?" >>testtrygrep
 
   echo "---------------------------- Test U3 ------------------------------" >>testtrygrep
-  (cd $srcdir; $valgrind $pcre2grep --line-offsets -u --newline=any '(?<=\K\x{17f})' ./testdata/grepinput8) >>testtrygrep
+  (cd $srcdir; $valgrind $vjs $pcre2grep --line-offsets -u --newline=any '(?<=\K\x{17f})' ./testdata/grepinput8) >>testtrygrep
   echo "RC=$?" >>testtrygrep
 
   $cf $srcdir/testdata/grepoutput8 testtrygrep
@@ -593,27 +610,38 @@ echo "Testing pcre2grep newline settings"
 printf "abc\rdef\r\nghi\njkl" >testNinputgrep
 
 printf "%c--------------------------- Test N1 ------------------------------\r\n" - >testtrygrep
-$valgrind $pcre2grep -n -N CR "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
+$valgrind $vjs $pcre2grep -n -N CR "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
 
 printf "%c--------------------------- Test N2 ------------------------------\r\n" - >>testtrygrep
-$valgrind $pcre2grep -n --newline=crlf "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
+$valgrind $vjs $pcre2grep -n --newline=crlf "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
 
 printf "%c--------------------------- Test N3 ------------------------------\r\n" - >>testtrygrep
 pattern=`printf 'def\rjkl'`
-$valgrind $pcre2grep -n --newline=cr -F "$pattern" testNinputgrep >>testtrygrep
+$valgrind $vjs $pcre2grep -n --newline=cr -F "$pattern" testNinputgrep >>testtrygrep
 
 printf "%c--------------------------- Test N4 ------------------------------\r\n" - >>testtrygrep
-$valgrind $pcre2grep -n --newline=crlf -F -f $srcdir/testdata/greppatN4 testNinputgrep >>testtrygrep
+$valgrind $vjs $pcre2grep -n --newline=crlf -F -f $srcdir/testdata/greppatN4 testNinputgrep >>testtrygrep
 
 printf "%c--------------------------- Test N5 ------------------------------\r\n" - >>testtrygrep
-$valgrind $pcre2grep -n --newline=any "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
+$valgrind $vjs $pcre2grep -n --newline=any "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
 
 printf "%c--------------------------- Test N6 ------------------------------\r\n" - >>testtrygrep
-$valgrind $pcre2grep -n --newline=anycrlf "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
+$valgrind $vjs $pcre2grep -n --newline=anycrlf "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
 
 $cf $srcdir/testdata/grepoutputN testtrygrep
 if [ $? != 0 ] ; then exit 1; fi
 
+# If pcre2grep supports script callouts, run some tests on them.
+
+if $valgrind $vjs $pcre2grep --help | $valgrind $vjs $pcre2grep -q 'Callout scripts in patterns are supported'; then
+  echo "Testing pcre2grep script callouts"
+  $valgrind $vjs $pcre2grep '(T)(..(.))(?C"/bin/echo|Arg1: [$1] [$2] [$3]|Arg2: $|${1}$| ($4) ($14) ($0)")()' $srcdir/testdata/grepinputv >testtrygrep
+  $valgrind $vjs $pcre2grep '(T)(..(.))()()()()()()()(..)(?C"/bin/echo|Arg1: [$11] [${11}]")' $srcdir/testdata/grepinputv >>testtrygrep
+  $cf $srcdir/testdata/grepoutputC testtrygrep
+  if [ $? != 0 ] ; then exit 1; fi
+else
+  echo "Script callouts are not supported"
+fi
 
 # Finally, some tests to exercise code that is not tested above, just to be
 # sure that it runs OK. Doing this improves the coverage statistics. The output
diff --git a/RunTest b/RunTest
index 36dc638edd7c689313299e4e90da363018f0b4b5..d0eec77e0067db1e3cd3aec3f72cf40b05910ed8 100755 (executable)
--- a/RunTest
+++ b/RunTest
@@ -53,7 +53,7 @@
 
 title0="Test 0: Unchecked pcre2test argument tests (to improve coverage)"
 title1="Test 1: Main non-UTF, non-UCP functionality (compatible with Perl >= 5.10)"
-title2="Test 2: API, errors, internals, and non-Perl stuff"
+title2="Test 2: API, errors, internals and non-Perl stuff"
 title3="Test 3: Locale-specific features"
 title4A="Test 4: UTF"
 title4B=" and Unicode property support (compatible with Perl >= 5.10)"
@@ -74,7 +74,7 @@ title16="Test 16: JIT-specific features when JIT is not available"
 title17="Test 17: JIT-specific features when JIT is available"
 title18="Test 18: Tests of the POSIX interface, excluding UTF/UCP"
 title19="Test 19: Tests of the POSIX interface with UTF/UCP"
-title20="Test 20: Serialization tests"
+title20="Test 20: Serialization and code copy tests"
 title21="Test 21: \C tests without UTF (supported for DFA matching)"
 title22="Test 22: \C tests with UTF (not supported for DFA matching)"
 title23="Test 23: \C disabled test"
@@ -265,8 +265,8 @@ while [ $# -gt 0 ] ; do
    bigstack|-bigstack) bigstack=yes;;
    nojit|-nojit) nojit=yes;;
    sim|-sim) shift; sim=$1;;
-   valgrind|-valgrind) valgrind="valgrind --tool=memcheck -q --smc-check=all";;
-   valgrind-log|-valgrind-log) valgrind="valgrind --tool=memcheck --num-callers=30 --leak-check=no --error-limit=no --smc-check=all --log-file=report.%p ";;
+   valgrind|-valgrind) valgrind="valgrind --tool=memcheck -q --smc-check=all-non-file";;
+   valgrind-log|-valgrind-log) valgrind="valgrind --tool=memcheck --num-callers=30 --leak-check=no --error-limit=no --smc-check=all-non-file --log-file=report.%p ";;
    ~*)
      if expr "$1" : '~[0-9][0-9]*$' >/dev/null; then
        skip="$skip `expr "$1" : '~\([0-9]*\)*$'`"
@@ -310,9 +310,12 @@ fi
 
 # If it is possible to set the system stack size, arrange to set a value for
 # test 2, which needs more than the even the Linux default when PCRE2 has been
-# compiled by gcc with -fsanitize=address. When the compiler is clang, sanitize
-# options require an even bigger stack for test 2, and an increased stack for
-# some of the other tests.
+# compiled by gcc with -fsanitize=address. If "bigstack" is on the command
+# line, set even bigger numbers. When the compiler is clang, sanitize options
+# require an even bigger stack for test 2, and an increased stack for some of
+# the other tests. Test 2 now has code to automatically try again with a 64M
+# stack if it crashes when test2stack is "-S 16" when matching with the
+# interpreter.
 
 $sim ./pcre2test -S 1 /dev/null /dev/null
 if [ $? -eq 0 ] ; then
@@ -499,15 +502,32 @@ for bmode in "$test8" "$test16" "$test32"; do
     for opt in "" $jitopt; do
       $sim $valgrind ${opt:+$vjs} ./pcre2test -q $test2stack $bmode $opt $testdata/testinput2 testtry
       if [ $? = 0 ] ; then
+        $sim $valgrind ${opt:+$vjs} ./pcre2test -q $bmode $opt -error -63,-62,-2,-1,0,100,188,189 >>testtry
         checkresult $? 2 "$opt"
       else
         echo " "
-        echo "** Test 2 requires a lot of stack. If it has crashed with a"
-        echo "** segmentation fault, it may be that you do not have enough"
-        echo "** stack available by default. Please see the 'pcre2stack' man"
-        echo "** page for a discussion of PCRE2's stack usage."
+        echo "** Test 2, when run under the interpreter, requires a lot of stack."
+        echo "** If it has crashed with a segmentation fault, it may be that you"
+        echo "** do not have enough stack available by default. Please see the"
+        echo "** 'pcre2stack' man page for a discussion of PCRE2's stack usage."
+        if [ "$test2stack" != "-S 16" -o "$opt" != "" ]; then
+          echo " "
+          exit 1
+        fi
+        echo " "
+        echo "** Trying again with an increased stack size."
         echo " "
-        exit 1
+        echo $title2 "(excluding UTF-$bits) (64M stack)"
+        $sim $valgrind ${opt:+$vjs} ./pcre2test -q -S 64 $bmode $opt $testdata/testinput2 testtry
+        if [ $? = 0 ] ; then
+          $sim $valgrind ${opt:+$vjs} ./pcre2test -q $bmode $opt -error -63,-62,-2,-1,0,100,188,189 >>testtry
+          checkresult $? 2 "$opt"
+        else
+          echo " "
+          echo "** Failed with an increased stack size. Tests abandoned."
+          echo " "
+          exit 1
+        fi
       fi
     done
   fi
index ce9d5b577eb57c2ff541c998afbe8e23a785b073..54d9f34922e72c52f6357b6c7ec29a26bfcafd30 100644 (file)
@@ -25,6 +25,7 @@
 @rem The file was converted for PCRE2 by PH, February 2015.\r
 @rem Updated for new test 14 (moving others up a number), August 2015.\r
 @rem Tidied and updated for new tests 21, 22, 23 by PH, October 2015.\r
+@rem PH added missing "set type" for test 22, April 2016.\r
 \r
 \r
 setlocal enabledelayedexpansion\r
@@ -242,11 +243,18 @@ if [%3] == [] (
   exit /b 1\r
 )\r
 \r
+if %1 == 8 (\r
+  set outnum=8-%bits%-%link_size%\r
+) else if %1 == 22 (\r
+  set outnum=22-%bits%\r
+) else (\r
+  set outnum=%1\r
+)\r
 set testinput=testinput%1\r
-set testoutput=testoutput%1\r
+set testoutput=testoutput%outnum%\r
 if exist %srcdir%\testdata\win%testinput% (\r
   set testinput=wintestinput%1\r
-  set testoutput=wintestoutput%1\r
+  set testoutput=wintestoutput%outnum%\r
 )\r
 \r
 echo Test %1: %3\r
@@ -259,9 +267,6 @@ if errorlevel 1 (
 )\r
 \r
 set type=\r
-if [%1]==[8] (\r
-  set type=-%bits%\r
-)\r
 if [%1]==[11] (\r
   set type=-%bits%\r
 )\r
@@ -271,6 +276,9 @@ if [%1]==[12] (
 if [%1]==[14] (\r
   set type=-%bits%\r
 )\r
+if [%1]==[22] (\r
+  set type=-%bits%\r
+)\r
 \r
 fc /n %srcdir%\testdata\%testoutput%%type% %2%bits%\%testoutput% >NUL\r
 \r
index 10c9cd1c989ff79ccfb3bdaa9853ddc481bbc7c0..d7204d97d726d331cba57e0e8bc92c78053fb821 100644 (file)
@@ -21,7 +21,7 @@ If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 
 dnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
-dnl serial 11 (pkg-config-0.29)
+dnl serial 11 (pkg-config-0.29.1)
 dnl
 dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
 dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
@@ -63,7 +63,7 @@ dnl
 dnl See the "Since" comment for each macro you use to see what version
 dnl of the macros you require.
 m4_defun([PKG_PREREQ],
-[m4_define([PKG_MACROS_VERSION], [0.29])
+[m4_define([PKG_MACROS_VERSION], [0.29.1])
 m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
     [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
 ])dnl PKG_PREREQ
index e9f9e374d25a4cdcf148cfea4660cad34c3e9eae..72b58bdc526509baa138d768212afd017503f6b5 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for PCRE2 10.21.
+# Generated by GNU Autoconf 2.69 for PCRE2 10.22.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='PCRE2'
 PACKAGE_TARNAME='pcre2'
-PACKAGE_VERSION='10.21'
-PACKAGE_STRING='PCRE2 10.21'
+PACKAGE_VERSION='10.22'
+PACKAGE_STRING='PCRE2 10.22'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -821,6 +821,7 @@ enable_pcre2_32
 enable_debug
 enable_jit
 enable_pcre2grep_jit
+enable_pcre2grep_callout
 enable_rebuild_chartables
 enable_unicode
 enable_newline_is_cr
@@ -1402,7 +1403,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures PCRE2 10.21 to adapt to many kinds of systems.
+\`configure' configures PCRE2 10.22 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1472,7 +1473,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of PCRE2 10.21:";;
+     short | recursive ) echo "Configuration of PCRE2 10.22:";;
    esac
   cat <<\_ACEOF
 
@@ -1498,6 +1499,8 @@ Optional Features:
   --enable-debug          enable debugging code
   --enable-jit            enable Just-In-Time compiling support
   --disable-pcre2grep-jit disable JIT support in pcre2grep
+  --disable-pcre2grep-callout
+                          disable callout script support in pcre2grep
   --enable-rebuild-chartables
                           rebuild character tables in current locale
   --disable-unicode       disable Unicode support
@@ -1638,7 +1641,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-PCRE2 configure 10.21
+PCRE2 configure 10.22
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2133,7 +2136,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by PCRE2 $as_me 10.21, which was
+It was created by PCRE2 $as_me 10.22, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2997,7 +3000,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='pcre2'
- VERSION='10.21'
+ VERSION='10.22'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -13593,9 +13596,9 @@ _ACEOF
 # Versioning
 
 PCRE2_MAJOR="10"
-PCRE2_MINOR="21"
+PCRE2_MINOR="22"
 PCRE2_PRERELEASE=""
-PCRE2_DATE="2016-01-12"
+PCRE2_DATE="2016-07-29"
 
 if test "$PCRE2_MINOR" = "08" -o "$PCRE2_MINOR" = "09"
 then
@@ -13703,6 +13706,20 @@ else
 fi
 
 
+# Handle --disable-pcre2grep-callout (enabled by default) but not supported
+# for Windows.
+if test "$HAVE_WINDOWS_H" != "1"; then
+  # Check whether --enable-pcre2grep-callout was given.
+if test "${enable_pcre2grep_callout+set}" = set; then :
+  enableval=$enable_pcre2grep_callout;
+else
+  enable_pcre2grep_callout=yes
+fi
+
+else
+  enable_pcre2grep_callout=no
+fi
+
 # Handle --enable-rebuild-chartables
 # Check whether --enable-rebuild-chartables was given.
 if test "${enable_rebuild_chartables+set}" = set; then :
 
 done
 
+for ac_header in sys/wait.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "sys/wait.h" "ac_cv_header_sys_wait_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_wait_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_WAIT_H 1
+_ACEOF
+ HAVE_SYS_WAIT_H=1
+fi
+
+done
+
 
 # Conditional compilation
  if test "x$enable_pcre2_8" = "xyes"; then
@@ -15240,6 +15269,23 @@ $as_echo "#define SUPPORT_PCRE2GREP_JIT /**/" >>confdefs.h
 
 fi
 
+# Currently pcre2grep callout string is not supported under Windows.
+
+if test "$enable_pcre2grep_callout" = "yes"; then
+  if test "$HAVE_WINDOWS_H" != "1"; then
+    if test "$HAVE_SYS_WAIT_H" != "1"; then
+      as_fn_error $? "Callout script support needs sys/wait.h." "$LINENO" 5
+    fi
+
+$as_echo "#define SUPPORT_PCRE2GREP_CALLOUT /**/" >>confdefs.h
+
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Callout script support is not available for Windows: disabled" >&5
+$as_echo "$as_me: WARNING: Callout script support is not available for Windows: disabled" >&2;}
+    enable_pcre2grep_callout=no
+  fi
+fi
+
 if test "$enable_unicode" = "yes"; then
 
 $as_echo "#define SUPPORT_UNICODE /**/" >>confdefs.h
@@ -15383,16 +15429,16 @@ esac
 # are m4 variables, assigned above.
 
 EXTRA_LIBPCRE2_8_LDFLAGS="$EXTRA_LIBPCRE2_8_LDFLAGS \
-  $NO_UNDEFINED -version-info 3:0:3"
+  $NO_UNDEFINED -version-info 4:0:4"
 
 EXTRA_LIBPCRE2_16_LDFLAGS="$EXTRA_LIBPCRE2_16_LDFLAGS \
-  $NO_UNDEFINED -version-info 3:0:3"
+  $NO_UNDEFINED -version-info 4:0:4"
 
 EXTRA_LIBPCRE2_32_LDFLAGS="$EXTRA_LIBPCRE2_32_LDFLAGS \
-  $NO_UNDEFINED -version-info 3:0:3"
+  $NO_UNDEFINED -version-info 4:0:4"
 
 EXTRA_LIBPCRE2_POSIX_LDFLAGS="$EXTRA_LIBPCRE2_POSIX_LDFLAGS \
-  $NO_UNDEFINED -version-info 0:1:0"
+  $NO_UNDEFINED -version-info 1:0:0"
 
 
 
@@ -16435,7 +16481,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by PCRE2 $as_me 10.21, which was
+This file was extended by PCRE2 $as_me 10.22, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -16501,7 +16547,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-PCRE2 config.status 10.21
+PCRE2 config.status 10.22
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -18245,6 +18291,7 @@ $PACKAGE-$VERSION configuration summary:
     Build shared libs ............... : ${enable_shared}
     Build static libs ............... : ${enable_static}
     Use JIT in pcre2grep ............ : ${enable_pcre2grep_jit}
+    Enable callouts in pcre2grep .... : ${enable_pcre2grep_callout}
     Buffer size for pcre2grep ....... : ${with_pcre2grep_bufsize}
     Link pcre2grep with libz ........ : ${enable_pcre2grep_libz}
     Link pcre2grep with libbz2 ...... : ${enable_pcre2grep_libbz2}
index 99ad8a9f016f0b0d79023d5fa9c34471ab572af5..d7c57aa6441df1f7a6fa2c9bec11ee27a414c6e5 100644 (file)
@@ -9,18 +9,18 @@ dnl The PCRE2_PRERELEASE feature is for identifying release candidates. It might
 dnl be defined as -RC2, for example. For real releases, it should be empty.
 
 m4_define(pcre2_major, [10])
-m4_define(pcre2_minor, [21])
+m4_define(pcre2_minor, [22])
 m4_define(pcre2_prerelease, [])
-m4_define(pcre2_date, [2016-01-12])
+m4_define(pcre2_date, [2016-07-29])
 
 # NOTE: The CMakeLists.txt file searches for the above variables in the first
 # 50 lines of this file. Please update that if the variables above are moved.
 
 # Libtool shared library interface versions (current:revision:age)
-m4_define(libpcre2_8_version,     [3:0:3])
-m4_define(libpcre2_16_version,    [3:0:3])
-m4_define(libpcre2_32_version,    [3:0:3])
-m4_define(libpcre2_posix_version, [0:1:0])
+m4_define(libpcre2_8_version,     [4:0:4])
+m4_define(libpcre2_16_version,    [4:0:4])
+m4_define(libpcre2_32_version,    [4:0:4])
+m4_define(libpcre2_posix_version, [1:0:0])
 
 AC_PREREQ(2.57)
 AC_INIT(PCRE2, pcre2_major.pcre2_minor[]pcre2_prerelease, , pcre2)
@@ -148,6 +148,17 @@ AC_ARG_ENABLE(pcre2grep-jit,
                              [disable JIT support in pcre2grep]),
               , enable_pcre2grep_jit=yes)
 
+# Handle --disable-pcre2grep-callout (enabled by default) but not supported
+# for Windows.
+if test "$HAVE_WINDOWS_H" != "1"; then
+  AC_ARG_ENABLE(pcre2grep-callout,
+                AS_HELP_STRING([--disable-pcre2grep-callout],
+                               [disable callout script support in pcre2grep]),
+                , enable_pcre2grep_callout=yes)
+else
+  enable_pcre2grep_callout=no
+fi
+
 # Handle --enable-rebuild-chartables
 AC_ARG_ENABLE(rebuild-chartables,
               AS_HELP_STRING([--enable-rebuild-chartables],
@@ -392,6 +403,7 @@ sure both macros are undefined; an emulation function will then be used. */])
 AC_HEADER_STDC
 AC_CHECK_HEADERS(limits.h sys/types.h sys/stat.h dirent.h)
 AC_CHECK_HEADERS([windows.h], [HAVE_WINDOWS_H=1])
+AC_CHECK_HEADERS([sys/wait.h], [HAVE_SYS_WAIT_H=1])
 
 # Conditional compilation
 AM_CONDITIONAL(WITH_PCRE2_8, test "x$enable_pcre2_8" = "xyes")
@@ -546,6 +558,21 @@ if test "$enable_pcre2grep_jit" = "yes"; then
     Define to any value to enable JIT support in pcre2grep.])
 fi
 
+# Currently pcre2grep callout string is not supported under Windows.
+
+if test "$enable_pcre2grep_callout" = "yes"; then
+  if test "$HAVE_WINDOWS_H" != "1"; then
+    if test "$HAVE_SYS_WAIT_H" != "1"; then
+      AC_MSG_ERROR([Callout script support needs sys/wait.h.])
+    fi
+    AC_DEFINE([SUPPORT_PCRE2GREP_CALLOUT], [], [
+      Define to any value to enable callout script support in pcre2grep.])
+  else
+    AC_MSG_WARN([Callout script support is not available for Windows: disabled])
+    enable_pcre2grep_callout=no
+  fi
+fi
+
 if test "$enable_unicode" = "yes"; then
   AC_DEFINE([SUPPORT_UNICODE], [], [
     Define to any value to enable support for Unicode and UTF encoding.
@@ -908,6 +935,7 @@ $PACKAGE-$VERSION configuration summary:
     Build shared libs ............... : ${enable_shared}
     Build static libs ............... : ${enable_static}
     Use JIT in pcre2grep ............ : ${enable_pcre2grep_jit}
+    Enable callouts in pcre2grep .... : ${enable_pcre2grep_callout}
     Buffer size for pcre2grep ....... : ${with_pcre2grep_bufsize}
     Link pcre2grep with libz ........ : ${enable_pcre2grep_libz}
     Link pcre2grep with libbz2 ...... : ${enable_pcre2grep_libbz2}
index 48d2ffdd7cbcacdd5dee1af65e2f52b84b3201cb..03d67f65f6b23435fc9b652f437dd5adc32c25ce 100644 (file)
@@ -168,15 +168,12 @@ library. They are also documented in the pcre2build man page.
   built. If you want only the 16-bit or 32-bit library, use --disable-pcre2-8
   to disable building the 8-bit library.
 
-. If you want to include support for just-in-time compiling, which can give
-  large performance improvements on certain platforms, add --enable-jit to the
-  "configure" command. This support is available only for certain hardware
+. If you want to include support for just-in-time (JIT) compiling, which can
+  give large performance improvements on certain platforms, add --enable-jit to
+  the "configure" command. This support is available only for certain hardware
   architectures. If you try to enable it on an unsupported architecture, there
   will be a compile time error.
 
-. When JIT support is enabled, pcre2grep automatically makes use of it, unless
-  you add --disable-pcre2grep-jit to the "configure" command.
-
 . If you do not want to make use of the support for UTF-8 Unicode character
   strings in the 8-bit library, UTF-16 Unicode character strings in the 16-bit
   library, or UTF-32 Unicode character strings in the 32-bit library, you can
@@ -324,6 +321,14 @@ library. They are also documented in the pcre2build man page.
   running "make" to build PCRE2. There is more information about coverage
   reporting in the "pcre2build" documentation.
 
+. When JIT support is enabled, pcre2grep automatically makes use of it, unless
+  you add --disable-pcre2grep-jit to the "configure" command.
+
+. On non-Windows sytems there is support for calling external scripts during
+  matching in the pcre2grep command via PCRE2's callout facility with string
+  arguments. This support can be disabled by adding --disable-pcre2grep-callout
+  to the "configure" command.
+
 . The pcre2grep program currently supports only 8-bit data files, and so
   requires the 8-bit PCRE2 library. It is possible to compile pcre2grep to use
   libz and/or libbz2, in order to read .gz and .bz2 files (respectively), by
@@ -840,4 +845,4 @@ The distribution should contain the files listed below.
 Philip Hazel
 Email local part: ph10
 Email domain: cam.ac.uk
-Last updated: 16 October 2015
+Last updated: 01 April 2016
index f459657143000ae6ef7a8c444972dd722b580f58..703c29837c20f0cff3fb81157ce34a34c3de714f 100644 (file)
@@ -91,6 +91,9 @@ in the library.
 <tr><td><a href="pcre2_callout_enumerate.html">pcre2_callout_enumerate</a></td>
     <td>&nbsp;&nbsp;Enumerate callouts in a compiled pattern</td></tr>
 
+<tr><td><a href="pcre2_code_copy.html">pcre2_code_copy</a></td>
+    <td>&nbsp;&nbsp;Copy a compiled pattern</td></tr>
+
 <tr><td><a href="pcre2_code_free.html">pcre2_code_free</a></td>
     <td>&nbsp;&nbsp;Free a compiled pattern</td></tr>
 
diff --git a/doc/html/pcre2_code_copy.html b/doc/html/pcre2_code_copy.html
new file mode 100644 (file)
index 0000000..5b68282
--- /dev/null
@@ -0,0 +1,42 @@
+<html>
+<head>
+<title>pcre2_code_copy specification</title>
+</head>
+<body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
+<h1>pcre2_code_copy man page</h1>
+<p>
+Return to the <a href="index.html">PCRE2 index page</a>.
+</p>
+<p>
+This page is part of the PCRE2 HTML documentation. It was generated
+automatically from the original man page. If there is any nonsense in it,
+please consult the man page, in case the conversion went wrong.
+<br>
+<br><b>
+SYNOPSIS
+</b><br>
+<P>
+<b>#include &#60;pcre2.h&#62;</b>
+</P>
+<P>
+<b>pcre2_code *pcre2_code_copy(const pcre2_code *<i>code</i>);</b>
+</P>
+<br><b>
+DESCRIPTION
+</b><br>
+<P>
+This function makes a copy of the memory used for a compiled pattern, excluding
+any memory used by the JIT compiler. Without a subsequent call to
+<b>pcre2_jit_compile()</b>, the copy can be used only for non-JIT matching. The
+yield of the function is NULL if <i>code</i> is NULL or if sufficient memory
+cannot be obtained.
+</P>
+<P>
+There is a complete description of the PCRE2 native API in the
+<a href="pcre2api.html"><b>pcre2api</b></a>
+page and a description of the POSIX API in the
+<a href="pcre2posix.html"><b>pcre2posix</b></a>
+page.
+<p>
+Return to the <a href="index.html">PCRE2 index page</a>.
+</p>
index 5d422913e409412226c2a8e58c8023e26f31045c..26c80febea89ba06818c639ba43e61a20f0d54c2 100644 (file)
@@ -35,7 +35,10 @@ errors are negative numbers. The arguments are:
   <i>bufflen</i>     the length of the buffer (code units)
 </pre>
 The function returns the length of the message, excluding the trailing zero, or
-a negative error code if the buffer is too small.
+the negative error code PCRE2_ERROR_NOMEMORY if the buffer is too small. In
+this case, the returned message is truncated (but still with a trailing zero).
+If <i>errorcode</i> does not contain a recognized error code number, the
+negative value PCRE2_ERROR_BADDATA is returned.
 </P>
 <P>
 There is a complete description of the PCRE2 native API in the
index bf1dd8eaa22e482bb05acdaf0b2b03979ea1c3a3..fa9f342e2c7ca75f2d03baf8b55bca9287e35152 100644 (file)
@@ -43,16 +43,17 @@ please consult the man page, in case the conversion went wrong.
 <li><a name="TOC28" href="#SEC28">HOW PCRE2_MATCH() RETURNS A STRING AND CAPTURED SUBSTRINGS</a>
 <li><a name="TOC29" href="#SEC29">OTHER INFORMATION ABOUT A MATCH</a>
 <li><a name="TOC30" href="#SEC30">ERROR RETURNS FROM <b>pcre2_match()</b></a>
-<li><a name="TOC31" href="#SEC31">EXTRACTING CAPTURED SUBSTRINGS BY NUMBER</a>
-<li><a name="TOC32" href="#SEC32">EXTRACTING A LIST OF ALL CAPTURED SUBSTRINGS</a>
-<li><a name="TOC33" href="#SEC33">EXTRACTING CAPTURED SUBSTRINGS BY NAME</a>
-<li><a name="TOC34" href="#SEC34">CREATING A NEW STRING WITH SUBSTITUTIONS</a>
-<li><a name="TOC35" href="#SEC35">DUPLICATE SUBPATTERN NAMES</a>
-<li><a name="TOC36" href="#SEC36">FINDING ALL POSSIBLE MATCHES AT ONE POSITION</a>
-<li><a name="TOC37" href="#SEC37">MATCHING A PATTERN: THE ALTERNATIVE FUNCTION</a>
-<li><a name="TOC38" href="#SEC38">SEE ALSO</a>
-<li><a name="TOC39" href="#SEC39">AUTHOR</a>
-<li><a name="TOC40" href="#SEC40">REVISION</a>
+<li><a name="TOC31" href="#SEC31">OBTAINING A TEXTUAL ERROR MESSAGE</a>
+<li><a name="TOC32" href="#SEC32">EXTRACTING CAPTURED SUBSTRINGS BY NUMBER</a>
+<li><a name="TOC33" href="#SEC33">EXTRACTING A LIST OF ALL CAPTURED SUBSTRINGS</a>
+<li><a name="TOC34" href="#SEC34">EXTRACTING CAPTURED SUBSTRINGS BY NAME</a>
+<li><a name="TOC35" href="#SEC35">CREATING A NEW STRING WITH SUBSTITUTIONS</a>
+<li><a name="TOC36" href="#SEC36">DUPLICATE SUBPATTERN NAMES</a>
+<li><a name="TOC37" href="#SEC37">FINDING ALL POSSIBLE MATCHES AT ONE POSITION</a>
+<li><a name="TOC38" href="#SEC38">MATCHING A PATTERN: THE ALTERNATIVE FUNCTION</a>
+<li><a name="TOC39" href="#SEC39">SEE ALSO</a>
+<li><a name="TOC40" href="#SEC40">AUTHOR</a>
+<li><a name="TOC41" href="#SEC41">REVISION</a>
 </ul>
 <P>
 <b>#include &#60;pcre2.h&#62;</b>
@@ -290,6 +291,9 @@ document for an overview of all the PCRE2 documentation.
 </P>
 <br><a name="SEC10" href="#TOC1">PCRE2 NATIVE API AUXILIARY FUNCTIONS</a><br>
 <P>
+<b>pcre2_code *pcre2_code_copy(const pcre2_code *<i>code</i>);</b>
+<br>
+<br>
 <b>int pcre2_get_error_message(int <i>errorcode</i>, PCRE2_UCHAR *<i>buffer</i>,</b>
 <b>  PCRE2_SIZE <i>bufflen</i>);</b>
 <br>
@@ -414,9 +418,10 @@ More complicated programs might need to make use of the specialist functions
 <b>pcre2_jit_stack_assign()</b> in order to control the JIT code's memory usage.
 </P>
 <P>
-JIT matching is automatically used by <b>pcre2_match()</b> if it is available.
-There is also a direct interface for JIT matching, which gives improved
-performance. The JIT-specific functions are discussed in the
+JIT matching is automatically used by <b>pcre2_match()</b> if it is available,
+unless the PCRE2_NO_JIT option is set. There is also a direct interface for JIT
+matching, which gives improved performance. The JIT-specific functions are
+discussed in the
 <a href="pcre2jit.html"><b>pcre2jit</b></a>
 documentation.
 </P>
@@ -455,10 +460,19 @@ return a copy of the subject string with substitutions for parts that were
 matched.
 </P>
 <P>
+Functions whose names begin with <b>pcre2_serialize_</b> are used for saving
+compiled patterns on disc or elsewhere, and reloading them later.
+</P>
+<P>
 Finally, there are functions for finding out information about a compiled
 pattern (<b>pcre2_pattern_info()</b>) and about the configuration with which
 PCRE2 was built (<b>pcre2_config()</b>).
 </P>
+<P>
+Functions with names ending with <b>_free()</b> are used for freeing memory
+blocks of various sorts. In all cases, if one of these functions is called with
+a NULL argument, it does nothing.
+</P>
 <br><a name="SEC13" href="#TOC1">STRING LENGTHS AND OFFSETS</a><br>
 <P>
 The PCRE2 API uses string lengths and offsets into strings of code units in
@@ -516,20 +530,51 @@ time ensuring that multithreaded applications can use it.
 There are several different blocks of data that are used to pass information
 between the application and the PCRE2 libraries.
 </P>
+<br><b>
+The compiled pattern
+</b><br>
 <P>
-(1) A pointer to the compiled form of a pattern is returned to the user when
+A pointer to the compiled form of a pattern is returned to the user when
 <b>pcre2_compile()</b> is successful. The data in the compiled pattern is fixed,
 and does not change when the pattern is matched. Therefore, it is thread-safe,
 that is, the same compiled pattern can be used by more than one thread
-simultaneously. An application can compile all its patterns at the start,
-before forking off multiple threads that use them. However, if the just-in-time
-optimization feature is being used, it needs separate memory stack areas for
-each thread. See the
+simultaneously. For example, an application can compile all its patterns at the
+start, before forking off multiple threads that use them. However, if the
+just-in-time optimization feature is being used, it needs separate memory stack
+areas for each thread. See the
 <a href="pcre2jit.html"><b>pcre2jit</b></a>
 documentation for more details.
 </P>
 <P>
-(2) The next section below introduces the idea of "contexts" in which PCRE2
+In a more complicated situation, where patterns are compiled only when they are
+first needed, but are still shared between threads, pointers to compiled
+patterns must be protected from simultaneous writing by multiple threads, at
+least until a pattern has been compiled. The logic can be something like this:
+<pre>
+  Get a read-only (shared) lock (mutex) for pointer
+  if (pointer == NULL)
+    {
+    Get a write (unique) lock for pointer
+    pointer = pcre2_compile(...
+    }
+  Release the lock
+  Use pointer in pcre2_match()
+</pre>
+Of course, testing for compilation errors should also be included in the code.
+</P>
+<P>
+If JIT is being used, but the JIT compilation is not being done immediately,
+(perhaps waiting to see if the pattern is used often enough) similar logic is
+required. JIT compilation updates a pointer within the compiled code block, so
+a thread must gain unique write access to the pointer before calling
+<b>pcre2_jit_compile()</b>. Alternatively, <b>pcre2_code_copy()</b> can be used
+to obtain a private copy of the compiled code.
+</P>
+<br><b>
+Context blocks
+</b><br>
+<P>
+The next main section below introduces the idea of "contexts" in which PCRE2
 functions are called. A context is nothing more than a collection of parameters
 that control the way PCRE2 operates. Grouping a number of parameters together
 in a context is a convenient way of passing them to a PCRE2 function without
@@ -543,11 +588,14 @@ are never changed, the same context can be used by all the threads. However, if
 any thread needs to change any value in a context, it must make its own
 thread-specific copy.
 </P>
+<br><b>
+Match blocks
+</b><br>
 <P>
-(3) The matching functions need a block of memory for working space and for
-storing the results of a match. This includes details of what was matched, as
-well as additional information such as the name of a (*MARK) setting. Each
-thread must provide its own version of this memory.
+The matching functions need a block of memory for working space and for storing
+the results of a match. This includes details of what was matched, as well as
+additional information such as the name of a (*MARK) setting. Each thread must
+provide its own copy of this memory.
 </P>
 <br><a name="SEC16" href="#TOC1">PCRE2 CONTEXTS</a><br>
 <P>
@@ -1007,34 +1055,50 @@ zero.
 <br>
 <br>
 <b>void pcre2_code_free(pcre2_code *<i>code</i>);</b>
+<br>
+<br>
+<b>pcre2_code *pcre2_code_copy(const pcre2_code *<i>code</i>);</b>
 </P>
 <P>
 The <b>pcre2_compile()</b> function compiles a pattern into an internal form.
-The pattern is defined by a pointer to a string of code units and a length, If
+The pattern is defined by a pointer to a string of code units and a length. If
 the pattern is zero-terminated, the length can be specified as
 PCRE2_ZERO_TERMINATED. The function returns a pointer to a block of memory that
-contains the compiled pattern and related data. The caller must free the memory
-by calling <b>pcre2_code_free()</b> when it is no longer needed.
+contains the compiled pattern and related data, or NULL if an error occurred.
+</P>
+<P>
+If the compile context argument <i>ccontext</i> is NULL, memory for the compiled
+pattern is obtained by calling <b>malloc()</b>. Otherwise, it is obtained from
+the same memory function that was used for the compile context. The caller must
+free the memory by calling <b>pcre2_code_free()</b> when it is no longer needed.
+</P>
+<P>
+The function <b>pcre2_code_copy()</b> makes a copy of the compiled code in new
+memory, using the same memory allocator as was used for the original. However,
+if the code has been processed by the JIT compiler (see
+<a href="#jitcompiling">below),</a>
+the JIT information cannot be copied (because it is position-dependent).
+The new copy can initially be used only for non-JIT matching, though it can be
+passed to <b>pcre2_jit_compile()</b> if required. The <b>pcre2_code_copy()</b>
+function provides a way for individual threads in a multithreaded application
+to acquire a private copy of shared compiled code.
 </P>
 <P>
 NOTE: When one of the matching functions is called, pointers to the compiled
 pattern and the subject string are set in the match data block so that they can
-be referenced by the extraction functions. After running a match, you must not
-free a compiled pattern (or a subject string) until after all operations on the
+be referenced by the substring extraction functions. After running a match, you
+must not free a compiled pattern (or a subject string) until after all
+operations on the
 <a href="#matchdatablock">match data block</a>
 have taken place.
 </P>
 <P>
-If the compile context argument <i>ccontext</i> is NULL, memory for the compiled
-pattern is obtained by calling <b>malloc()</b>. Otherwise, it is obtained from
-the same memory function that was used for the compile context.
-</P>
-<P>
-The <i>options</i> argument contains various bit settings that affect the
-compilation. It should be zero if no options are required. The available
-options are described below. Some of them (in particular, those that are
-compatible with Perl, but some others as well) can also be set and unset from
-within the pattern (see the detailed description in the
+The <i>options</i> argument for <b>pcre2_compile()</b> contains various bit
+settings that affect the compilation. It should be zero if no options are
+required. The available options are described below. Some of them (in
+particular, those that are compatible with Perl, but some others as well) can
+also be set and unset from within the pattern (see the detailed description in
+the
 <a href="pcre2pattern.html"><b>pcre2pattern</b></a>
 documentation).
 </P>
@@ -1051,13 +1115,20 @@ newline setting) can be provided in a compile context (as described
 </P>
 <P>
 If <i>errorcode</i> or <i>erroroffset</i> is NULL, <b>pcre2_compile()</b> returns
-NULL immediately. Otherwise, if compilation of a pattern fails,
-<b>pcre2_compile()</b> returns NULL, having set these variables to an error code
-and an offset (number of code units) within the pattern, respectively. The
-<b>pcre2_get_error_message()</b> function provides a textual message for each
-error code. Compilation errors are positive numbers, but UTF formatting errors
-are negative numbers. For an invalid UTF-8 or UTF-16 string, the offset is that
-of the first code unit of the failing character.
+NULL immediately. Otherwise, the variables to which these point are set to an
+error code and an offset (number of code units) within the pattern,
+respectively, when <b>pcre2_compile()</b> returns NULL because a compilation
+error has occurred. The values are not defined when compilation is successful
+and <b>pcre2_compile()</b> returns a non-NULL value.
+</P>
+<P>
+The <b>pcre2_get_error_message()</b> function (see "Obtaining a textual error
+message"
+<a href="#geterrormessage">below)</a>
+provides a textual message for each error code. Compilation errors have
+positive error codes; UTF formatting error codes are negative. For an invalid
+UTF-8 or UTF-16 string, the offset is that of the first code unit of the
+failing character.
 </P>
 <P>
 Some errors are not detected until the whole pattern has been scanned; in these
@@ -1282,7 +1353,9 @@ If this option is set, it disables the use of numbered capturing parentheses in
 the pattern. Any opening parenthesis that is not followed by ? behaves as if it
 were followed by ?: but named parentheses can still be used for capturing (and
 they acquire numbers in the usual way). There is no equivalent of this option
-in Perl.
+in Perl. Note that, if this option is set, references to capturing groups (back
+references or recursion/subroutine calls) may only refer to named groups,
+though the reference can be by name or by number.
 <pre>
   PCRE2_NO_AUTO_POSSESS
 </pre>
@@ -1424,14 +1497,17 @@ page.
 </P>
 <br><a name="SEC19" href="#TOC1">COMPILATION ERROR CODES</a><br>
 <P>
-There are over 80 positive error codes that <b>pcre2_compile()</b> may return if
-it finds an error in the pattern. There are also some negative error codes that
-are used for invalid UTF strings. These are the same as given by
-<b>pcre2_match()</b> and <b>pcre2_dfa_match()</b>, and are described in the
+There are over 80 positive error codes that <b>pcre2_compile()</b> may return
+(via <i>errorcode</i>) if it finds an error in the pattern. There are also some
+negative error codes that are used for invalid UTF strings. These are the same
+as given by <b>pcre2_match()</b> and <b>pcre2_dfa_match()</b>, and are described
+in the
 <a href="pcre2unicode.html"><b>pcre2unicode</b></a>
-page. The <b>pcre2_get_error_message()</b> function can be called to obtain a
-textual error message from any error code.
-</P>
+page. The <b>pcre2_get_error_message()</b> function (see "Obtaining a textual
+error message"
+<a href="#geterrormessage">below)</a>
+can be called to obtain a textual error message from any error code.
+<a name="jitcompiling"></a></P>
 <br><a name="SEC20" href="#TOC1">JUST-IN-TIME (JIT) COMPILATION</a><br>
 <P>
 <b>int pcre2_jit_compile(pcre2_code *<i>code</i>, uint32_t <i>options</i>);</b>
@@ -1567,10 +1643,15 @@ are as follows:
 Return a copy of the pattern's options. The third argument should point to a
 <b>uint32_t</b> variable. PCRE2_INFO_ARGOPTIONS returns exactly the options that
 were passed to <b>pcre2_compile()</b>, whereas PCRE2_INFO_ALLOPTIONS returns
-the compile options as modified by any top-level option settings such as (*UTF)
-at the start of the pattern itself. For example, if the pattern /(*UTF)abc/ is
-compiled with the PCRE2_EXTENDED option, the result is PCRE2_EXTENDED and
-PCRE2_UTF.
+the compile options as modified by any top-level (*XXX) option settings such as
+(*UTF) at the start of the pattern itself.
+</P>
+<P>
+For example, if the pattern /(*UTF)abc/ is compiled with the PCRE2_EXTENDED
+option, the result for PCRE2_INFO_ALLOPTIONS is PCRE2_EXTENDED and PCRE2_UTF.
+Option settings such as (?i) that can change within a pattern do not affect the
+result of PCRE2_INFO_ALLOPTIONS, even if they appear right at the start of the
+pattern. (This was different in some earlier releases.)
 </P>
 <P>
 A pattern compiled without PCRE2_ANCHORED is automatically anchored by PCRE2 if
@@ -2025,14 +2106,15 @@ Option bits for <b>pcre2_match()</b>
 <P>
 The unused bits of the <i>options</i> argument for <b>pcre2_match()</b> must be
 zero. The only bits that may be set are PCRE2_ANCHORED, PCRE2_NOTBOL,
-PCRE2_NOTEOL, PCRE2_NOTEMPTY, PCRE2_NOTEMPTY_ATSTART, PCRE2_NO_UTF_CHECK,
-PCRE2_PARTIAL_HARD, and PCRE2_PARTIAL_SOFT. Their action is described below.
+PCRE2_NOTEOL, PCRE2_NOTEMPTY, PCRE2_NOTEMPTY_ATSTART, PCRE2_NO_JIT,
+PCRE2_NO_UTF_CHECK, PCRE2_PARTIAL_HARD, and PCRE2_PARTIAL_SOFT. Their action is
+described below.
 </P>
 <P>
 Setting PCRE2_ANCHORED at match time is not supported by the just-in-time (JIT)
 compiler. If it is set, JIT matching is disabled and the normal interpretive
-code in <b>pcre2_match()</b> is run. The remaining options are supported for JIT
-matching.
+code in <b>pcre2_match()</b> is run. Apart from PCRE2_NO_JIT (obviously), the
+remaining options are supported for JIT matching.
 <pre>
   PCRE2_ANCHORED
 </pre>
@@ -2079,6 +2161,13 @@ only at the first matching position, that is, at the start of the subject plus
 the starting offset. An empty string match later in the subject is permitted.
 If the pattern is anchored, such a match can occur only if the pattern contains
 \K.
+<pre>
+  PCRE2_NO_JIT
+</pre>
+By default, if a pattern has been successfully processed by
+<b>pcre2_jit_compile()</b>, JIT is automatically used when <b>pcre2_match()</b>
+is called with options that JIT supports. Setting PCRE2_NO_JIT disables the use
+of JIT; it forces matching to be done by the interpreter.
 <pre>
   PCRE2_NO_UTF_CHECK
 </pre>
@@ -2339,11 +2428,13 @@ page.
 <br><a name="SEC30" href="#TOC1">ERROR RETURNS FROM <b>pcre2_match()</b></a><br>
 <P>
 If <b>pcre2_match()</b> fails, it returns a negative number. This can be
-converted to a text string by calling <b>pcre2_get_error_message()</b>. Negative
-error codes are also returned by other functions, and are documented with them.
-The codes are given names in the header file. If UTF checking is in force and
-an invalid UTF subject string is detected, one of a number of UTF-specific
-negative error codes is returned. Details are given in the
+converted to a text string by calling the <b>pcre2_get_error_message()</b>
+function (see "Obtaining a textual error message"
+<a href="#geterrormessage">below).</a>
+Negative error codes are also returned by other functions, and are documented
+with them. The codes are given names in the header file. If UTF checking is in
+force and an invalid UTF subject string is detected, one of a number of
+UTF-specific negative error codes is returned. Details are given in the
 <a href="pcre2unicode.html"><b>pcre2unicode</b></a>
 page. The following are the other errors that may be returned by
 <b>pcre2_match()</b>:
@@ -2444,8 +2535,29 @@ is attempted.
   PCRE2_ERROR_RECURSIONLIMIT
 </pre>
 The internal recursion limit was reached.
+<a name="geterrormessage"></a></P>
+<br><a name="SEC31" href="#TOC1">OBTAINING A TEXTUAL ERROR MESSAGE</a><br>
+<P>
+<b>int pcre2_get_error_message(int <i>errorcode</i>, PCRE2_UCHAR *<i>buffer</i>,</b>
+<b>  PCRE2_SIZE <i>bufflen</i>);</b>
+</P>
+<P>
+A text message for an error code from any PCRE2 function (compile, match, or
+auxiliary) can be obtained by calling <b>pcre2_get_error_message()</b>. The code
+is passed as the first argument, with the remaining two arguments specifying a
+code unit buffer and its length, into which the text message is placed. Note
+that the message is returned in code units of the appropriate width for the
+library that is being used.
+</P>
+<P>
+The returned message is terminated with a trailing zero, and the function
+returns the number of code units used, excluding the trailing zero. If the
+error number is unknown, the negative error code PCRE2_ERROR_BADDATA is
+returned. If the buffer is too small, the message is truncated (but still with
+a trailing zero), and the negative error code PCRE2_ERROR_NOMEMORY is returned.
+None of the messages are very long; a buffer size of 120 code units is ample.
 <a name="extractbynumber"></a></P>
-<br><a name="SEC31" href="#TOC1">EXTRACTING CAPTURED SUBSTRINGS BY NUMBER</a><br>
+<br><a name="SEC32" href="#TOC1">EXTRACTING CAPTURED SUBSTRINGS BY NUMBER</a><br>
 <P>
 <b>int pcre2_substring_length_bynumber(pcre2_match_data *<i>match_data</i>,</b>
 <b>  uint32_t <i>number</i>, PCRE2_SIZE *<i>length</i>);</b>
@@ -2542,7 +2654,7 @@ The substring did not participate in the match. For example, if the pattern is
 (abc)|(def) and the subject is "def", and the ovector contains at least two
 capturing slots, substring number 1 is unset.
 </P>
-<br><a name="SEC32" href="#TOC1">EXTRACTING A LIST OF ALL CAPTURED SUBSTRINGS</a><br>
+<br><a name="SEC33" href="#TOC1">EXTRACTING A LIST OF ALL CAPTURED SUBSTRINGS</a><br>
 <P>
 <b>int pcre2_substring_list_get(pcre2_match_data *<i>match_data</i>,</b>
 <b>"  PCRE2_UCHAR ***<i>listptr</i>, PCRE2_SIZE **<i>lengthsptr</i>);</b>
@@ -2581,7 +2693,7 @@ can be distinguished from a genuine zero-length substring by inspecting the
 appropriate offset in the ovector, which contain PCRE2_UNSET for unset
 substrings, or by calling <b>pcre2_substring_length_bynumber()</b>.
 <a name="extractbyname"></a></P>
-<br><a name="SEC33" href="#TOC1">EXTRACTING CAPTURED SUBSTRINGS BY NAME</a><br>
+<br><a name="SEC34" href="#TOC1">EXTRACTING CAPTURED SUBSTRINGS BY NAME</a><br>
 <P>
 <b>int pcre2_substring_number_from_name(const pcre2_code *<i>code</i>,</b>
 <b>  PCRE2_SPTR <i>name</i>);</b>
@@ -2641,7 +2753,7 @@ names are not included in the compiled code. The matching process uses only
 numbers. For this reason, the use of different names for subpatterns of the
 same number causes an error at compile time.
 </P>
-<br><a name="SEC34" href="#TOC1">CREATING A NEW STRING WITH SUBSTITUTIONS</a><br>
+<br><a name="SEC35" href="#TOC1">CREATING A NEW STRING WITH SUBSTITUTIONS</a><br>
 <P>
 <b>int pcre2_substitute(const pcre2_code *<i>code</i>, PCRE2_SPTR <i>subject</i>,</b>
 <b>  PCRE2_SIZE <i>length</i>, PCRE2_SIZE <i>startoffset</i>,</b>
@@ -2844,9 +2956,11 @@ started, which can happen if \K is used in an assertion).
 </P>
 <P>
 As for all PCRE2 errors, a text message that describes the error can be
-obtained by calling <b>pcre2_get_error_message()</b>.
+obtained by calling the <b>pcre2_get_error_message()</b> function (see
+"Obtaining a textual error message"
+<a href="#geterrormessage">above).</a>
 </P>
-<br><a name="SEC35" href="#TOC1">DUPLICATE SUBPATTERN NAMES</a><br>
+<br><a name="SEC36" href="#TOC1">DUPLICATE SUBPATTERN NAMES</a><br>
 <P>
 <b>int pcre2_substring_nametable_scan(const pcre2_code *<i>code</i>,</b>
 <b>  PCRE2_SPTR <i>name</i>, PCRE2_SPTR *<i>first</i>, PCRE2_SPTR *<i>last</i>);</b>
@@ -2891,7 +3005,7 @@ in the section entitled <i>Information about a pattern</i>. Given all the
 relevant entries for the name, you can extract each of their numbers, and hence
 the captured data.
 </P>
-<br><a name="SEC36" href="#TOC1">FINDING ALL POSSIBLE MATCHES AT ONE POSITION</a><br>
+<br><a name="SEC37" href="#TOC1">FINDING ALL POSSIBLE MATCHES AT ONE POSITION</a><br>
 <P>
 The traditional matching function uses a similar algorithm to Perl, which stops
 when it finds the first match at a given point in the subject. If you want to
@@ -2909,7 +3023,7 @@ substring. Then return 1, which forces <b>pcre2_match()</b> to backtrack and try
 other alternatives. Ultimately, when it runs out of matches,
 <b>pcre2_match()</b> will yield PCRE2_ERROR_NOMATCH.
 <a name="dfamatch"></a></P>
-<br><a name="SEC37" href="#TOC1">MATCHING A PATTERN: THE ALTERNATIVE FUNCTION</a><br>
+<br><a name="SEC38" href="#TOC1">MATCHING A PATTERN: THE ALTERNATIVE FUNCTION</a><br>
 <P>
 <b>int pcre2_dfa_match(const pcre2_code *<i>code</i>, PCRE2_SPTR <i>subject</i>,</b>
 <b>  PCRE2_SIZE <i>length</i>, PCRE2_SIZE <i>startoffset</i>,</b>
@@ -3104,13 +3218,13 @@ some plausibility checks are made on the contents of the workspace, which
 should contain data about the previous partial match. If any of these checks
 fail, this error is given.
 </P>
-<br><a name="SEC38" href="#TOC1">SEE ALSO</a><br>
+<br><a name="SEC39" href="#TOC1">SEE ALSO</a><br>
 <P>
 <b>pcre2build</b>(3), <b>pcre2callout</b>(3), <b>pcre2demo(3)</b>,
 <b>pcre2matching</b>(3), <b>pcre2partial</b>(3), <b>pcre2posix</b>(3),
 <b>pcre2sample</b>(3), <b>pcre2stack</b>(3), <b>pcre2unicode</b>(3).
 </P>
-<br><a name="SEC39" href="#TOC1">AUTHOR</a><br>
+<br><a name="SEC40" href="#TOC1">AUTHOR</a><br>
 <P>
 Philip Hazel
 <br>
@@ -3119,11 +3233,11 @@ University Computing Service
 Cambridge, England.
 <br>
 </P>
-<br><a name="SEC40" href="#TOC1">REVISION</a><br>
+<br><a name="SEC41" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 16 December 2015
+Last updated: 17 June 2016
 <br>
-Copyright &copy; 1997-2015 University of Cambridge.
+Copyright &copy; 1997-2016 University of Cambridge.
 <br>
 <p>
 Return to the <a href="index.html">PCRE2 index page</a>.
index 1e5f7373d7c1dc38745f26f6c54ee6a1a1fd8510..6c8e1def36b9609f96b57fe1f6e75435570f3d3b 100644 (file)
@@ -27,15 +27,16 @@ please consult the man page, in case the conversion went wrong.
 <li><a name="TOC12" href="#SEC12">LIMITING PCRE2 RESOURCE USAGE</a>
 <li><a name="TOC13" href="#SEC13">CREATING CHARACTER TABLES AT BUILD TIME</a>
 <li><a name="TOC14" href="#SEC14">USING EBCDIC CODE</a>
-<li><a name="TOC15" href="#SEC15">PCRE2GREP OPTIONS FOR COMPRESSED FILE SUPPORT</a>
-<li><a name="TOC16" href="#SEC16">PCRE2GREP BUFFER SIZE</a>
-<li><a name="TOC17" href="#SEC17">PCRE2TEST OPTION FOR LIBREADLINE SUPPORT</a>
-<li><a name="TOC18" href="#SEC18">INCLUDING DEBUGGING CODE</a>
-<li><a name="TOC19" href="#SEC19">DEBUGGING WITH VALGRIND SUPPORT</a>
-<li><a name="TOC20" href="#SEC20">CODE COVERAGE REPORTING</a>
-<li><a name="TOC21" href="#SEC21">SEE ALSO</a>
-<li><a name="TOC22" href="#SEC22">AUTHOR</a>
-<li><a name="TOC23" href="#SEC23">REVISION</a>
+<li><a name="TOC15" href="#SEC15">PCRE2GREP SUPPORT FOR EXTERNAL SCRIPTS</a>
+<li><a name="TOC16" href="#SEC16">PCRE2GREP OPTIONS FOR COMPRESSED FILE SUPPORT</a>
+<li><a name="TOC17" href="#SEC17">PCRE2GREP BUFFER SIZE</a>
+<li><a name="TOC18" href="#SEC18">PCRE2TEST OPTION FOR LIBREADLINE SUPPORT</a>
+<li><a name="TOC19" href="#SEC19">INCLUDING DEBUGGING CODE</a>
+<li><a name="TOC20" href="#SEC20">DEBUGGING WITH VALGRIND SUPPORT</a>
+<li><a name="TOC21" href="#SEC21">CODE COVERAGE REPORTING</a>
+<li><a name="TOC22" href="#SEC22">SEE ALSO</a>
+<li><a name="TOC23" href="#SEC23">AUTHOR</a>
+<li><a name="TOC24" href="#SEC24">REVISION</a>
 </ul>
 <br><a name="SEC1" href="#TOC1">BUILDING PCRE2</a><br>
 <P>
@@ -349,7 +350,16 @@ The options that select newline behaviour, such as --enable-newline-is-cr,
 and equivalent run-time options, refer to these character values in an EBCDIC
 environment.
 </P>
-<br><a name="SEC15" href="#TOC1">PCRE2GREP OPTIONS FOR COMPRESSED FILE SUPPORT</a><br>
+<br><a name="SEC15" href="#TOC1">PCRE2GREP SUPPORT FOR EXTERNAL SCRIPTS</a><br>
+<P>
+By default, on non-Windows systems, <b>pcre2grep</b> supports the use of
+callouts with string arguments within the patterns it is matching, in order to
+run external scripts. For details, see the
+<a href="pcre2grep.html"><b>pcre2grep</b></a>
+documentation. This support can be disabled by adding
+--disable-pcre2grep-callout to the <b>configure</b> command.
+</P>
+<br><a name="SEC16" href="#TOC1">PCRE2GREP OPTIONS FOR COMPRESSED FILE SUPPORT</a><br>
 <P>
 By default, <b>pcre2grep</b> reads all files as plain text. You can build it so
 that it recognizes files whose names end in <b>.gz</b> or <b>.bz2</b>, and reads
@@ -362,7 +372,7 @@ to the <b>configure</b> command. These options naturally require that the
 relevant libraries are installed on your system. Configuration will fail if
 they are not.
 </P>
-<br><a name="SEC16" href="#TOC1">PCRE2GREP BUFFER SIZE</a><br>
+<br><a name="SEC17" href="#TOC1">PCRE2GREP BUFFER SIZE</a><br>
 <P>
 <b>pcre2grep</b> uses an internal buffer to hold a "window" on the file it is
 scanning, in order to be able to output "before" and "after" lines when it
@@ -375,9 +385,9 @@ parameter value by adding, for example,
   --with-pcre2grep-bufsize=50K
 </pre>
 to the <b>configure</b> command. The caller of \fPpcre2grep\fP can override this
-value by using --buffer-size on the command line..
+value by using --buffer-size on the command line.
 </P>
-<br><a name="SEC17" href="#TOC1">PCRE2TEST OPTION FOR LIBREADLINE SUPPORT</a><br>
+<br><a name="SEC18" href="#TOC1">PCRE2TEST OPTION FOR LIBREADLINE SUPPORT</a><br>
 <P>
 If you add one of
 <pre>
@@ -411,7 +421,7 @@ automatically included, you may need to add something like
 </pre>
 immediately before the <b>configure</b> command.
 </P>
-<br><a name="SEC18" href="#TOC1">INCLUDING DEBUGGING CODE</a><br>
+<br><a name="SEC19" href="#TOC1">INCLUDING DEBUGGING CODE</a><br>
 <P>
 If you add
 <pre>
@@ -420,7 +430,7 @@ If you add
 to the <b>configure</b> command, additional debugging code is included in the
 build. This feature is intended for use by the PCRE2 maintainers.
 </P>
-<br><a name="SEC19" href="#TOC1">DEBUGGING WITH VALGRIND SUPPORT</a><br>
+<br><a name="SEC20" href="#TOC1">DEBUGGING WITH VALGRIND SUPPORT</a><br>
 <P>
 If you add
 <pre>
@@ -430,7 +440,7 @@ to the <b>configure</b> command, PCRE2 will use valgrind annotations to mark
 certain memory regions as unaddressable. This allows it to detect invalid
 memory accesses, and is mostly useful for debugging PCRE2 itself.
 </P>
-<br><a name="SEC20" href="#TOC1">CODE COVERAGE REPORTING</a><br>
+<br><a name="SEC21" href="#TOC1">CODE COVERAGE REPORTING</a><br>
 <P>
 If your C compiler is gcc, you can build a version of PCRE2 that can generate a
 code coverage report for its test suite. To enable this, you must install
@@ -487,11 +497,11 @@ This cleans all coverage data including the generated coverage report. For more
 information about code coverage, see the <b>gcov</b> and <b>lcov</b>
 documentation.
 </P>
-<br><a name="SEC21" href="#TOC1">SEE ALSO</a><br>
+<br><a name="SEC22" href="#TOC1">SEE ALSO</a><br>
 <P>
 <b>pcre2api</b>(3), <b>pcre2-config</b>(3).
 </P>
-<br><a name="SEC22" href="#TOC1">AUTHOR</a><br>
+<br><a name="SEC23" href="#TOC1">AUTHOR</a><br>
 <P>
 Philip Hazel
 <br>
@@ -500,11 +510,11 @@ University Computing Service
 Cambridge, England.
 <br>
 </P>
-<br><a name="SEC23" href="#TOC1">REVISION</a><br>
+<br><a name="SEC24" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 16 October 2015
+Last updated: 01 April 2016
 <br>
-Copyright &copy; 1997-2015 University of Cambridge.
+Copyright &copy; 1997-2016 University of Cambridge.
 <br>
 <p>
 Return to the <a href="index.html">PCRE2 index page</a>.
index 5919117a17dee38d53f4d2b30f72fbd1d7510eee..d64e16be18f60aa45da0637dd00f4082d941492a 100644 (file)
@@ -20,28 +20,31 @@ please consult the man page, in case the conversion went wrong.
 *************************************************/
 
 /* This is a demonstration program to illustrate a straightforward way of
-calling the PCRE2 regular expression library from a C program. See the
+using the PCRE2 regular expression library from a C program. See the
 pcre2sample documentation for a short discussion ("man pcre2sample" if you have
 the PCRE2 man pages installed). PCRE2 is a revised API for the library, and is
 incompatible with the original PCRE API.
 
 There are actually three libraries, each supporting a different code unit
-width. This demonstration program uses the 8-bit library.
+width. This demonstration program uses the 8-bit library. The default is to
+process each code unit as a separate character, but if the pattern begins with
+"(*UTF)", both it and the subject are treated as UTF-8 strings, where
+characters may occupy multiple code units.
 
 In Unix-like environments, if PCRE2 is installed in your standard system
 libraries, you should be able to compile this program using this command:
 
-gcc -Wall pcre2demo.c -lpcre2-8 -o pcre2demo
+cc -Wall pcre2demo.c -lpcre2-8 -o pcre2demo
 
 If PCRE2 is not installed in a standard place, it is likely to be installed
 with support for the pkg-config mechanism. If you have pkg-config, you can
 compile this program using this command:
 
-gcc -Wall pcre2demo.c `pkg-config --cflags --libs libpcre2-8` -o pcre2demo
+cc -Wall pcre2demo.c `pkg-config --cflags --libs libpcre2-8` -o pcre2demo
 
-If you do not have pkg-config, you may have to use this:
+If you do not have pkg-config, you may have to use something like this:
 
-gcc -Wall pcre2demo.c -I/usr/local/include -L/usr/local/lib \
+cc -Wall pcre2demo.c -I/usr/local/include -L/usr/local/lib \
   -R/usr/local/lib -lpcre2-8 -o pcre2demo
 
 Replace "/usr/local/include" and "/usr/local/lib" with wherever the include and
@@ -56,9 +59,14 @@ the following line. */
 
 /* #define PCRE2_STATIC */
 
-/* This macro must be defined before including pcre2.h. For a program that uses
-only one code unit width, it makes it possible to use generic function names
-such as pcre2_compile(). */
+/* The PCRE2_CODE_UNIT_WIDTH macro must be defined before including pcre2.h.
+For a program that uses only one code unit width, setting it to 8, 16, or 32
+makes it possible to use generic function names such as pcre2_compile(). Note
+that just changing 8 to 16 (for example) is not sufficient to convert this
+program to process 16-bit characters. Even in a fully 16-bit environment, where
+string-handling functions such as strcmp() and printf() work with 16-bit
+characters, the code for handling the table of named substrings will still need
+to be modified. */
 
 #define PCRE2_CODE_UNIT_WIDTH 8
 
@@ -79,19 +87,19 @@ int main(int argc, char **argv)
 {
 pcre2_code *re;
 PCRE2_SPTR pattern;     /* PCRE2_SPTR is a pointer to unsigned code units of */
-PCRE2_SPTR subject;     /* the appropriate width (8, 16, or 32 bits). */
+PCRE2_SPTR subject;     /* the appropriate width (in this case, 8 bits). */
 PCRE2_SPTR name_table;
 
 int crlf_is_newline;
 int errornumber;
 int find_all;
 int i;
-int namecount;
-int name_entry_size;
 int rc;
 int utf8;
 
 uint32_t option_bits;
+uint32_t namecount;
+uint32_t name_entry_size;
 uint32_t newline;
 
 PCRE2_SIZE erroroffset;
@@ -106,15 +114,19 @@ pcre2_match_data *match_data;
 * First, sort out the command line. There is only one possible option at  *
 * the moment, "-g" to request repeated matching to find all occurrences,  *
 * like Perl's /g option. We set the variable find_all to a non-zero value *
-* if the -g option is present. Apart from that, there must be exactly two *
-* arguments.                                                              *
+* if the -g option is present.                                            *
 **************************************************************************/
 
 find_all = 0;
 for (i = 1; i &lt; argc; i++)
   {
   if (strcmp(argv[i], "-g") == 0) find_all = 1;
-    else break;
+  else if (argv[i][0] == '-')
+    {
+    printf("Unrecognised option %s\n", argv[i]);
+    return 1;
+    }
+  else break;
   }
 
 /* After the options, we require exactly two arguments, which are the pattern,
@@ -122,7 +134,7 @@ and the subject string. */
 
 if (argc - i != 2)
   {
-  printf("Two arguments required: a regex and a subject string\n");
+  printf("Exactly two arguments required: a regex and a subject string\n");
   return 1;
   }
 
@@ -201,7 +213,7 @@ if (rc &lt; 0)
 stored. */
 
 ovector = pcre2_get_ovector_pointer(match_data);
-printf("\nMatch succeeded at offset %d\n", (int)ovector[0]);
+printf("Match succeeded at offset %d\n", (int)ovector[0]);
 
 
 /*************************************************************************
@@ -242,7 +254,7 @@ we have to extract the count of named parentheses from the pattern. */
   PCRE2_INFO_NAMECOUNT, /* get the number of named substrings */
   &amp;namecount);          /* where to put the answer */
 
-if (namecount &lt;= 0) printf("No named substrings\n"); else
+if (namecount == 0) printf("No named substrings\n"); else
   {
   PCRE2_SPTR tabptr;
   printf("Named substrings\n");
@@ -330,8 +342,8 @@ crlf_is_newline = newline == PCRE2_NEWLINE_ANY ||
 
 for (;;)
   {
-  uint32_t options = 0;                    /* Normally no options */
-  PCRE2_SIZE start_offset = ovector[1];  /* Start at end of previous match */
+  uint32_t options = 0;                   /* Normally no options */
+  PCRE2_SIZE start_offset = ovector[1];   /* Start at end of previous match */
 
   /* If the previous match was for an empty string, we are finished if we are
   at the end of the subject. Otherwise, arrange to run another match at the
@@ -371,7 +383,7 @@ for (;;)
     {
     if (options == 0) break;                    /* All matches found */
     ovector[1] = start_offset + 1;              /* Advance one code unit */
-    if (crlf_is_newline &amp;&amp;                      /* If CRLF is newline &amp; */
+    if (crlf_is_newline &amp;&amp;                      /* If CRLF is newline &amp; */
         start_offset &lt; subject_length - 1 &amp;&amp;    /* we are at CRLF, */
         subject[start_offset] == '\r' &amp;&amp;
         subject[start_offset + 1] == '\n')
@@ -417,7 +429,7 @@ for (;;)
     printf("%2d: %.*s\n", i, (int)substring_length, (char *)substring_start);
     }
 
-  if (namecount &lt;= 0) printf("No named substrings\n"); else
+  if (namecount == 0) printf("No named substrings\n"); else
     {
     PCRE2_SPTR tabptr = name_table;
     printf("Named substrings\n");
index dcfb96f34b31173a167651014e6e7fce0b474f20..d02d36521bb4adde9e36d0e032b46a581ab24123 100644 (file)
@@ -22,11 +22,12 @@ please consult the man page, in case the conversion went wrong.
 <li><a name="TOC7" href="#SEC7">NEWLINES</a>
 <li><a name="TOC8" href="#SEC8">OPTIONS COMPATIBILITY</a>
 <li><a name="TOC9" href="#SEC9">OPTIONS WITH DATA</a>
-<li><a name="TOC10" href="#SEC10">MATCHING ERRORS</a>
-<li><a name="TOC11" href="#SEC11">DIAGNOSTICS</a>
-<li><a name="TOC12" href="#SEC12">SEE ALSO</a>
-<li><a name="TOC13" href="#SEC13">AUTHOR</a>
-<li><a name="TOC14" href="#SEC14">REVISION</a>
+<li><a name="TOC10" href="#SEC10">CALLING EXTERNAL SCRIPTS</a>
+<li><a name="TOC11" href="#SEC11">MATCHING ERRORS</a>
+<li><a name="TOC12" href="#SEC12">DIAGNOSTICS</a>
+<li><a name="TOC13" href="#SEC13">SEE ALSO</a>
+<li><a name="TOC14" href="#SEC14">AUTHOR</a>
+<li><a name="TOC15" href="#SEC15">REVISION</a>
 </ul>
 <br><a name="SEC1" href="#TOC1">SYNOPSIS</a><br>
 <P>
@@ -510,10 +511,16 @@ line in which the match ended. If the matched string ends with a newline
 sequence the output ends at the end of that line.
 <br>
 <br>
-When this option is set, the PCRE2 library is called in "multiline" mode.
-However, <b>pcre2grep</b> still processes the input line by line. The difference
-is that a matched string may extend past the end of a line and continue on
-one or more subsequent lines. The newline sequence must be matched as part of
+When this option is set, the PCRE2 library is called in "multiline" mode. This
+allows a matched string to extend past the end of a line and continue on one or
+more subsequent lines. However, <b>pcre2grep</b> still processes the input line
+by line. Once a match has been handled, scanning restarts at the beginning of
+the next line, just as it does when <b>-M</b> is not present. This means that it
+is possible for the second or subsequent lines in a multiline match to be
+output again as part of another match.
+<br>
+<br>
+The newline sequence that separates multiple lines must be matched as part of
 the pattern. For example, to find the phrase "regular expression" in a file
 where "regular" might be at the end of a line and "expression" at the start of
 the next line, you could use this command:
@@ -735,7 +742,57 @@ The exceptions to the above are the <b>--colour</b> (or <b>--color</b>) and
 options does have data, it must be given in the first form, using an equals
 character. Otherwise <b>pcre2grep</b> will assume that it has no data.
 </P>
-<br><a name="SEC10" href="#TOC1">MATCHING ERRORS</a><br>
+<br><a name="SEC10" href="#TOC1">CALLING EXTERNAL SCRIPTS</a><br>
+<P>
+On non-Windows systems, <b>pcre2grep</b> has, by default, support for calling
+external programs or scripts during matching by making use of PCRE2's callout
+facility. However, this support can be disabled when <b>pcre2grep</b> is built.
+You can find out whether your binary has support for callouts by running it
+with the <b>--help</b> option. If the support is not enabled, all callouts in
+patterns are ignored by <b>pcre2grep</b>.
+</P>
+<P>
+A callout in a PCRE2 pattern is of the form (?C&#60;arg&#62;) where the argument is
+either a number or a quoted string (see the
+<a href="pcre2callout.html"><b>pcre2callout</b></a>
+documentation for details). Numbered callouts are ignored by <b>pcre2grep</b>.
+String arguments are parsed as a list of substrings separated by pipe (vertical
+bar) characters. The first substring must be an executable name, with the
+following substrings specifying arguments:
+<pre>
+  executable_name|arg1|arg2|...
+</pre>
+Any substring (including the executable name) may contain escape sequences
+started by a dollar character: $&#60;digits&#62; or ${&#60;digits&#62;} is replaced by the
+captured substring of the given decimal number, which must be greater than
+zero. If the number is greater than the number of capturing substrings, or if
+the capture is unset, the replacement is empty.
+</P>
+<P>
+Any other character is substituted by itself. In particular, $$ is replaced by
+a single dollar and $| is replaced by a pipe character. Here is an example:
+<pre>
+  echo -e "abcde\n12345" | pcre2grep \
+    '(?x)(.)(..(.))
+    (?C"/bin/echo|Arg1: [$1] [$2] [$3]|Arg2: $|${1}$| ($4)")()' -
+
+  Output:
+
+    Arg1: [a] [bcd] [d] Arg2: |a| ()
+    abcde
+    Arg1: [1] [234] [4] Arg2: |1| ()
+    12345
+</pre>
+The parameters for the <b>execv()</b> system call that is used to run the
+program or script are zero-terminated strings. This means that binary zero
+characters in the callout argument will cause premature termination of their
+substrings, and therefore should not be present. Any syntax errors in the
+string (for example, a dollar not followed by another character) cause the
+callout to be ignored. If running the program fails for any reason (including
+the non-existence of the executable), a local matching failure occurs and the
+matcher backtracks in the normal way.
+</P>
+<br><a name="SEC11" href="#TOC1">MATCHING ERRORS</a><br>
 <P>
 It is possible to supply a regular expression that takes a very long time to
 fail to match certain lines. Such patterns normally involve nested indefinite
@@ -751,7 +808,7 @@ overall resource limit; there is a second option called <b>--recursion-limit</b>
 that sets a limit on the amount of memory (usually stack) that is used (see the
 discussion of these options above).
 </P>
-<br><a name="SEC11" href="#TOC1">DIAGNOSTICS</a><br>
+<br><a name="SEC12" href="#TOC1">DIAGNOSTICS</a><br>
 <P>
 Exit status is 0 if any matches were found, 1 if no matches were found, and 2
 for syntax errors, overlong lines, non-existent or inaccessible files (even if
@@ -759,11 +816,11 @@ matches were found in other files) or too many matching errors. Using the
 <b>-s</b> option to suppress error messages about inaccessible files does not
 affect the return code.
 </P>
-<br><a name="SEC12" href="#TOC1">SEE ALSO</a><br>
+<br><a name="SEC13" href="#TOC1">SEE ALSO</a><br>
 <P>
-<b>pcre2pattern</b>(3), <b>pcre2syntax</b>(3).
+<b>pcre2pattern</b>(3), <b>pcre2syntax</b>(3), <b>pcre2callout</b>(3).
 </P>
-<br><a name="SEC13" href="#TOC1">AUTHOR</a><br>
+<br><a name="SEC14" href="#TOC1">AUTHOR</a><br>
 <P>
 Philip Hazel
 <br>
@@ -772,11 +829,11 @@ University Computing Service
 Cambridge, England.
 <br>
 </P>
-<br><a name="SEC14" href="#TOC1">REVISION</a><br>
+<br><a name="SEC15" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 03 January 2015
+Last updated: 19 June 2016
 <br>
-Copyright &copy; 1997-2015 University of Cambridge.
+Copyright &copy; 1997-2016 University of Cambridge.
 <br>
 <p>
 Return to the <a href="index.html">PCRE2 index page</a>.
index 48ee122d227bbdc1709c54a4663660b451e03dc3..4a6d4ff371e5c4118d20638dd280232a129c93fa 100644 (file)
@@ -152,6 +152,10 @@ PCRE2_NO_UTF_CHECK, PCRE2_PARTIAL_HARD, and PCRE2_PARTIAL_SOFT. The
 PCRE2_ANCHORED option is not supported at match time.
 </P>
 <P>
+If the PCRE2_NO_JIT option is passed to <b>pcre2_match()</b> it disables the
+use of JIT, forcing matching by the interpreter code.
+</P>
+<P>
 The only unsupported pattern items are \C (match a single data unit) when
 running in a UTF mode, and a callout immediately before an assertion condition
 in a conditional group.
@@ -403,7 +407,7 @@ The fast path function is called <b>pcre2_jit_match()</b>, and it takes exactly
 the same arguments as <b>pcre2_match()</b>. The return values are also the same,
 plus PCRE2_ERROR_JIT_BADOPTION if a matching mode (partial or complete) is
 requested that was not compiled. Unsupported option bits (for example,
-PCRE2_ANCHORED) are ignored.
+PCRE2_ANCHORED) are ignored, as is the PCRE2_NO_JIT option.
 </P>
 <P>
 When you call <b>pcre2_match()</b>, as well as testing for invalid options, a
@@ -432,9 +436,9 @@ Cambridge, England.
 </P>
 <br><a name="SEC13" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 14 November 2015
+Last updated: 05 June 2016
 <br>
-Copyright &copy; 1997-2015 University of Cambridge.
+Copyright &copy; 1997-2016 University of Cambridge.
 <br>
 <p>
 Return to the <a href="index.html">PCRE2 index page</a>.
index c88e931368d8d4b13ebf469ae07a6f4d25409919..797690a1fe7008328f5212bbe66adad2616172c8 100644 (file)
@@ -1256,17 +1256,22 @@ build PCRE2 with the use of \C permanently disabled.
 <P>
 PCRE2 does not allow \C to appear in lookbehind assertions
 <a href="#lookbehind">(described below)</a>
-in a UTF mode, because this would make it impossible to calculate the length of
-the lookbehind. Neither the alternative matching function
-<b>pcre2_dfa_match()</b> not the JIT optimizer support \C in a UTF mode. The
-former gives a match-time error; the latter fails to optimize and so the match
-is always run using the interpreter.
+in UTF-8 or UTF-16 modes, because this would make it impossible to calculate
+the length of the lookbehind. Neither the alternative matching function
+<b>pcre2_dfa_match()</b> nor the JIT optimizer support \C in these UTF modes.
+The former gives a match-time error; the latter fails to optimize and so the
+match is always run using the interpreter.
+</P>
+<P>
+In the 32-bit library, however, \C is always supported (when not explicitly
+locked out) because it always matches a single code unit, whether or not UTF-32
+is specified.
 </P>
 <P>
 In general, the \C escape sequence is best avoided. However, one way of using
-it that avoids the problem of malformed UTF characters is to use a lookahead to
-check the length of the next character, as in this pattern, which could be used
-with a UTF-8 string (ignore white space and line breaks):
+it that avoids the problem of malformed UTF-8 or UTF-16 characters is to use a
+lookahead to check the length of the next character, as in this pattern, which
+could be used with a UTF-8 string (ignore white space and line breaks):
 <pre>
   (?| (?=[\x00-\x7f])(\C) |
       (?=[\x80-\x{7ff}])(\C)(\C) |
@@ -3388,9 +3393,9 @@ Cambridge, England.
 </P>
 <br><a name="SEC30" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 13 November 2015
+Last updated: 20 June 2016
 <br>
-Copyright &copy; 1997-2015 University of Cambridge.
+Copyright &copy; 1997-2016 University of Cambridge.
 <br>
 <p>
 Return to the <a href="index.html">PCRE2 index page</a>.
index e16a4c37461d7e88c7cc15db55b9cce77815ea20..1d5fe6356f744370c77e04f9bbb3a79775f1603f 100644 (file)
@@ -48,7 +48,7 @@ This set of functions provides a POSIX-style API for the PCRE2 regular
 expression 8-bit library. See the
 <a href="pcre2api.html"><b>pcre2api</b></a>
 documentation for a description of PCRE2's native API, which contains much
-additional functionality. There is no POSIX-style wrapper for PCRE2's 16-bit
+additional functionality. There are no POSIX-style wrappers for PCRE2's 16-bit
 and 32-bit libraries.
 </P>
 <P>
@@ -67,9 +67,9 @@ POSIX interface often use it, this makes it easier to slot in PCRE2 as a
 replacement library. Other POSIX options are not even defined.
 </P>
 <P>
-There are also some other options that are not defined by POSIX. These have
-been added at the request of users who want to make use of certain
-PCRE2-specific features via the POSIX calling interface.
+There are also some options that are not defined by POSIX. These have been
+added at the request of users who want to make use of certain PCRE2-specific
+features via the POSIX calling interface.
 </P>
 <P>
 When PCRE2 is called via these functions, it is only the API that is POSIX-like
@@ -119,11 +119,11 @@ defined POSIX behaviour for REG_NEWLINE (see the following section).
 <pre>
   REG_NOSUB
 </pre>
-The PCRE2_NO_AUTO_CAPTURE option is set when the regular expression is passed
-for compilation to the native function. In addition, when a pattern that is
-compiled with this flag is passed to <b>regexec()</b> for matching, the
-<i>nmatch</i> and <i>pmatch</i> arguments are ignored, and no captured strings
-are returned.
+When a pattern that is compiled with this flag is passed to <b>regexec()</b> for
+matching, the <i>nmatch</i> and <i>pmatch</i> arguments are ignored, and no
+captured strings are returned. Versions of the PCRE library prior to 10.22 used
+to set the PCRE2_NO_AUTO_CAPTURE compile option, but this no longer happens
+because it disables the use of back references.
 <pre>
   REG_UCP
 </pre>
@@ -241,14 +241,15 @@ mutually exclusive; the error REG_INVARG is returned.
 <P>
 If the pattern was compiled with the REG_NOSUB flag, no data about any matched
 strings is returned. The <i>nmatch</i> and <i>pmatch</i> arguments of
-<b>regexec()</b> are ignored.
+<b>regexec()</b> are ignored (except possibly as input for REG_STARTEND).
 </P>
 <P>
-If the value of <i>nmatch</i> is zero, or if the value <i>pmatch</i> is NULL,
-no data about any matched strings is returned.
+The value of <i>nmatch</i> may be zero, and the value <i>pmatch</i> may be NULL
+(unless REG_STARTEND is set); in both these cases no data about any matched
+strings is returned.
 </P>
 <P>
-Otherwise,the portion of the string that was matched, and also any captured
+Otherwise, the portion of the string that was matched, and also any captured
 substrings, are returned via the <i>pmatch</i> argument, which points to an
 array of <i>nmatch</i> structures of type <i>regmatch_t</i>, containing the
 members <i>rm_so</i> and <i>rm_eo</i>. These contain the byte offset to the first
@@ -290,9 +291,9 @@ Cambridge, England.
 </P>
 <br><a name="SEC9" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 29 November 2015
+Last updated: 31 January 2016
 <br>
-Copyright &copy; 1997-2015 University of Cambridge.
+Copyright &copy; 1997-2016 University of Cambridge.
 <br>
 <p>
 Return to the <a href="index.html">PCRE2 index page</a>.
index 60a928bccb186ef255e40a8821ff1fc09bf1c5f8..2b36f1fc6aa58eb041e160a28b61ea0eb079ded3 100644 (file)
@@ -24,12 +24,11 @@ documentation. If you do not have a copy of the PCRE2 distribution, you can
 save this listing to re-create the contents of <i>pcre2demo.c</i>.
 </P>
 <P>
-The demonstration program, which uses the PCRE2 8-bit library, compiles the
-regular expression that is its first argument, and matches it against the
-subject string in its second argument. No PCRE2 options are set, and default
-character tables are used. If matching succeeds, the program outputs the
-portion of the subject that matched, together with the contents of any captured
-substrings.
+The demonstration program compiles the regular expression that is its
+first argument, and matches it against the subject string in its second
+argument. No PCRE2 options are set, and default character tables are used. If
+matching succeeds, the program outputs the portion of the subject that matched,
+together with the contents of any captured substrings.
 </P>
 <P>
 If the -g option is given on the command line, the program then goes on to
@@ -38,34 +37,39 @@ string. The logic is a little bit tricky because of the possibility of matching
 an empty string. Comments in the code explain what is going on.
 </P>
 <P>
+The code in <b>pcre2demo.c</b> is an 8-bit program that uses the PCRE2 8-bit
+library. It handles strings and characters that are stored in 8-bit code units.
+By default, one character corresponds to one code unit, but if the pattern
+starts with "(*UTF)", both it and the subject are treated as UTF-8 strings,
+where characters may occupy multiple code units.
+</P>
+<P>
 If PCRE2 is installed in the standard include and library directories for your
 operating system, you should be able to compile the demonstration program using
-this command:
+a command like this:
 <pre>
-  gcc -o pcre2demo pcre2demo.c -lpcre2-8
+  cc -o pcre2demo pcre2demo.c -lpcre2-8
 </pre>
 If PCRE2 is installed elsewhere, you may need to add additional options to the
 command line. For example, on a Unix-like system that has PCRE2 installed in
 <i>/usr/local</i>, you can compile the demonstration program using a command
 like this:
 <pre>
-  gcc -o pcre2demo -I/usr/local/include pcre2demo.c -L/usr/local/lib -lpcre2-8
-
-</PRE>
-</P>
-<P>
-Once you have compiled and linked the demonstration program, you can run simple
-tests like this:
+  cc -o pcre2demo -I/usr/local/include pcre2demo.c -L/usr/local/lib -lpcre2-8
+</pre>
+Once you have built the demonstration program, you can run simple tests like
+this:
 <pre>
   ./pcre2demo 'cat|dog' 'the cat sat on the mat'
   ./pcre2demo -g 'cat|dog' 'the dog sat on the cat'
 </pre>
 Note that there is a much more comprehensive test program, called
 <a href="pcre2test.html"><b>pcre2test</b>,</a>
-which supports many more facilities for testing regular expressions using the
-PCRE2 libraries. The
+which supports many more facilities for testing regular expressions using all
+three PCRE2 libraries (8-bit, 16-bit, and 32-bit, though not all three need be
+installed). The
 <a href="pcre2demo.html"><b>pcre2demo</b></a>
-program is provided as a simple coding example.
+program is provided as a relatively simple coding example.
 </P>
 <P>
 If you try to run
@@ -73,7 +77,7 @@ If you try to run
 when PCRE2 is not installed in the standard library directory, you may get an
 error like this on some operating systems (e.g. Solaris):
 <pre>
-  ld.so.1: a.out: fatal: libpcre2.so.0: open failed: No such file or directory
+  ld.so.1: pcre2demo: fatal: libpcre2-8.so.0: open failed: No such file or directory
 </pre>
 This is caused by the way shared library support works on those systems. You
 need to add
@@ -97,9 +101,9 @@ Cambridge, England.
 REVISION
 </b><br>
 <P>
-Last updated: 20 October 2014
+Last updated: 02 February 2016
 <br>
-Copyright &copy; 1997-2014 University of Cambridge.
+Copyright &copy; 1997-2016 University of Cambridge.
 <br>
 <p>
 Return to the <a href="index.html">PCRE2 index page</a>.
index 3747c0a90bd1ba069c5efd3f1997aabb2ec166cf..edf415afdb1ee5d26b591f054efc533cb0d31529 100644 (file)
@@ -14,10 +14,11 @@ please consult the man page, in case the conversion went wrong.
 <br>
 <ul>
 <li><a name="TOC1" href="#SEC1">SAVING AND RE-USING PRECOMPILED PCRE2 PATTERNS</a>
-<li><a name="TOC2" href="#SEC2">SAVING COMPILED PATTERNS</a>
-<li><a name="TOC3" href="#SEC3">RE-USING PRECOMPILED PATTERNS</a>
-<li><a name="TOC4" href="#SEC4">AUTHOR</a>
-<li><a name="TOC5" href="#SEC5">REVISION</a>
+<li><a name="TOC2" href="#SEC2">SECURITY CONCERNS</a>
+<li><a name="TOC3" href="#SEC3">SAVING COMPILED PATTERNS</a>
+<li><a name="TOC4" href="#SEC4">RE-USING PRECOMPILED PATTERNS</a>
+<li><a name="TOC5" href="#SEC5">AUTHOR</a>
+<li><a name="TOC6" href="#SEC6">REVISION</a>
 </ul>
 <br><a name="SEC1" href="#TOC1">SAVING AND RE-USING PRECOMPILED PCRE2 PATTERNS</a><br>
 <P>
@@ -48,7 +49,15 @@ and PCRE2_SIZE type. For example, patterns compiled on a 32-bit system using
 PCRE2's 16-bit library cannot be reloaded on a 64-bit system, nor can they be
 reloaded using the 8-bit library.
 </P>
-<br><a name="SEC2" href="#TOC1">SAVING COMPILED PATTERNS</a><br>
+<br><a name="SEC2" href="#TOC1">SECURITY CONCERNS</a><br>
+<P>
+The facility for saving and restoring compiled patterns is intended for use
+within individual applications. As such, the data supplied to
+<b>pcre2_serialize_decode()</b> is expected to be trusted data, not data from
+arbitrary external sources. There is only some simple consistency checking, not
+complete validation of what is being re-loaded.
+</P>
+<br><a name="SEC3" href="#TOC1">SAVING COMPILED PATTERNS</a><br>
 <P>
 Before compiled patterns can be saved they must be serialized, that is,
 converted to a stream of bytes. A single byte stream may contain any number of
@@ -110,7 +119,7 @@ still be used for matching. Their memory must eventually be freed in the usual
 way by calling <b>pcre2_code_free()</b>. When you have finished with the byte
 stream, it too must be freed by calling <b>pcre2_serialize_free()</b>.
 </P>
-<br><a name="SEC3" href="#TOC1">RE-USING PRECOMPILED PATTERNS</a><br>
+<br><a name="SEC4" href="#TOC1">RE-USING PRECOMPILED PATTERNS</a><br>
 <P>
 In order to re-use a set of saved patterns you must first make the serialized
 byte stream available in main memory (for example, by reading from a file). The
@@ -142,11 +151,12 @@ is filled with those that fit, and the remainder are ignored. The yield of the
 function is the number of decoded patterns, or one of the following negative
 error codes:
 <pre>
-  PCRE2_ERROR_BADDATA   second argument is zero or less
-  PCRE2_ERROR_BADMAGIC  mismatch of id bytes in the data
-  PCRE2_ERROR_BADMODE   mismatch of variable unit size or PCRE2 version
-  PCRE2_ERROR_MEMORY    memory allocation failed
-  PCRE2_ERROR_NULL      first or third argument is NULL
+  PCRE2_ERROR_BADDATA    second argument is zero or less
+  PCRE2_ERROR_BADMAGIC   mismatch of id bytes in the data
+  PCRE2_ERROR_BADMODE    mismatch of code unit size or PCRE2 version
+  PCRE2_ERROR_BADSERIALIZEDDATA  other sanity check failure
+  PCRE2_ERROR_MEMORY     memory allocation failed
+  PCRE2_ERROR_NULL       first or third argument is NULL
 </pre>
 PCRE2_ERROR_BADMAGIC may mean that the data is corrupt, or that it was compiled
 on a system with different endianness.
@@ -169,7 +179,7 @@ serialized, the JIT data is discarded and so is no longer available after a
 save/restore cycle. You can, however, process a restored pattern with
 <b>pcre2_jit_compile()</b> if you wish.
 </P>
-<br><a name="SEC4" href="#TOC1">AUTHOR</a><br>
+<br><a name="SEC5" href="#TOC1">AUTHOR</a><br>
 <P>
 Philip Hazel
 <br>
@@ -178,11 +188,11 @@ University Computing Service
 Cambridge, England.
 <br>
 </P>
-<br><a name="SEC5" href="#TOC1">REVISION</a><br>
+<br><a name="SEC6" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 03 November 2015
+Last updated: 24 May 2016
 <br>
-Copyright &copy; 1997-2015 University of Cambridge.
+Copyright &copy; 1997-2016 University of Cambridge.
 <br>
 <p>
 Return to the <a href="index.html">PCRE2 index page</a>.
index 537985deb13995a84cedcbd2aaa3b8bc67d61da2..17b308e63197ecaca476e9c9534fe40a71554381 100644 (file)
@@ -98,10 +98,11 @@ further data is read.
 </P>
 <P>
 For maximum portability, therefore, it is safest to avoid non-printing
-characters in <b>pcre2test</b> input files. There is a facility for specifying a
-pattern's characters as hexadecimal pairs, thus making it possible to include
-binary zeroes in a pattern for testing purposes. Subject lines are processed
-for backslash escapes, which makes it possible to include any data value.
+characters in <b>pcre2test</b> input files. There is a facility for specifying
+some or all of a pattern's characters as hexadecimal pairs, thus making it
+possible to include binary zeroes in a pattern for testing purposes. Subject
+lines are processed for backslash escapes, which makes it possible to include
+any data value.
 </P>
 <br><a name="SEC4" href="#TOC1">COMMAND LINE OPTIONS</a><br>
 <P>
@@ -178,6 +179,13 @@ using the <b>pcre2_dfa_match()</b> function instead of the default
 <b>pcre2_match()</b>.
 </P>
 <P>
+<b>-error</b> <i>number[,number,...]</i>
+Call <b>pcre2_get_error_message()</b> for each of the error numbers in the
+comma-separated list, display the resulting messages on the standard output,
+then exit with zero exit code. The numbers may be positive or negative. This is
+a convenience facility for PCRE2 maintainers.
+</P>
+<P>
 <b>-help</b>
 Output a brief summary these options and then exit.
 </P>
@@ -352,9 +360,10 @@ test files that are also processed by <b>perltest.sh</b>. The <b>#perltest</b>
 command helps detect tests that are accidentally put in the wrong file.
 <pre>
   #pop [&#60;modifiers&#62;]
+  #popcopy [&#60;modifiers&#62;]
 </pre>
-This command is used to manipulate the stack of compiled patterns, as described
-in the section entitled "Saving and restoring compiled patterns"
+These commands are used to manipulate the stack of compiled patterns, as
+described in the section entitled "Saving and restoring compiled patterns"
 <a href="#saverestore">below.</a>
 <pre>
   #save &#60;filename&#62;
@@ -559,7 +568,7 @@ about the pattern:
       debug                     same as info,fullbincode
       fullbincode               show binary code with lengths
   /I  info                      show info about compiled pattern
-      hex                       pattern is coded in hexadecimal
+      hex                       unquoted characters are hexadecimal
       jit[=&#60;number&#62;]            use JIT
       jitfast                   use JIT fast path
       jitverify                 verify JIT use
@@ -570,7 +579,9 @@ about the pattern:
       null_context              compile with a NULL context
       parens_nest_limit=&#60;n&#62;     set maximum parentheses depth
       posix                     use the POSIX API
+      posix_nosub               use the POSIX API with REG_NOSUB
       push                      push compiled pattern onto the stack
+      pushcopy                  push a copy onto the stack
       stackguard=&#60;number&#62;       test the stackguard feature
       tables=[0|1|2]            select internal tables
 </pre>
@@ -655,20 +666,31 @@ testing that <b>pcre2_compile()</b> behaves correctly in this case (it uses
 default values).
 </P>
 <br><b>
-Specifying a pattern in hex
+Specifying pattern characters in hexadecimal
 </b><br>
 <P>
-The <b>hex</b> modifier specifies that the characters of the pattern are to be
-interpreted as pairs of hexadecimal digits. White space is permitted between
-pairs. For example:
+The <b>hex</b> modifier specifies that the characters of the pattern, except for
+substrings enclosed in single or double quotes, are to be interpreted as pairs
+of hexadecimal digits. This feature is provided as a way of creating patterns
+that contain binary zeros and other non-printing characters. White space is
+permitted between pairs of digits. For example, this pattern contains three
+characters:
 <pre>
   /ab 32 59/hex
 </pre>
-This feature is provided as a way of creating patterns that contain binary zero
-and other non-printing characters. By default, <b>pcre2test</b> passes patterns
-as zero-terminated strings to <b>pcre2_compile()</b>, giving the length as
-PCRE2_ZERO_TERMINATED. However, for patterns specified in hexadecimal, the
-actual length of the pattern is passed.
+Parts of such a pattern are taken literally if quoted. This pattern contains
+nine characters, only two of which are specified in hexadecimal:
+<pre>
+  /ab "literal" 32/hex
+</pre>
+Either single or double quotes may be used. There is no way of including
+the delimiter within a substring.
+</P>
+<P>
+By default, <b>pcre2test</b> passes patterns as zero-terminated strings to
+<b>pcre2_compile()</b>, giving the length as PCRE2_ZERO_TERMINATED. However, for
+patterns specified with the <b>hex</b> modifier, the actual length of the
+pattern is passed.
 </P>
 <br><b>
 Generating long repetitive patterns
@@ -821,16 +843,17 @@ variable can hold (essentially unlimited).
 Using the POSIX wrapper API
 </b><br>
 <P>
-The <b>/posix</b> modifier causes <b>pcre2test</b> to call PCRE2 via the POSIX
-wrapper API rather than its native API. This supports only the 8-bit library.
-Note that it does not imply POSIX matching semantics; for more detail see the
+The <b>/posix</b> and <b>posix_nosub</b> modifiers cause <b>pcre2test</b> to call
+PCRE2 via the POSIX wrapper API rather than its native API. When
+<b>posix_nosub</b> is used, the POSIX option REG_NOSUB is passed to
+<b>regcomp()</b>. The POSIX wrapper supports only the 8-bit library. Note that
+it does not imply POSIX matching semantics; for more detail see the
 <a href="pcre2posix.html"><b>pcre2posix</b></a>
-documentation. When the POSIX API is being used, the following pattern
-modifiers set options for the <b>regcomp()</b> function:
+documentation. The following pattern modifiers set options for the
+<b>regcomp()</b> function:
 <pre>
   caseless           REG_ICASE
   multiline          REG_NEWLINE
-  no_auto_capture    REG_NOSUB
   dotall             REG_DOTALL     )
   ungreedy           REG_UNGREEDY   ) These options are not part of
   ucp                REG_UCP        )   the POSIX standard
@@ -847,7 +870,8 @@ large buffer is used.
 </P>
 <P>
 The <b>aftertext</b> and <b>allaftertext</b> subject modifiers work as described
-below. All other modifiers cause an error.
+below. All other modifiers are either ignored, with a warning message, or cause
+an error.
 </P>
 <br><b>
 Testing the stack guard feature
@@ -917,12 +941,16 @@ pushed onto a stack of compiled patterns, and <b>pcre2test</b> expects the next
 line to contain a new pattern (or a command) instead of a subject line. This
 facility is used when saving compiled patterns to a file, as described in the
 section entitled "Saving and restoring compiled patterns"
-<a href="#saverestore">below.</a>
-The <b>push</b> modifier is incompatible with compilation modifiers such as
-<b>global</b> that act at match time. Any that are specified are ignored, with a
-warning message, except for <b>replace</b>, which causes an error. Note that,
-<b>jitverify</b>, which is allowed, does not carry through to any subsequent
-matching that uses this pattern.
+<a href="#saverestore">below. If <b>pushcopy</b> is used instead of <b>push</b>, a copy of the compiled</a>
+pattern is stacked, leaving the original as current, ready to match the
+following input lines. This provides a way of testing the
+<b>pcre2_code_copy()</b> function.
+The <b>push</b> and <b>pushcopy </b> modifiers are incompatible with compilation
+modifiers such as <b>global</b> that act at match time. Any that are specified
+are ignored (for the stacked copy), with a warning message, except for
+<b>replace</b>, which causes an error. Note that <b>jitverify</b>, which is
+allowed, does not carry through to any subsequent matching that uses a stacked
+pattern.
 <a name="subjectmodifiers"></a></P>
 <br><a name="SEC11" href="#TOC1">SUBJECT MODIFIERS</a><br>
 <P>
@@ -941,6 +969,7 @@ for a description of their effects.
       anchored                  set PCRE2_ANCHORED
       dfa_restart               set PCRE2_DFA_RESTART
       dfa_shortest              set PCRE2_DFA_SHORTEST
+      no_jit                    set PCRE2_NO_JIT
       no_utf_check              set PCRE2_NO_UTF_CHECK
       notbol                    set PCRE2_NOTBOL
       notempty                  set PCRE2_NOTEMPTY
@@ -957,7 +986,7 @@ If the <b>/posix</b> modifier was present on the pattern, causing the POSIX
 wrapper API to be used, the only option-setting modifiers that have any effect
 are <b>notbol</b>, <b>notempty</b>, and <b>noteol</b>, causing REG_NOTBOL,
 REG_NOTEMPTY, and REG_NOTEOL, respectively, to be passed to <b>regexec()</b>.
-Any other modifiers cause an error.
+The other modifiers are ignored, with a warning message.
 </P>
 <br><b>
 Setting match controls
@@ -1001,7 +1030,10 @@ pattern.
       substitute_unset_empty     use PCRE2_SUBSTITUTE_UNSET_EMPTY
       zero_terminate             pass the subject as zero-terminated
 </pre>
-The effects of these modifiers are described in the following sections.
+The effects of these modifiers are described in the following sections. When
+matching via the POSIX wrapper API, the <b>aftertext</b>, <b>allaftertext</b>,
+and <b>ovector</b> subject modifiers work as described below. All other
+modifiers are either ignored, with a warning message, or cause an error.
 </P>
 <br><b>
 Showing more text
@@ -1058,7 +1090,8 @@ The <b>allcaptures</b> modifier requests that the values of all potential
 captured parentheses be output after a match. By default, only those up to the
 highest one actually used in the match are output (corresponding to the return
 code from <b>pcre2_match()</b>). Groups that did not take part in the match
-are output as "&#60;unset&#62;".
+are output as "&#60;unset&#62;". This modifier is not relevant for DFA matching (which
+does no capturing); it is ignored, with a warning message, if present.
 </P>
 <br><b>
 Testing callouts
@@ -1512,7 +1545,9 @@ item to be tested. For example:
 This output indicates that callout number 0 occurred for a match attempt
 starting at the fourth character of the subject string, when the pointer was at
 the seventh character, and when the next pattern item was \d. Just
-one circumflex is output if the start and current positions are the same.
+one circumflex is output if the start and current positions are the same, or if
+the current position precedes the start position, which can happen if the
+callout is in a lookbehind assertion.
 </P>
 <P>
 Callouts numbered 255 are assumed to be automatic callouts, inserted as a
@@ -1604,11 +1639,16 @@ can be used to test these functions.
 <P>
 When a pattern with <b>push</b> modifier is successfully compiled, it is pushed
 onto a stack of compiled patterns, and <b>pcre2test</b> expects the next line to
-contain a new pattern (or command) instead of a subject line. By this means, a
-number of patterns can be compiled and retained. The <b>push</b> modifier is
-incompatible with <b>posix</b>, and control modifiers that act at match time are
-ignored (with a message). The <b>jitverify</b> modifier applies only at compile
-time. The command
+contain a new pattern (or command) instead of a subject line. By contrast,
+the <b>pushcopy</b> modifier causes a copy of the compiled pattern to be
+stacked, leaving the original available for immediate matching. By using
+<b>push</b> and/or <b>pushcopy</b>, a number of patterns can be compiled and
+retained. These modifiers are incompatible with <b>posix</b>, and control
+modifiers that act at match time are ignored (with a message) for the stacked
+patterns. The <b>jitverify</b> modifier applies only at compile time.
+</P>
+<P>
+The command
 <pre>
   #save &#60;filename&#62;
 </pre>
@@ -1625,7 +1665,8 @@ usual by an empty line or end of file. This command may be followed by a
 modifier list containing only
 <a href="#controlmodifiers">control modifiers</a>
 that act after a pattern has been compiled. In particular, <b>hex</b>,
-<b>posix</b>, and <b>push</b> are not allowed, nor are any
+<b>posix</b>, <b>posix_nosub</b>, <b>push</b>, and <b>pushcopy</b> are not allowed,
+nor are any
 <a href="#optionmodifiers">option-setting modifiers.</a>
 The JIT modifiers are, however permitted. Here is an example that saves and
 reloads two patterns.
@@ -1643,6 +1684,11 @@ reloads two patterns.
 If <b>jitverify</b> is used with #pop, it does not automatically imply
 <b>jit</b>, which is different behaviour from when it is used on a pattern.
 </P>
+<P>
+The #popcopy command is analagous to the <b>pushcopy</b> modifier in that it
+makes current a copy of the topmost stack pattern, leaving the original still
+on the stack.
+</P>
 <br><a name="SEC19" href="#TOC1">SEE ALSO</a><br>
 <P>
 <b>pcre2</b>(3), <b>pcre2api</b>(3), <b>pcre2callout</b>(3),
@@ -1660,9 +1706,9 @@ Cambridge, England.
 </P>
 <br><a name="SEC21" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 12 December 2015
+Last updated: 06 July 2016
 <br>
-Copyright &copy; 1997-2015 University of Cambridge.
+Copyright &copy; 1997-2016 University of Cambridge.
 <br>
 <p>
 Return to the <a href="index.html">PCRE2 index page</a>.
index 7af55c3eba07ac831a8740d68801a4c7656927c9..6ca367f4e1b138fe1e5b93ae35e2c9478ee64233 100644 (file)
@@ -67,16 +67,20 @@ In UTF modes, the dot metacharacter matches one UTF character instead of a
 single code unit.
 </P>
 <P>
-The escape sequence \C can be used to match a single code unit, in a UTF mode,
+The escape sequence \C can be used to match a single code unit in a UTF mode,
 but its use can lead to some strange effects because it breaks up multi-unit
 characters (see the description of \C in the
 <a href="pcre2pattern.html"><b>pcre2pattern</b></a>
-documentation). The use of \C is not supported by the alternative matching
-function <b>pcre2_dfa_match()</b> when in UTF mode. Its use provokes a
-match-time error. The JIT optimization also does not support \C in UTF mode.
-If JIT optimization is requested for a UTF pattern that contains \C, it will
-not succeed, and so the matching will be carried out by the normal interpretive
-function.
+documentation).
+</P>
+<P>
+The use of \C is not supported by the alternative matching function
+<b>pcre2_dfa_match()</b> when in UTF-8 or UTF-16 mode, that is, when a character
+may consist of more than one code unit. The use of \C in these modes provokes
+a match-time error. Also, the JIT optimization does not support \C in these
+modes. If JIT optimization is requested for a UTF-8 or UTF-16 pattern that
+contains \C, it will not succeed, and so when <b>pcre2_match()</b> is called,
+the matching will be carried out by the normal interpretive function.
 </P>
 <P>
 The character escapes \b, \B, \d, \D, \s, \S, \w, and \W correctly test
@@ -244,9 +248,9 @@ Errors in UTF-16 strings
 <P>
 The following negative error codes are given for invalid UTF-16 strings:
 <pre>
-  PCRE_UTF16_ERR1  Missing low surrogate at end of string
-  PCRE_UTF16_ERR2  Invalid low surrogate follows high surrogate
-  PCRE_UTF16_ERR3  Isolated low surrogate
+  PCRE2_ERROR_UTF16_ERR1  Missing low surrogate at end of string
+  PCRE2_ERROR_UTF16_ERR2  Invalid low surrogate follows high surrogate
+  PCRE2_ERROR_UTF16_ERR3  Isolated low surrogate
 
 <a name="utf32strings"></a></PRE>
 </P>
@@ -256,8 +260,8 @@ Errors in UTF-32 strings
 <P>
 The following negative error codes are given for invalid UTF-32 strings:
 <pre>
-  PCRE_UTF32_ERR1  Surrogate character (range from 0xd800 to 0xdfff)
-  PCRE_UTF32_ERR2  Code point is greater than 0x10ffff
+  PCRE2_ERROR_UTF32_ERR1  Surrogate character (0xd800 to 0xdfff)
+  PCRE2_ERROR_UTF32_ERR2  Code point is greater than 0x10ffff
 
 </PRE>
 </P>
@@ -276,9 +280,9 @@ Cambridge, England.
 REVISION
 </b><br>
 <P>
-Last updated: 16 October 2015
+Last updated: 03 July 2016
 <br>
-Copyright &copy; 1997-2015 University of Cambridge.
+Copyright &copy; 1997-2016 University of Cambridge.
 <br>
 <p>
 Return to the <a href="index.html">PCRE2 index page</a>.
index f459657143000ae6ef7a8c444972dd722b580f58..703c29837c20f0cff3fb81157ce34a34c3de714f 100644 (file)
@@ -91,6 +91,9 @@ in the library.
 <tr><td><a href="pcre2_callout_enumerate.html">pcre2_callout_enumerate</a></td>
     <td>&nbsp;&nbsp;Enumerate callouts in a compiled pattern</td></tr>
 
+<tr><td><a href="pcre2_code_copy.html">pcre2_code_copy</a></td>
+    <td>&nbsp;&nbsp;Copy a compiled pattern</td></tr>
+
 <tr><td><a href="pcre2_code_free.html">pcre2_code_free</a></td>
     <td>&nbsp;&nbsp;Free a compiled pattern</td></tr>
 
index 9df2d47ebc3e60554b37c1cf8a6ab9394b14b714..8f4e8a18ec885fd94e23ae690b5d4657fd43b839 100644 (file)
@@ -377,6 +377,8 @@ PCRE2 NATIVE API SERIALIZATION FUNCTIONS
 
 PCRE2 NATIVE API AUXILIARY FUNCTIONS
 
+       pcre2_code *pcre2_code_copy(const pcre2_code *code);
+
        int pcre2_get_error_message(int errorcode, PCRE2_UCHAR *buffer,
          PCRE2_SIZE bufflen);
 
@@ -487,10 +489,10 @@ PCRE2 API OVERVIEW
        pcre2_jit_stack_assign() in order to  control  the  JIT  code's  memory
        usage.
 
-       JIT matching is automatically used by pcre2_match() if it is available.
-       There is also a direct interface for JIT matching, which gives improved
-       performance.  The  JIT-specific functions are discussed in the pcre2jit
-       documentation.
+       JIT matching is automatically used by pcre2_match() if it is available,
+       unless the PCRE2_NO_JIT option is set. There is also a direct interface
+       for  JIT  matching,  which gives improved performance. The JIT-specific
+       functions are discussed in the pcre2jit documentation.
 
        A second matching function, pcre2_dfa_match(), which is  not  Perl-com-
        patible,  is  also  provided.  This  uses a different algorithm for the
@@ -523,76 +525,113 @@ PCRE2 API OVERVIEW
        return a copy of the subject string with substitutions for  parts  that
        were matched.
 
-       Finally,  there  are functions for finding out information about a com-
-       piled pattern (pcre2_pattern_info()) and about the  configuration  with
+       Functions  whose  names begin with pcre2_serialize_ are used for saving
+       compiled patterns on disc or elsewhere, and reloading them later.
+
+       Finally, there are functions for finding out information about  a  com-
+       piled  pattern  (pcre2_pattern_info()) and about the configuration with
        which PCRE2 was built (pcre2_config()).
 
+       Functions with names ending with _free() are used  for  freeing  memory
+       blocks  of  various  sorts.  In all cases, if one of these functions is
+       called with a NULL argument, it does nothing.
+
 
 STRING LENGTHS AND OFFSETS
 
-       The  PCRE2  API  uses  string  lengths and offsets into strings of code
-       units in several places. These values are always  of  type  PCRE2_SIZE,
-       which  is an unsigned integer type, currently always defined as size_t.
-       The largest  value  that  can  be  stored  in  such  a  type  (that  is
-       ~(PCRE2_SIZE)0)  is reserved as a special indicator for zero-terminated
-       strings and unset offsets.  Therefore, the longest string that  can  be
+       The PCRE2 API uses string lengths and  offsets  into  strings  of  code
+       units  in  several  places. These values are always of type PCRE2_SIZE,
+       which is an unsigned integer type, currently always defined as  size_t.
+       The  largest  value  that  can  be  stored  in  such  a  type  (that is
+       ~(PCRE2_SIZE)0) is reserved as a special indicator for  zero-terminated
+       strings  and  unset offsets.  Therefore, the longest string that can be
        handled is one less than this maximum.
 
 
 NEWLINES
 
        PCRE2 supports five different conventions for indicating line breaks in
-       strings: a single CR (carriage return) character, a  single  LF  (line-
+       strings:  a  single  CR (carriage return) character, a single LF (line-
        feed) character, the two-character sequence CRLF, any of the three pre-
-       ceding, or any Unicode newline sequence. The Unicode newline  sequences
-       are  the  three just mentioned, plus the single characters VT (vertical
+       ceding,  or any Unicode newline sequence. The Unicode newline sequences
+       are the three just mentioned, plus the single characters  VT  (vertical
        tab, U+000B), FF (form feed, U+000C), NEL (next line, U+0085), LS (line
        separator, U+2028), and PS (paragraph separator, U+2029).
 
-       Each  of  the first three conventions is used by at least one operating
+       Each of the first three conventions is used by at least  one  operating
        system as its standard newline sequence. When PCRE2 is built, a default
-       can  be  specified.  The default default is LF, which is the Unix stan-
-       dard. However, the newline convention can be changed by an  application
+       can be specified.  The default default is LF, which is the  Unix  stan-
+       dard.  However, the newline convention can be changed by an application
        when calling pcre2_compile(), or it can be specified by special text at
        the start of the pattern itself; this overrides any other settings. See
        the pcre2pattern page for details of the special character sequences.
 
-       In  the  PCRE2  documentation  the  word "newline" is used to mean "the
+       In the PCRE2 documentation the word "newline"  is  used  to  mean  "the
        character or pair of characters that indicate a line break". The choice
-       of  newline convention affects the handling of the dot, circumflex, and
+       of newline convention affects the handling of the dot, circumflex,  and
        dollar metacharacters, the handling of #-comments in /x mode, and, when
-       CRLF  is a recognized line ending sequence, the match position advance-
+       CRLF is a recognized line ending sequence, the match position  advance-
        ment for a non-anchored pattern. There is more detail about this in the
        section on pcre2_match() options below.
 
-       The  choice of newline convention does not affect the interpretation of
+       The choice of newline convention does not affect the interpretation  of
        the \n or \r escape sequences, nor does it affect what \R matches; this
        has its own separate convention.
 
 
 MULTITHREADING
 
-       In  a multithreaded application it is important to keep thread-specific
-       data separate from data that can be shared between threads.  The  PCRE2
-       library  code  itself  is  thread-safe: it contains no static or global
-       variables. The API is designed to be  fairly  simple  for  non-threaded
-       applications  while at the same time ensuring that multithreaded appli-
+       In a multithreaded application it is important to keep  thread-specific
+       data  separate  from data that can be shared between threads. The PCRE2
+       library code itself is thread-safe: it contains  no  static  or  global
+       variables.  The  API  is  designed to be fairly simple for non-threaded
+       applications while at the same time ensuring that multithreaded  appli-
        cations can use it.
 
        There are several different blocks of data that are used to pass infor-
        mation between the application and the PCRE2 libraries.
 
-       (1) A pointer to the compiled form of a pattern is returned to the user
+   The compiled pattern
+
+       A pointer to the compiled form of a pattern is  returned  to  the  user
        when pcre2_compile() is successful. The data in the compiled pattern is
-       fixed,  and  does not change when the pattern is matched. Therefore, it
-       is thread-safe, that is, the same compiled pattern can be used by  more
-       than one thread simultaneously. An application can compile all its pat-
-       terns at the start, before forking off multiple threads that use  them.
-       However,  if  the  just-in-time  optimization feature is being used, it
-       needs separate memory stack areas for each  thread.  See  the  pcre2jit
-       documentation for more details.
-
-       (2)  The  next section below introduces the idea of "contexts" in which
+       fixed, and does not change when the pattern is matched.  Therefore,  it
+       is  thread-safe, that is, the same compiled pattern can be used by more
+       than one thread simultaneously. For example, an application can compile
+       all its patterns at the start, before forking off multiple threads that
+       use them. However, if the just-in-time optimization  feature  is  being
+       used,  it  needs  separate  memory stack areas for each thread. See the
+       pcre2jit documentation for more details.
+
+       In a more complicated situation, where patterns are compiled only  when
+       they  are  first needed, but are still shared between threads, pointers
+       to compiled patterns must be protected  from  simultaneous  writing  by
+       multiple threads, at least until a pattern has been compiled. The logic
+       can be something like this:
+
+         Get a read-only (shared) lock (mutex) for pointer
+         if (pointer == NULL)
+           {
+           Get a write (unique) lock for pointer
+           pointer = pcre2_compile(...
+           }
+         Release the lock
+         Use pointer in pcre2_match()
+
+       Of course, testing for compilation errors should also  be  included  in
+       the code.
+
+       If JIT is being used, but the JIT compilation is not being done immedi-
+       ately, (perhaps waiting to see if the pattern  is  used  often  enough)
+       similar logic is required. JIT compilation updates a pointer within the
+       compiled code block, so a thread must gain unique write access  to  the
+       pointer     before    calling    pcre2_jit_compile().    Alternatively,
+       pcre2_code_copy() can be used to obtain a private copy of the  compiled
+       code.
+
+   Context blocks
+
+       The  next main section below introduces the idea of "contexts" in which
        PCRE2 functions are called. A context is nothing more than a collection
        of parameters that control the way PCRE2 operates. Grouping a number of
        parameters together in a context is a convenient way of passing them to
@@ -605,44 +644,45 @@ MULTITHREADING
        threads. However, if any thread needs to change any value in a context,
        it must make its own thread-specific copy.
 
-       (3) The matching functions need a block of memory for working space and
-       for  storing  the results of a match. This includes details of what was
+   Match blocks
+
+       The matching functions need a block of memory for working space and for
+       storing  the  results  of  a  match.  This includes details of what was
        matched, as well as additional  information  such  as  the  name  of  a
-       (*MARK)  setting. Each thread must provide its own version of this mem-
-       ory.
+       (*MARK) setting. Each thread must provide its own copy of this memory.
 
 
 PCRE2 CONTEXTS
 
-       Some PCRE2 functions have a lot of parameters, many of which  are  used
-       only  by  specialist  applications,  for example, those that use custom
-       memory management or non-standard character tables.  To  keep  function
-       argument  lists  at a reasonable size, and at the same time to keep the
-       API extensible, "uncommon" parameters are passed to  certain  functions
-       in  a  context instead of directly. A context is just a block of memory
-       that holds the parameter values.  Applications  that  do  not  need  to
-       adjust  any  of  the  context  parameters  can pass NULL when a context
+       Some  PCRE2  functions have a lot of parameters, many of which are used
+       only by specialist applications, for example,  those  that  use  custom
+       memory  management  or  non-standard character tables. To keep function
+       argument lists at a reasonable size, and at the same time to  keep  the
+       API  extensible,  "uncommon" parameters are passed to certain functions
+       in a context instead of directly. A context is just a block  of  memory
+       that  holds  the  parameter  values.   Applications that do not need to
+       adjust any of the context parameters  can  pass  NULL  when  a  context
        pointer is required.
 
-       There are three different types of context: a general context  that  is
-       relevant  for  several  PCRE2 operations, a compile-time context, and a
+       There  are  three different types of context: a general context that is
+       relevant for several PCRE2 operations, a compile-time  context,  and  a
        match-time context.
 
    The general context
 
-       At present, this context just  contains  pointers  to  (and  data  for)
-       external  memory  management  functions  that  are  called from several
+       At  present,  this  context  just  contains  pointers to (and data for)
+       external memory management  functions  that  are  called  from  several
        places in the PCRE2 library. The context is named `general' rather than
-       specifically  `memory'  because in future other fields may be added. If
-       you do not want to supply your own custom memory management  functions,
-       you  do not need to bother with a general context. A general context is
+       specifically `memory' because in future other fields may be  added.  If
+       you  do not want to supply your own custom memory management functions,
+       you do not need to bother with a general context. A general context  is
        created by:
 
        pcre2_general_context *pcre2_general_context_create(
          void *(*private_malloc)(PCRE2_SIZE, void *),
          void (*private_free)(void *, void *), void *memory_data);
 
-       The two function pointers specify custom memory  management  functions,
+       The  two  function pointers specify custom memory management functions,
        whose prototypes are:
 
          void *private_malloc(PCRE2_SIZE, void *);
@@ -650,16 +690,16 @@ PCRE2 CONTEXTS
 
        Whenever code in PCRE2 calls these functions, the final argument is the
        value of memory_data. Either of the first two arguments of the creation
-       function  may be NULL, in which case the system memory management func-
-       tions malloc() and free() are used. (This is not currently  useful,  as
-       there  are  no  other  fields in a general context, but in future there
-       might be.)  The private_malloc() function  is  used  (if  supplied)  to
-       obtain  memory  for storing the context, and all three values are saved
+       function may be NULL, in which case the system memory management  func-
+       tions  malloc()  and free() are used. (This is not currently useful, as
+       there are no other fields in a general context,  but  in  future  there
+       might  be.)   The  private_malloc()  function  is used (if supplied) to
+       obtain memory for storing the context, and all three values  are  saved
        as part of the context.
 
-       Whenever PCRE2 creates a data block of any kind, the block  contains  a
-       pointer  to the free() function that matches the malloc() function that
-       was used. When the time comes to  free  the  block,  this  function  is
+       Whenever  PCRE2  creates a data block of any kind, the block contains a
+       pointer to the free() function that matches the malloc() function  that
+       was  used.  When  the  time  comes  to free the block, this function is
        called.
 
        A general context can be copied by calling:
@@ -674,7 +714,7 @@ PCRE2 CONTEXTS
 
    The compile context
 
-       A  compile context is required if you want to change the default values
+       A compile context is required if you want to change the default  values
        of any of the following compile-time parameters:
 
          What \R matches (Unicode newlines or CR, LF, CRLF only)
@@ -684,11 +724,11 @@ PCRE2 CONTEXTS
          The maximum length of the pattern string
          An external function for stack checking
 
-       A compile context is also required if you are using custom memory  man-
-       agement.   If  none of these apply, just pass NULL as the context argu-
+       A  compile context is also required if you are using custom memory man-
+       agement.  If none of these apply, just pass NULL as the  context  argu-
        ment of pcre2_compile().
 
-       A compile context is created, copied, and freed by the following  func-
+       A  compile context is created, copied, and freed by the following func-
        tions:
 
        pcre2_compile_context *pcre2_compile_context_create(
@@ -699,33 +739,33 @@ PCRE2 CONTEXTS
 
        void pcre2_compile_context_free(pcre2_compile_context *ccontext);
 
-       A  compile  context  is created with default values for its parameters.
+       A compile context is created with default values  for  its  parameters.
        These can be changed by calling the following functions, which return 0
        on success, or PCRE2_ERROR_BADDATA if invalid data is detected.
 
        int pcre2_set_bsr(pcre2_compile_context *ccontext,
          uint32_t value);
 
-       The  value  must  be PCRE2_BSR_ANYCRLF, to specify that \R matches only
-       CR, LF, or CRLF, or PCRE2_BSR_UNICODE, to specify that \R  matches  any
+       The value must be PCRE2_BSR_ANYCRLF, to specify that  \R  matches  only
+       CR,  LF,  or CRLF, or PCRE2_BSR_UNICODE, to specify that \R matches any
        Unicode line ending sequence. The value is used by the JIT compiler and
-       by  the  two  interpreted   matching   functions,   pcre2_match()   and
+       by   the   two   interpreted   matching  functions,  pcre2_match()  and
        pcre2_dfa_match().
 
        int pcre2_set_character_tables(pcre2_compile_context *ccontext,
          const unsigned char *tables);
 
-       The  value  must  be  the result of a call to pcre2_maketables(), whose
+       The value must be the result of a  call  to  pcre2_maketables(),  whose
        only argument is a general context. This function builds a set of char-
        acter tables in the current locale.
 
        int pcre2_set_max_pattern_length(pcre2_compile_context *ccontext,
          PCRE2_SIZE value);
 
-       This  sets a maximum length, in code units, for the pattern string that
-       is to be compiled. If the pattern is longer,  an  error  is  generated.
-       This  facility  is  provided  so that applications that accept patterns
-       from external sources can limit their size. The default is the  largest
+       This sets a maximum length, in code units, for the pattern string  that
+       is  to  be  compiled.  If the pattern is longer, an error is generated.
+       This facility is provided so that  applications  that  accept  patterns
+       from  external sources can limit their size. The default is the largest
        number that a PCRE2_SIZE variable can hold, which is effectively unlim-
        ited.
 
@@ -733,38 +773,38 @@ PCRE2 CONTEXTS
          uint32_t value);
 
        This specifies which characters or character sequences are to be recog-
-       nized  as newlines. The value must be one of PCRE2_NEWLINE_CR (carriage
+       nized as newlines. The value must be one of PCRE2_NEWLINE_CR  (carriage
        return only), PCRE2_NEWLINE_LF (linefeed only), PCRE2_NEWLINE_CRLF (the
-       two-character  sequence  CR followed by LF), PCRE2_NEWLINE_ANYCRLF (any
+       two-character sequence CR followed by LF),  PCRE2_NEWLINE_ANYCRLF  (any
        of the above), or PCRE2_NEWLINE_ANY (any Unicode newline sequence).
 
        When a pattern is compiled with the PCRE2_EXTENDED option, the value of
-       this  parameter  affects  the recognition of white space and the end of
+       this parameter affects the recognition of white space and  the  end  of
        internal comments starting with #. The value is saved with the compiled
-       pattern  for  subsequent  use by the JIT compiler and by the two inter-
+       pattern for subsequent use by the JIT compiler and by  the  two  inter-
        preted matching functions, pcre2_match() and pcre2_dfa_match().
 
        int pcre2_set_parens_nest_limit(pcre2_compile_context *ccontext,
          uint32_t value);
 
        This parameter ajusts the limit, set when PCRE2 is built (default 250),
-       on  the  depth  of  parenthesis  nesting in a pattern. This limit stops
+       on the depth of parenthesis nesting in  a  pattern.  This  limit  stops
        rogue patterns using up too much system stack when being compiled.
 
        int pcre2_set_compile_recursion_guard(pcre2_compile_context *ccontext,
          int (*guard_function)(uint32_t, void *), void *user_data);
 
-       There is at least one application that runs PCRE2 in threads with  very
-       limited  system  stack,  where running out of stack is to be avoided at
-       all costs. The parenthesis limit above cannot take account of how  much
-       stack  is  actually  available.  For  a finer control, you can supply a
-       function that is called whenever pcre2_compile() starts  to  compile  a
-       parenthesized  part  of  a  pattern. This function can check the actual
+       There  is at least one application that runs PCRE2 in threads with very
+       limited system stack, where running out of stack is to  be  avoided  at
+       all  costs. The parenthesis limit above cannot take account of how much
+       stack is actually available. For a finer  control,  you  can  supply  a
+       function  that  is  called whenever pcre2_compile() starts to compile a
+       parenthesized part of a pattern. This function  can  check  the  actual
        stack size (or anything else that it wants to, of course).
 
-       The first argument to the callout function gives the current  depth  of
-       nesting,  and  the second is user data that is set up by the last argu-
-       ment  of  pcre2_set_compile_recursion_guard().  The  callout   function
+       The  first  argument to the callout function gives the current depth of
+       nesting, and the second is user data that is set up by the  last  argu-
+       ment   of  pcre2_set_compile_recursion_guard().  The  callout  function
        should return zero if all is well, or non-zero to force an error.
 
    The match context
@@ -778,10 +818,10 @@ PCRE2 CONTEXTS
          The limit for calling match() recursively
 
        A match context is also required if you are using custom memory manage-
-       ment.   If  none of these apply, just pass NULL as the context argument
+       ment.  If none of these apply, just pass NULL as the  context  argument
        of pcre2_match(), pcre2_dfa_match(), or pcre2_jit_match().
 
-       A match context is created, copied, and freed by  the  following  func-
+       A  match  context  is created, copied, and freed by the following func-
        tions:
 
        pcre2_match_context *pcre2_match_context_create(
@@ -792,7 +832,7 @@ PCRE2 CONTEXTS
 
        void pcre2_match_context_free(pcre2_match_context *mcontext);
 
-       A  match  context  is  created  with default values for its parameters.
+       A match context is created with  default  values  for  its  parameters.
        These can be changed by calling the following functions, which return 0
        on success, or PCRE2_ERROR_BADDATA if invalid data is detected.
 
@@ -800,96 +840,96 @@ PCRE2 CONTEXTS
          int (*callout_function)(pcre2_callout_block *, void *),
          void *callout_data);
 
-       This  sets  up a "callout" function, which PCRE2 will call at specified
+       This sets up a "callout" function, which PCRE2 will call  at  specified
        points during a matching operation. Details are given in the pcre2call-
        out documentation.
 
        int pcre2_set_offset_limit(pcre2_match_context *mcontext,
          PCRE2_SIZE value);
 
-       The  offset_limit  parameter  limits  how  far an unanchored search can
-       advance in the subject string. The default value  is  PCRE2_UNSET.  The
-       pcre2_match()      and      pcre2_dfa_match()      functions     return
-       PCRE2_ERROR_NOMATCH if a match with a starting point before or  at  the
+       The offset_limit parameter limits how  far  an  unanchored  search  can
+       advance  in  the  subject string. The default value is PCRE2_UNSET. The
+       pcre2_match()     and      pcre2_dfa_match()      functions      return
+       PCRE2_ERROR_NOMATCH  if  a match with a starting point before or at the
        given offset is not found. For example, if the pattern /abc/ is matched
-       against "123abc" with an offset  limit  less  than  3,  the  result  is
-       PCRE2_ERROR_NO_MATCH.   A  match  can never be found if the startoffset
+       against  "123abc"  with  an  offset  limit  less  than 3, the result is
+       PCRE2_ERROR_NO_MATCH.  A match can never be found  if  the  startoffset
        argument of pcre2_match() or pcre2_dfa_match() is greater than the off-
        set limit.
 
-       When  using  this  facility,  you  must set PCRE2_USE_OFFSET_LIMIT when
-       calling pcre2_compile() so that when JIT is in use, different code  can
-       be  compiled. If a match is started with a non-default match limit when
+       When using this facility,  you  must  set  PCRE2_USE_OFFSET_LIMIT  when
+       calling  pcre2_compile() so that when JIT is in use, different code can
+       be compiled. If a match is started with a non-default match limit  when
        PCRE2_USE_OFFSET_LIMIT is not set, an error is generated.
 
-       The offset limit facility can be used to track progress when  searching
-       large  subject  strings.  See  also  the  PCRE2_FIRSTLINE option, which
+       The  offset limit facility can be used to track progress when searching
+       large subject strings.  See  also  the  PCRE2_FIRSTLINE  option,  which
        requires a match to start within the first line of the subject. If this
-       is  set  with an offset limit, a match must occur in the first line and
-       also within the offset limit.  In other words,  whichever  limit  comes
+       is set with an offset limit, a match must occur in the first  line  and
+       also  within  the  offset limit.  In other words, whichever limit comes
        first is used.
 
        int pcre2_set_match_limit(pcre2_match_context *mcontext,
          uint32_t value);
 
-       The  match_limit  parameter  provides  a means of preventing PCRE2 from
+       The match_limit parameter provides a means  of  preventing  PCRE2  from
        using up too many resources when processing patterns that are not going
-       to  match, but which have a very large number of possibilities in their
-       search trees. The classic example is a pattern that uses nested  unlim-
+       to match, but which have a very large number of possibilities in  their
+       search  trees. The classic example is a pattern that uses nested unlim-
        ited repeats.
 
-       Internally,  pcre2_match()  uses  a  function  called match(), which it
-       calls repeatedly (sometimes recursively). The limit set by  match_limit
-       is  imposed  on  the  number  of times this function is called during a
+       Internally, pcre2_match() uses a  function  called  match(),  which  it
+       calls  repeatedly (sometimes recursively). The limit set by match_limit
+       is imposed on the number of times this  function  is  called  during  a
        match, which has the effect of limiting the amount of backtracking that
-       can  take place. For patterns that are not anchored, the count restarts
-       from zero for each position in the subject string. This  limit  is  not
+       can take place. For patterns that are not anchored, the count  restarts
+       from  zero  for  each position in the subject string. This limit is not
        relevant to pcre2_dfa_match(), which ignores it.
 
-       When  pcre2_match() is called with a pattern that was successfully pro-
+       When pcre2_match() is called with a pattern that was successfully  pro-
        cessed by pcre2_jit_compile(), the way in which matching is executed is
-       entirely  different. However, there is still the possibility of runaway
-       matching that goes on for a very long  time,  and  so  the  match_limit
-       value  is  also used in this case (but in a different way) to limit how
+       entirely different. However, there is still the possibility of  runaway
+       matching  that  goes  on  for  a very long time, and so the match_limit
+       value is also used in this case (but in a different way) to  limit  how
        long the matching can continue.
 
-       The default value for the limit can be set when  PCRE2  is  built;  the
-       default  default  is 10 million, which handles all but the most extreme
-       cases.   If   the   limit   is    exceeded,    pcre2_match()    returns
-       PCRE2_ERROR_MATCHLIMIT.  A  value  for the match limit may also be sup-
+       The  default  value  for  the limit can be set when PCRE2 is built; the
+       default default is 10 million, which handles all but the  most  extreme
+       cases.    If    the    limit   is   exceeded,   pcre2_match()   returns
+       PCRE2_ERROR_MATCHLIMIT. A value for the match limit may  also  be  sup-
        plied by an item at the start of a pattern of the form
 
          (*LIMIT_MATCH=ddd)
 
-       where ddd is a decimal number.  However,  such  a  setting  is  ignored
-       unless  ddd  is  less than the limit set by the caller of pcre2_match()
+       where  ddd  is  a  decimal  number.  However, such a setting is ignored
+       unless ddd is less than the limit set by the  caller  of  pcre2_match()
        or, if no such limit is set, less than the default.
 
        int pcre2_set_recursion_limit(pcre2_match_context *mcontext,
          uint32_t value);
 
        The recursion_limit parameter is similar to match_limit, but instead of
-       limiting  the  total  number of times that match() is called, it limits
-       the depth of recursion. The recursion depth is a  smaller  number  than
-       the  total number of calls, because not all calls to match() are recur-
+       limiting the total number of times that match() is  called,  it  limits
+       the  depth  of  recursion. The recursion depth is a smaller number than
+       the total number of calls, because not all calls to match() are  recur-
        sive.  This limit is of use only if it is set smaller than match_limit.
 
        Limiting the recursion depth limits the amount of system stack that can
-       be  used,  or,  when  PCRE2 has been compiled to use memory on the heap
-       instead of the stack, the amount of heap memory that can be used.  This
-       limit  is not relevant, and is ignored, when matching is done using JIT
+       be used, or, when PCRE2 has been compiled to use  memory  on  the  heap
+       instead  of the stack, the amount of heap memory that can be used. This
+       limit is not relevant, and is ignored, when matching is done using  JIT
        compiled code or by the pcre2_dfa_match() function.
 
-       The default value for recursion_limit can be set when PCRE2  is  built;
-       the  default  default is the same value as the default for match_limit.
-       If the limit is exceeded, pcre2_match() returns  PCRE2_ERROR_RECURSION-
-       LIMIT.  A value for the recursion limit may also be supplied by an item
+       The  default  value for recursion_limit can be set when PCRE2 is built;
+       the default default is the same value as the default  for  match_limit.
+       If  the limit is exceeded, pcre2_match() returns PCRE2_ERROR_RECURSION-
+       LIMIT. A value for the recursion limit may also be supplied by an  item
        at the start of a pattern of the form
 
          (*LIMIT_RECURSION=ddd)
 
-       where ddd is a decimal number.  However,  such  a  setting  is  ignored
-       unless  ddd  is  less than the limit set by the caller of pcre2_match()
+       where  ddd  is  a  decimal  number.  However, such a setting is ignored
+       unless ddd is less than the limit set by the  caller  of  pcre2_match()
        or, if no such limit is set, less than the default.
 
        int pcre2_set_recursion_memory_management(
@@ -898,21 +938,21 @@ PCRE2 CONTEXTS
          void (*private_free)(void *, void *), void *memory_data);
 
        This function sets up two additional custom memory management functions
-       for  use  by  pcre2_match()  when PCRE2 is compiled to use the heap for
+       for use by pcre2_match() when PCRE2 is compiled to  use  the  heap  for
        remembering backtracking data, instead of recursive function calls that
-       use  the  system stack. There is a discussion about PCRE2's stack usage
-       in the pcre2stack documentation. See the pcre2build  documentation  for
+       use the system stack. There is a discussion about PCRE2's  stack  usage
+       in  the  pcre2stack documentation. See the pcre2build documentation for
        details of how to build PCRE2.
 
-       Using  the  heap for recursion is a non-standard way of building PCRE2,
-       for use in environments  that  have  limited  stacks.  Because  of  the
+       Using the heap for recursion is a non-standard way of  building  PCRE2,
+       for  use  in  environments  that  have  limited  stacks. Because of the
        greater use of memory management, pcre2_match() runs more slowly. Func-
-       tions that are different to the general  custom  memory  functions  are
-       provided  so  that  special-purpose  external code can be used for this
-       case, because the memory blocks are all the same size. The  blocks  are
+       tions  that  are  different  to the general custom memory functions are
+       provided so that special-purpose external code can  be  used  for  this
+       case,  because  the memory blocks are all the same size. The blocks are
        retained by pcre2_match() until it is about to exit so that they can be
-       re-used when possible during the match. In the absence of  these  func-
-       tions,  the normal custom memory management functions are used, if sup-
+       re-used  when  possible during the match. In the absence of these func-
+       tions, the normal custom memory management functions are used, if  sup-
        plied, otherwise the system functions.
 
 
@@ -920,75 +960,75 @@ CHECKING BUILD-TIME OPTIONS
 
        int pcre2_config(uint32_t what, void *where);
 
-       The function pcre2_config() makes it possible for  a  PCRE2  client  to
-       discover  which  optional  features  have  been compiled into the PCRE2
-       library. The pcre2build documentation  has  more  details  about  these
+       The  function  pcre2_config()  makes  it possible for a PCRE2 client to
+       discover which optional features have  been  compiled  into  the  PCRE2
+       library.  The  pcre2build  documentation  has  more details about these
        optional features.
 
-       The  first  argument  for pcre2_config() specifies which information is
-       required. The second argument is a pointer to  memory  into  which  the
-       information  is  placed.  If  NULL  is passed, the function returns the
-       amount of memory that is needed  for  the  requested  information.  For
-       calls  that  return  numerical  values,  the  value  is  in bytes; when
-       requesting these values, where should point  to  appropriately  aligned
-       memory.  For calls that return strings, the required length is given in
+       The first argument for pcre2_config() specifies  which  information  is
+       required.  The  second  argument  is a pointer to memory into which the
+       information is placed. If NULL is  passed,  the  function  returns  the
+       amount  of  memory  that  is  needed for the requested information. For
+       calls that return  numerical  values,  the  value  is  in  bytes;  when
+       requesting  these  values,  where should point to appropriately aligned
+       memory. For calls that return strings, the required length is given  in
        code units, not counting the terminating zero.
 
-       When requesting information, the returned value from pcre2_config()  is
-       non-negative  on success, or the negative error code PCRE2_ERROR_BADOP-
-       TION if the value in the first argument is not recognized. The  follow-
+       When  requesting information, the returned value from pcre2_config() is
+       non-negative on success, or the negative error code  PCRE2_ERROR_BADOP-
+       TION  if the value in the first argument is not recognized. The follow-
        ing information is available:
 
          PCRE2_CONFIG_BSR
 
-       The  output  is a uint32_t integer whose value indicates what character
-       sequences the \R  escape  sequence  matches  by  default.  A  value  of
+       The output is a uint32_t integer whose value indicates  what  character
+       sequences  the  \R  escape  sequence  matches  by  default.  A value of
        PCRE2_BSR_UNICODE  means  that  \R  matches  any  Unicode  line  ending
-       sequence; a value of PCRE2_BSR_ANYCRLF means that \R matches  only  CR,
+       sequence;  a  value of PCRE2_BSR_ANYCRLF means that \R matches only CR,
        LF, or CRLF. The default can be overridden when a pattern is compiled.
 
          PCRE2_CONFIG_JIT
 
-       The  output  is  a  uint32_t  integer that is set to one if support for
+       The output is a uint32_t integer that is set  to  one  if  support  for
        just-in-time compiling is available; otherwise it is set to zero.
 
          PCRE2_CONFIG_JITTARGET
 
-       The where argument should point to a buffer that is at  least  48  code
-       units  long.  (The  exact  length  required  can  be  found  by calling
-       pcre2_config() with where set to NULL.) The buffer  is  filled  with  a
-       string  that  contains  the  name of the architecture for which the JIT
-       compiler is  configured,  for  example  "x86  32bit  (little  endian  +
-       unaligned)".  If JIT support is not available, PCRE2_ERROR_BADOPTION is
-       returned, otherwise the number of code units used is returned. This  is
+       The  where  argument  should point to a buffer that is at least 48 code
+       units long.  (The  exact  length  required  can  be  found  by  calling
+       pcre2_config()  with  where  set  to NULL.) The buffer is filled with a
+       string that contains the name of the architecture  for  which  the  JIT
+       compiler  is  configured,  for  example  "x86  32bit  (little  endian +
+       unaligned)". If JIT support is not available, PCRE2_ERROR_BADOPTION  is
+       returned,  otherwise the number of code units used is returned. This is
        the length of the string, plus one unit for the terminating zero.
 
          PCRE2_CONFIG_LINKSIZE
 
        The output is a uint32_t integer that contains the number of bytes used
-       for internal linkage in compiled regular  expressions.  When  PCRE2  is
-       configured,  the value can be set to 2, 3, or 4, with the default being
-       2. This is the value that is returned by pcre2_config(). However,  when
-       the  16-bit  library  is compiled, a value of 3 is rounded up to 4, and
-       when the 32-bit library is compiled, internal  linkages  always  use  4
+       for  internal  linkage  in  compiled regular expressions. When PCRE2 is
+       configured, the value can be set to 2, 3, or 4, with the default  being
+       2.  This is the value that is returned by pcre2_config(). However, when
+       the 16-bit library is compiled, a value of 3 is rounded up  to  4,  and
+       when  the  32-bit  library  is compiled, internal linkages always use 4
        bytes, so the configured value is not relevant.
 
        The default value of 2 for the 8-bit and 16-bit libraries is sufficient
-       for all but the most massive patterns, since it allows the size of  the
+       for  all but the most massive patterns, since it allows the size of the
        compiled pattern to be up to 64K code units. Larger values allow larger
-       regular expressions to be compiled by those two libraries, but  at  the
+       regular  expressions  to be compiled by those two libraries, but at the
        expense of slower matching.
 
          PCRE2_CONFIG_MATCHLIMIT
 
-       The  output  is a uint32_t integer that gives the default limit for the
-       number of internal matching function calls in  a  pcre2_match()  execu-
+       The output is a uint32_t integer that gives the default limit  for  the
+       number  of  internal  matching function calls in a pcre2_match() execu-
        tion. Further details are given with pcre2_match() below.
 
          PCRE2_CONFIG_NEWLINE
 
-       The  output  is  a  uint32_t  integer whose value specifies the default
-       character sequence that is recognized as meaning "newline". The  values
+       The output is a uint32_t integer  whose  value  specifies  the  default
+       character  sequence that is recognized as meaning "newline". The values
        are:
 
          PCRE2_NEWLINE_CR       Carriage return (CR)
@@ -997,56 +1037,56 @@ CHECKING BUILD-TIME OPTIONS
          PCRE2_NEWLINE_ANY      Any Unicode line ending
          PCRE2_NEWLINE_ANYCRLF  Any of CR, LF, or CRLF
 
-       The  default  should  normally  correspond to the standard sequence for
+       The default should normally correspond to  the  standard  sequence  for
        your operating system.
 
          PCRE2_CONFIG_PARENSLIMIT
 
-       The output is a uint32_t integer that gives the maximum depth of  nest-
+       The  output is a uint32_t integer that gives the maximum depth of nest-
        ing of parentheses (of any kind) in a pattern. This limit is imposed to
-       cap the amount of system stack used when a pattern is compiled.  It  is
-       specified  when PCRE2 is built; the default is 250. This limit does not
-       take into account the stack that may already be  used  by  the  calling
-       application.  For  finer  control  over  compilation  stack  usage, see
+       cap  the  amount of system stack used when a pattern is compiled. It is
+       specified when PCRE2 is built; the default is 250. This limit does  not
+       take  into  account  the  stack that may already be used by the calling
+       application. For  finer  control  over  compilation  stack  usage,  see
        pcre2_set_compile_recursion_guard().
 
          PCRE2_CONFIG_RECURSIONLIMIT
 
-       The output is a uint32_t integer that gives the default limit  for  the
-       depth  of  recursion  when  calling the internal matching function in a
-       pcre2_match() execution. Further details are given  with  pcre2_match()
+       The  output  is a uint32_t integer that gives the default limit for the
+       depth of recursion when calling the internal  matching  function  in  a
+       pcre2_match()  execution.  Further details are given with pcre2_match()
        below.
 
          PCRE2_CONFIG_STACKRECURSE
 
-       The  output is a uint32_t integer that is set to one if internal recur-
-       sion when running pcre2_match() is implemented  by  recursive  function
-       calls  that  use  the system stack to remember their state. This is the
-       usual way that PCRE2 is compiled. The output is zero if PCRE2 was  com-
-       piled  to  use blocks of data on the heap instead of recursive function
+       The output is a uint32_t integer that is set to one if internal  recur-
+       sion  when  running  pcre2_match() is implemented by recursive function
+       calls that use the system stack to remember their state.  This  is  the
+       usual  way that PCRE2 is compiled. The output is zero if PCRE2 was com-
+       piled to use blocks of data on the heap instead of  recursive  function
        calls.
 
          PCRE2_CONFIG_UNICODE_VERSION
 
-       The where argument should point to a buffer that is at  least  24  code
-       units  long.  (The  exact  length  required  can  be  found  by calling
-       pcre2_config() with where set to NULL.)  If  PCRE2  has  been  compiled
-       without  Unicode  support,  the buffer is filled with the text "Unicode
-       not supported". Otherwise, the Unicode  version  string  (for  example,
-       "8.0.0")  is  inserted. The number of code units used is returned. This
+       The  where  argument  should point to a buffer that is at least 24 code
+       units long.  (The  exact  length  required  can  be  found  by  calling
+       pcre2_config()  with  where  set  to  NULL.) If PCRE2 has been compiled
+       without Unicode support, the buffer is filled with  the  text  "Unicode
+       not  supported".  Otherwise,  the  Unicode version string (for example,
+       "8.0.0") is inserted. The number of code units used is  returned.  This
        is the length of the string plus one unit for the terminating zero.
 
          PCRE2_CONFIG_UNICODE
 
-       The output is a uint32_t integer that is set to one if Unicode  support
-       is  available; otherwise it is set to zero. Unicode support implies UTF
+       The  output is a uint32_t integer that is set to one if Unicode support
+       is available; otherwise it is set to zero. Unicode support implies  UTF
        support.
 
          PCRE2_CONFIG_VERSION
 
-       The where argument should point to a buffer that is at  least  12  code
-       units  long.  (The  exact  length  required  can  be  found  by calling
-       pcre2_config() with where set to NULL.) The buffer is filled  with  the
+       The  where  argument  should point to a buffer that is at least 12 code
+       units long.  (The  exact  length  required  can  be  found  by  calling
+       pcre2_config()  with  where set to NULL.) The buffer is filled with the
        PCRE2 version string, zero-terminated. The number of code units used is
        returned. This is the length of the string plus one unit for the termi-
        nating zero.
@@ -1060,58 +1100,74 @@ COMPILING A PATTERN
 
        void pcre2_code_free(pcre2_code *code);
 
-       The  pcre2_compile() function compiles a pattern into an internal form.
-       The pattern is defined by a pointer to a string of  code  units  and  a
-       length,  If the pattern is zero-terminated, the length can be specified
-       as PCRE2_ZERO_TERMINATED. The function returns a pointer to a block  of
-       memory  that contains the compiled pattern and related data. The caller
-       must free the memory by calling pcre2_code_free() when it is no  longer
-       needed.
+       pcre2_code *pcre2_code_copy(const pcre2_code *code);
+
+       The pcre2_compile() function compiles a pattern into an internal  form.
+       The  pattern  is  defined  by a pointer to a string of code units and a
+       length. If the pattern is zero-terminated, the length can be  specified
+       as  PCRE2_ZERO_TERMINATED. The function returns a pointer to a block of
+       memory that contains the compiled pattern and related data, or NULL  if
+       an error occurred.
+
+       If  the  compile context argument ccontext is NULL, memory for the com-
+       piled pattern  is  obtained  by  calling  malloc().  Otherwise,  it  is
+       obtained  from  the  same memory function that was used for the compile
+       context. The caller must free the memory by  calling  pcre2_code_free()
+       when it is no longer needed.
+
+       The function pcre2_code_copy() makes a copy of the compiled code in new
+       memory, using the same memory allocator as was used for  the  original.
+       However,  if  the  code  has  been  processed  by the JIT compiler (see
+       below), the JIT information cannot be copied (because it  is  position-
+       dependent).  The new copy can initially be used only for non-JIT match-
+       ing, though it can be passed to pcre2_jit_compile()  if  required.  The
+       pcre2_code_copy()  function  provides a way for individual threads in a
+       multithreaded application to acquire a private copy of shared  compiled
+       code.
 
        NOTE:  When  one  of  the matching functions is called, pointers to the
        compiled pattern and the subject string are set in the match data block
-       so  that they can be referenced by the extraction functions. After run-
-       ning a match, you must not  free  a  compiled  pattern  (or  a  subject
-       string)  until  after all operations on the match data block have taken
-       place.
-
-       If the compile context argument ccontext is NULL, memory for  the  com-
-       piled  pattern  is  obtained  by  calling  malloc().  Otherwise,  it is
-       obtained from the same memory function that was used  for  the  compile
-       context.
-
-       The options argument contains various bit settings that affect the com-
-       pilation. It should be zero if no options are required.  The  available
-       options  are  described  below. Some of them (in particular, those that
-       are compatible with Perl, but some others as well) can also be set  and
-       unset  from  within  the  pattern  (see the detailed description in the
-       pcre2pattern documentation).
-
-       For those options that can be different in different parts of the  pat-
-       tern,  the contents of the options argument specifies their settings at
-       the start of compilation.  The  PCRE2_ANCHORED  and  PCRE2_NO_UTF_CHECK
+       so  that  they can be referenced by the substring extraction functions.
+       After running a match, you must not free a compiled pattern (or a  sub-
+       ject  string)  until  after all operations on the match data block have
+       taken place.
+
+       The options argument for pcre2_compile() contains various bit  settings
+       that  affect  the  compilation.  It  should  be  zero if no options are
+       required. The available options are described below. Some of  them  (in
+       particular,  those  that  are  compatible with Perl, but some others as
+       well) can also be set and  unset  from  within  the  pattern  (see  the
+       detailed description in the pcre2pattern documentation).
+
+       For  those options that can be different in different parts of the pat-
+       tern, the contents of the options argument specifies their settings  at
+       the  start  of  compilation.  The PCRE2_ANCHORED and PCRE2_NO_UTF_CHECK
        options can be set at the time of matching as well as at compile time.
 
-       Other,  less  frequently required compile-time parameters (for example,
+       Other, less frequently required compile-time parameters  (for  example,
        the newline setting) can be provided in a compile context (as described
        above).
 
        If errorcode or erroroffset is NULL, pcre2_compile() returns NULL imme-
-       diately. Otherwise, if compilation of a pattern fails,  pcre2_compile()
-       returns NULL, having set these variables to an error code and an offset
-       (number  of  code  units)  within  the   pattern,   respectively.   The
-       pcre2_get_error_message()  function provides a textual message for each
-       error code. Compilation errors are positive numbers, but UTF formatting
-       errors are negative numbers. For an invalid UTF-8 or UTF-16 string, the
-       offset is that of the first code unit of the failing character.
-
-       Some errors are not detected until the whole pattern has been  scanned;
-       in  these  cases,  the offset passed back is the length of the pattern.
-       Note that the offset is in code units, not characters, even  in  a  UTF
+       diately.  Otherwise,  the  variables to which these point are set to an
+       error code and an offset (number of code  units)  within  the  pattern,
+       respectively,  when  pcre2_compile() returns NULL because a compilation
+       error has occurred. The values are not defined when compilation is suc-
+       cessful and pcre2_compile() returns a non-NULL value.
+
+       The  pcre2_get_error_message() function (see "Obtaining a textual error
+       message" below) provides a textual message for each error code.  Compi-
+       lation errors have positive error codes; UTF formatting error codes are
+       negative. For an invalid UTF-8 or UTF-16 string, the offset is that  of
+       the first code unit of the failing character.
+
+       Some  errors are not detected until the whole pattern has been scanned;
+       in these cases, the offset passed back is the length  of  the  pattern.
+       Note  that  the  offset is in code units, not characters, even in a UTF
        mode. It may sometimes point into the middle of a UTF-8 or UTF-16 char-
        acter.
 
-       This code fragment shows a typical straightforward call  to  pcre2_com-
+       This  code  fragment shows a typical straightforward call to pcre2_com-
        pile():
 
          pcre2_code *re;
@@ -1125,208 +1181,211 @@ COMPILING A PATTERN
            &erroffset,             /* for error offset */
            NULL);                  /* no compile context */
 
-       The  following  names for option bits are defined in the pcre2.h header
+       The following names for option bits are defined in the  pcre2.h  header
        file:
 
          PCRE2_ANCHORED
 
        If this bit is set, the pattern is forced to be "anchored", that is, it
-       is  constrained to match only at the first matching point in the string
-       that is being searched (the "subject string"). This effect can also  be
-       achieved  by appropriate constructs in the pattern itself, which is the
+       is constrained to match only at the first matching point in the  string
+       that  is being searched (the "subject string"). This effect can also be
+       achieved by appropriate constructs in the pattern itself, which is  the
        only way to do it in Perl.
 
          PCRE2_ALLOW_EMPTY_CLASS
 
-       By default, for compatibility with Perl, a closing square bracket  that
-       immediately  follows  an opening one is treated as a data character for
-       the class. When  PCRE2_ALLOW_EMPTY_CLASS  is  set,  it  terminates  the
+       By  default, for compatibility with Perl, a closing square bracket that
+       immediately follows an opening one is treated as a data  character  for
+       the  class.  When  PCRE2_ALLOW_EMPTY_CLASS  is  set,  it terminates the
        class, which therefore contains no characters and so can never match.
 
          PCRE2_ALT_BSUX
 
-       This  option  request  alternative  handling of three escape sequences,
-       which makes PCRE2's behaviour more like  ECMAscript  (aka  JavaScript).
+       This option request alternative handling  of  three  escape  sequences,
+       which  makes  PCRE2's  behaviour more like ECMAscript (aka JavaScript).
        When it is set:
 
        (1) \U matches an upper case "U" character; by default \U causes a com-
        pile time error (Perl uses \U to upper case subsequent characters).
 
        (2) \u matches a lower case "u" character unless it is followed by four
-       hexadecimal  digits,  in  which case the hexadecimal number defines the
-       code point to match. By default, \u causes a compile time  error  (Perl
+       hexadecimal digits, in which case the hexadecimal  number  defines  the
+       code  point  to match. By default, \u causes a compile time error (Perl
        uses it to upper case the following character).
 
-       (3)  \x matches a lower case "x" character unless it is followed by two
-       hexadecimal digits, in which case the hexadecimal  number  defines  the
-       code  point  to  match. By default, as in Perl, a hexadecimal number is
+       (3) \x matches a lower case "x" character unless it is followed by  two
+       hexadecimal  digits,  in  which case the hexadecimal number defines the
+       code point to match. By default, as in Perl, a  hexadecimal  number  is
        always expected after \x, but it may have zero, one, or two digits (so,
        for example, \xz matches a binary zero character followed by z).
 
          PCRE2_ALT_CIRCUMFLEX
 
        In  multiline  mode  (when  PCRE2_MULTILINE  is  set),  the  circumflex
-       metacharacter matches at the start of the subject (unless  PCRE2_NOTBOL
-       is  set),  and  also  after  any internal newline. However, it does not
+       metacharacter  matches at the start of the subject (unless PCRE2_NOTBOL
+       is set), and also after any internal  newline.  However,  it  does  not
        match after a newline at the end of the subject, for compatibility with
-       Perl.  If  you want a multiline circumflex also to match after a termi-
+       Perl. If you want a multiline circumflex also to match after  a  termi-
        nating newline, you must set PCRE2_ALT_CIRCUMFLEX.
 
          PCRE2_ALT_VERBNAMES
 
-       By default, for compatibility with Perl, the name in any verb  sequence
-       such  as  (*MARK:NAME)  is  any  sequence  of  characters that does not
-       include a closing parenthesis. The name is not processed  in  any  way,
-       and  it  is  not possible to include a closing parenthesis in the name.
-       However, if the PCRE2_ALT_VERBNAMES option  is  set,  normal  backslash
-       processing  is  applied  to  verb  names  and only an unescaped closing
-       parenthesis terminates the name. A closing parenthesis can be  included
-       in  a  name  either  as  \) or between \Q and \E. If the PCRE2_EXTENDED
+       By  default, for compatibility with Perl, the name in any verb sequence
+       such as (*MARK:NAME) is  any  sequence  of  characters  that  does  not
+       include  a  closing  parenthesis. The name is not processed in any way,
+       and it is not possible to include a closing parenthesis  in  the  name.
+       However,  if  the  PCRE2_ALT_VERBNAMES  option is set, normal backslash
+       processing is applied to verb  names  and  only  an  unescaped  closing
+       parenthesis  terminates the name. A closing parenthesis can be included
+       in a name either as \) or between \Q  and  \E.  If  the  PCRE2_EXTENDED
        option is set, unescaped whitespace in verb names is skipped and #-com-
        ments are recognized, exactly as in the rest of the pattern.
 
          PCRE2_AUTO_CALLOUT
 
-       If  this  bit  is  set,  pcre2_compile()  automatically inserts callout
+       If this bit  is  set,  pcre2_compile()  automatically  inserts  callout
        items, all with number 255, before each pattern item. For discussion of
        the callout facility, see the pcre2callout documentation.
 
          PCRE2_CASELESS
 
-       If  this  bit is set, letters in the pattern match both upper and lower
-       case letters in the subject. It is equivalent to Perl's /i option,  and
+       If this bit is set, letters in the pattern match both upper  and  lower
+       case  letters in the subject. It is equivalent to Perl's /i option, and
        it can be changed within a pattern by a (?i) option setting.
 
          PCRE2_DOLLAR_ENDONLY
 
-       If  this bit is set, a dollar metacharacter in the pattern matches only
-       at the end of the subject string. Without this option,  a  dollar  also
-       matches  immediately before a newline at the end of the string (but not
-       before any other newlines). The PCRE2_DOLLAR_ENDONLY option is  ignored
-       if  PCRE2_MULTILINE  is  set.  There is no equivalent to this option in
+       If this bit is set, a dollar metacharacter in the pattern matches  only
+       at  the  end  of the subject string. Without this option, a dollar also
+       matches immediately before a newline at the end of the string (but  not
+       before  any other newlines). The PCRE2_DOLLAR_ENDONLY option is ignored
+       if PCRE2_MULTILINE is set. There is no equivalent  to  this  option  in
        Perl, and no way to set it within a pattern.
 
          PCRE2_DOTALL
 
-       If this bit is set, a dot metacharacter  in  the  pattern  matches  any
-       character,  including  one  that  indicates a newline. However, it only
+       If  this  bit  is  set,  a dot metacharacter in the pattern matches any
+       character, including one that indicates a  newline.  However,  it  only
        ever matches one character, even if newlines are coded as CRLF. Without
        this option, a dot does not match when the current position in the sub-
-       ject is at a newline. This option is equivalent to  Perl's  /s  option,
+       ject  is  at  a newline. This option is equivalent to Perl's /s option,
        and it can be changed within a pattern by a (?s) option setting. A neg-
        ative class such as [^a] always matches newline characters, independent
        of the setting of this option.
 
          PCRE2_DUPNAMES
 
-       If  this  bit is set, names used to identify capturing subpatterns need
+       If this bit is set, names used to identify capturing  subpatterns  need
        not be unique. This can be helpful for certain types of pattern when it
-       is  known  that  only  one instance of the named subpattern can ever be
-       matched. There are more details of named subpatterns  below;  see  also
+       is known that only one instance of the named  subpattern  can  ever  be
+       matched.  There  are  more details of named subpatterns below; see also
        the pcre2pattern documentation.
 
          PCRE2_EXTENDED
 
-       If  this  bit  is  set,  most white space characters in the pattern are
-       totally ignored except when escaped or inside a character  class.  How-
-       ever,  white  space  is  not  allowed within sequences such as (?> that
+       If this bit is set, most white space  characters  in  the  pattern  are
+       totally  ignored  except when escaped or inside a character class. How-
+       ever, white space is not allowed within  sequences  such  as  (?>  that
        introduce various parenthesized subpatterns, nor within numerical quan-
-       tifiers  such  as {1,3}.  Ignorable white space is permitted between an
-       item and a following quantifier and between a quantifier and a  follow-
+       tifiers such as {1,3}.  Ignorable white space is permitted  between  an
+       item  and a following quantifier and between a quantifier and a follow-
        ing + that indicates possessiveness.
 
-       PCRE2_EXTENDED  also causes characters between an unescaped # outside a
-       character class and the next newline, inclusive, to be  ignored,  which
+       PCRE2_EXTENDED also causes characters between an unescaped # outside  a
+       character  class  and the next newline, inclusive, to be ignored, which
        makes it possible to include comments inside complicated patterns. Note
-       that the end of this type of comment is a literal newline  sequence  in
+       that  the  end of this type of comment is a literal newline sequence in
        the pattern; escape sequences that happen to represent a newline do not
-       count. PCRE2_EXTENDED is equivalent to Perl's /x option, and it can  be
+       count.  PCRE2_EXTENDED is equivalent to Perl's /x option, and it can be
        changed within a pattern by a (?x) option setting.
 
        Which characters are interpreted as newlines can be specified by a set-
-       ting in the compile context that is passed to pcre2_compile() or  by  a
-       special  sequence at the start of the pattern, as described in the sec-
-       tion entitled "Newline conventions" in the pcre2pattern  documentation.
+       ting  in  the compile context that is passed to pcre2_compile() or by a
+       special sequence at the start of the pattern, as described in the  sec-
+       tion  entitled "Newline conventions" in the pcre2pattern documentation.
        A default is defined when PCRE2 is built.
 
          PCRE2_FIRSTLINE
 
-       If  this  option  is  set,  an  unanchored pattern is required to match
-       before or at the first  newline  in  the  subject  string,  though  the
-       matched  text  may  continue  over the newline. See also PCRE2_USE_OFF-
-       SET_LIMIT,  which  provides  a  more  general  limiting  facility.   If
-       PCRE2_FIRSTLINE  is set with an offset limit, a match must occur in the
-       first line and also within the offset limit. In other words,  whichever
+       If this option is set, an  unanchored  pattern  is  required  to  match
+       before  or  at  the  first  newline  in  the subject string, though the
+       matched text may continue over the  newline.  See  also  PCRE2_USE_OFF-
+       SET_LIMIT,   which  provides  a  more  general  limiting  facility.  If
+       PCRE2_FIRSTLINE is set with an offset limit, a match must occur in  the
+       first  line and also within the offset limit. In other words, whichever
        limit comes first is used.
 
          PCRE2_MATCH_UNSET_BACKREF
 
-       If  this  option  is set, a back reference to an unset subpattern group
-       matches an empty string (by default this causes  the  current  matching
-       alternative  to  fail).   A  pattern such as (\1)(a) succeeds when this
-       option is set (assuming it can find an "a" in the subject), whereas  it
-       fails  by  default,  for  Perl compatibility. Setting this option makes
+       If this option is set, a back reference to an  unset  subpattern  group
+       matches  an  empty  string (by default this causes the current matching
+       alternative to fail).  A pattern such as  (\1)(a)  succeeds  when  this
+       option  is set (assuming it can find an "a" in the subject), whereas it
+       fails by default, for Perl compatibility.  Setting  this  option  makes
        PCRE2 behave more like ECMAscript (aka JavaScript).
 
          PCRE2_MULTILINE
 
-       By default, for the purposes of matching "start of line"  and  "end  of
-       line",  PCRE2  treats the subject string as consisting of a single line
-       of characters, even if it actually contains  newlines.  The  "start  of
-       line"  metacharacter  (^)  matches only at the start of the string, and
-       the "end of line" metacharacter ($) matches only  at  the  end  of  the
+       By  default,  for  the purposes of matching "start of line" and "end of
+       line", PCRE2 treats the subject string as consisting of a  single  line
+       of  characters,  even  if  it actually contains newlines. The "start of
+       line" metacharacter (^) matches only at the start of  the  string,  and
+       the  "end  of  line"  metacharacter  ($) matches only at the end of the
        string,  or  before  a  terminating  newline  (except  when  PCRE2_DOL-
-       LAR_ENDONLY is set). Note, however, that unless  PCRE2_DOTALL  is  set,
+       LAR_ENDONLY  is  set).  Note, however, that unless PCRE2_DOTALL is set,
        the "any character" metacharacter (.) does not match at a newline. This
        behaviour (for ^, $, and dot) is the same as Perl.
 
-       When PCRE2_MULTILINE it is set, the "start of line" and "end  of  line"
-       constructs  match  immediately following or immediately before internal
-       newlines in the subject string, respectively, as well as  at  the  very
-       start  and  end.  This is equivalent to Perl's /m option, and it can be
+       When  PCRE2_MULTILINE  it is set, the "start of line" and "end of line"
+       constructs match immediately following or immediately  before  internal
+       newlines  in  the  subject string, respectively, as well as at the very
+       start and end. This is equivalent to Perl's /m option, and  it  can  be
        changed within a pattern by a (?m) option setting. Note that the "start
        of line" metacharacter does not match after a newline at the end of the
-       subject, for compatibility with Perl.  However, you can change this  by
-       setting  the PCRE2_ALT_CIRCUMFLEX option. If there are no newlines in a
-       subject string, or no occurrences of ^  or  $  in  a  pattern,  setting
+       subject,  for compatibility with Perl.  However, you can change this by
+       setting the PCRE2_ALT_CIRCUMFLEX option. If there are no newlines in  a
+       subject  string,  or  no  occurrences  of  ^ or $ in a pattern, setting
        PCRE2_MULTILINE has no effect.
 
          PCRE2_NEVER_BACKSLASH_C
 
-       This  option  locks out the use of \C in the pattern that is being com-
-       piled.  This escape can  cause  unpredictable  behaviour  in  UTF-8  or
-       UTF-16  modes,  because  it may leave the current matching point in the
-       middle of a multi-code-unit character. This option  may  be  useful  in
-       applications  that  process  patterns  from external sources. Note that
+       This option locks out the use of \C in the pattern that is  being  com-
+       piled.   This  escape  can  cause  unpredictable  behaviour in UTF-8 or
+       UTF-16 modes, because it may leave the current matching  point  in  the
+       middle  of  a  multi-code-unit  character. This option may be useful in
+       applications that process patterns from  external  sources.  Note  that
        there is also a build-time option that permanently locks out the use of
        \C.
 
          PCRE2_NEVER_UCP
 
-       This  option  locks  out the use of Unicode properties for handling \B,
+       This option locks out the use of Unicode properties  for  handling  \B,
        \b, \D, \d, \S, \s, \W, \w, and some of the POSIX character classes, as
-       described  for  the  PCRE2_UCP option below. In particular, it prevents
-       the creator of the pattern from enabling this facility by starting  the
-       pattern  with  (*UCP).  This  option may be useful in applications that
+       described for the PCRE2_UCP option below. In  particular,  it  prevents
+       the  creator of the pattern from enabling this facility by starting the
+       pattern with (*UCP). This option may be  useful  in  applications  that
        process patterns from external sources. The option combination PCRE_UCP
        and PCRE_NEVER_UCP causes an error.
 
          PCRE2_NEVER_UTF
 
-       This  option  locks out interpretation of the pattern as UTF-8, UTF-16,
+       This option locks out interpretation of the pattern as  UTF-8,  UTF-16,
        or UTF-32, depending on which library is in use. In particular, it pre-
-       vents  the  creator of the pattern from switching to UTF interpretation
-       by starting the pattern with (*UTF).  This  option  may  be  useful  in
-       applications  that process patterns from external sources. The combina-
+       vents the creator of the pattern from switching to  UTF  interpretation
+       by  starting  the  pattern  with  (*UTF).  This option may be useful in
+       applications that process patterns from external sources. The  combina-
        tion of PCRE2_UTF and PCRE2_NEVER_UTF causes an error.
 
          PCRE2_NO_AUTO_CAPTURE
 
        If this option is set, it disables the use of numbered capturing paren-
-       theses  in the pattern. Any opening parenthesis that is not followed by
-       ? behaves as if it were followed by ?: but named parentheses can  still
-       be  used  for  capturing  (and  they acquire numbers in the usual way).
-       There is no equivalent of this option in Perl.
+       theses in the pattern. Any opening parenthesis that is not followed  by
+       ?  behaves as if it were followed by ?: but named parentheses can still
+       be used for capturing (and they acquire  numbers  in  the  usual  way).
+       There  is  no  equivalent  of  this  option in Perl. Note that, if this
+       option is set, references  to  capturing  groups  (back  references  or
+       recursion/subroutine  calls) may only refer to named groups, though the
+       reference can be by name or by number.
 
          PCRE2_NO_AUTO_POSSESS
 
@@ -1461,11 +1520,12 @@ COMPILING A PATTERN
 COMPILATION ERROR CODES
 
        There  are over 80 positive error codes that pcre2_compile() may return
-       if it finds an error in the pattern. There are also some negative error
-       codes  that  are  used  for  invalid UTF strings. These are the same as
-       given by pcre2_match() and pcre2_dfa_match(), and are described in  the
-       pcre2unicode page. The pcre2_get_error_message() function can be called
-       to obtain a textual error message from any error code.
+       (via errorcode) if it finds an error in the  pattern.  There  are  also
+       some  negative error codes that are used for invalid UTF strings. These
+       are the same as given by pcre2_match() and pcre2_dfa_match(),  and  are
+       described in the pcre2unicode page. The pcre2_get_error_message() func-
+       tion (see "Obtaining a textual error message" below) can be  called  to
+       obtain a textual error message from any error code.
 
 
 JUST-IN-TIME (JIT) COMPILATION
@@ -1487,53 +1547,53 @@ JUST-IN-TIME (JIT) COMPILATION
 
        void pcre2_jit_stack_free(pcre2_jit_stack *jit_stack);
 
-       These functions provide support for  JIT  compilation,  which,  if  the
-       just-in-time  compiler  is available, further processes a compiled pat-
+       These  functions  provide  support  for  JIT compilation, which, if the
+       just-in-time compiler is available, further processes a  compiled  pat-
        tern into machine code that executes much faster than the pcre2_match()
-       interpretive  matching function. Full details are given in the pcre2jit
+       interpretive matching function. Full details are given in the  pcre2jit
        documentation.
 
-       JIT compilation is a heavyweight optimization. It can  take  some  time
-       for  patterns  to  be analyzed, and for one-off matches and simple pat-
-       terns the benefit of faster execution might be offset by a much  slower
-       compilation  time.   Most, but not all patterns can be optimized by the
+       JIT  compilation  is  a heavyweight optimization. It can take some time
+       for patterns to be analyzed, and for one-off matches  and  simple  pat-
+       terns  the benefit of faster execution might be offset by a much slower
+       compilation time.  Most, but not all patterns can be optimized  by  the
        JIT compiler.
 
 
 LOCALE SUPPORT
 
-       PCRE2 handles caseless matching, and determines whether characters  are
-       letters,  digits, or whatever, by reference to a set of tables, indexed
-       by character code point. This applies only  to  characters  whose  code
-       points  are  less than 256. By default, higher-valued code points never
-       match escapes such as \w or \d.  However, if PCRE2 is  built  with  UTF
-       support,  all  characters  can  be  tested with \p and \P, or, alterna-
-       tively, the PCRE2_UCP option can be set when  a  pattern  is  compiled;
-       this  causes  \w and friends to use Unicode property support instead of
+       PCRE2  handles caseless matching, and determines whether characters are
+       letters, digits, or whatever, by reference to a set of tables,  indexed
+       by  character  code  point.  This applies only to characters whose code
+       points are less than 256. By default, higher-valued code  points  never
+       match  escapes  such  as \w or \d.  However, if PCRE2 is built with UTF
+       support, all characters can be tested with  \p  and  \P,  or,  alterna-
+       tively,  the  PCRE2_UCP  option  can be set when a pattern is compiled;
+       this causes \w and friends to use Unicode property support  instead  of
        the built-in tables.
 
-       The use of locales with Unicode is discouraged.  If  you  are  handling
-       characters  with  code  points  greater than 128, you should either use
+       The  use  of  locales  with Unicode is discouraged. If you are handling
+       characters with code points greater than 128,  you  should  either  use
        Unicode support, or use locales, but not try to mix the two.
 
-       PCRE2 contains an internal set of character tables  that  are  used  by
-       default.   These  are  sufficient  for many applications. Normally, the
+       PCRE2  contains  an  internal  set of character tables that are used by
+       default.  These are sufficient for  many  applications.  Normally,  the
        internal tables recognize only ASCII characters. However, when PCRE2 is
        built, it is possible to cause the internal tables to be rebuilt in the
        default "C" locale of the local system, which may cause them to be dif-
        ferent.
 
-       The  internal tables can be overridden by tables supplied by the appli-
-       cation that calls PCRE2. These may be created  in  a  different  locale
-       from  the  default.  As more and more applications change to using Uni-
+       The internal tables can be overridden by tables supplied by the  appli-
+       cation  that  calls  PCRE2.  These may be created in a different locale
+       from the default.  As more and more applications change to  using  Uni-
        code, the need for this locale support is expected to die away.
 
-       External tables are built by calling the  pcre2_maketables()  function,
-       in  the relevant locale. The result can be passed to pcre2_compile() as
-       often  as  necessary,  by  creating  a  compile  context  and   calling
-       pcre2_set_character_tables()  to  set  the  tables pointer therein. For
-       example, to build and use tables that are appropriate  for  the  French
-       locale  (where  accented  characters  with  values greater than 128 are
+       External  tables  are built by calling the pcre2_maketables() function,
+       in the relevant locale. The result can be passed to pcre2_compile()  as
+       often   as  necessary,  by  creating  a  compile  context  and  calling
+       pcre2_set_character_tables() to set the  tables  pointer  therein.  For
+       example,  to  build  and use tables that are appropriate for the French
+       locale (where accented characters with  values  greater  than  128  are
        treated as letters), the following code could be used:
 
          setlocale(LC_CTYPE, "fr_FR");
@@ -1542,15 +1602,15 @@ LOCALE SUPPORT
          pcre2_set_character_tables(ccontext, tables);
          re = pcre2_compile(..., ccontext);
 
-       The locale name "fr_FR" is used on Linux and other  Unix-like  systems;
-       if  you  are using Windows, the name for the French locale is "french".
-       It is the caller's responsibility to ensure that the memory  containing
+       The  locale  name "fr_FR" is used on Linux and other Unix-like systems;
+       if you are using Windows, the name for the French locale  is  "french".
+       It  is the caller's responsibility to ensure that the memory containing
        the tables remains available for as long as it is needed.
 
        The pointer that is passed (via the compile context) to pcre2_compile()
-       is saved with the compiled pattern, and the same  tables  are  used  by
-       pcre2_match()  and pcre_dfa_match(). Thus, for any single pattern, com-
-       pilation, and matching all happen in the  same  locale,  but  different
+       is  saved  with  the  compiled pattern, and the same tables are used by
+       pcre2_match() and pcre_dfa_match(). Thus, for any single pattern,  com-
+       pilation,  and  matching  all  happen in the same locale, but different
        patterns can be processed in different locales.
 
 
@@ -1558,13 +1618,13 @@ INFORMATION ABOUT A COMPILED PATTERN
 
        int pcre2_pattern_info(const pcre2 *code, uint32_t what, void *where);
 
-       The  pcre2_pattern_info()  function returns general information about a
+       The pcre2_pattern_info() function returns general information  about  a
        compiled pattern. For information about callouts, see the next section.
-       The  first  argument  for pcre2_pattern_info() is a pointer to the com-
+       The first argument for pcre2_pattern_info() is a pointer  to  the  com-
        piled pattern. The second argument specifies which piece of information
-       is  required,  and  the  third  argument  is a pointer to a variable to
-       receive the data. If the third argument is NULL, the first argument  is
-       ignored,  and  the  function  returns the size in bytes of the variable
+       is required, and the third argument is  a  pointer  to  a  variable  to
+       receive  the data. If the third argument is NULL, the first argument is
+       ignored, and the function returns the size in  bytes  of  the  variable
        that is required for the information requested. Otherwise, The yield of
        the function is zero for success, or one of the following negative num-
        bers:
@@ -1574,9 +1634,9 @@ INFORMATION ABOUT A COMPILED PATTERN
          PCRE2_ERROR_BADOPTION      the value of what was invalid
          PCRE2_ERROR_UNSET          the requested field is not set
 
-       The "magic number" is placed at the start of each compiled  pattern  as
-       an  simple check against passing an arbitrary memory pointer. Here is a
-       typical call of pcre2_pattern_info(), to obtain the length of the  com-
+       The  "magic  number" is placed at the start of each compiled pattern as
+       an simple check against passing an arbitrary memory pointer. Here is  a
+       typical  call of pcre2_pattern_info(), to obtain the length of the com-
        piled pattern:
 
          int rc;
@@ -1593,12 +1653,17 @@ INFORMATION ABOUT A COMPILED PATTERN
          PCRE2_INFO_ARGOPTIONS
 
        Return a copy of the pattern's options. The third argument should point
-       to  a  uint32_t  variable.  PCRE2_INFO_ARGOPTIONS  returns  exactly the
-       options that were passed to pcre2_compile(), whereas  PCRE2_INFO_ALLOP-
-       TIONS  returns  the compile options as modified by any top-level option
-       settings such as (*UTF) at the start of the pattern itself.  For  exam-
-       ple,  if  the  pattern  /(*UTF)abc/ is compiled with the PCRE2_EXTENDED
-       option, the result is PCRE2_EXTENDED and PCRE2_UTF.
+       to a  uint32_t  variable.  PCRE2_INFO_ARGOPTIONS  returns  exactly  the
+       options  that were passed to pcre2_compile(), whereas PCRE2_INFO_ALLOP-
+       TIONS returns the compile options as modified by any  top-level  (*XXX)
+       option settings such as (*UTF) at the start of the pattern itself.
+
+       For   example,   if  the  pattern  /(*UTF)abc/  is  compiled  with  the
+       PCRE2_EXTENDED  option,  the  result   for   PCRE2_INFO_ALLOPTIONS   is
+       PCRE2_EXTENDED  and  PCRE2_UTF.   Option settings such as (?i) that can
+       change within a pattern do not affect the result  of  PCRE2_INFO_ALLOP-
+       TIONS, even if they appear right at the start of the pattern. (This was
+       different in some earlier releases.)
 
        A pattern compiled without PCRE2_ANCHORED is automatically anchored  by
        PCRE2 if the first significant item in every top-level branch is one of
@@ -2038,62 +2103,70 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
 
        The unused bits of the options argument for pcre2_match() must be zero.
        The only  bits  that  may  be  set  are  PCRE2_ANCHORED,  PCRE2_NOTBOL,
-       PCRE2_NOTEOL,          PCRE2_NOTEMPTY,          PCRE2_NOTEMPTY_ATSTART,
+       PCRE2_NOTEOL,   PCRE2_NOTEMPTY,  PCRE2_NOTEMPTY_ATSTART,  PCRE2_NO_JIT,
        PCRE2_NO_UTF_CHECK, PCRE2_PARTIAL_HARD, and  PCRE2_PARTIAL_SOFT.  Their
        action is described below.
 
        Setting  PCRE2_ANCHORED  at match time is not supported by the just-in-
        time (JIT) compiler. If it is set, JIT matching  is  disabled  and  the
-       normal interpretive code in pcre2_match() is run. The remaining options
-       are supported for JIT matching.
+       normal   interpretive   code   in  pcre2_match()  is  run.  Apart  from
+       PCRE2_NO_JIT (obviously), the remaining options are supported  for  JIT
+       matching.
 
          PCRE2_ANCHORED
 
        The PCRE2_ANCHORED option limits pcre2_match() to matching at the first
-       matching  position.  If  a pattern was compiled with PCRE2_ANCHORED, or
-       turned out to be anchored by virtue of its contents, it cannot be  made
-       unachored  at matching time. Note that setting the option at match time
+       matching position. If a pattern was compiled  with  PCRE2_ANCHORED,  or
+       turned  out to be anchored by virtue of its contents, it cannot be made
+       unachored at matching time. Note that setting the option at match  time
        disables JIT matching.
 
          PCRE2_NOTBOL
 
        This option specifies that first character of the subject string is not
-       the  beginning  of  a  line, so the circumflex metacharacter should not
-       match before it. Setting this without  having  set  PCRE2_MULTILINE  at
+       the beginning of a line, so the  circumflex  metacharacter  should  not
+       match  before  it.  Setting  this without having set PCRE2_MULTILINE at
        compile time causes circumflex never to match. This option affects only
        the behaviour of the circumflex metacharacter. It does not affect \A.
 
          PCRE2_NOTEOL
 
        This option specifies that the end of the subject string is not the end
-       of  a line, so the dollar metacharacter should not match it nor (except
-       in multiline mode) a newline immediately before it. Setting this  with-
-       out  having  set PCRE2_MULTILINE at compile time causes dollar never to
+       of a line, so the dollar metacharacter should not match it nor  (except
+       in  multiline mode) a newline immediately before it. Setting this with-
+       out having set PCRE2_MULTILINE at compile time causes dollar  never  to
        match. This option affects only the behaviour of the dollar metacharac-
        ter. It does not affect \Z or \z.
 
          PCRE2_NOTEMPTY
 
        An empty string is not considered to be a valid match if this option is
-       set. If there are alternatives in the pattern, they are tried.  If  all
-       the  alternatives  match  the empty string, the entire match fails. For
+       set.  If  there are alternatives in the pattern, they are tried. If all
+       the alternatives match the empty string, the entire  match  fails.  For
        example, if the pattern
 
          a?b?
 
-       is applied to a string not beginning with "a" or  "b",  it  matches  an
+       is  applied  to  a  string not beginning with "a" or "b", it matches an
        empty string at the start of the subject. With PCRE2_NOTEMPTY set, this
-       match is not valid, so pcre2_match() searches further into  the  string
+       match  is  not valid, so pcre2_match() searches further into the string
        for occurrences of "a" or "b".
 
          PCRE2_NOTEMPTY_ATSTART
 
-       This  is  like PCRE2_NOTEMPTY, except that it locks out an empty string
+       This is like PCRE2_NOTEMPTY, except that it locks out an  empty  string
        match only at the first matching position, that is, at the start of the
-       subject  plus  the  starting offset. An empty string match later in the
-       subject is permitted.  If the pattern is anchored,  such  a  match  can
+       subject plus the starting offset. An empty string match  later  in  the
+       subject  is  permitted.   If  the pattern is anchored, such a match can
        occur only if the pattern contains \K.
 
+         PCRE2_NO_JIT
+
+       By  default,  if  a  pattern  has  been   successfully   processed   by
+       pcre2_jit_compile(),  JIT  is  automatically used when pcre2_match() is
+       called with options that JIT supports.  Setting  PCRE2_NO_JIT  disables
+       the use of JIT; it forces matching to be done by the interpreter.
+
          PCRE2_NO_UTF_CHECK
 
        When PCRE2_UTF is set at compile time, the validity of the subject as a
@@ -2322,13 +2395,14 @@ OTHER INFORMATION ABOUT A MATCH
 ERROR RETURNS FROM pcre2_match()
 
        If  pcre2_match() fails, it returns a negative number. This can be con-
-       verted to a text string by calling pcre2_get_error_message().  Negative
-       error  codes  are  also returned by other functions, and are documented
-       with them.  The codes are given names in the header file. If UTF check-
-       ing is in force and an invalid UTF subject string is detected, one of a
-       number of UTF-specific negative error codes is  returned.  Details  are
-       given in the pcre2unicode page. The following are the other errors that
-       may be returned by pcre2_match():
+       verted to a text string by calling the pcre2_get_error_message()  func-
+       tion  (see  "Obtaining a textual error message" below).  Negative error
+       codes are also returned by other functions,  and  are  documented  with
+       them.  The codes are given names in the header file. If UTF checking is
+       in force and an invalid UTF subject string is detected, one of a number
+       of  UTF-specific negative error codes is returned. Details are given in
+       the pcre2unicode page. The following are the other errors that  may  be
+       returned by pcre2_match():
 
          PCRE2_ERROR_NOMATCH
 
@@ -2336,19 +2410,19 @@ ERROR RETURNS FROM pcre2_match()
 
          PCRE2_ERROR_PARTIAL
 
-       The subject string did not match, but it did match partially.  See  the
+       The  subject  string did not match, but it did match partially. See the
        pcre2partial documentation for details of partial matching.
 
          PCRE2_ERROR_BADMAGIC
 
        PCRE2 stores a 4-byte "magic number" at the start of the compiled code,
-       to catch the case when it is passed a junk pointer. This is  the  error
+       to  catch  the case when it is passed a junk pointer. This is the error
        that is returned when the magic number is not present.
 
          PCRE2_ERROR_BADMODE
 
-       This  error  is  given  when  a  pattern that was compiled by the 8-bit
-       library is passed to a 16-bit  or  32-bit  library  function,  or  vice
+       This error is given when a pattern  that  was  compiled  by  the  8-bit
+       library  is  passed  to  a  16-bit  or 32-bit library function, or vice
        versa.
 
          PCRE2_ERROR_BADOFFSET
@@ -2362,35 +2436,35 @@ ERROR RETURNS FROM pcre2_match()
          PCRE2_ERROR_BADUTFOFFSET
 
        The UTF code unit sequence that was passed as a subject was checked and
-       found to be valid (the PCRE2_NO_UTF_CHECK option was not set), but  the
-       value  of startoffset did not point to the beginning of a UTF character
+       found  to be valid (the PCRE2_NO_UTF_CHECK option was not set), but the
+       value of startoffset did not point to the beginning of a UTF  character
        or the end of the subject.
 
          PCRE2_ERROR_CALLOUT
 
-       This error is never generated by pcre2_match() itself. It  is  provided
-       for  use  by  callout  functions  that  want  to cause pcre2_match() or
-       pcre2_callout_enumerate() to return a distinctive error code.  See  the
+       This  error  is never generated by pcre2_match() itself. It is provided
+       for use by callout  functions  that  want  to  cause  pcre2_match()  or
+       pcre2_callout_enumerate()  to  return a distinctive error code. See the
        pcre2callout documentation for details.
 
          PCRE2_ERROR_INTERNAL
 
-       An  unexpected  internal error has occurred. This error could be caused
+       An unexpected internal error has occurred. This error could  be  caused
        by a bug in PCRE2 or by overwriting of the compiled pattern.
 
          PCRE2_ERROR_JIT_BADOPTION
 
-       This error is returned when a pattern  that  was  successfully  studied
-       using  JIT is being matched, but the matching mode (partial or complete
-       match) does not correspond to any JIT compilation mode.  When  the  JIT
-       fast  path  function  is used, this error may be also given for invalid
+       This  error  is  returned  when a pattern that was successfully studied
+       using JIT is being matched, but the matching mode (partial or  complete
+       match)  does  not  correspond to any JIT compilation mode. When the JIT
+       fast path function is used, this error may be also  given  for  invalid
        options. See the pcre2jit documentation for more details.
 
          PCRE2_ERROR_JIT_STACKLIMIT
 
-       This error is returned when a pattern  that  was  successfully  studied
-       using  JIT  is being matched, but the memory available for the just-in-
-       time processing stack is not large enough. See the pcre2jit  documenta-
+       This  error  is  returned  when a pattern that was successfully studied
+       using JIT is being matched, but the memory available for  the  just-in-
+       time  processing stack is not large enough. See the pcre2jit documenta-
        tion for more details.
 
          PCRE2_ERROR_MATCHLIMIT
@@ -2399,10 +2473,10 @@ ERROR RETURNS FROM pcre2_match()
 
          PCRE2_ERROR_NOMEMORY
 
-       If  a  pattern  contains  back  references,  but the ovector is not big
-       enough to remember the referenced substrings, PCRE2  gets  a  block  of
+       If a pattern contains back references,  but  the  ovector  is  not  big
+       enough  to  remember  the  referenced substrings, PCRE2 gets a block of
        memory at the start of matching to use for this purpose. There are some
-       other special cases where extra memory is needed during matching.  This
+       other  special cases where extra memory is needed during matching. This
        error is given when memory cannot be obtained.
 
          PCRE2_ERROR_NULL
@@ -2411,12 +2485,12 @@ ERROR RETURNS FROM pcre2_match()
 
          PCRE2_ERROR_RECURSELOOP
 
-       This  error  is  returned  when  pcre2_match() detects a recursion loop
-       within the pattern. Specifically, it means that either the  whole  pat-
+       This error is returned when  pcre2_match()  detects  a  recursion  loop
+       within  the  pattern. Specifically, it means that either the whole pat-
        tern or a subpattern has been called recursively for the second time at
-       the same position in the subject  string.  Some  simple  patterns  that
-       might  do  this are detected and faulted at compile time, but more com-
-       plicated cases, in particular mutual recursions between  two  different
+       the  same  position  in  the  subject string. Some simple patterns that
+       might do this are detected and faulted at compile time, but  more  com-
+       plicated  cases,  in particular mutual recursions between two different
        subpatterns, cannot be detected until matching is attempted.
 
          PCRE2_ERROR_RECURSIONLIMIT
@@ -2424,6 +2498,27 @@ ERROR RETURNS FROM pcre2_match()
        The internal recursion limit was reached.
 
 
+OBTAINING A TEXTUAL ERROR MESSAGE
+
+       int pcre2_get_error_message(int errorcode, PCRE2_UCHAR *buffer,
+         PCRE2_SIZE bufflen);
+
+       A text message for an error code  from  any  PCRE2  function  (compile,
+       match,  or  auxiliary)  can be obtained by calling pcre2_get_error_mes-
+       sage(). The code is passed as the first argument,  with  the  remaining
+       two  arguments specifying a code unit buffer and its length, into which
+       the text message is placed. Note that the message is returned  in  code
+       units of the appropriate width for the library that is being used.
+
+       The  returned message is terminated with a trailing zero, and the func-
+       tion returns the number of code  units  used,  excluding  the  trailing
+       zero.  If  the  error  number  is  unknown,  the  negative  error  code
+       PCRE2_ERROR_BADDATA is returned. If the buffer is too small,  the  mes-
+       sage  is  truncated  (but still with a trailing zero), and the negative
+       error code PCRE2_ERROR_NOMEMORY is returned.  None of the messages  are
+       very long; a buffer size of 120 code units is ample.
+
+
 EXTRACTING CAPTURED SUBSTRINGS BY NUMBER
 
        int pcre2_substring_length_bynumber(pcre2_match_data *match_data,
@@ -2794,7 +2889,8 @@ CREATING A NEW STRING WITH SUBSTITUTIONS
        used in an assertion).
 
        As for all PCRE2 errors, a text message that describes the error can be
-       obtained by calling pcre2_get_error_message().
+       obtained  by  calling  the  pcre2_get_error_message()   function   (see
+       "Obtaining a textual error message" above).
 
 
 DUPLICATE SUBPATTERN NAMES
@@ -2802,56 +2898,56 @@ DUPLICATE SUBPATTERN NAMES
        int pcre2_substring_nametable_scan(const pcre2_code *code,
          PCRE2_SPTR name, PCRE2_SPTR *first, PCRE2_SPTR *last);
 
-       When a pattern is compiled with the PCRE2_DUPNAMES  option,  names  for
-       subpatterns  are  not required to be unique. Duplicate names are always
-       allowed for subpatterns with the same number, created by using the  (?|
-       feature.  Indeed,  if  such subpatterns are named, they are required to
+       When  a  pattern  is compiled with the PCRE2_DUPNAMES option, names for
+       subpatterns are not required to be unique. Duplicate names  are  always
+       allowed  for subpatterns with the same number, created by using the (?|
+       feature. Indeed, if such subpatterns are named, they  are  required  to
        use the same names.
 
        Normally, patterns with duplicate names are such that in any one match,
-       only  one of the named subpatterns participates. An example is shown in
+       only one of the named subpatterns participates. An example is shown  in
        the pcre2pattern documentation.
 
-       When  duplicates   are   present,   pcre2_substring_copy_byname()   and
-       pcre2_substring_get_byname()  return  the first substring corresponding
-       to  the  given  name  that  is  set.  Only   if   none   are   set   is
-       PCRE2_ERROR_UNSET  is  returned. The pcre2_substring_number_from_name()
+       When   duplicates   are   present,   pcre2_substring_copy_byname()  and
+       pcre2_substring_get_byname() return the first  substring  corresponding
+       to   the   given   name   that   is  set.  Only  if  none  are  set  is
+       PCRE2_ERROR_UNSET is returned.  The  pcre2_substring_number_from_name()
        function returns the error PCRE2_ERROR_NOUNIQUESUBSTRING when there are
        duplicate names.
 
-       If  you want to get full details of all captured substrings for a given
-       name, you must use the pcre2_substring_nametable_scan()  function.  The
-       first  argument is the compiled pattern, and the second is the name. If
-       the third and fourth arguments are NULL, the function returns  a  group
+       If you want to get full details of all captured substrings for a  given
+       name,  you  must use the pcre2_substring_nametable_scan() function. The
+       first argument is the compiled pattern, and the second is the name.  If
+       the  third  and fourth arguments are NULL, the function returns a group
        number for a unique name, or PCRE2_ERROR_NOUNIQUESUBSTRING otherwise.
 
        When the third and fourth arguments are not NULL, they must be pointers
-       to variables that are updated by the function. After it has  run,  they
+       to  variables  that are updated by the function. After it has run, they
        point to the first and last entries in the name-to-number table for the
-       given name, and the function returns the length of each entry  in  code
-       units.  In both cases, PCRE2_ERROR_NOSUBSTRING is returned if there are
+       given  name,  and the function returns the length of each entry in code
+       units. In both cases, PCRE2_ERROR_NOSUBSTRING is returned if there  are
        no entries for the given name.
 
        The format of the name table is described above in the section entitled
-       Information  about  a  pattern.  Given all the relevant entries for the
-       name, you can extract each of their numbers,  and  hence  the  captured
+       Information about a pattern. Given all the  relevant  entries  for  the
+       name,  you  can  extract  each of their numbers, and hence the captured
        data.
 
 
 FINDING ALL POSSIBLE MATCHES AT ONE POSITION
 
-       The  traditional  matching  function  uses a similar algorithm to Perl,
-       which stops when it finds the first match at a given point in the  sub-
+       The traditional matching function uses a  similar  algorithm  to  Perl,
+       which  stops when it finds the first match at a given point in the sub-
        ject. If you want to find all possible matches, or the longest possible
-       match at a given position,  consider  using  the  alternative  matching
-       function  (see  below) instead. If you cannot use the alternative func-
+       match  at  a  given  position,  consider using the alternative matching
+       function (see below) instead. If you cannot use the  alternative  func-
        tion, you can kludge it up by making use of the callout facility, which
        is described in the pcre2callout documentation.
 
        What you have to do is to insert a callout right at the end of the pat-
-       tern.  When your callout function is called, extract and save the  cur-
-       rent  matched  substring.  Then return 1, which forces pcre2_match() to
-       backtrack and try other alternatives. Ultimately, when it runs  out  of
+       tern.   When your callout function is called, extract and save the cur-
+       rent matched substring. Then return 1, which  forces  pcre2_match()  to
+       backtrack  and  try other alternatives. Ultimately, when it runs out of
        matches, pcre2_match() will yield PCRE2_ERROR_NOMATCH.
 
 
@@ -2863,26 +2959,26 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
          pcre2_match_context *mcontext,
          int *workspace, PCRE2_SIZE wscount);
 
-       The  function  pcre2_dfa_match()  is  called  to match a subject string
-       against a compiled pattern, using a matching algorithm that  scans  the
-       subject  string  just  once, and does not backtrack. This has different
-       characteristics to the normal algorithm, and  is  not  compatible  with
-       Perl.  Some of the features of PCRE2 patterns are not supported. Never-
-       theless, there are times when this kind of matching can be useful.  For
-       a  discussion  of  the  two matching algorithms, and a list of features
+       The function pcre2_dfa_match() is called  to  match  a  subject  string
+       against  a  compiled pattern, using a matching algorithm that scans the
+       subject string just once, and does not backtrack.  This  has  different
+       characteristics  to  the  normal  algorithm, and is not compatible with
+       Perl. Some of the features of PCRE2 patterns are not supported.  Never-
+       theless,  there are times when this kind of matching can be useful. For
+       a discussion of the two matching algorithms, and  a  list  of  features
        that pcre2_dfa_match() does not support, see the pcre2matching documen-
        tation.
 
-       The  arguments  for  the pcre2_dfa_match() function are the same as for
+       The arguments for the pcre2_dfa_match() function are the  same  as  for
        pcre2_match(), plus two extras. The ovector within the match data block
        is used in a different way, and this is described below. The other com-
-       mon arguments are used in the same way as for pcre2_match(),  so  their
+       mon  arguments  are used in the same way as for pcre2_match(), so their
        description is not repeated here.
 
-       The  two  additional  arguments provide workspace for the function. The
-       workspace vector should contain at least 20 elements. It  is  used  for
+       The two additional arguments provide workspace for  the  function.  The
+       workspace  vector  should  contain at least 20 elements. It is used for
        keeping  track  of  multiple  paths  through  the  pattern  tree.  More
-       workspace is needed for patterns and subjects where there are a lot  of
+       workspace  is needed for patterns and subjects where there are a lot of
        potential matches.
 
        Here is an example of a simple call to pcre2_dfa_match():
@@ -2902,45 +2998,45 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
 
    Option bits for pcre_dfa_match()
 
-       The  unused  bits of the options argument for pcre2_dfa_match() must be
-       zero. The only bits that may be set are  PCRE2_ANCHORED,  PCRE2_NOTBOL,
+       The unused bits of the options argument for pcre2_dfa_match()  must  be
+       zero.  The  only bits that may be set are PCRE2_ANCHORED, PCRE2_NOTBOL,
        PCRE2_NOTEOL,          PCRE2_NOTEMPTY,          PCRE2_NOTEMPTY_ATSTART,
        PCRE2_NO_UTF_CHECK,       PCRE2_PARTIAL_HARD,       PCRE2_PARTIAL_SOFT,
-       PCRE2_DFA_SHORTEST,  and  PCRE2_DFA_RESTART.  All  but the last four of
-       these are exactly the same as for pcre2_match(), so  their  description
+       PCRE2_DFA_SHORTEST, and PCRE2_DFA_RESTART. All but  the  last  four  of
+       these  are  exactly the same as for pcre2_match(), so their description
        is not repeated here.
 
          PCRE2_PARTIAL_HARD
          PCRE2_PARTIAL_SOFT
 
-       These  have  the  same general effect as they do for pcre2_match(), but
-       the details are slightly different. When PCRE2_PARTIAL_HARD is set  for
-       pcre2_dfa_match(),  it  returns  PCRE2_ERROR_PARTIAL  if the end of the
+       These have the same general effect as they do  for  pcre2_match(),  but
+       the  details are slightly different. When PCRE2_PARTIAL_HARD is set for
+       pcre2_dfa_match(), it returns PCRE2_ERROR_PARTIAL if  the  end  of  the
        subject is reached and there is still at least one matching possibility
        that requires additional characters. This happens even if some complete
-       matches have already been found. When PCRE2_PARTIAL_SOFT  is  set,  the
-       return  code  PCRE2_ERROR_NOMATCH is converted into PCRE2_ERROR_PARTIAL
-       if the end of the subject is  reached,  there  have  been  no  complete
+       matches  have  already  been found. When PCRE2_PARTIAL_SOFT is set, the
+       return code PCRE2_ERROR_NOMATCH is converted  into  PCRE2_ERROR_PARTIAL
+       if  the  end  of  the  subject  is reached, there have been no complete
        matches, but there is still at least one matching possibility. The por-
-       tion of the string that was inspected when the  longest  partial  match
+       tion  of  the  string that was inspected when the longest partial match
        was found is set as the first matching string in both cases. There is a
-       more detailed discussion of partial and  multi-segment  matching,  with
+       more  detailed  discussion  of partial and multi-segment matching, with
        examples, in the pcre2partial documentation.
 
          PCRE2_DFA_SHORTEST
 
-       Setting  the PCRE2_DFA_SHORTEST option causes the matching algorithm to
+       Setting the PCRE2_DFA_SHORTEST option causes the matching algorithm  to
        stop as soon as it has found one match. Because of the way the alterna-
-       tive  algorithm  works, this is necessarily the shortest possible match
+       tive algorithm works, this is necessarily the shortest  possible  match
        at the first possible matching point in the subject string.
 
          PCRE2_DFA_RESTART
 
-       When pcre2_dfa_match() returns a partial match, it is possible to  call
+       When  pcre2_dfa_match() returns a partial match, it is possible to call
        it again, with additional subject characters, and have it continue with
        the same match. The PCRE2_DFA_RESTART option requests this action; when
-       it  is  set,  the workspace and wscount options must reference the same
-       vector as before because data about the match so far is  left  in  them
+       it is set, the workspace and wscount options must  reference  the  same
+       vector  as  before  because data about the match so far is left in them
        after a partial match. There is more discussion of this facility in the
        pcre2partial documentation.
 
@@ -2948,8 +3044,8 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
 
        When pcre2_dfa_match() succeeds, it may have matched more than one sub-
        string in the subject. Note, however, that all the matches from one run
-       of the function start at the same point in  the  subject.  The  shorter
-       matches  are all initial substrings of the longer matches. For example,
+       of  the  function  start  at the same point in the subject. The shorter
+       matches are all initial substrings of the longer matches. For  example,
        if the pattern
 
          <.*>
@@ -2964,17 +3060,17 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
          <something> <something else>
          <something>
 
-       On success, the yield of the function is a number  greater  than  zero,
-       which  is  the  number  of  matched substrings. The offsets of the sub-
-       strings are returned in the ovector, and can be extracted by number  in
-       the  same way as for pcre2_match(), but the numbers bear no relation to
-       any capturing groups that may exist in the pattern, because DFA  match-
+       On  success,  the  yield of the function is a number greater than zero,
+       which is the number of matched substrings.  The  offsets  of  the  sub-
+       strings  are returned in the ovector, and can be extracted by number in
+       the same way as for pcre2_match(), but the numbers bear no relation  to
+       any  capturing groups that may exist in the pattern, because DFA match-
        ing does not support group capture.
 
-       Calls  to  the  convenience  functions  that extract substrings by name
-       return the error PCRE2_ERROR_DFA_UFUNC (unsupported function)  if  used
+       Calls to the convenience functions  that  extract  substrings  by  name
+       return  the  error PCRE2_ERROR_DFA_UFUNC (unsupported function) if used
        after a DFA match. The convenience functions that extract substrings by
-       number never return PCRE2_ERROR_NOSUBSTRING, and the meanings  of  some
+       number  never  return PCRE2_ERROR_NOSUBSTRING, and the meanings of some
        other errors are slightly different:
 
          PCRE2_ERROR_UNAVAILABLE
@@ -2984,64 +3080,64 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
 
          PCRE2_ERROR_UNSET
 
-       There is a slot in the ovector  for  this  substring,  but  there  were
+       There  is  a  slot  in  the  ovector for this substring, but there were
        insufficient matches to fill it.
 
-       The  matched  strings  are  stored  in  the ovector in reverse order of
-       length; that is, the longest matching string is first.  If  there  were
-       too  many matches to fit into the ovector, the yield of the function is
+       The matched strings are stored in  the  ovector  in  reverse  order  of
+       length;  that  is,  the longest matching string is first. If there were
+       too many matches to fit into the ovector, the yield of the function  is
        zero, and the vector is filled with the longest matches.
 
-       NOTE: PCRE2's "auto-possessification" optimization usually  applies  to
-       character  repeats at the end of a pattern (as well as internally). For
-       example, the pattern "a\d+" is compiled as if it were "a\d++". For  DFA
-       matching,  this  means  that  only  one possible match is found. If you
-       really do want multiple matches in such cases, either use  an  ungreedy
-       repeat  auch  as  "a\d+?"  or set the PCRE2_NO_AUTO_POSSESS option when
+       NOTE:  PCRE2's  "auto-possessification" optimization usually applies to
+       character repeats at the end of a pattern (as well as internally).  For
+       example,  the pattern "a\d+" is compiled as if it were "a\d++". For DFA
+       matching, this means that only one possible  match  is  found.  If  you
+       really  do  want multiple matches in such cases, either use an ungreedy
+       repeat auch as "a\d+?" or set  the  PCRE2_NO_AUTO_POSSESS  option  when
        compiling.
 
    Error returns from pcre2_dfa_match()
 
        The pcre2_dfa_match() function returns a negative number when it fails.
-       Many  of  the  errors  are  the same as for pcre2_match(), as described
+       Many of the errors are the same  as  for  pcre2_match(),  as  described
        above.  There are in addition the following errors that are specific to
        pcre2_dfa_match():
 
          PCRE2_ERROR_DFA_UITEM
 
-       This  return  is  given  if pcre2_dfa_match() encounters an item in the
-       pattern that it does not support, for instance, the use of \C in a  UTF
+       This return is given if pcre2_dfa_match() encounters  an  item  in  the
+       pattern  that it does not support, for instance, the use of \C in a UTF
        mode or a back reference.
 
          PCRE2_ERROR_DFA_UCOND
 
-       This  return  is given if pcre2_dfa_match() encounters a condition item
-       that uses a back reference for the condition, or a test  for  recursion
+       This return is given if pcre2_dfa_match() encounters a  condition  item
+       that  uses  a back reference for the condition, or a test for recursion
        in a specific group. These are not supported.
 
          PCRE2_ERROR_DFA_WSSIZE
 
-       This  return  is  given  if  pcre2_dfa_match() runs out of space in the
+       This return is given if pcre2_dfa_match() runs  out  of  space  in  the
        workspace vector.
 
          PCRE2_ERROR_DFA_RECURSE
 
-       When a recursive subpattern is processed, the matching  function  calls
+       When  a  recursive subpattern is processed, the matching function calls
        itself recursively, using private memory for the ovector and workspace.
-       This error is given if the internal ovector is not large  enough.  This
+       This  error  is given if the internal ovector is not large enough. This
        should be extremely rare, as a vector of size 1000 is used.
 
          PCRE2_ERROR_DFA_BADRESTART
 
-       When  pcre2_dfa_match()  is  called  with the PCRE2_DFA_RESTART option,
-       some plausibility checks are made on the  contents  of  the  workspace,
-       which  should  contain data about the previous partial match. If any of
+       When pcre2_dfa_match() is called  with  the  PCRE2_DFA_RESTART  option,
+       some  plausibility  checks  are  made on the contents of the workspace,
+       which should contain data about the previous partial match. If  any  of
        these checks fail, this error is given.
 
 
 SEE ALSO
 
-       pcre2build(3),   pcre2callout(3),    pcre2demo(3),    pcre2matching(3),
+       pcre2build(3),    pcre2callout(3),    pcre2demo(3),   pcre2matching(3),
        pcre2partial(3),    pcre2posix(3),    pcre2sample(3),    pcre2stack(3),
        pcre2unicode(3).
 
@@ -3055,8 +3151,8 @@ AUTHOR
 
 REVISION
 
-       Last updated: 16 December 2015
-       Copyright (c) 1997-2015 University of Cambridge.
+       Last updated: 17 June 2016
+       Copyright (c) 1997-2016 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -3383,6 +3479,15 @@ USING EBCDIC CODE
        an EBCDIC environment.
 
 
+PCRE2GREP SUPPORT FOR EXTERNAL SCRIPTS
+
+       By default, on non-Windows systems, pcre2grep supports the use of call-
+       outs with string arguments within the patterns it is matching, in order
+       to  run external scripts. For details, see the pcre2grep documentation.
+       This support can be disabled by adding  --disable-pcre2grep-callout  to
+       the configure command.
+
+
 PCRE2GREP OPTIONS FOR COMPRESSED FILE SUPPORT
 
        By  default,  pcre2grep reads all files as plain text. You can build it
@@ -3410,7 +3515,7 @@ PCRE2GREP BUFFER SIZE
          --with-pcre2grep-bufsize=50K
 
        to  the  configure  command.  The caller of pcre2grep can override this
-       value by using --buffer-size on the command line..
+       value by using --buffer-size on the command line.
 
 
 PCRE2TEST OPTION FOR LIBREADLINE SUPPORT
@@ -3539,8 +3644,8 @@ AUTHOR
 
 REVISION
 
-       Last updated: 16 October 2015
-       Copyright (c) 1997-2015 University of Cambridge.
+       Last updated: 01 April 2016
+       Copyright (c) 1997-2016 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -4218,49 +4323,52 @@ UNSUPPORTED OPTIONS AND PATTERN ITEMS
        PCRE2_NO_UTF_CHECK,  PCRE2_PARTIAL_HARD,  and  PCRE2_PARTIAL_SOFT.  The
        PCRE2_ANCHORED option is not supported at match time.
 
-       The  only  unsupported  pattern items are \C (match a single data unit)
-       when running in a UTF mode, and a callout immediately before an  asser-
+       If  the  PCRE2_NO_JIT option is passed to pcre2_match() it disables the
+       use of JIT, forcing matching by the interpreter code.
+
+       The only unsupported pattern items are \C (match a  single  data  unit)
+       when  running in a UTF mode, and a callout immediately before an asser-
        tion condition in a conditional group.
 
 
 RETURN VALUES FROM JIT MATCHING
 
        When a pattern is matched using JIT matching, the return values are the
-       same as those given by the interpretive pcre2_match()  code,  with  the
-       addition  of one new error code: PCRE2_ERROR_JIT_STACKLIMIT. This means
-       that the memory used for the JIT stack was insufficient. See  "Control-
+       same  as  those  given by the interpretive pcre2_match() code, with the
+       addition of one new error code: PCRE2_ERROR_JIT_STACKLIMIT. This  means
+       that  the memory used for the JIT stack was insufficient. See "Control-
        ling the JIT stack" below for a discussion of JIT stack usage.
 
-       The  error  code  PCRE2_ERROR_MATCHLIMIT is returned by the JIT code if
-       searching a very large pattern tree goes on for too long, as it  is  in
-       the  same circumstance when JIT is not used, but the details of exactly
-       what is counted are not the same. The PCRE2_ERROR_RECURSIONLIMIT  error
+       The error code PCRE2_ERROR_MATCHLIMIT is returned by the  JIT  code  if
+       searching  a  very large pattern tree goes on for too long, as it is in
+       the same circumstance when JIT is not used, but the details of  exactly
+       what  is counted are not the same. The PCRE2_ERROR_RECURSIONLIMIT error
        code is never returned when JIT matching is used.
 
 
 CONTROLLING THE JIT STACK
 
        When the compiled JIT code runs, it needs a block of memory to use as a
-       stack.  By default, it uses 32K on the  machine  stack.  However,  some
-       large   or   complicated  patterns  need  more  than  this.  The  error
-       PCRE2_ERROR_JIT_STACKLIMIT is given when there  is  not  enough  stack.
-       Three  functions  are provided for managing blocks of memory for use as
-       JIT stacks. There is further discussion about the use of JIT stacks  in
+       stack.   By  default,  it  uses 32K on the machine stack. However, some
+       large  or  complicated  patterns  need  more  than  this.   The   error
+       PCRE2_ERROR_JIT_STACKLIMIT  is  given  when  there is not enough stack.
+       Three functions are provided for managing blocks of memory for  use  as
+       JIT  stacks. There is further discussion about the use of JIT stacks in
        the section entitled "JIT stack FAQ" below.
 
-       The  pcre2_jit_stack_create()  function  creates a JIT stack. Its argu-
-       ments are a starting size, a maximum size, and a general  context  (for
-       memory  allocation  functions, or NULL for standard memory allocation).
+       The pcre2_jit_stack_create() function creates a JIT  stack.  Its  argu-
+       ments  are  a starting size, a maximum size, and a general context (for
+       memory allocation functions, or NULL for standard  memory  allocation).
        It returns a pointer to an opaque structure of type pcre2_jit_stack, or
-       NULL  if there is an error. The pcre2_jit_stack_free() function is used
-       to free a stack that is no longer needed. (For the technically  minded:
+       NULL if there is an error. The pcre2_jit_stack_free() function is  used
+       to  free a stack that is no longer needed. (For the technically minded:
        the address space is allocated by mmap or VirtualAlloc.)
 
-       JIT  uses far less memory for recursion than the interpretive code, and
-       a maximum stack size of 512K to 1M should be more than enough  for  any
+       JIT uses far less memory for recursion than the interpretive code,  and
+       a  maximum  stack size of 512K to 1M should be more than enough for any
        pattern.
 
-       The  pcre2_jit_stack_assign()  function  specifies which stack JIT code
+       The pcre2_jit_stack_assign() function specifies which  stack  JIT  code
        should use. Its arguments are as follows:
 
          pcre2_match_context  *mcontext
@@ -4269,7 +4377,7 @@ CONTROLLING THE JIT STACK
 
        The first argument is a pointer to a match context. When this is subse-
        quently passed to a matching function, its information determines which
-       JIT stack is used. There are three cases for the values  of  the  other
+       JIT  stack  is  used. There are three cases for the values of the other
        two options:
 
          (1) If callback is NULL and data is NULL, an internal 32K block
@@ -4287,34 +4395,34 @@ CONTROLLING THE JIT STACK
              return value must be a valid JIT stack, the result of calling
              pcre2_jit_stack_create().
 
-       A  callback function is obeyed whenever JIT code is about to be run; it
+       A callback function is obeyed whenever JIT code is about to be run;  it
        is not obeyed when pcre2_match() is called with options that are incom-
-       patible  for JIT matching. A callback function can therefore be used to
-       determine whether a match operation was  executed  by  JIT  or  by  the
+       patible for JIT matching. A callback function can therefore be used  to
+       determine  whether  a  match  operation  was  executed by JIT or by the
        interpreter.
 
        You may safely use the same JIT stack for more than one pattern (either
-       by assigning directly or by callback), as  long  as  the  patterns  are
+       by  assigning  directly  or  by  callback), as long as the patterns are
        matched sequentially in the same thread. Currently, the only way to set
-       up non-sequential matches in one thread is to use callouts: if a  call-
-       out  function starts another match, that match must use a different JIT
+       up  non-sequential matches in one thread is to use callouts: if a call-
+       out function starts another match, that match must use a different  JIT
        stack to the one used for currently suspended match(es).
 
-       In a multithread application, if you do not specify a JIT stack, or  if
-       you  assign  or  pass  back  NULL from a callback, that is thread-safe,
-       because each thread has its own machine stack. However, if  you  assign
-       or  pass  back a non-NULL JIT stack, this must be a different stack for
+       In  a multithread application, if you do not specify a JIT stack, or if
+       you assign or pass back NULL from  a  callback,  that  is  thread-safe,
+       because  each  thread has its own machine stack. However, if you assign
+       or pass back a non-NULL JIT stack, this must be a different  stack  for
        each thread so that the application is thread-safe.
 
-       Strictly speaking, even more is allowed. You can assign the  same  non-
-       NULL  stack  to a match context that is used by any number of patterns,
-       as long as they are not used for matching by multiple  threads  at  the
-       same  time.  For  example, you could use the same stack in all compiled
-       patterns, with a global mutex in the callback to wait until  the  stack
+       Strictly  speaking,  even more is allowed. You can assign the same non-
+       NULL stack to a match context that is used by any number  of  patterns,
+       as  long  as  they are not used for matching by multiple threads at the
+       same time. For example, you could use the same stack  in  all  compiled
+       patterns,  with  a global mutex in the callback to wait until the stack
        is available for use. However, this is an inefficient solution, and not
        recommended.
 
-       This is a suggestion for how a multithreaded program that needs to  set
+       This  is a suggestion for how a multithreaded program that needs to set
        up non-default JIT stacks might operate:
 
          During thread initalization
@@ -4326,7 +4434,7 @@ CONTROLLING THE JIT STACK
          Use a one-line callback function
            return thread_local_var
 
-       All  the  functions  described in this section do nothing if JIT is not
+       All the functions described in this section do nothing if  JIT  is  not
        available.
 
 
@@ -4335,20 +4443,20 @@ JIT STACK FAQ
        (1) Why do we need JIT stacks?
 
        PCRE2 (and JIT) is a recursive, depth-first engine, so it needs a stack
-       where  the local data of the current node is pushed before checking its
+       where the local data of the current node is pushed before checking  its
        child nodes.  Allocating real machine stack on some platforms is diffi-
        cult. For example, the stack chain needs to be updated every time if we
-       extend the stack on PowerPC.  Although it  is  possible,  its  updating
+       extend  the  stack  on  PowerPC.  Although it is possible, its updating
        time overhead decreases performance. So we do the recursion in memory.
 
        (2) Why don't we simply allocate blocks of memory with malloc()?
 
-       Modern  operating  systems  have  a  nice  feature: they can reserve an
+       Modern operating systems have a  nice  feature:  they  can  reserve  an
        address space instead of allocating memory. We can safely allocate mem-
-       ory  pages  inside  this address space, so the stack could grow without
+       ory pages inside this address space, so the stack  could  grow  without
        moving memory data (this is important because of pointers). Thus we can
-       allocate  1M  address space, and use only a single memory page (usually
-       4K) if that is enough. However, we can still grow up to 1M  anytime  if
+       allocate 1M address space, and use only a single memory  page  (usually
+       4K)  if  that is enough. However, we can still grow up to 1M anytime if
        needed.
 
        (3) Who "owns" a JIT stack?
@@ -4356,8 +4464,8 @@ JIT STACK FAQ
        The owner of the stack is the user program, not the JIT studied pattern
        or anything else. The user program must ensure that if a stack is being
        used by pcre2_match(), (that is, it is assigned to a match context that
-       is passed to the pattern currently running), that  stack  must  not  be
-       used  by any other threads (to avoid overwriting the same memory area).
+       is  passed  to  the  pattern currently running), that stack must not be
+       used by any other threads (to avoid overwriting the same memory  area).
        The best practice for multithreaded programs is to allocate a stack for
        each thread, and return this stack through the JIT callback function.
 
@@ -4365,36 +4473,36 @@ JIT STACK FAQ
 
        You can free a JIT stack at any time, as long as it will not be used by
        pcre2_match() again. When you assign the stack to a match context, only
-       a  pointer  is  set. There is no reference counting or any other magic.
+       a pointer is set. There is no reference counting or  any  other  magic.
        You can free compiled patterns, contexts, and stacks in any order, any-
-       time.  Just  do not call pcre2_match() with a match context pointing to
+       time. Just do not call pcre2_match() with a match context  pointing  to
        an already freed stack, as that will cause SEGFAULT. (Also, do not free
-       a  stack  currently  used  by pcre2_match() in another thread). You can
-       also replace the stack in a context at any time when it is not in  use.
+       a stack currently used by pcre2_match() in  another  thread).  You  can
+       also  replace the stack in a context at any time when it is not in use.
        You should free the previous stack before assigning a replacement.
 
-       (5)  Should  I  allocate/free  a  stack every time before/after calling
+       (5) Should I allocate/free a  stack  every  time  before/after  calling
        pcre2_match()?
 
-       No, because this is too costly in  terms  of  resources.  However,  you
-       could  implement  some clever idea which release the stack if it is not
-       used in let's say two minutes. The JIT callback  can  help  to  achieve
+       No,  because  this  is  too  costly in terms of resources. However, you
+       could implement some clever idea which release the stack if it  is  not
+       used  in  let's  say  two minutes. The JIT callback can help to achieve
        this without keeping a list of patterns.
 
-       (6)  OK, the stack is for long term memory allocation. But what happens
-       if a pattern causes stack overflow with a stack of 1M? Is that 1M  kept
+       (6) OK, the stack is for long term memory allocation. But what  happens
+       if  a pattern causes stack overflow with a stack of 1M? Is that 1M kept
        until the stack is freed?
 
-       Especially  on embedded sytems, it might be a good idea to release mem-
-       ory sometimes without freeing the stack. There is no API  for  this  at
-       the  moment.  Probably a function call which returns with the currently
-       allocated memory for any stack and another which allows releasing  mem-
+       Especially on embedded sytems, it might be a good idea to release  mem-
+       ory  sometimes  without  freeing the stack. There is no API for this at
+       the moment.  Probably a function call which returns with the  currently
+       allocated  memory for any stack and another which allows releasing mem-
        ory (shrinking the stack) would be a good idea if someone needs this.
 
        (7) This is too much of a headache. Isn't there any better solution for
        JIT stack handling?
 
-       No, thanks to Windows. If POSIX threads were used everywhere, we  could
+       No,  thanks to Windows. If POSIX threads were used everywhere, we could
        throw out this complicated API.
 
 
@@ -4403,18 +4511,18 @@ FREEING JIT SPECULATIVE MEMORY
        void pcre2_jit_free_unused_memory(pcre2_general_context *gcontext);
 
        The JIT executable allocator does not free all memory when it is possi-
-       ble.  It expects new allocations, and keeps some free memory around  to
-       improve  allocation  speed. However, in low memory conditions, it might
-       be better to free all possible memory. You can cause this to happen  by
-       calling  pcre2_jit_free_unused_memory(). Its argument is a general con-
+       ble.   It expects new allocations, and keeps some free memory around to
+       improve allocation speed. However, in low memory conditions,  it  might
+       be  better to free all possible memory. You can cause this to happen by
+       calling pcre2_jit_free_unused_memory(). Its argument is a general  con-
        text, for custom memory management, or NULL for standard memory manage-
        ment.
 
 
 EXAMPLE CODE
 
-       This  is  a  single-threaded example that specifies a JIT stack without
-       using a callback. A real program should include  error  checking  after
+       This is a single-threaded example that specifies a  JIT  stack  without
+       using  a  callback.  A real program should include error checking after
        all the function calls.
 
          int rc;
@@ -4442,19 +4550,20 @@ EXAMPLE CODE
 JIT FAST PATH API
 
        Because the API described above falls back to interpreted matching when
-       JIT is not available, it is convenient for programs  that  are  written
+       JIT  is  not  available, it is convenient for programs that are written
        for  general  use  in  many  environments.  However,  calling  JIT  via
        pcre2_match() does have a performance impact. Programs that are written
-       for  use  where  JIT  is known to be available, and which need the best
-       possible performance, can instead use a "fast path"  API  to  call  JIT
-       matching  directly instead of calling pcre2_match() (obviously only for
+       for use where JIT is known to be available, and  which  need  the  best
+       possible  performance,  can  instead  use a "fast path" API to call JIT
+       matching directly instead of calling pcre2_match() (obviously only  for
        patterns that have been successfully processed by pcre2_jit_compile()).
 
-       The fast path  function  is  called  pcre2_jit_match(),  and  it  takes
+       The  fast  path  function  is  called  pcre2_jit_match(),  and it takes
        exactly the same arguments as pcre2_match(). The return values are also
        the same, plus PCRE2_ERROR_JIT_BADOPTION if a matching mode (partial or
-       complete)  is  requested that was not compiled. Unsupported option bits
-       (for example, PCRE2_ANCHORED) are ignored.
+       complete) is requested that was not compiled. Unsupported  option  bits
+       (for  example,  PCRE2_ANCHORED)  are  ignored,  as  is the PCRE2_NO_JIT
+       option.
 
        When you call pcre2_match(), as well as testing for invalid options,  a
        number of other sanity checks are performed on the arguments. For exam-
@@ -4481,8 +4590,8 @@ AUTHOR
 
 REVISION
 
-       Last updated: 14 November 2015
-       Copyright (c) 1997-2015 University of Cambridge.
+       Last updated: 05 June 2016
+       Copyright (c) 1997-2016 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -6229,17 +6338,21 @@ MATCHING A SINGLE CODE UNIT
        possible to build PCRE2 with the use of \C permanently disabled.
 
        PCRE2  does  not allow \C to appear in lookbehind assertions (described
-       below) in a UTF mode, because this would make it impossible  to  calcu-
-       late  the  length  of  the lookbehind. Neither the alternative matching
-       function pcre2_dfa_match() not the JIT optimizer support \C  in  a  UTF
-       mode. The former gives a match-time error; the latter fails to optimize
-       and so the match is always run using the interpreter.
+       below) in UTF-8 or UTF-16 modes, because this would make it  impossible
+       to  calculate  the  length  of  the lookbehind. Neither the alternative
+       matching function pcre2_dfa_match() nor the JIT optimizer support \C in
+       these UTF modes.  The former gives a match-time error; the latter fails
+       to optimize and so the match is always run using the interpreter.
+
+       In the 32-bit library,  however,  \C  is  always  supported  (when  not
+       explicitly  locked  out)  because it always matches a single code unit,
+       whether or not UTF-32 is specified.
 
        In general, the \C escape sequence is best avoided. However, one way of
-       using  it that avoids the problem of malformed UTF characters is to use
-       a lookahead to check the length of the next character, as in this  pat-
-       tern,  which  could be used with a UTF-8 string (ignore white space and
-       line breaks):
+       using  it  that avoids the problem of malformed UTF-8 or UTF-16 charac-
+       ters is to use a lookahead to check the length of the  next  character,
+       as  in  this  pattern,  which could be used with a UTF-8 string (ignore
+       white space and line breaks):
 
          (?| (?=[\x00-\x7f])(\C) |
              (?=[\x80-\x{7ff}])(\C)(\C) |
@@ -8254,8 +8367,8 @@ AUTHOR
 
 REVISION
 
-       Last updated: 13 November 2015
-       Copyright (c) 1997-2015 University of Cambridge.
+       Last updated: 20 June 2016
+       Copyright (c) 1997-2016 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -8460,7 +8573,7 @@ DESCRIPTION
        This  set of functions provides a POSIX-style API for the PCRE2 regular
        expression 8-bit library. See the pcre2api documentation for a descrip-
        tion  of PCRE2's native API, which contains much additional functional-
-       ity. There is no POSIX-style wrapper  for  PCRE2's  16-bit  and  32-bit
+       ity. There are no POSIX-style wrappers for PCRE2's  16-bit  and  32-bit
        libraries.
 
        The functions described here are just wrapper functions that ultimately
@@ -8478,8 +8591,8 @@ DESCRIPTION
        easier  to  slot in PCRE2 as a replacement library. Other POSIX options
        are not even defined.
 
-       There are also some other options that are not defined by POSIX.  These
-       have been added at the request of users who want to make use of certain
+       There are also some options that are not defined by POSIX.  These  have
+       been  added  at  the  request  of users who want to make use of certain
        PCRE2-specific features via the POSIX calling interface.
 
        When PCRE2 is called via these functions, it is only the  API  that  is
@@ -8530,11 +8643,11 @@ COMPILING A PATTERN
 
          REG_NOSUB
 
-       The  PCRE2_NO_AUTO_CAPTURE option is set when the regular expression is
-       passed for compilation to the native function. In addition, when a pat-
-       tern  that is compiled with this flag is passed to regexec() for match-
-       ing, the nmatch and pmatch  arguments  are  ignored,  and  no  captured
-       strings are returned.
+       When  a  pattern that is compiled with this flag is passed to regexec()
+       for matching, the nmatch and pmatch arguments are ignored, and no  cap-
+       tured strings are returned. Versions of the PCRE library prior to 10.22
+       used to set the  PCRE2_NO_AUTO_CAPTURE  compile  option,  but  this  no
+       longer happens because it disables the use of back references.
 
          REG_UCP
 
@@ -8653,43 +8766,44 @@ MATCHING A PATTERN
 
        If the pattern was compiled with the REG_NOSUB flag, no data about  any
        matched  strings  is  returned.  The  nmatch  and  pmatch  arguments of
-       regexec() are ignored.
-
-       If the value of nmatch is zero, or if the value pmatch is NULL, no data
-       about any matched strings is returned.
-
-       Otherwise,the portion of the string that was matched, and also any cap-
-       tured substrings, are returned via the pmatch argument, which points to
-       an  array  of nmatch structures of type regmatch_t, containing the mem-
-       bers rm_so and rm_eo. These contain the byte offset to the first  char-
-       acter of each substring and the offset to the first character after the
-       end of each substring, respectively. The  0th  element  of  the  vector
-       relates  to  the  entire portion of string that was matched; subsequent
+       regexec() are ignored (except possibly as input for REG_STARTEND).
+
+       The value of nmatch may be zero, and  the  value  pmatch  may  be  NULL
+       (unless  REG_STARTEND  is  set);  in both these cases no data about any
+       matched strings is returned.
+
+       Otherwise, the portion of the string that was  matched,  and  also  any
+       captured substrings, are returned via the pmatch argument, which points
+       to an array of nmatch structures of  type  regmatch_t,  containing  the
+       members  rm_so  and  rm_eo.  These contain the byte offset to the first
+       character of each substring and the offset to the first character after
+       the  end of each substring, respectively. The 0th element of the vector
+       relates to the entire portion of string that  was  matched;  subsequent
        elements relate to the capturing subpatterns of the regular expression.
        Unused entries in the array have both structure members set to -1.
 
-       A  successful  match  yields  a  zero  return;  various error codes are
-       defined in the header file, of  which  REG_NOMATCH  is  the  "expected"
+       A successful match yields  a  zero  return;  various  error  codes  are
+       defined  in  the  header  file,  of which REG_NOMATCH is the "expected"
        failure code.
 
 
 ERROR MESSAGES
 
        The regerror() function maps a non-zero errorcode from either regcomp()
-       or regexec() to a printable message. If preg is  not  NULL,  the  error
+       or  regexec()  to  a  printable message. If preg is not NULL, the error
        should have arisen from the use of that structure. A message terminated
-       by a binary zero is placed in errbuf. If the buffer is too short,  only
+       by  a binary zero is placed in errbuf. If the buffer is too short, only
        the first errbuf_size - 1 characters of the error message are used. The
-       yield of the function is the size of buffer needed to  hold  the  whole
-       message,  including  the  terminating  zero. This value is greater than
+       yield  of  the  function is the size of buffer needed to hold the whole
+       message, including the terminating zero. This  value  is  greater  than
        errbuf_size if the message was truncated.
 
 
 MEMORY USAGE
 
-       Compiling a regular expression causes memory to be allocated and  asso-
-       ciated  with  the preg structure. The function regfree() frees all such
-       memory, after which preg may no longer be used as  a  compiled  expres-
+       Compiling  a regular expression causes memory to be allocated and asso-
+       ciated with the preg structure. The function regfree() frees  all  such
+       memory,  after  which  preg may no longer be used as a compiled expres-
        sion.
 
 
@@ -8702,8 +8816,8 @@ AUTHOR
 
 REVISION
 
-       Last updated: 29 November 2015
-       Copyright (c) 1997-2015 University of Cambridge.
+       Last updated: 31 January 2016
+       Copyright (c) 1997-2016 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -8722,12 +8836,12 @@ PCRE2 SAMPLE PROGRAM
        documentation. If you do not have a copy of the PCRE2 distribution, you
        can save this listing to re-create the contents of pcre2demo.c.
 
-       The demonstration program, which uses the PCRE2 8-bit library, compiles
-       the regular expression that is  its  first  argument,  and  matches  it
-       against the subject string in its second argument. No PCRE2 options are
-       set, and default character tables are used. If matching  succeeds,  the
-       program  outputs the portion of the subject that matched, together with
-       the contents of any captured substrings.
+       The  demonstration  program compiles the regular expression that is its
+       first argument, and matches it against the subject string in its second
+       argument.  No  PCRE2  options are set, and default character tables are
+       used. If matching succeeds, the program outputs the portion of the sub-
+       ject  that  matched,  together  with  the contents of any captured sub-
+       strings.
 
        If the -g option is given on the command line, the program then goes on
        to check for further matches of the same regular expression in the same
@@ -8735,38 +8849,45 @@ PCRE2 SAMPLE PROGRAM
        bility  of  matching an empty string. Comments in the code explain what
        is going on.
 
-       If PCRE2 is installed in the standard include and  library  directories
+       The code in pcre2demo.c is an 8-bit program that uses the  PCRE2  8-bit
+       library.  It  handles  strings  and characters that are stored in 8-bit
+       code units.  By default, one character corresponds to  one  code  unit,
+       but  if  the  pattern starts with "(*UTF)", both it and the subject are
+       treated as UTF-8 strings, where characters  may  occupy  multiple  code
+       units.
+
+       If  PCRE2  is installed in the standard include and library directories
        for your operating system, you should be able to compile the demonstra-
-       tion program using this command:
+       tion program using a command like this:
 
-         gcc -o pcre2demo pcre2demo.c -lpcre2-8
+         cc -o pcre2demo pcre2demo.c -lpcre2-8
 
        If PCRE2 is installed elsewhere, you may need to add additional options
-       to  the command line. For example, on a Unix-like system that has PCRE2
-       installed in /usr/local, you  can  compile  the  demonstration  program
+       to the command line. For example, on a Unix-like system that has  PCRE2
+       installed  in  /usr/local,  you  can  compile the demonstration program
        using a command like this:
 
-         gcc -o pcre2demo -I/usr/local/include pcre2demo.c \
-             -L/usr/local/lib -lpcre2-8
+         cc -o pcre2demo -I/usr/local/include pcre2demo.c \
+            -L/usr/local/lib -lpcre2-8
 
-
-       Once  you  have  compiled and linked the demonstration program, you can
-       run simple tests like this:
+       Once you have built the demonstration program, you can run simple tests
+       like this:
 
          ./pcre2demo 'cat|dog' 'the cat sat on the mat'
          ./pcre2demo -g 'cat|dog' 'the dog sat on the cat'
 
-       Note that there is a  much  more  comprehensive  test  program,  called
-       pcre2test,  which  supports  many  more  facilities for testing regular
-       expressions using the PCRE2 libraries. The pcre2demo  program  is  pro-
-       vided as a simple coding example.
+       Note  that  there  is  a  much  more comprehensive test program, called
+       pcre2test, which supports many  more  facilities  for  testing  regular
+       expressions using all three PCRE2 libraries (8-bit, 16-bit, and 32-bit,
+       though not all three need be installed). The pcre2demo program is  pro-
+       vided as a relatively simple coding example.
 
        If you try to run pcre2demo when PCRE2 is not installed in the standard
        library directory, you may get an error like  this  on  some  operating
        systems (e.g. Solaris):
 
-         ld.so.1:  a.out:  fatal:  libpcre2.so.0: open failed: No such file or
-       directory
+         ld.so.1: pcre2demo: fatal: libpcre2-8.so.0: open failed: No such file
+       or directory
 
        This is caused by the way shared library support works  on  those  sys-
        tems. You need to add
@@ -8785,8 +8906,8 @@ AUTHOR
 
 REVISION
 
-       Last updated: 20 October 2014
-       Copyright (c) 1997-2014 University of Cambridge.
+       Last updated: 02 February 2016
+       Copyright (c) 1997-2016 University of Cambridge.
 ------------------------------------------------------------------------------
 PCRE2SERIALIZE(3)          Library Functions Manual          PCRE2SERIALIZE(3)
 
@@ -8822,6 +8943,15 @@ SAVING AND RE-USING PRECOMPILED PCRE2 PATTERNS
        using the 8-bit library.
 
 
+SECURITY CONCERNS
+
+       The facility for saving and restoring compiled patterns is intended for
+       use within individual applications.  As  such,  the  data  supplied  to
+       pcre2_serialize_decode()  is expected to be trusted data, not data from
+       arbitrary external sources.  There  is  only  some  simple  consistency
+       checking, not complete validation of what is being re-loaded.
+
+
 SAVING COMPILED PATTERNS
 
        Before compiled patterns can be saved they must be serialized, that is,
@@ -8915,11 +9045,12 @@ RE-USING PRECOMPILED PATTERNS
        ignored. The yield of the function is the number of  decoded  patterns,
        or one of the following negative error codes:
 
-         PCRE2_ERROR_BADDATA   second argument is zero or less
-         PCRE2_ERROR_BADMAGIC  mismatch of id bytes in the data
-         PCRE2_ERROR_BADMODE   mismatch of variable unit size or PCRE2 version
-         PCRE2_ERROR_MEMORY    memory allocation failed
-         PCRE2_ERROR_NULL      first or third argument is NULL
+         PCRE2_ERROR_BADDATA    second argument is zero or less
+         PCRE2_ERROR_BADMAGIC   mismatch of id bytes in the data
+         PCRE2_ERROR_BADMODE    mismatch of code unit size or PCRE2 version
+         PCRE2_ERROR_BADSERIALIZEDDATA  other sanity check failure
+         PCRE2_ERROR_MEMORY     memory allocation failed
+         PCRE2_ERROR_NULL       first or third argument is NULL
 
        PCRE2_ERROR_BADMAGIC  may mean that the data is corrupt, or that it was
        compiled on a system with different endianness.
@@ -8951,8 +9082,8 @@ AUTHOR
 
 REVISION
 
-       Last updated: 03 November 2015
-       Copyright (c) 1997-2015 University of Cambridge.
+       Last updated: 24 May 2016
+       Copyright (c) 1997-2016 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -9609,15 +9740,19 @@ WIDE CHARACTERS AND UTF MODES
        In UTF modes, the dot metacharacter matches one UTF  character  instead
        of a single code unit.
 
-       The  escape  sequence  \C can be used to match a single code unit, in a
-       UTF mode, but its use can lead  to  some  strange  effects  because  it
-       breaks  up  multi-unit  characters  (see  the  description of \C in the
-       pcre2pattern documentation). The use of \C  is  not  supported  by  the
-       alternative  matching  function pcre2_dfa_match() when in UTF mode. Its
-       use provokes a match-time error. The JIT  optimization  also  does  not
-       support  \C  in  UTF  mode.  If JIT optimization is requested for a UTF
-       pattern that contains \C, it will not succeed, and so the matching will
-       be carried out by the normal interpretive function.
+       The escape sequence \C can be used to match a single code unit in a UTF
+       mode, but its use can lead to some strange effects because it breaks up
+       multi-unit  characters  (see  the description of \C in the pcre2pattern
+       documentation).
+
+       The use of \C is not supported by  the  alternative  matching  function
+       pcre2_dfa_match() when in UTF-8 or UTF-16 mode, that is, when a charac-
+       ter may consist of more than one code unit. The  use  of  \C  in  these
+       modes  provokes a match-time error. Also, the JIT optimization does not
+       support \C in these modes. If JIT optimization is requested for a UTF-8
+       or  UTF-16  pattern  that contains \C, it will not succeed, and so when
+       pcre2_match() is called, the matching will be carried out by the normal
+       interpretive function.
 
        The character escapes \b, \B, \d, \D, \s, \S, \w, and \W correctly test
        characters of any code value, but,  by  default,  the  characters  that
@@ -9769,9 +9904,9 @@ VALIDITY OF UTF STRINGS
        The following  negative  error  codes  are  given  for  invalid  UTF-16
        strings:
 
-         PCRE_UTF16_ERR1  Missing low surrogate at end of string
-         PCRE_UTF16_ERR2  Invalid low surrogate follows high surrogate
-         PCRE_UTF16_ERR3  Isolated low surrogate
+         PCRE2_ERROR_UTF16_ERR1  Missing low surrogate at end of string
+         PCRE2_ERROR_UTF16_ERR2  Invalid low surrogate follows high surrogate
+         PCRE2_ERROR_UTF16_ERR3  Isolated low surrogate
 
 
    Errors in UTF-32 strings
@@ -9779,8 +9914,8 @@ VALIDITY OF UTF STRINGS
        The  following  negative  error  codes  are  given  for  invalid UTF-32
        strings:
 
-         PCRE_UTF32_ERR1  Surrogate character (range from 0xd800 to 0xdfff)
-         PCRE_UTF32_ERR2  Code point is greater than 0x10ffff
+         PCRE2_ERROR_UTF32_ERR1  Surrogate character (0xd800 to 0xdfff)
+         PCRE2_ERROR_UTF32_ERR2  Code point is greater than 0x10ffff
 
 
 AUTHOR
@@ -9792,8 +9927,8 @@ AUTHOR
 
 REVISION
 
-       Last updated: 16 October 2015
-       Copyright (c) 1997-2015 University of Cambridge.
+       Last updated: 03 July 2016
+       Copyright (c) 1997-2016 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
diff --git a/doc/pcre2_code_copy.3 b/doc/pcre2_code_copy.3
new file mode 100644 (file)
index 0000000..270b3a6
--- /dev/null
@@ -0,0 +1,30 @@
+.TH PCRE2_CODE_COPY 3 "26 February 2016" "PCRE2 10.22"
+.SH NAME
+PCRE2 - Perl-compatible regular expressions (revised API)
+.SH SYNOPSIS
+.rs
+.sp
+.B #include <pcre2.h>
+.PP
+.nf
+.B pcre2_code *pcre2_code_copy(const pcre2_code *\fIcode\fP);
+.fi
+.
+.SH DESCRIPTION
+.rs
+.sp
+This function makes a copy of the memory used for a compiled pattern, excluding
+any memory used by the JIT compiler. Without a subsequent call to
+\fBpcre2_jit_compile()\fP, the copy can be used only for non-JIT matching. The
+yield of the function is NULL if \fIcode\fP is NULL or if sufficient memory
+cannot be obtained.
+.P
+There is a complete description of the PCRE2 native API in the
+.\" HREF
+\fBpcre2api\fP
+.\"
+page and a description of the POSIX API in the
+.\" HREF
+\fBpcre2posix\fP
+.\"
+page.
index 9ff53420de918ec96380529d45dd885424b147f9..9378b183588ccc5509bacc8b894d281542df02f4 100644 (file)
@@ -1,4 +1,4 @@
-.TH PCRE2_GET_ERROR_MESSAGE 3 "21 October 2014" "PCRE2 10.00"
+.TH PCRE2_GET_ERROR_MESSAGE 3 "17 June 2016" "PCRE2 10.22"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .SH SYNOPSIS
@@ -23,7 +23,10 @@ errors are negative numbers. The arguments are:
   \fIbufflen\fP     the length of the buffer (code units)
 .sp
 The function returns the length of the message, excluding the trailing zero, or
-a negative error code if the buffer is too small.
+the negative error code PCRE2_ERROR_NOMEMORY if the buffer is too small. In
+this case, the returned message is truncated (but still with a trailing zero).
+If \fIerrorcode\fP does not contain a recognized error code number, the
+negative value PCRE2_ERROR_BADDATA is returned.
 .P
 There is a complete description of the PCRE2 native API in the
 .\" HREF
index b29f7b0bcb35557bb50afea7d080e2d937951eca..db61ea065e66845d1142bedd7cb7956301f43d50 100644 (file)
@@ -1,4 +1,4 @@
-.TH PCRE2API 3 "16 December 2015" "PCRE2 10.21"
+.TH PCRE2API 3 "17 June 2016" "PCRE2 10.22"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .sp
@@ -233,6 +233,8 @@ document for an overview of all the PCRE2 documentation.
 .rs
 .sp
 .nf
+.B pcre2_code *pcre2_code_copy(const pcre2_code *\fIcode\fP);
+.sp
 .B int pcre2_get_error_message(int \fIerrorcode\fP, PCRE2_UCHAR *\fIbuffer\fP,
 .B "  PCRE2_SIZE \fIbufflen\fP);"
 .sp
@@ -352,9 +354,10 @@ More complicated programs might need to make use of the specialist functions
 \fBpcre2_jit_stack_create()\fP, \fBpcre2_jit_stack_free()\fP, and
 \fBpcre2_jit_stack_assign()\fP in order to control the JIT code's memory usage.
 .P
-JIT matching is automatically used by \fBpcre2_match()\fP if it is available.
-There is also a direct interface for JIT matching, which gives improved
-performance. The JIT-specific functions are discussed in the
+JIT matching is automatically used by \fBpcre2_match()\fP if it is available,
+unless the PCRE2_NO_JIT option is set. There is also a direct interface for JIT
+matching, which gives improved performance. The JIT-specific functions are
+discussed in the
 .\" HREF
 \fBpcre2jit\fP
 .\"
@@ -393,9 +396,16 @@ The function \fBpcre2_substitute()\fP can be called to match a pattern and
 return a copy of the subject string with substitutions for parts that were
 matched.
 .P
+Functions whose names begin with \fBpcre2_serialize_\fP are used for saving
+compiled patterns on disc or elsewhere, and reloading them later.
+.P
 Finally, there are functions for finding out information about a compiled
 pattern (\fBpcre2_pattern_info()\fP) and about the configuration with which
 PCRE2 was built (\fBpcre2_config()\fP).
+.P
+Functions with names ending with \fB_free()\fP are used for freeing memory
+blocks of various sorts. In all cases, if one of these functions is called with
+a NULL argument, it does nothing.
 .
 .
 .SH "STRING LENGTHS AND OFFSETS"
@@ -461,21 +471,52 @@ time ensuring that multithreaded applications can use it.
 .P
 There are several different blocks of data that are used to pass information
 between the application and the PCRE2 libraries.
-.P
-(1) A pointer to the compiled form of a pattern is returned to the user when
+.
+.
+.SS "The compiled pattern"
+.rs
+.sp
+A pointer to the compiled form of a pattern is returned to the user when
 \fBpcre2_compile()\fP is successful. The data in the compiled pattern is fixed,
 and does not change when the pattern is matched. Therefore, it is thread-safe,
 that is, the same compiled pattern can be used by more than one thread
-simultaneously. An application can compile all its patterns at the start,
-before forking off multiple threads that use them. However, if the just-in-time
-optimization feature is being used, it needs separate memory stack areas for
-each thread. See the
+simultaneously. For example, an application can compile all its patterns at the
+start, before forking off multiple threads that use them. However, if the
+just-in-time optimization feature is being used, it needs separate memory stack
+areas for each thread. See the
 .\" HREF
 \fBpcre2jit\fP
 .\"
 documentation for more details.
 .P
-(2) The next section below introduces the idea of "contexts" in which PCRE2
+In a more complicated situation, where patterns are compiled only when they are
+first needed, but are still shared between threads, pointers to compiled
+patterns must be protected from simultaneous writing by multiple threads, at
+least until a pattern has been compiled. The logic can be something like this:
+.sp
+  Get a read-only (shared) lock (mutex) for pointer
+  if (pointer == NULL)
+    {
+    Get a write (unique) lock for pointer
+    pointer = pcre2_compile(...
+    }
+  Release the lock
+  Use pointer in pcre2_match()
+.sp
+Of course, testing for compilation errors should also be included in the code.
+.P
+If JIT is being used, but the JIT compilation is not being done immediately,
+(perhaps waiting to see if the pattern is used often enough) similar logic is
+required. JIT compilation updates a pointer within the compiled code block, so
+a thread must gain unique write access to the pointer before calling
+\fBpcre2_jit_compile()\fP. Alternatively, \fBpcre2_code_copy()\fP can be used
+to obtain a private copy of the compiled code.
+.
+.
+.SS "Context blocks"
+.rs
+.sp
+The next main section below introduces the idea of "contexts" in which PCRE2
 functions are called. A context is nothing more than a collection of parameters
 that control the way PCRE2 operates. Grouping a number of parameters together
 in a context is a convenient way of passing them to a PCRE2 function without
@@ -487,11 +528,15 @@ In a multithreaded application, if the parameters in a context are values that
 are never changed, the same context can be used by all the threads. However, if
 any thread needs to change any value in a context, it must make its own
 thread-specific copy.
-.P
-(3) The matching functions need a block of memory for working space and for
-storing the results of a match. This includes details of what was matched, as
-well as additional information such as the name of a (*MARK) setting. Each
-thread must provide its own version of this memory.
+.
+.
+.SS "Match blocks"
+.rs
+.sp
+The matching functions need a block of memory for working space and for storing
+the results of a match. This includes details of what was matched, as well as
+additional information such as the name of a (*MARK) setting. Each thread must
+provide its own copy of this memory.
 .
 .
 .SH "PCRE2 CONTEXTS"
@@ -979,34 +1024,51 @@ zero.
 .B "  pcre2_compile_context *\fIccontext\fP);"
 .sp
 .B void pcre2_code_free(pcre2_code *\fIcode\fP);
+.sp
+.B pcre2_code *pcre2_code_copy(const pcre2_code *\fIcode\fP);
 .fi
 .P
 The \fBpcre2_compile()\fP function compiles a pattern into an internal form.
-The pattern is defined by a pointer to a string of code units and a length, If
+The pattern is defined by a pointer to a string of code units and a length. If
 the pattern is zero-terminated, the length can be specified as
 PCRE2_ZERO_TERMINATED. The function returns a pointer to a block of memory that
-contains the compiled pattern and related data. The caller must free the memory
-by calling \fBpcre2_code_free()\fP when it is no longer needed.
+contains the compiled pattern and related data, or NULL if an error occurred.
+.P
+If the compile context argument \fIccontext\fP is NULL, memory for the compiled
+pattern is obtained by calling \fBmalloc()\fP. Otherwise, it is obtained from
+the same memory function that was used for the compile context. The caller must
+free the memory by calling \fBpcre2_code_free()\fP when it is no longer needed.
+.P
+The function \fBpcre2_code_copy()\fP makes a copy of the compiled code in new
+memory, using the same memory allocator as was used for the original. However,
+if the code has been processed by the JIT compiler (see
+.\" HTML <a href="#jitcompiling">
+.\" </a>
+below),
+.\"
+the JIT information cannot be copied (because it is position-dependent).
+The new copy can initially be used only for non-JIT matching, though it can be
+passed to \fBpcre2_jit_compile()\fP if required. The \fBpcre2_code_copy()\fP
+function provides a way for individual threads in a multithreaded application
+to acquire a private copy of shared compiled code.
 .P
 NOTE: When one of the matching functions is called, pointers to the compiled
 pattern and the subject string are set in the match data block so that they can
-be referenced by the extraction functions. After running a match, you must not
-free a compiled pattern (or a subject string) until after all operations on the
+be referenced by the substring extraction functions. After running a match, you
+must not free a compiled pattern (or a subject string) until after all
+operations on the
 .\" HTML <a href="#matchdatablock">
 .\" </a>
 match data block
 .\"
 have taken place.
 .P
-If the compile context argument \fIccontext\fP is NULL, memory for the compiled
-pattern is obtained by calling \fBmalloc()\fP. Otherwise, it is obtained from
-the same memory function that was used for the compile context.
-.P
-The \fIoptions\fP argument contains various bit settings that affect the
-compilation. It should be zero if no options are required. The available
-options are described below. Some of them (in particular, those that are
-compatible with Perl, but some others as well) can also be set and unset from
-within the pattern (see the detailed description in the
+The \fIoptions\fP argument for \fBpcre2_compile()\fP contains various bit
+settings that affect the compilation. It should be zero if no options are
+required. The available options are described below. Some of them (in
+particular, those that are compatible with Perl, but some others as well) can
+also be set and unset from within the pattern (see the detailed description in
+the
 .\" HREF
 \fBpcre2pattern\fP
 .\"
@@ -1025,13 +1087,22 @@ above).
 .\"
 .P
 If \fIerrorcode\fP or \fIerroroffset\fP is NULL, \fBpcre2_compile()\fP returns
-NULL immediately. Otherwise, if compilation of a pattern fails,
-\fBpcre2_compile()\fP returns NULL, having set these variables to an error code
-and an offset (number of code units) within the pattern, respectively. The
-\fBpcre2_get_error_message()\fP function provides a textual message for each
-error code. Compilation errors are positive numbers, but UTF formatting errors
-are negative numbers. For an invalid UTF-8 or UTF-16 string, the offset is that
-of the first code unit of the failing character.
+NULL immediately. Otherwise, the variables to which these point are set to an
+error code and an offset (number of code units) within the pattern,
+respectively, when \fBpcre2_compile()\fP returns NULL because a compilation
+error has occurred. The values are not defined when compilation is successful
+and \fBpcre2_compile()\fP returns a non-NULL value.
+.P
+The \fBpcre2_get_error_message()\fP function (see "Obtaining a textual error
+message"
+.\" HTML <a href="#geterrormessage">
+.\" </a>
+below)
+.\"
+provides a textual message for each error code. Compilation errors have
+positive error codes; UTF formatting error codes are negative. For an invalid
+UTF-8 or UTF-16 string, the offset is that of the first code unit of the
+failing character.
 .P
 Some errors are not detected until the whole pattern has been scanned; in these
 cases, the offset passed back is the length of the pattern. Note that the
@@ -1255,7 +1326,9 @@ If this option is set, it disables the use of numbered capturing parentheses in
 the pattern. Any opening parenthesis that is not followed by ? behaves as if it
 were followed by ?: but named parentheses can still be used for capturing (and
 they acquire numbers in the usual way). There is no equivalent of this option
-in Perl.
+in Perl. Note that, if this option is set, references to capturing groups (back
+references or recursion/subroutine calls) may only refer to named groups,
+though the reference can be by name or by number.
 .sp
   PCRE2_NO_AUTO_POSSESS
 .sp
@@ -1416,17 +1489,24 @@ page.
 .SH "COMPILATION ERROR CODES"
 .rs
 .sp
-There are over 80 positive error codes that \fBpcre2_compile()\fP may return if
-it finds an error in the pattern. There are also some negative error codes that
-are used for invalid UTF strings. These are the same as given by
-\fBpcre2_match()\fP and \fBpcre2_dfa_match()\fP, and are described in the
+There are over 80 positive error codes that \fBpcre2_compile()\fP may return
+(via \fIerrorcode\fP) if it finds an error in the pattern. There are also some
+negative error codes that are used for invalid UTF strings. These are the same
+as given by \fBpcre2_match()\fP and \fBpcre2_dfa_match()\fP, and are described
+in the
 .\" HREF
 \fBpcre2unicode\fP
 .\"
-page. The \fBpcre2_get_error_message()\fP function can be called to obtain a
-textual error message from any error code.
+page. The \fBpcre2_get_error_message()\fP function (see "Obtaining a textual
+error message"
+.\" HTML <a href="#geterrormessage">
+.\" </a>
+below)
+.\"
+can be called to obtain a textual error message from any error code.
 .
 .
+.\" HTML <a name="jitcompiling"></a>
 .SH "JUST-IN-TIME (JIT) COMPILATION"
 .rs
 .sp
@@ -1565,10 +1645,14 @@ are as follows:
 Return a copy of the pattern's options. The third argument should point to a
 \fBuint32_t\fP variable. PCRE2_INFO_ARGOPTIONS returns exactly the options that
 were passed to \fBpcre2_compile()\fP, whereas PCRE2_INFO_ALLOPTIONS returns
-the compile options as modified by any top-level option settings such as (*UTF)
-at the start of the pattern itself. For example, if the pattern /(*UTF)abc/ is
-compiled with the PCRE2_EXTENDED option, the result is PCRE2_EXTENDED and
-PCRE2_UTF.
+the compile options as modified by any top-level (*XXX) option settings such as
+(*UTF) at the start of the pattern itself.
+.P
+For example, if the pattern /(*UTF)abc/ is compiled with the PCRE2_EXTENDED
+option, the result for PCRE2_INFO_ALLOPTIONS is PCRE2_EXTENDED and PCRE2_UTF.
+Option settings such as (?i) that can change within a pattern do not affect the
+result of PCRE2_INFO_ALLOPTIONS, even if they appear right at the start of the
+pattern. (This was different in some earlier releases.)
 .P
 A pattern compiled without PCRE2_ANCHORED is automatically anchored by PCRE2 if
 the first significant item in every top-level branch is one of the following:
@@ -2043,13 +2127,14 @@ pattern does not require the match to be at the start of the subject.
 .sp
 The unused bits of the \fIoptions\fP argument for \fBpcre2_match()\fP must be
 zero. The only bits that may be set are PCRE2_ANCHORED, PCRE2_NOTBOL,
-PCRE2_NOTEOL, PCRE2_NOTEMPTY, PCRE2_NOTEMPTY_ATSTART, PCRE2_NO_UTF_CHECK,
-PCRE2_PARTIAL_HARD, and PCRE2_PARTIAL_SOFT. Their action is described below.
+PCRE2_NOTEOL, PCRE2_NOTEMPTY, PCRE2_NOTEMPTY_ATSTART, PCRE2_NO_JIT,
+PCRE2_NO_UTF_CHECK, PCRE2_PARTIAL_HARD, and PCRE2_PARTIAL_SOFT. Their action is
+described below.
 .P
 Setting PCRE2_ANCHORED at match time is not supported by the just-in-time (JIT)
 compiler. If it is set, JIT matching is disabled and the normal interpretive
-code in \fBpcre2_match()\fP is run. The remaining options are supported for JIT
-matching.
+code in \fBpcre2_match()\fP is run. Apart from PCRE2_NO_JIT (obviously), the
+remaining options are supported for JIT matching.
 .sp
   PCRE2_ANCHORED
 .sp
@@ -2096,6 +2181,13 @@ only at the first matching position, that is, at the start of the subject plus
 the starting offset. An empty string match later in the subject is permitted.
 If the pattern is anchored, such a match can occur only if the pattern contains
 \eK.
+.sp
+  PCRE2_NO_JIT
+.sp
+By default, if a pattern has been successfully processed by
+\fBpcre2_jit_compile()\fP, JIT is automatically used when \fBpcre2_match()\fP
+is called with options that JIT supports. Setting PCRE2_NO_JIT disables the use
+of JIT; it forces matching to be done by the interpreter.
 .sp
   PCRE2_NO_UTF_CHECK
 .sp
@@ -2378,11 +2470,16 @@ page.
 .rs
 .sp
 If \fBpcre2_match()\fP fails, it returns a negative number. This can be
-converted to a text string by calling \fBpcre2_get_error_message()\fP. Negative
-error codes are also returned by other functions, and are documented with them.
-The codes are given names in the header file. If UTF checking is in force and
-an invalid UTF subject string is detected, one of a number of UTF-specific
-negative error codes is returned. Details are given in the
+converted to a text string by calling the \fBpcre2_get_error_message()\fP
+function (see "Obtaining a textual error message"
+.\" HTML <a href="#geterrormessage">
+.\" </a>
+below).
+.\"
+Negative error codes are also returned by other functions, and are documented
+with them. The codes are given names in the header file. If UTF checking is in
+force and an invalid UTF subject string is detected, one of a number of
+UTF-specific negative error codes is returned. Details are given in the
 .\" HREF
 \fBpcre2unicode\fP
 .\"
@@ -2495,6 +2592,30 @@ is attempted.
 The internal recursion limit was reached.
 .
 .
+.\" HTML <a name="geterrormessage"></a>
+.SH "OBTAINING A TEXTUAL ERROR MESSAGE"
+.rs
+.sp
+.nf
+.B int pcre2_get_error_message(int \fIerrorcode\fP, PCRE2_UCHAR *\fIbuffer\fP,
+.B "  PCRE2_SIZE \fIbufflen\fP);"
+.fi
+.P
+A text message for an error code from any PCRE2 function (compile, match, or
+auxiliary) can be obtained by calling \fBpcre2_get_error_message()\fP. The code
+is passed as the first argument, with the remaining two arguments specifying a
+code unit buffer and its length, into which the text message is placed. Note
+that the message is returned in code units of the appropriate width for the
+library that is being used.
+.P
+The returned message is terminated with a trailing zero, and the function
+returns the number of code units used, excluding the trailing zero. If the
+error number is unknown, the negative error code PCRE2_ERROR_BADDATA is
+returned. If the buffer is too small, the message is truncated (but still with
+a trailing zero), and the negative error code PCRE2_ERROR_NOMEMORY is returned.
+None of the messages are very long; a buffer size of 120 code units is ample.
+.
+.
 .\" HTML <a name="extractbynumber"></a>
 .SH "EXTRACTING CAPTURED SUBSTRINGS BY NUMBER"
 .rs
@@ -2872,7 +2993,12 @@ substitution), and PCRE2_BADSUBPATTERN (the pattern match ended before it
 started, which can happen if \eK is used in an assertion).
 .P
 As for all PCRE2 errors, a text message that describes the error can be
-obtained by calling \fBpcre2_get_error_message()\fP.
+obtained by calling the \fBpcre2_get_error_message()\fP function (see
+"Obtaining a textual error message"
+.\" HTML <a href="#geterrormessage">
+.\" </a>
+above).
+.\"
 .
 .
 .SH "DUPLICATE SUBPATTERN NAMES"
@@ -3166,6 +3292,6 @@ Cambridge, England.
 .rs
 .sp
 .nf
-Last updated: 16 December 2015
-Copyright (c) 1997-2015 University of Cambridge.
+Last updated: 17 June 2016
+Copyright (c) 1997-2016 University of Cambridge.
 .fi
index a90f1b2f0ca7eccb9e8ec81ccd6bb69598722a0c..11b1c573ac21aad46085f29639676ba3bdeaa1a5 100644 (file)
@@ -1,4 +1,4 @@
-.TH PCRE2BUILD 3 "16 October 2015" "PCRE2 10.21"
+.TH PCRE2BUILD 3 "01 April 2016" "PCRE2 10.22"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .
@@ -352,6 +352,19 @@ and equivalent run-time options, refer to these character values in an EBCDIC
 environment.
 .
 .
+.SH "PCRE2GREP SUPPORT FOR EXTERNAL SCRIPTS"
+.rs
+.sp
+By default, on non-Windows systems, \fBpcre2grep\fP supports the use of
+callouts with string arguments within the patterns it is matching, in order to
+run external scripts. For details, see the
+.\" HREF
+\fBpcre2grep\fP
+.\"
+documentation. This support can be disabled by adding
+--disable-pcre2grep-callout to the \fBconfigure\fP command.
+.
+.
 .SH "PCRE2GREP OPTIONS FOR COMPRESSED FILE SUPPORT"
 .rs
 .sp
@@ -381,7 +394,7 @@ parameter value by adding, for example,
   --with-pcre2grep-bufsize=50K
 .sp
 to the \fBconfigure\fP command. The caller of \fPpcre2grep\fP can override this
-value by using --buffer-size on the command line..
+value by using --buffer-size on the command line.
 .
 .
 .SH "PCRE2TEST OPTION FOR LIBREADLINE SUPPORT"
@@ -519,6 +532,6 @@ Cambridge, England.
 .rs
 .sp
 .nf
-Last updated: 16 October 2015
-Copyright (c) 1997-2015 University of Cambridge.
+Last updated: 01 April 2016
+Copyright (c) 1997-2016 University of Cambridge.
 .fi
index 5deed0a05cbeaed5078d06006e2e9287eabdb411..c02dcd95c26e5d7428f62e75709dfdf3235bd808 100644 (file)
 *************************************************/
 
 /* This is a demonstration program to illustrate a straightforward way of
-calling the PCRE2 regular expression library from a C program. See the
+using the PCRE2 regular expression library from a C program. See the
 pcre2sample documentation for a short discussion ("man pcre2sample" if you have
 the PCRE2 man pages installed). PCRE2 is a revised API for the library, and is
 incompatible with the original PCRE API.
 
 There are actually three libraries, each supporting a different code unit
-width. This demonstration program uses the 8-bit library.
+width. This demonstration program uses the 8-bit library. The default is to
+process each code unit as a separate character, but if the pattern begins with
+"(*UTF)", both it and the subject are treated as UTF-8 strings, where
+characters may occupy multiple code units.
 
 In Unix-like environments, if PCRE2 is installed in your standard system
 libraries, you should be able to compile this program using this command:
 
-gcc -Wall pcre2demo.c -lpcre2-8 -o pcre2demo
+cc -Wall pcre2demo.c -lpcre2-8 -o pcre2demo
 
 If PCRE2 is not installed in a standard place, it is likely to be installed
 with support for the pkg-config mechanism. If you have pkg-config, you can
 compile this program using this command:
 
-gcc -Wall pcre2demo.c `pkg-config --cflags --libs libpcre2-8` -o pcre2demo
+cc -Wall pcre2demo.c `pkg-config --cflags --libs libpcre2-8` -o pcre2demo
 
-If you do not have pkg-config, you may have to use this:
+If you do not have pkg-config, you may have to use something like this:
 
-gcc -Wall pcre2demo.c -I/usr/local/include -L/usr/local/lib \e
+cc -Wall pcre2demo.c -I/usr/local/include -L/usr/local/lib \e
   -R/usr/local/lib -lpcre2-8 -o pcre2demo
 
 Replace "/usr/local/include" and "/usr/local/lib" with wherever the include and
@@ -56,9 +59,14 @@ the following line. */
 
 /* #define PCRE2_STATIC */
 
-/* This macro must be defined before including pcre2.h. For a program that uses
-only one code unit width, it makes it possible to use generic function names
-such as pcre2_compile(). */
+/* The PCRE2_CODE_UNIT_WIDTH macro must be defined before including pcre2.h.
+For a program that uses only one code unit width, setting it to 8, 16, or 32
+makes it possible to use generic function names such as pcre2_compile(). Note
+that just changing 8 to 16 (for example) is not sufficient to convert this
+program to process 16-bit characters. Even in a fully 16-bit environment, where
+string-handling functions such as strcmp() and printf() work with 16-bit
+characters, the code for handling the table of named substrings will still need
+to be modified. */
 
 #define PCRE2_CODE_UNIT_WIDTH 8
 
@@ -79,19 +87,19 @@ int main(int argc, char **argv)
 {
 pcre2_code *re;
 PCRE2_SPTR pattern;     /* PCRE2_SPTR is a pointer to unsigned code units of */
-PCRE2_SPTR subject;     /* the appropriate width (8, 16, or 32 bits). */
+PCRE2_SPTR subject;     /* the appropriate width (in this case, 8 bits). */
 PCRE2_SPTR name_table;
 
 int crlf_is_newline;
 int errornumber;
 int find_all;
 int i;
-int namecount;
-int name_entry_size;
 int rc;
 int utf8;
 
 uint32_t option_bits;
+uint32_t namecount;
+uint32_t name_entry_size;
 uint32_t newline;
 
 PCRE2_SIZE erroroffset;
@@ -106,15 +114,19 @@ pcre2_match_data *match_data;
 * First, sort out the command line. There is only one possible option at  *
 * the moment, "-g" to request repeated matching to find all occurrences,  *
 * like Perl's /g option. We set the variable find_all to a non-zero value *
-* if the -g option is present. Apart from that, there must be exactly two *
-* arguments.                                                              *
+* if the -g option is present.                                            *
 **************************************************************************/
 
 find_all = 0;
 for (i = 1; i < argc; i++)
   {
   if (strcmp(argv[i], "-g") == 0) find_all = 1;
-    else break;
+  else if (argv[i][0] == '-')
+    {
+    printf("Unrecognised option %s\en", argv[i]);
+    return 1;
+    }
+  else break;
   }
 
 /* After the options, we require exactly two arguments, which are the pattern,
@@ -122,7 +134,7 @@ and the subject string. */
 
 if (argc - i != 2)
   {
-  printf("Two arguments required: a regex and a subject string\en");
+  printf("Exactly two arguments required: a regex and a subject string\en");
   return 1;
   }
 
@@ -201,7 +213,7 @@ if (rc < 0)
 stored. */
 
 ovector = pcre2_get_ovector_pointer(match_data);
-printf("\enMatch succeeded at offset %d\en", (int)ovector[0]);
+printf("Match succeeded at offset %d\en", (int)ovector[0]);
 
 
 /*************************************************************************
@@ -242,7 +254,7 @@ we have to extract the count of named parentheses from the pattern. */
   PCRE2_INFO_NAMECOUNT, /* get the number of named substrings */
   &namecount);          /* where to put the answer */
 
-if (namecount <= 0) printf("No named substrings\en"); else
+if (namecount == 0) printf("No named substrings\en"); else
   {
   PCRE2_SPTR tabptr;
   printf("Named substrings\en");
@@ -330,8 +342,8 @@ crlf_is_newline = newline == PCRE2_NEWLINE_ANY ||
 
 for (;;)
   {
-  uint32_t options = 0;                    /* Normally no options */
-  PCRE2_SIZE start_offset = ovector[1];  /* Start at end of previous match */
+  uint32_t options = 0;                   /* Normally no options */
+  PCRE2_SIZE start_offset = ovector[1];   /* Start at end of previous match */
 
   /* If the previous match was for an empty string, we are finished if we are
   at the end of the subject. Otherwise, arrange to run another match at the
@@ -371,7 +383,7 @@ for (;;)
     {
     if (options == 0) break;                    /* All matches found */
     ovector[1] = start_offset + 1;              /* Advance one code unit */
-    if (crlf_is_newline &&                      /* If CRLF is newline & */
+    if (crlf_is_newline &&                      /* If CRLF is newline & */
         start_offset < subject_length - 1 &&    /* we are at CRLF, */
         subject[start_offset] == '\er' &&
         subject[start_offset + 1] == '\en')
@@ -417,7 +429,7 @@ for (;;)
     printf("%2d: %.*s\en", i, (int)substring_length, (char *)substring_start);
     }
 
-  if (namecount <= 0) printf("No named substrings\en"); else
+  if (namecount == 0) printf("No named substrings\en"); else
     {
     PCRE2_SPTR tabptr = name_table;
     printf("Named substrings\en");
index 028a91e4e8a41afef0963ac945d1d25cb5c541d6..6d277801eb8529a1f52a15e957eeee6f15c083a5 100644 (file)
@@ -1,4 +1,4 @@
-.TH PCRE2GREP 1 "03 January 2015" "PCRE2 10.00"
+.TH PCRE2GREP 1 "19 June 2016" "PCRE2 10.22"
 .SH NAME
 pcre2grep - a grep with Perl-compatible regular expressions.
 .SH SYNOPSIS
@@ -440,10 +440,15 @@ one line. The first is the line in which the match started, and the last is the
 line in which the match ended. If the matched string ends with a newline
 sequence the output ends at the end of that line.
 .sp
-When this option is set, the PCRE2 library is called in "multiline" mode.
-However, \fBpcre2grep\fP still processes the input line by line. The difference
-is that a matched string may extend past the end of a line and continue on
-one or more subsequent lines. The newline sequence must be matched as part of
+When this option is set, the PCRE2 library is called in "multiline" mode. This
+allows a matched string to extend past the end of a line and continue on one or
+more subsequent lines. However, \fBpcre2grep\fP still processes the input line
+by line. Once a match has been handled, scanning restarts at the beginning of
+the next line, just as it does when \fB-M\fP is not present. This means that it
+is possible for the second or subsequent lines in a multiline match to be
+output again as part of another match.
+.sp
+The newline sequence that separates multiple lines must be matched as part of
 the pattern. For example, to find the phrase "regular expression" in a file
 where "regular" might be at the end of a line and "expression" at the start of
 the next line, you could use this command:
@@ -653,6 +658,58 @@ options does have data, it must be given in the first form, using an equals
 character. Otherwise \fBpcre2grep\fP will assume that it has no data.
 .
 .
+.SH "CALLING EXTERNAL SCRIPTS"
+.rs
+.sp
+On non-Windows systems, \fBpcre2grep\fP has, by default, support for calling
+external programs or scripts during matching by making use of PCRE2's callout
+facility. However, this support can be disabled when \fBpcre2grep\fP is built.
+You can find out whether your binary has support for callouts by running it
+with the \fB--help\fP option. If the support is not enabled, all callouts in
+patterns are ignored by \fBpcre2grep\fP.
+.P
+A callout in a PCRE2 pattern is of the form (?C<arg>) where the argument is
+either a number or a quoted string (see the
+.\" HREF
+\fBpcre2callout\fP
+.\"
+documentation for details). Numbered callouts are ignored by \fBpcre2grep\fP.
+String arguments are parsed as a list of substrings separated by pipe (vertical
+bar) characters. The first substring must be an executable name, with the
+following substrings specifying arguments:
+.sp
+  executable_name|arg1|arg2|...
+.sp
+Any substring (including the executable name) may contain escape sequences
+started by a dollar character: $<digits> or ${<digits>} is replaced by the
+captured substring of the given decimal number, which must be greater than
+zero. If the number is greater than the number of capturing substrings, or if
+the capture is unset, the replacement is empty.
+.P
+Any other character is substituted by itself. In particular, $$ is replaced by
+a single dollar and $| is replaced by a pipe character. Here is an example:
+.sp
+  echo -e "abcde\en12345" | pcre2grep \e
+    '(?x)(.)(..(.))
+    (?C"/bin/echo|Arg1: [$1] [$2] [$3]|Arg2: $|${1}$| ($4)")()' -
+.sp
+  Output:
+.sp
+    Arg1: [a] [bcd] [d] Arg2: |a| ()
+    abcde
+    Arg1: [1] [234] [4] Arg2: |1| ()
+    12345
+.sp
+The parameters for the \fBexecv()\fP system call that is used to run the
+program or script are zero-terminated strings. This means that binary zero
+characters in the callout argument will cause premature termination of their
+substrings, and therefore should not be present. Any syntax errors in the
+string (for example, a dollar not followed by another character) cause the
+callout to be ignored. If running the program fails for any reason (including
+the non-existence of the executable), a local matching failure occurs and the
+matcher backtracks in the normal way.
+.
+.
 .SH "MATCHING ERRORS"
 .rs
 .sp
@@ -683,7 +740,7 @@ affect the return code.
 .SH "SEE ALSO"
 .rs
 .sp
-\fBpcre2pattern\fP(3), \fBpcre2syntax\fP(3).
+\fBpcre2pattern\fP(3), \fBpcre2syntax\fP(3), \fBpcre2callout\fP(3).
 .
 .
 .SH AUTHOR
@@ -700,6 +757,6 @@ Cambridge, England.
 .rs
 .sp
 .nf
-Last updated: 03 January 2015
-Copyright (c) 1997-2015 University of Cambridge.
+Last updated: 19 June 2016
+Copyright (c) 1997-2016 University of Cambridge.
 .fi
index 29cd75cfad0ab7cffded89b0104c1009e3d29686..31aa610d84303300a08794c4dcbe4265ddcd6e38 100644 (file)
@@ -493,14 +493,20 @@ OPTIONS
                  end of that line.
 
                  When this option is set, the PCRE2 library is called in "mul-
-                 tiline"  mode.   However, pcre2grep still processes the input
-                 line by line. The difference is that  a  matched  string  may
-                 extend  past  the  end  of a line and continue on one or more
-                 subsequent lines. The newline sequence  must  be  matched  as
-                 part of the pattern. For example, to find the phrase "regular
-                 expression" in a file where "regular" might be at the end  of
-                 a  line  and  "expression" at the start of the next line, you
-                 could use this command:
+                 tiline" mode. This allows a matched string to extend past the
+                 end of a line and continue on one or more  subsequent  lines.
+                 However,  pcre2grep  still  processes the input line by line.
+                 Once a match has  been  handled,  scanning  restarts  at  the
+                 beginning  of  the  next line, just as it does when -M is not
+                 present. This means that it is possible  for  the  second  or
+                 subsequent  lines  in a multiline match to be output again as
+                 part of another match.
+
+                 The newline sequence that separates multiple  lines  must  be
+                 matched  as  part  of  the  pattern. For example, to find the
+                 phrase "regular expression" in a file where  "regular"  might
+                 be  at the end of a line and "expression" at the start of the
+                 next line, you could use this command:
 
                    pcre2grep -M 'regular\s+expression' <file>
 
@@ -725,35 +731,86 @@ OPTIONS WITH DATA
        equals character. Otherwise pcre2grep will assume that it has no data.
 
 
+CALLING EXTERNAL SCRIPTS
+
+       On non-Windows systems, pcre2grep has, by default, support for  calling
+       external  programs  or scripts during matching by making use of PCRE2's
+       callout facility. However, this support can be disabled when  pcre2grep
+       is  built.   You can find out whether your binary has support for call-
+       outs by running it with the  --help  option.  If  the  support  is  not
+       enabled, all callouts in patterns are ignored by pcre2grep.
+
+       A  callout  in a PCRE2 pattern is of the form (?C<arg>) where the argu-
+       ment is either a number or a quoted string (see the pcre2callout  docu-
+       mentation  for  details).  Numbered  callouts are ignored by pcre2grep.
+       String arguments are parsed as a list of substrings separated  by  pipe
+       (vertical  bar)  characters.  The first substring must be an executable
+       name, with the following substrings specifying arguments:
+
+         executable_name|arg1|arg2|...
+
+       Any substring  (including  the  executable  name)  may  contain  escape
+       sequences  started  by  a dollar character: $<digits> or ${<digits>} is
+       replaced by the captured substring of the given decimal  number,  which
+       must  be greater than zero. If the number is greater than the number of
+       capturing substrings, or if the capture is unset,  the  replacement  is
+       empty.
+
+       Any  other  character  is  substituted  by itself. In particular, $$ is
+       replaced by a single dollar and $| is replaced  by  a  pipe  character.
+       Here is an example:
+
+         echo -e "abcde\n12345" | pcre2grep \
+           '(?x)(.)(..(.))
+           (?C"/bin/echo|Arg1: [$1] [$2] [$3]|Arg2: $|${1}$| ($4)")()' -
+
+         Output:
+
+           Arg1: [a] [bcd] [d] Arg2: |a| ()
+           abcde
+           Arg1: [1] [234] [4] Arg2: |1| ()
+           12345
+
+       The parameters for the execv() system call that is used to run the pro-
+       gram or script are zero-terminated strings. This means that binary zero
+       characters  in the callout argument will cause premature termination of
+       their substrings, and therefore  should  not  be  present.  Any  syntax
+       errors  in  the  string  (for example, a dollar not followed by another
+       character) cause the callout to be  ignored.  If  running  the  program
+       fails for any reason (including the non-existence of the executable), a
+       local matching failure occurs and the matcher backtracks in the  normal
+       way.
+
+
 MATCHING ERRORS
 
-       It is possible to supply a regular expression that takes  a  very  long
-       time  to  fail  to  match certain lines. Such patterns normally involve
-       nested indefinite repeats, for example: (a+)*\d when matched against  a
-       line  of  a's  with  no  final digit. The PCRE2 matching function has a
-       resource limit that causes it to abort in these circumstances. If  this
-       happens,  pcre2grep  outputs  an error message and the line that caused
-       the problem to the standard error stream. If there  are  more  than  20
+       It  is  possible  to supply a regular expression that takes a very long
+       time to fail to match certain lines.  Such  patterns  normally  involve
+       nested  indefinite repeats, for example: (a+)*\d when matched against a
+       line of a's with no final digit. The  PCRE2  matching  function  has  a
+       resource  limit that causes it to abort in these circumstances. If this
+       happens, pcre2grep outputs an error message and the  line  that  caused
+       the  problem  to  the  standard error stream. If there are more than 20
        such errors, pcre2grep gives up.
 
-       The  --match-limit  option  of pcre2grep can be used to set the overall
-       resource limit; there is a second option called --recursion-limit  that
-       sets  a limit on the amount of memory (usually stack) that is used (see
+       The --match-limit option of pcre2grep can be used to  set  the  overall
+       resource  limit; there is a second option called --recursion-limit that
+       sets a limit on the amount of memory (usually stack) that is used  (see
        the discussion of these options above).
 
 
 DIAGNOSTICS
 
        Exit status is 0 if any matches were found, 1 if no matches were found,
-       and  2  for syntax errors, overlong lines, non-existent or inaccessible
-       files (even if matches were found in other files) or too many  matching
+       and 2 for syntax errors, overlong lines, non-existent  or  inaccessible
+       files  (even if matches were found in other files) or too many matching
        errors. Using the -s option to suppress error messages about inaccessi-
        ble files does not affect the return code.
 
 
 SEE ALSO
 
-       pcre2pattern(3), pcre2syntax(3).
+       pcre2pattern(3), pcre2syntax(3), pcre2callout(3).
 
 
 AUTHOR
@@ -765,5 +822,5 @@ AUTHOR
 
 REVISION
 
-       Last updated: 03 January 2015
-       Copyright (c) 1997-2015 University of Cambridge.
+       Last updated: 19 June 2016
+       Copyright (c) 1997-2016 University of Cambridge.
index a2117ea0faadc80a994a60d09790c9b2ced89f0f..0b95b4dc68340f52015ee9a80dd5ef7632879677 100644 (file)
@@ -1,4 +1,4 @@
-.TH PCRE2JIT 3 "14 November 2015" "PCRE2 10.21"
+.TH PCRE2JIT 3 "05 June 2016" "PCRE2 10.22"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .SH "PCRE2 JUST-IN-TIME COMPILER SUPPORT"
@@ -128,6 +128,9 @@ PCRE2_NOTBOL, PCRE2_NOTEOL, PCRE2_NOTEMPTY, PCRE2_NOTEMPTY_ATSTART,
 PCRE2_NO_UTF_CHECK, PCRE2_PARTIAL_HARD, and PCRE2_PARTIAL_SOFT. The
 PCRE2_ANCHORED option is not supported at match time.
 .P
+If the PCRE2_NO_JIT option is passed to \fBpcre2_match()\fP it disables the
+use of JIT, forcing matching by the interpreter code.
+.P
 The only unsupported pattern items are \eC (match a single data unit) when
 running in a UTF mode, and a callout immediately before an assertion condition
 in a conditional group.
@@ -377,7 +380,7 @@ The fast path function is called \fBpcre2_jit_match()\fP, and it takes exactly
 the same arguments as \fBpcre2_match()\fP. The return values are also the same,
 plus PCRE2_ERROR_JIT_BADOPTION if a matching mode (partial or complete) is
 requested that was not compiled. Unsupported option bits (for example,
-PCRE2_ANCHORED) are ignored.
+PCRE2_ANCHORED) are ignored, as is the PCRE2_NO_JIT option.
 .P
 When you call \fBpcre2_match()\fP, as well as testing for invalid options, a
 number of other sanity checks are performed on the arguments. For example, if
@@ -410,6 +413,6 @@ Cambridge, England.
 .rs
 .sp
 .nf
-Last updated: 14 November 2015
-Copyright (c) 1997-2015 University of Cambridge.
+Last updated: 05 June 2016
+Copyright (c) 1997-2016 University of Cambridge.
 .fi
index 8d0e9dfc7ea335b617ae456e7bdcb3e8b0c03b0e..70ac14a5a0902622f816d3027707b9530219cf4b 100644 (file)
@@ -1,4 +1,4 @@
-.TH PCRE2PATTERN 3 "13 November 2015" "PCRE2 10.21"
+.TH PCRE2PATTERN 3 "20 June 2016" "PCRE2 10.22"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .SH "PCRE2 REGULAR EXPRESSION DETAILS"
@@ -1256,16 +1256,20 @@ PCRE2 does not allow \eC to appear in lookbehind assertions
 .\" </a>
 (described below)
 .\"
-in a UTF mode, because this would make it impossible to calculate the length of
-the lookbehind. Neither the alternative matching function
-\fBpcre2_dfa_match()\fP not the JIT optimizer support \eC in a UTF mode. The
-former gives a match-time error; the latter fails to optimize and so the match
-is always run using the interpreter.
+in UTF-8 or UTF-16 modes, because this would make it impossible to calculate
+the length of the lookbehind. Neither the alternative matching function
+\fBpcre2_dfa_match()\fP nor the JIT optimizer support \eC in these UTF modes.
+The former gives a match-time error; the latter fails to optimize and so the
+match is always run using the interpreter.
+.P
+In the 32-bit library, however, \eC is always supported (when not explicitly
+locked out) because it always matches a single code unit, whether or not UTF-32
+is specified.
 .P
 In general, the \eC escape sequence is best avoided. However, one way of using
-it that avoids the problem of malformed UTF characters is to use a lookahead to
-check the length of the next character, as in this pattern, which could be used
-with a UTF-8 string (ignore white space and line breaks):
+it that avoids the problem of malformed UTF-8 or UTF-16 characters is to use a
+lookahead to check the length of the next character, as in this pattern, which
+could be used with a UTF-8 string (ignore white space and line breaks):
 .sp
   (?| (?=[\ex00-\ex7f])(\eC) |
       (?=[\ex80-\ex{7ff}])(\eC)(\eC) |
@@ -3425,6 +3429,6 @@ Cambridge, England.
 .rs
 .sp
 .nf
-Last updated: 13 November 2015
-Copyright (c) 1997-2015 University of Cambridge.
+Last updated: 20 June 2016
+Copyright (c) 1997-2016 University of Cambridge.
 .fi
index 833e96cba1f9ab3ed380cb751d314a5615ed7664..70a86d81db1639504bb88d3523d6c50b844787aa 100644 (file)
@@ -1,4 +1,4 @@
-.TH PCRE2POSIX 3 "29 November 2015" "PCRE2 10.21"
+.TH PCRE2POSIX 3 "31 January 2016" "PCRE2 10.22"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .SH "SYNOPSIS"
@@ -28,7 +28,7 @@ expression 8-bit library. See the
 \fBpcre2api\fP
 .\"
 documentation for a description of PCRE2's native API, which contains much
-additional functionality. There is no POSIX-style wrapper for PCRE2's 16-bit
+additional functionality. There are no POSIX-style wrappers for PCRE2's 16-bit
 and 32-bit libraries.
 .P
 The functions described here are just wrapper functions that ultimately call
@@ -44,9 +44,9 @@ value zero. This has no effect, but since programs that are written to the
 POSIX interface often use it, this makes it easier to slot in PCRE2 as a
 replacement library. Other POSIX options are not even defined.
 .P
-There are also some other options that are not defined by POSIX. These have
-been added at the request of users who want to make use of certain
-PCRE2-specific features via the POSIX calling interface.
+There are also some options that are not defined by POSIX. These have been
+added at the request of users who want to make use of certain PCRE2-specific
+features via the POSIX calling interface.
 .P
 When PCRE2 is called via these functions, it is only the API that is POSIX-like
 in style. The syntax and semantics of the regular expressions themselves are
@@ -95,11 +95,11 @@ defined POSIX behaviour for REG_NEWLINE (see the following section).
 .sp
   REG_NOSUB
 .sp
-The PCRE2_NO_AUTO_CAPTURE option is set when the regular expression is passed
-for compilation to the native function. In addition, when a pattern that is
-compiled with this flag is passed to \fBregexec()\fP for matching, the
-\fInmatch\fP and \fIpmatch\fP arguments are ignored, and no captured strings
-are returned.
+When a pattern that is compiled with this flag is passed to \fBregexec()\fP for
+matching, the \fInmatch\fP and \fIpmatch\fP arguments are ignored, and no
+captured strings are returned. Versions of the PCRE library prior to 10.22 used
+to set the PCRE2_NO_AUTO_CAPTURE compile option, but this no longer happens
+because it disables the use of back references.
 .sp
   REG_UCP
 .sp
@@ -216,12 +216,13 @@ mutually exclusive; the error REG_INVARG is returned.
 .P
 If the pattern was compiled with the REG_NOSUB flag, no data about any matched
 strings is returned. The \fInmatch\fP and \fIpmatch\fP arguments of
-\fBregexec()\fP are ignored.
+\fBregexec()\fP are ignored (except possibly as input for REG_STARTEND).
 .P
-If the value of \fInmatch\fP is zero, or if the value \fIpmatch\fP is NULL,
-no data about any matched strings is returned.
+The value of \fInmatch\fP may be zero, and the value \fIpmatch\fP may be NULL
+(unless REG_STARTEND is set); in both these cases no data about any matched
+strings is returned.
 .P
-Otherwise,the portion of the string that was matched, and also any captured
+Otherwise, the portion of the string that was matched, and also any captured
 substrings, are returned via the \fIpmatch\fP argument, which points to an
 array of \fInmatch\fP structures of type \fIregmatch_t\fP, containing the
 members \fIrm_so\fP and \fIrm_eo\fP. These contain the byte offset to the first
@@ -270,6 +271,6 @@ Cambridge, England.
 .rs
 .sp
 .nf
-Last updated: 29 November 2015
-Copyright (c) 1997-2015 University of Cambridge.
+Last updated: 31 January 2016
+Copyright (c) 1997-2016 University of Cambridge.
 .fi
index 7b469356bc1f594fdd1abaab3633711a455722ca..661e3927417c89cf72230de3b611b9e2f5bdb6f3 100644 (file)
@@ -1,4 +1,4 @@
-.TH PCRE2SAMPLE 3 "20 October 2014" "PCRE2 10.00"
+.TH PCRE2SAMPLE 3 "02 February 2016" "PCRE2 10.22"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .SH "PCRE2 SAMPLE PROGRAM"
@@ -13,23 +13,28 @@ distribution. A listing of this program is given in the
 documentation. If you do not have a copy of the PCRE2 distribution, you can
 save this listing to re-create the contents of \fIpcre2demo.c\fP.
 .P
-The demonstration program, which uses the PCRE2 8-bit library, compiles the
-regular expression that is its first argument, and matches it against the
-subject string in its second argument. No PCRE2 options are set, and default
-character tables are used. If matching succeeds, the program outputs the
-portion of the subject that matched, together with the contents of any captured
-substrings.
+The demonstration program compiles the regular expression that is its
+first argument, and matches it against the subject string in its second
+argument. No PCRE2 options are set, and default character tables are used. If
+matching succeeds, the program outputs the portion of the subject that matched,
+together with the contents of any captured substrings.
 .P
 If the -g option is given on the command line, the program then goes on to
 check for further matches of the same regular expression in the same subject
 string. The logic is a little bit tricky because of the possibility of matching
 an empty string. Comments in the code explain what is going on.
 .P
+The code in \fBpcre2demo.c\fP is an 8-bit program that uses the PCRE2 8-bit
+library. It handles strings and characters that are stored in 8-bit code units.
+By default, one character corresponds to one code unit, but if the pattern
+starts with "(*UTF)", both it and the subject are treated as UTF-8 strings,
+where characters may occupy multiple code units.
+.P
 If PCRE2 is installed in the standard include and library directories for your
 operating system, you should be able to compile the demonstration program using
-this command:
+a command like this:
 .sp
-  gcc -o pcre2demo pcre2demo.c -lpcre2-8
+  cc -o pcre2demo pcre2demo.c -lpcre2-8
 .sp
 If PCRE2 is installed elsewhere, you may need to add additional options to the
 command line. For example, on a Unix-like system that has PCRE2 installed in
@@ -37,12 +42,11 @@ command line. For example, on a Unix-like system that has PCRE2 installed in
 like this:
 .sp
 .\" JOINSH
-  gcc -o pcre2demo -I/usr/local/include pcre2demo.c \e
-      -L/usr/local/lib -lpcre2-8
+  cc -o pcre2demo -I/usr/local/include pcre2demo.c \e
+     -L/usr/local/lib -lpcre2-8
 .sp
-.P
-Once you have compiled and linked the demonstration program, you can run simple
-tests like this:
+Once you have built the demonstration program, you can run simple tests like
+this:
 .sp
   ./pcre2demo 'cat|dog' 'the cat sat on the mat'
   ./pcre2demo -g 'cat|dog' 'the dog sat on the cat'
@@ -51,12 +55,13 @@ Note that there is a much more comprehensive test program, called
 .\" HREF
 \fBpcre2test\fP,
 .\"
-which supports many more facilities for testing regular expressions using the
-PCRE2 libraries. The
+which supports many more facilities for testing regular expressions using all
+three PCRE2 libraries (8-bit, 16-bit, and 32-bit, though not all three need be
+installed). The
 .\" HREF
 \fBpcre2demo\fP
 .\"
-program is provided as a simple coding example.
+program is provided as a relatively simple coding example.
 .P
 If you try to run
 .\" HREF
@@ -65,7 +70,7 @@ If you try to run
 when PCRE2 is not installed in the standard library directory, you may get an
 error like this on some operating systems (e.g. Solaris):
 .sp
-  ld.so.1: a.out: fatal: libpcre2.so.0: open failed: No such file or directory
+  ld.so.1: pcre2demo: fatal: libpcre2-8.so.0: open failed: No such file or directory
 .sp
 This is caused by the way shared library support works on those systems. You
 need to add
@@ -89,6 +94,6 @@ Cambridge, England.
 .rs
 .sp
 .nf
-Last updated: 20 October 2014
-Copyright (c) 1997-2014 University of Cambridge.
+Last updated: 02 February 2016
+Copyright (c) 1997-2016 University of Cambridge.
 .fi
index 69bcb181dd7560efc730a0c96c4e696bcf2ca306..664c1db567bf2347a2527fcd585147ec15bd812d 100644 (file)
@@ -1,4 +1,4 @@
-.TH PCRE2SERIALIZE 3 "03 November 2015" "PCRE2 10.21"
+.TH PCRE2SERIALIZE 3 "24 May 2016" "PCRE2 10.22"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .SH "SAVING AND RE-USING PRECOMPILED PCRE2 PATTERNS"
@@ -30,6 +30,16 @@ PCRE2's 16-bit library cannot be reloaded on a 64-bit system, nor can they be
 reloaded using the 8-bit library.
 .
 .
+.SH "SECURITY CONCERNS"
+.rs
+.sp
+The facility for saving and restoring compiled patterns is intended for use
+within individual applications. As such, the data supplied to
+\fBpcre2_serialize_decode()\fP is expected to be trusted data, not data from
+arbitrary external sources. There is only some simple consistency checking, not
+complete validation of what is being re-loaded.
+.
+.
 .SH "SAVING COMPILED PATTERNS"
 .rs
 .sp
@@ -129,11 +139,12 @@ is filled with those that fit, and the remainder are ignored. The yield of the
 function is the number of decoded patterns, or one of the following negative
 error codes:
 .sp
-  PCRE2_ERROR_BADDATA   second argument is zero or less
-  PCRE2_ERROR_BADMAGIC  mismatch of id bytes in the data
-  PCRE2_ERROR_BADMODE   mismatch of variable unit size or PCRE2 version
-  PCRE2_ERROR_MEMORY    memory allocation failed
-  PCRE2_ERROR_NULL      first or third argument is NULL
+  PCRE2_ERROR_BADDATA    second argument is zero or less
+  PCRE2_ERROR_BADMAGIC   mismatch of id bytes in the data
+  PCRE2_ERROR_BADMODE    mismatch of code unit size or PCRE2 version
+  PCRE2_ERROR_BADSERIALIZEDDATA  other sanity check failure
+  PCRE2_ERROR_MEMORY     memory allocation failed
+  PCRE2_ERROR_NULL       first or third argument is NULL
 .sp
 PCRE2_ERROR_BADMAGIC may mean that the data is corrupt, or that it was compiled
 on a system with different endianness.
@@ -170,6 +181,6 @@ Cambridge, England.
 .rs
 .sp
 .nf
-Last updated: 03 November 2015
-Copyright (c) 1997-2015 University of Cambridge.
+Last updated: 24 May 2016
+Copyright (c) 1997-2016 University of Cambridge.
 .fi
index b8eef93890ac3e1958db050d84b6d1ce174aec17..2fbf794fc24534ab4bafec6365f4c7baeff5e76d 100644 (file)
@@ -1,4 +1,4 @@
-.TH PCRE2TEST 1 "12 December 2015" "PCRE 10.21"
+.TH PCRE2TEST 1 "06 July 2016" "PCRE 10.22"
 .SH NAME
 pcre2test - a program for testing Perl-compatible regular expressions.
 .SH SYNOPSIS
@@ -68,10 +68,11 @@ environments character 26 (hex 1A) causes an immediate end of file, and no
 further data is read.
 .P
 For maximum portability, therefore, it is safest to avoid non-printing
-characters in \fBpcre2test\fP input files. There is a facility for specifying a
-pattern's characters as hexadecimal pairs, thus making it possible to include
-binary zeroes in a pattern for testing purposes. Subject lines are processed
-for backslash escapes, which makes it possible to include any data value.
+characters in \fBpcre2test\fP input files. There is a facility for specifying
+some or all of a pattern's characters as hexadecimal pairs, thus making it
+possible to include binary zeroes in a pattern for testing purposes. Subject
+lines are processed for backslash escapes, which makes it possible to include
+any data value.
 .
 .
 .SH "COMMAND LINE OPTIONS"
@@ -142,6 +143,12 @@ Behave as if each subject line has the \fBdfa\fP modifier; matching is done
 using the \fBpcre2_dfa_match()\fP function instead of the default
 \fBpcre2_match()\fP.
 .TP 10
+\fB-error\fP \fInumber[,number,...]\fP
+Call \fBpcre2_get_error_message()\fP for each of the error numbers in the
+comma-separated list, display the resulting messages on the standard output,
+then exit with zero exit code. The numbers may be positive or negative. This is
+a convenience facility for PCRE2 maintainers.
+.TP 10
 \fB-help\fP
 Output a brief summary these options and then exit.
 .TP 10
@@ -305,9 +312,10 @@ test files that are also processed by \fBperltest.sh\fP. The \fB#perltest\fP
 command helps detect tests that are accidentally put in the wrong file.
 .sp
   #pop [<modifiers>]
+  #popcopy [<modifiers>]
 .sp
-This command is used to manipulate the stack of compiled patterns, as described
-in the section entitled "Saving and restoring compiled patterns"
+These commands are used to manipulate the stack of compiled patterns, as
+described in the section entitled "Saving and restoring compiled patterns"
 .\" HTML <a href="#saverestore">
 .\" </a>
 below.
@@ -523,7 +531,7 @@ about the pattern:
       debug                     same as info,fullbincode
       fullbincode               show binary code with lengths
   /I  info                      show info about compiled pattern
-      hex                       pattern is coded in hexadecimal
+      hex                       unquoted characters are hexadecimal
       jit[=<number>]            use JIT
       jitfast                   use JIT fast path
       jitverify                 verify JIT use
@@ -534,7 +542,9 @@ about the pattern:
       null_context              compile with a NULL context
       parens_nest_limit=<n>     set maximum parentheses depth
       posix                     use the POSIX API
+      posix_nosub               use the POSIX API with REG_NOSUB
       push                      push compiled pattern onto the stack
+      pushcopy                  push a copy onto the stack
       stackguard=<number>       test the stackguard feature
       tables=[0|1|2]            select internal tables
 .sp
@@ -614,20 +624,30 @@ testing that \fBpcre2_compile()\fP behaves correctly in this case (it uses
 default values).
 .
 .
-.SS "Specifying a pattern in hex"
+.SS "Specifying pattern characters in hexadecimal"
 .rs
 .sp
-The \fBhex\fP modifier specifies that the characters of the pattern are to be
-interpreted as pairs of hexadecimal digits. White space is permitted between
-pairs. For example:
+The \fBhex\fP modifier specifies that the characters of the pattern, except for
+substrings enclosed in single or double quotes, are to be interpreted as pairs
+of hexadecimal digits. This feature is provided as a way of creating patterns
+that contain binary zeros and other non-printing characters. White space is
+permitted between pairs of digits. For example, this pattern contains three
+characters:
 .sp
   /ab 32 59/hex
 .sp
-This feature is provided as a way of creating patterns that contain binary zero
-and other non-printing characters. By default, \fBpcre2test\fP passes patterns
-as zero-terminated strings to \fBpcre2_compile()\fP, giving the length as
-PCRE2_ZERO_TERMINATED. However, for patterns specified in hexadecimal, the
-actual length of the pattern is passed.
+Parts of such a pattern are taken literally if quoted. This pattern contains
+nine characters, only two of which are specified in hexadecimal:
+.sp
+  /ab "literal" 32/hex
+.sp
+Either single or double quotes may be used. There is no way of including
+the delimiter within a substring.
+.P
+By default, \fBpcre2test\fP passes patterns as zero-terminated strings to
+\fBpcre2_compile()\fP, giving the length as PCRE2_ZERO_TERMINATED. However, for
+patterns specified with the \fBhex\fP modifier, the actual length of the
+pattern is passed.
 .
 .
 .SS "Generating long repetitive patterns"
@@ -780,18 +800,19 @@ variable can hold (essentially unlimited).
 .SS "Using the POSIX wrapper API"
 .rs
 .sp
-The \fB/posix\fP modifier causes \fBpcre2test\fP to call PCRE2 via the POSIX
-wrapper API rather than its native API. This supports only the 8-bit library.
-Note that it does not imply POSIX matching semantics; for more detail see the
+The \fB/posix\fP and \fBposix_nosub\fP modifiers cause \fBpcre2test\fP to call
+PCRE2 via the POSIX wrapper API rather than its native API. When
+\fBposix_nosub\fP is used, the POSIX option REG_NOSUB is passed to
+\fBregcomp()\fP. The POSIX wrapper supports only the 8-bit library. Note that
+it does not imply POSIX matching semantics; for more detail see the
 .\" HREF
 \fBpcre2posix\fP
 .\"
-documentation. When the POSIX API is being used, the following pattern
-modifiers set options for the \fBregcomp()\fP function:
+documentation. The following pattern modifiers set options for the
+\fBregcomp()\fP function:
 .sp
   caseless           REG_ICASE
   multiline          REG_NEWLINE
-  no_auto_capture    REG_NOSUB
   dotall             REG_DOTALL     )
   ungreedy           REG_UNGREEDY   ) These options are not part of
   ucp                REG_UCP        )   the POSIX standard
@@ -807,7 +828,8 @@ buffer is too small for the error message. If this modifier has not been set, a
 large buffer is used.
 .P
 The \fBaftertext\fP and \fBallaftertext\fP subject modifiers work as described
-below. All other modifiers cause an error.
+below. All other modifiers are either ignored, with a warning message, or cause
+an error.
 .
 .
 .SS "Testing the stack guard feature"
@@ -881,13 +903,17 @@ facility is used when saving compiled patterns to a file, as described in the
 section entitled "Saving and restoring compiled patterns"
 .\" HTML <a href="#saverestore">
 .\" </a>
-below.
+below. If \fBpushcopy\fP is used instead of \fBpush\fP, a copy of the compiled
+pattern is stacked, leaving the original as current, ready to match the
+following input lines. This provides a way of testing the
+\fBpcre2_code_copy()\fP function.
 .\"
-The \fBpush\fP modifier is incompatible with compilation modifiers such as
-\fBglobal\fP that act at match time. Any that are specified are ignored, with a
-warning message, except for \fBreplace\fP, which causes an error. Note that,
-\fBjitverify\fP, which is allowed, does not carry through to any subsequent
-matching that uses this pattern.
+The \fBpush\fP and \fBpushcopy \fP modifiers are incompatible with compilation
+modifiers such as \fBglobal\fP that act at match time. Any that are specified
+are ignored (for the stacked copy), with a warning message, except for
+\fBreplace\fP, which causes an error. Note that \fBjitverify\fP, which is
+allowed, does not carry through to any subsequent matching that uses a stacked
+pattern.
 .
 .
 .\" HTML <a name="subjectmodifiers"></a>
@@ -911,6 +937,7 @@ for a description of their effects.
       anchored                  set PCRE2_ANCHORED
       dfa_restart               set PCRE2_DFA_RESTART
       dfa_shortest              set PCRE2_DFA_SHORTEST
+      no_jit                    set PCRE2_NO_JIT
       no_utf_check              set PCRE2_NO_UTF_CHECK
       notbol                    set PCRE2_NOTBOL
       notempty                  set PCRE2_NOTEMPTY
@@ -926,7 +953,7 @@ If the \fB/posix\fP modifier was present on the pattern, causing the POSIX
 wrapper API to be used, the only option-setting modifiers that have any effect
 are \fBnotbol\fP, \fBnotempty\fP, and \fBnoteol\fP, causing REG_NOTBOL,
 REG_NOTEMPTY, and REG_NOTEOL, respectively, to be passed to \fBregexec()\fP.
-Any other modifiers cause an error.
+The other modifiers are ignored, with a warning message.
 .
 .
 .SS "Setting match controls"
@@ -970,7 +997,10 @@ pattern.
       substitute_unset_empty     use PCRE2_SUBSTITUTE_UNSET_EMPTY
       zero_terminate             pass the subject as zero-terminated
 .sp
-The effects of these modifiers are described in the following sections.
+The effects of these modifiers are described in the following sections. When
+matching via the POSIX wrapper API, the \fBaftertext\fP, \fBallaftertext\fP,
+and \fBovector\fP subject modifiers work as described below. All other
+modifiers are either ignored, with a warning message, or cause an error.
 .
 .
 .SS "Showing more text"
@@ -1025,7 +1055,8 @@ The \fBallcaptures\fP modifier requests that the values of all potential
 captured parentheses be output after a match. By default, only those up to the
 highest one actually used in the match are output (corresponding to the return
 code from \fBpcre2_match()\fP). Groups that did not take part in the match
-are output as "<unset>".
+are output as "<unset>". This modifier is not relevant for DFA matching (which
+does no capturing); it is ignored, with a warning message, if present.
 .
 .
 .SS "Testing callouts"
@@ -1475,7 +1506,9 @@ item to be tested. For example:
 This output indicates that callout number 0 occurred for a match attempt
 starting at the fourth character of the subject string, when the pointer was at
 the seventh character, and when the next pattern item was \ed. Just
-one circumflex is output if the start and current positions are the same.
+one circumflex is output if the start and current positions are the same, or if
+the current position precedes the start position, which can happen if the
+callout is in a lookbehind assertion.
 .P
 Callouts numbered 255 are assumed to be automatic callouts, inserted as a
 result of the \fB/auto_callout\fP pattern modifier. In this case, instead of
@@ -1571,11 +1604,15 @@ can be used to test these functions.
 .P
 When a pattern with \fBpush\fP modifier is successfully compiled, it is pushed
 onto a stack of compiled patterns, and \fBpcre2test\fP expects the next line to
-contain a new pattern (or command) instead of a subject line. By this means, a
-number of patterns can be compiled and retained. The \fBpush\fP modifier is
-incompatible with \fBposix\fP, and control modifiers that act at match time are
-ignored (with a message). The \fBjitverify\fP modifier applies only at compile
-time. The command
+contain a new pattern (or command) instead of a subject line. By contrast,
+the \fBpushcopy\fP modifier causes a copy of the compiled pattern to be
+stacked, leaving the original available for immediate matching. By using
+\fBpush\fP and/or \fBpushcopy\fP, a number of patterns can be compiled and
+retained. These modifiers are incompatible with \fBposix\fP, and control
+modifiers that act at match time are ignored (with a message) for the stacked
+patterns. The \fBjitverify\fP modifier applies only at compile time.
+.P
+The command
 .sp
   #save <filename>
 .sp
@@ -1595,7 +1632,8 @@ modifier list containing only
 control modifiers
 .\"
 that act after a pattern has been compiled. In particular, \fBhex\fP,
-\fBposix\fP, and \fBpush\fP are not allowed, nor are any
+\fBposix\fP, \fBposix_nosub\fP, \fBpush\fP, and \fBpushcopy\fP are not allowed,
+nor are any
 .\" HTML <a href="#optionmodifiers">
 .\" </a>
 option-setting modifiers.
@@ -1615,6 +1653,10 @@ reloads two patterns.
 .sp
 If \fBjitverify\fP is used with #pop, it does not automatically imply
 \fBjit\fP, which is different behaviour from when it is used on a pattern.
+.P
+The #popcopy command is analagous to the \fBpushcopy\fP modifier in that it
+makes current a copy of the topmost stack pattern, leaving the original still
+on the stack.
 .
 .
 .
@@ -1640,6 +1682,6 @@ Cambridge, England.
 .rs
 .sp
 .nf
-Last updated: 12 December 2015
-Copyright (c) 1997-2015 University of Cambridge.
+Last updated: 06 July 2016
+Copyright (c) 1997-2016 University of Cambridge.
 .fi
index d9dbc4df657cb3c4a9666539b1b3645dfab85e5c..cfa0baa777bc1711153cc1736746e94f76959760 100644 (file)
@@ -67,10 +67,10 @@ INPUT ENCODING
 
        For  maximum portability, therefore, it is safest to avoid non-printing
        characters in pcre2test input files. There is a facility for specifying
-       a pattern's characters as hexadecimal pairs, thus making it possible to
-       include binary zeroes in a pattern for testing purposes. Subject  lines
-       are processed for backslash escapes, which makes it possible to include
-       any data value.
+       some or all of a pattern's characters as hexadecimal pairs, thus making
+       it possible to include binary zeroes in a pattern for testing purposes.
+       Subject  lines are processed for backslash escapes, which makes it pos-
+       sible to include any data value.
 
 
 COMMAND LINE OPTIONS
@@ -138,6 +138,13 @@ COMMAND LINE OPTIONS
                  is  done  using the pcre2_dfa_match() function instead of the
                  default pcre2_match().
 
+       -error number[,number,...]
+                 Call pcre2_get_error_message() for each of the error  numbers
+                 in  the  comma-separated list, display the resulting messages
+                 on the standard output, then exit with zero  exit  code.  The
+                 numbers  may  be  positive or negative. This is a convenience
+                 facility for PCRE2 maintainers.
+
        -help     Output a brief summary these options and then exit.
 
        -i        Behave as if each pattern has the /info modifier; information
@@ -296,10 +303,11 @@ COMMAND LINES
        wrong file.
 
          #pop [<modifiers>]
+         #popcopy [<modifiers>]
 
-       This  command  is used to manipulate the stack of compiled patterns, as
-       described in the section entitled "Saving and restoring  compiled  pat-
-       terns" below.
+       These  commands  are used to manipulate the stack of compiled patterns,
+       as described in the section entitled  "Saving  and  restoring  compiled
+       patterns" below.
 
          #save <filename>
 
@@ -505,7 +513,7 @@ PATTERN MODIFIERS
              debug                     same as info,fullbincode
              fullbincode               show binary code with lengths
          /I  info                      show info about compiled pattern
-             hex                       pattern is coded in hexadecimal
+             hex                       unquoted characters are hexadecimal
              jit[=<number>]            use JIT
              jitfast                   use JIT fast path
              jitverify                 verify JIT use
@@ -516,7 +524,9 @@ PATTERN MODIFIERS
              null_context              compile with a NULL context
              parens_nest_limit=<n>     set maximum parentheses depth
              posix                     use the POSIX API
+             posix_nosub               use the POSIX API with REG_NOSUB
              push                      push compiled pattern onto the stack
+             pushcopy                  push a copy onto the stack
              stackguard=<number>       test the stackguard feature
              tables=[0|1|2]            select internal tables
 
@@ -591,59 +601,70 @@ PATTERN MODIFIERS
        testing that pcre2_compile() behaves correctly in this  case  (it  uses
        default values).
 
-   Specifying a pattern in hex
+   Specifying pattern characters in hexadecimal
 
-       The hex modifier specifies that the characters of the pattern are to be
-       interpreted as pairs of hexadecimal digits. White  space  is  permitted
-       between pairs. For example:
+       The  hex  modifier specifies that the characters of the pattern, except
+       for substrings enclosed in single or double quotes, are  to  be  inter-
+       preted  as  pairs  of hexadecimal digits. This feature is provided as a
+       way of creating patterns that contain binary zeros and other non-print-
+       ing  characters.  White space is permitted between pairs of digits. For
+       example, this pattern contains three characters:
 
          /ab 32 59/hex
 
-       This  feature  is  provided  as a way of creating patterns that contain
-       binary zero and other non-printing characters.  By  default,  pcre2test
-       passes  patterns  as zero-terminated strings to pcre2_compile(), giving
-       the length as PCRE2_ZERO_TERMINATED. However, for patterns specified in
-       hexadecimal, the actual length of the pattern is passed.
+       Parts of such a pattern are taken literally  if  quoted.  This  pattern
+       contains  nine characters, only two of which are specified in hexadeci-
+       mal:
+
+         /ab "literal" 32/hex
+
+       Either single or double quotes may be used. There is no way of  includ-
+       ing the delimiter within a substring.
+
+       By  default,  pcre2test  passes  patterns as zero-terminated strings to
+       pcre2_compile(), giving the length as  PCRE2_ZERO_TERMINATED.  However,
+       for  patterns specified with the hex modifier, the actual length of the
+       pattern is passed.
 
    Generating long repetitive patterns
 
-       Some  tests use long patterns that are very repetitive. Instead of cre-
-       ating a very long input line for such a pattern, you can use a  special
-       repetition  feature,  similar  to  the  one described for subject lines
-       above. If the expand modifier is present on a  pattern,  parts  of  the
+       Some tests use long patterns that are very repetitive. Instead of  cre-
+       ating  a very long input line for such a pattern, you can use a special
+       repetition feature, similar to the  one  described  for  subject  lines
+       above.  If  the  expand  modifier is present on a pattern, parts of the
        pattern that have the form
 
          \[<characters>]{<count>}
 
        are expanded before the pattern is passed to pcre2_compile(). For exam-
        ple, \[AB]{6000} is expanded to "ABAB..." 6000 times. This construction
-       cannot  be  nested. An initial "\[" sequence is recognized only if "]{"
-       followed by decimal digits and "}" is found later in  the  pattern.  If
+       cannot be nested. An initial "\[" sequence is recognized only  if  "]{"
+       followed  by  decimal  digits and "}" is found later in the pattern. If
        not, the characters remain in the pattern unaltered.
 
-       If  part  of an expanded pattern looks like an expansion, but is really
+       If part of an expanded pattern looks like an expansion, but  is  really
        part of the actual pattern, unwanted expansion can be avoided by giving
        two values in the quantifier. For example, \[AB]{6000,6000} is not rec-
        ognized as an expansion item.
 
-       If the info modifier is set on an expanded pattern, the result  of  the
+       If  the  info modifier is set on an expanded pattern, the result of the
        expansion is included in the information that is output.
 
    JIT compilation
 
-       Just-in-time  (JIT)  compiling  is  a heavyweight optimization that can
-       greatly speed up pattern matching. See the pcre2jit  documentation  for
-       details.  JIT  compiling  happens, optionally, after a pattern has been
-       successfully compiled into an internal form. The JIT compiler  converts
+       Just-in-time (JIT) compiling is a  heavyweight  optimization  that  can
+       greatly  speed  up pattern matching. See the pcre2jit documentation for
+       details. JIT compiling happens, optionally, after a  pattern  has  been
+       successfully  compiled into an internal form. The JIT compiler converts
        this to optimized machine code. It needs to know whether the match-time
        options PCRE2_PARTIAL_HARD and PCRE2_PARTIAL_SOFT are going to be used,
-       because  different  code  is generated for the different cases. See the
-       partial modifier in "Subject Modifiers" below for details of how  these
+       because different code is generated for the different  cases.  See  the
+       partial  modifier in "Subject Modifiers" below for details of how these
        options are specified for each match attempt.
 
-       JIT  compilation  is  requested by the /jit pattern modifier, which may
+       JIT compilation is requested by the /jit pattern  modifier,  which  may
        optionally be followed by an equals sign and a number in the range 0 to
-       7.   The  three bits that make up the number specify which of the three
+       7.  The three bits that make up the number specify which of  the  three
        JIT operating modes are to be compiled:
 
          1  compile JIT code for non-partial matching
@@ -660,31 +681,31 @@ PATTERN MODIFIERS
          6  soft and hard partial matching only
          7  all three modes
 
-       If no number is given, 7 is  assumed.  The  phrase  "partial  matching"
+       If  no  number  is  given,  7 is assumed. The phrase "partial matching"
        means a call to pcre2_match() with either the PCRE2_PARTIAL_SOFT or the
-       PCRE2_PARTIAL_HARD option set. Note that such a call may return a  com-
+       PCRE2_PARTIAL_HARD  option set. Note that such a call may return a com-
        plete match; the options enable the possibility of a partial match, but
-       do not require it. Note also that if you request JIT  compilation  only
-       for  partial  matching (for example, /jit=2) but do not set the partial
-       modifier on a subject line, that match will not use  JIT  code  because
+       do  not  require it. Note also that if you request JIT compilation only
+       for partial matching (for example, /jit=2) but do not set  the  partial
+       modifier  on  a  subject line, that match will not use JIT code because
        none was compiled for non-partial matching.
 
-       If  JIT compilation is successful, the compiled JIT code will automati-
-       cally be used when an appropriate type of match  is  run,  except  when
-       incompatible  run-time options are specified. For more details, see the
-       pcre2jit documentation. See also the jitstack modifier below for a  way
+       If JIT compilation is successful, the compiled JIT code will  automati-
+       cally  be  used  when  an appropriate type of match is run, except when
+       incompatible run-time options are specified. For more details, see  the
+       pcre2jit  documentation. See also the jitstack modifier below for a way
        of setting the size of the JIT stack.
 
-       If  the  jitfast  modifier is specified, matching is done using the JIT
-       "fast path" interface, pcre2_jit_match(), which skips some of the  san-
-       ity  checks that are done by pcre2_match(), and of course does not work
-       when JIT is not supported. If jitfast is specified without  jit,  jit=7
+       If the jitfast modifier is specified, matching is done  using  the  JIT
+       "fast  path" interface, pcre2_jit_match(), which skips some of the san-
+       ity checks that are done by pcre2_match(), and of course does not  work
+       when  JIT  is not supported. If jitfast is specified without jit, jit=7
        is assumed.
 
-       If  the jitverify modifier is specified, information about the compiled
-       pattern shows whether JIT compilation was or  was  not  successful.  If
-       jitverify  is  specified without jit, jit=7 is assumed. If JIT compila-
-       tion is successful when jitverify is set, the text "(JIT)" is added  to
+       If the jitverify modifier is specified, information about the  compiled
+       pattern  shows  whether  JIT  compilation was or was not successful. If
+       jitverify is specified without jit, jit=7 is assumed. If  JIT  compila-
+       tion  is successful when jitverify is set, the text "(JIT)" is added to
        the first output line after a match or non match when JIT-compiled code
        was actually used in the match.
 
@@ -695,18 +716,18 @@ PATTERN MODIFIERS
          /pattern/locale=fr_FR
 
        The given locale is set, pcre2_maketables() is called to build a set of
-       character  tables for the locale, and this is then passed to pcre2_com-
-       pile() when compiling the regular expression. The same tables are  used
+       character tables for the locale, and this is then passed to  pcre2_com-
+       pile()  when compiling the regular expression. The same tables are used
        when matching the following subject lines. The /locale modifier applies
        only to the pattern on which it appears, but can be given in a #pattern
-       command  if a default is needed. Setting a locale and alternate charac-
+       command if a default is needed. Setting a locale and alternate  charac-
        ter tables are mutually exclusive.
 
    Showing pattern memory
 
-       The /memory modifier causes the size in bytes of  the  memory  used  to
-       hold  the compiled pattern to be output. This does not include the size
-       of the pcre2_code block; it is just the actual compiled  data.  If  the
+       The  /memory  modifier  causes  the size in bytes of the memory used to
+       hold the compiled pattern to be output. This does not include the  size
+       of  the  pcre2_code  block; it is just the actual compiled data. If the
        pattern is subsequently passed to the JIT compiler, the size of the JIT
        compiled code is also output. Here is an example:
 
@@ -717,31 +738,31 @@ PATTERN MODIFIERS
 
    Limiting nested parentheses
 
-       The parens_nest_limit modifier sets a limit  on  the  depth  of  nested
-       parentheses  in  a  pattern.  Breaching  the limit causes a compilation
-       error.  The default for the library is set when  PCRE2  is  built,  but
-       pcre2test  sets  its  own default of 220, which is required for running
+       The  parens_nest_limit  modifier  sets  a  limit on the depth of nested
+       parentheses in a pattern. Breaching  the  limit  causes  a  compilation
+       error.   The  default  for  the library is set when PCRE2 is built, but
+       pcre2test sets its own default of 220, which is  required  for  running
        the standard test suite.
 
    Limiting the pattern length
 
-       The max_pattern_length modifier sets a limit, in  code  units,  to  the
+       The  max_pattern_length  modifier  sets  a limit, in code units, to the
        length of pattern that pcre2_compile() will accept. Breaching the limit
-       causes a compilation  error.  The  default  is  the  largest  number  a
+       causes  a  compilation  error.  The  default  is  the  largest number a
        PCRE2_SIZE variable can hold (essentially unlimited).
 
    Using the POSIX wrapper API
 
-       The  /posix modifier causes pcre2test to call PCRE2 via the POSIX wrap-
-       per API rather than its  native  API.  This  supports  only  the  8-bit
-       library.   Note  that  it  does not imply POSIX matching semantics; for
-       more detail see the pcre2posix documentation. When  the  POSIX  API  is
-       being  used,  the  following pattern modifiers set options for the reg-
-       comp() function:
+       The /posix and posix_nosub modifiers cause pcre2test to call PCRE2  via
+       the  POSIX  wrapper API rather than its native API. When posix_nosub is
+       used, the POSIX option REG_NOSUB is  passed  to  regcomp().  The  POSIX
+       wrapper  supports  only  the 8-bit library. Note that it does not imply
+       POSIX matching semantics; for more detail see the pcre2posix documenta-
+       tion.  The  following  pattern  modifiers set options for the regcomp()
+       function:
 
          caseless           REG_ICASE
          multiline          REG_NEWLINE
-         no_auto_capture    REG_NOSUB
          dotall             REG_DOTALL     )
          ungreedy           REG_UNGREEDY   ) These options are not part of
          ucp                REG_UCP        )   the POSIX standard
@@ -758,23 +779,24 @@ PATTERN MODIFIERS
        been set, a large buffer is used.
 
        The aftertext and allaftertext  subject  modifiers  work  as  described
-       below. All other modifiers cause an error.
+       below.  All other modifiers are either ignored, with a warning message,
+       or cause an error.
 
    Testing the stack guard feature
 
-       The  /stackguard  modifier  is  used  to test the use of pcre2_set_com-
-       pile_recursion_guard(), a function that is  provided  to  enable  stack
-       availability  to  be checked during compilation (see the pcre2api docu-
-       mentation for details). If the number  specified  by  the  modifier  is
+       The /stackguard modifier is used to  test  the  use  of  pcre2_set_com-
+       pile_recursion_guard(),  a  function  that  is provided to enable stack
+       availability to be checked during compilation (see the  pcre2api  docu-
+       mentation  for  details).  If  the  number specified by the modifier is
        greater than zero, pcre2_set_compile_recursion_guard() is called to set
-       up callback from pcre2_compile() to a local function. The  argument  it
-       receives  is  the current nesting parenthesis depth; if this is greater
+       up  callback  from pcre2_compile() to a local function. The argument it
+       receives is the current nesting parenthesis depth; if this  is  greater
        than the value given by the modifier, non-zero is returned, causing the
        compilation to be aborted.
 
    Using alternative character tables
 
-       The  value specified for the /tables modifier must be one of the digits
+       The value specified for the /tables modifier must be one of the  digits
        0, 1, or 2. It causes a specific set of built-in character tables to be
        passed to pcre2_compile(). This is used in the PCRE2 tests to check be-
        haviour with different character tables. The digit specifies the tables
@@ -785,15 +807,15 @@ PATTERN MODIFIERS
                pcre2_chartables.c.dist
          2   a set of tables defining ISO 8859 characters
 
-       In  table 2, some characters whose codes are greater than 128 are iden-
-       tified as letters, digits, spaces,  etc.  Setting  alternate  character
+       In table 2, some characters whose codes are greater than 128 are  iden-
+       tified  as  letters,  digits,  spaces, etc. Setting alternate character
        tables and a locale are mutually exclusive.
 
    Setting certain match controls
 
        The following modifiers are really subject modifiers, and are described
-       below.  However, they may be included in a pattern's modifier list,  in
-       which  case  they  are  applied to every subject line that is processed
+       below.   However, they may be included in a pattern's modifier list, in
+       which case they are applied to every subject  line  that  is  processed
        with that pattern. They may not appear in #pattern commands. These mod-
        ifiers do not affect the compilation process.
 
@@ -810,21 +832,25 @@ PATTERN MODIFIERS
              substitute_unknown_unset   use PCRE2_SUBSTITUTE_UNKNOWN_UNSET
              substitute_unset_empty     use PCRE2_SUBSTITUTE_UNSET_EMPTY
 
-       These  modifiers may not appear in a #pattern command. If you want them
+       These modifiers may not appear in a #pattern command. If you want  them
        as defaults, set them in a #subject command.
 
    Saving a compiled pattern
 
-       When a pattern with the push modifier is successfully compiled,  it  is
-       pushed  onto  a  stack  of compiled patterns, and pcre2test expects the
-       next line to contain a new pattern (or a command) instead of a  subject
+       When  a  pattern with the push modifier is successfully compiled, it is
+       pushed onto a stack of compiled patterns,  and  pcre2test  expects  the
+       next  line to contain a new pattern (or a command) instead of a subject
        line. This facility is used when saving compiled patterns to a file, as
-       described in the section entitled "Saving and restoring  compiled  pat-
-       terns" below.  The push modifier is incompatible with compilation modi-
-       fiers such as global that act at match time. Any that are specified are
-       ignored,  with  a  warning message, except for replace, which causes an
-       error. Note that, jitverify, which is allowed, does not  carry  through
-       to any subsequent matching that uses this pattern.
+       described  in  the section entitled "Saving and restoring compiled pat-
+       terns" below. If pushcopy is used instead of push, a copy of  the  com-
+       piled  pattern  is  stacked,  leaving the original as current, ready to
+       match the following input lines. This provides a  way  of  testing  the
+       pcre2_code_copy()  function.   The  push  and  pushcopy   modifiers are
+       incompatible with compilation modifiers such  as  global  that  act  at
+       match  time. Any that are specified are ignored (for the stacked copy),
+       with a warning message, except for replace, which causes an error. Note
+       that  jitverify, which is allowed, does not carry through to any subse-
+       quent matching that uses a stacked pattern.
 
 
 SUBJECT MODIFIERS
@@ -834,12 +860,13 @@ SUBJECT MODIFIERS
 
    Setting match options
 
-       The   following   modifiers   set   options   for   pcre2_match()    or
+       The    following   modifiers   set   options   for   pcre2_match()   or
        pcre2_dfa_match(). See pcreapi for a description of their effects.
 
              anchored                  set PCRE2_ANCHORED
              dfa_restart               set PCRE2_DFA_RESTART
              dfa_shortest              set PCRE2_DFA_SHORTEST
+             no_jit                    set PCRE2_NO_JIT
              no_utf_check              set PCRE2_NO_UTF_CHECK
              notbol                    set PCRE2_NOTBOL
              notempty                  set PCRE2_NOTEMPTY
@@ -848,20 +875,20 @@ SUBJECT MODIFIERS
              partial_hard (or ph)      set PCRE2_PARTIAL_HARD
              partial_soft (or ps)      set PCRE2_PARTIAL_SOFT
 
-       The  partial matching modifiers are provided with abbreviations because
+       The partial matching modifiers are provided with abbreviations  because
        they appear frequently in tests.
 
-       If the /posix modifier was present on the pattern,  causing  the  POSIX
+       If  the  /posix  modifier was present on the pattern, causing the POSIX
        wrapper API to be used, the only option-setting modifiers that have any
-       effect  are  notbol,  notempty,   and   noteol,   causing   REG_NOTBOL,
-       REG_NOTEMPTY,  and REG_NOTEOL, respectively, to be passed to regexec().
-       Any other modifiers cause an error.
+       effect   are   notbol,   notempty,   and  noteol,  causing  REG_NOTBOL,
+       REG_NOTEMPTY, and REG_NOTEOL, respectively, to be passed to  regexec().
+       The other modifiers are ignored, with a warning message.
 
    Setting match controls
 
-       The following modifiers affect the matching process  or  request  addi-
-       tional  information.  Some  of  them may also be specified on a pattern
-       line (see above), in which case they apply to every subject  line  that
+       The  following  modifiers  affect the matching process or request addi-
+       tional information. Some of them may also be  specified  on  a  pattern
+       line  (see  above), in which case they apply to every subject line that
        is matched against that pattern.
 
              aftertext                  show text after match
@@ -898,6 +925,9 @@ SUBJECT MODIFIERS
              zero_terminate             pass the subject as zero-terminated
 
        The effects of these modifiers are described in the following sections.
+       When  matching  via the POSIX wrapper API, the aftertext, allaftertext,
+       and ovector subject modifiers work as described below. All other  modi-
+       fiers are either ignored, with a warning message, or cause an error.
 
    Showing more text
 
@@ -951,7 +981,9 @@ SUBJECT MODIFIERS
        tured parentheses be output after a match. By default, only those up to
        the highest one actually used in the match are output (corresponding to
        the return code from pcre2_match()). Groups that did not take  part  in
-       the match are output as "<unset>".
+       the  match  are  output as "<unset>". This modifier is not relevant for
+       DFA matching (which does no capturing); it is ignored, with  a  warning
+       message, if present.
 
    Testing callouts
 
@@ -1363,10 +1395,11 @@ CALLOUTS
        attempt starting at the fourth character of the  subject  string,  when
        the  pointer  was  at  the seventh character, and when the next pattern
        item was \d. Just one circumflex is output if  the  start  and  current
-       positions are the same.
+       positions  are  the same, or if the current position precedes the start
+       position, which can happen if the callout is in a lookbehind assertion.
 
        Callouts numbered 255 are assumed to be automatic callouts, inserted as
-       a result of the /auto_callout pattern modifier. In this  case,  instead
+       a  result  of the /auto_callout pattern modifier. In this case, instead
        of showing the callout number, the offset in the pattern, preceded by a
        plus, is output. For example:
 
@@ -1380,7 +1413,7 @@ CALLOUTS
           0: E*
 
        If a pattern contains (*MARK) items, an additional line is output when-
-       ever  a  change  of  latest mark is passed to the callout function. For
+       ever a change of latest mark is passed to  the  callout  function.  For
        example:
 
            re> /a(*MARK:X)bc/auto_callout
@@ -1394,17 +1427,17 @@ CALLOUTS
          +12 ^  ^
           0: abc
 
-       The mark changes between matching "a" and "b", but stays the  same  for
-       the  rest  of  the match, so nothing more is output. If, as a result of
-       backtracking, the mark reverts to being unset, the  text  "<unset>"  is
+       The  mark  changes between matching "a" and "b", but stays the same for
+       the rest of the match, so nothing more is output. If, as  a  result  of
+       backtracking,  the  mark  reverts to being unset, the text "<unset>" is
        output.
 
    Callouts with string arguments
 
        The output for a callout with a string argument is similar, except that
-       instead of outputting a callout number before the position  indicators,
-       the  callout  string  and  its  offset in the pattern string are output
-       before the reflection of the subject string, and the subject string  is
+       instead  of outputting a callout number before the position indicators,
+       the callout string and its offset in  the  pattern  string  are  output
+       before  the reflection of the subject string, and the subject string is
        reflected for each callout. For example:
 
            re> /^ab(?C'first')cd(?C"second")ef/
@@ -1421,41 +1454,46 @@ CALLOUTS
 NON-PRINTING CHARACTERS
 
        When pcre2test is outputting text in the compiled version of a pattern,
-       bytes other than 32-126 are always treated as  non-printing  characters
+       bytes  other  than 32-126 are always treated as non-printing characters
        and are therefore shown as hex escapes.
 
-       When  pcre2test  is outputting text that is a matched part of a subject
-       string, it behaves in the same way, unless a different locale has  been
-       set  for  the  pattern  (using the /locale modifier). In this case, the
-       isprint() function is used to  distinguish  printing  and  non-printing
+       When pcre2test is outputting text that is a matched part of  a  subject
+       string,  it behaves in the same way, unless a different locale has been
+       set for the pattern (using the /locale modifier).  In  this  case,  the
+       isprint()  function  is  used  to distinguish printing and non-printing
        characters.
 
 
 SAVING AND RESTORING COMPILED PATTERNS
 
-       It  is  possible  to  save  compiled patterns on disc or elsewhere, and
+       It is possible to save compiled patterns  on  disc  or  elsewhere,  and
        reload them later, subject to a number of restrictions. JIT data cannot
-       be  saved.  The host on which the patterns are reloaded must be running
+       be saved. The host on which the patterns are reloaded must  be  running
        the same version of PCRE2, with the same code unit width, and must also
-       have  the  same  endianness,  pointer width and PCRE2_SIZE type. Before
-       compiled patterns can be saved they must be serialized, that  is,  con-
-       verted  to a stream of bytes. A single byte stream may contain any num-
-       ber of compiled patterns, but they must  all  use  the  same  character
+       have the same endianness, pointer width  and  PCRE2_SIZE  type.  Before
+       compiled  patterns  can be saved they must be serialized, that is, con-
+       verted to a stream of bytes. A single byte stream may contain any  num-
+       ber  of  compiled  patterns,  but  they must all use the same character
        tables. A single copy of the tables is included in the byte stream (its
        size is 1088 bytes).
 
-       The functions whose names begin  with  pcre2_serialize_  are  used  for
-       serializing  and de-serializing. They are described in the pcre2serial-
+       The  functions  whose  names  begin  with pcre2_serialize_ are used for
+       serializing and de-serializing. They are described in the  pcre2serial-
        ize  documentation.  In  this  section  we  describe  the  features  of
        pcre2test that can be used to test these functions.
 
-       When  a  pattern  with  push  modifier  is successfully compiled, it is
-       pushed onto a stack of compiled patterns,  and  pcre2test  expects  the
-       next  line  to  contain a new pattern (or command) instead of a subject
-       line. By this means, a number of patterns can be compiled and retained.
-       The  push  modifier  is  incompatible with posix, and control modifiers
-       that act at match time are ignored (with a message). The jitverify mod-
-       ifier applies only at compile time. The command
+       When a pattern with push  modifier  is  successfully  compiled,  it  is
+       pushed  onto  a  stack  of compiled patterns, and pcre2test expects the
+       next line to contain a new pattern (or command) instead  of  a  subject
+       line.  By contrast, the pushcopy modifier causes a copy of the compiled
+       pattern to be stacked, leaving the  original  available  for  immediate
+       matching.  By  using  push and/or pushcopy, a number of patterns can be
+       compiled and retained. These modifiers are incompatible with posix, and
+       control  modifiers  that act at match time are ignored (with a message)
+       for the stacked patterns. The jitverify modifier applies only  at  com-
+       pile time.
+
+       The command
 
          #save <filename>
 
@@ -1472,9 +1510,10 @@ SAVING AND RESTORING COMPILED PATTERNS
        matched  with  the pattern, terminated as usual by an empty line or end
        of file. This command may be followed by  a  modifier  list  containing
        only  control  modifiers that act after a pattern has been compiled. In
-       particular, hex, posix, and push are not allowed, nor are  any  option-
-       setting  modifiers.   The JIT modifiers are, however permitted. Here is
-       an example that saves and reloads two patterns.
+       particular,  hex,  posix,  posix_nosub,  push,  and  pushcopy  are  not
+       allowed,  nor are any option-setting modifiers.  The JIT modifiers are,
+       however permitted. Here is an example that saves and reloads  two  pat-
+       terns.
 
          /abc/push
          /xyz/push
@@ -1486,9 +1525,13 @@ SAVING AND RESTORING COMPILED PATTERNS
          #pop jit,bincode
          abc
 
-       If jitverify is used with #pop, it does not  automatically  imply  jit,
+       If  jitverify  is  used with #pop, it does not automatically imply jit,
        which is different behaviour from when it is used on a pattern.
 
+       The #popcopy command is analagous to the pushcopy modifier in  that  it
+       makes current a copy of the topmost stack pattern, leaving the original
+       still on the stack.
+
 
 SEE ALSO
 
@@ -1505,5 +1548,5 @@ AUTHOR
 
 REVISION
 
-       Last updated: 12 December 2015
-       Copyright (c) 1997-2015 University of Cambridge.
+       Last updated: 06 July 2016
+       Copyright (c) 1997-2016 University of Cambridge.
index 59e226e3067342d44f5ce14881ac4281a209e8bb..253d4b64d13a01134c7fefd6964c56d4e6c51f97 100644 (file)
@@ -1,4 +1,4 @@
-.TH PCRE2UNICODE 3 "16 October 2015" "PCRE2 10.21"
+.TH PCRE2UNICODE 3 "03 July 2016" "PCRE2 10.22"
 .SH NAME
 PCRE - Perl-compatible regular expressions (revised API)
 .SH "UNICODE AND UTF SUPPORT"
@@ -57,18 +57,21 @@ individual code units.
 In UTF modes, the dot metacharacter matches one UTF character instead of a
 single code unit.
 .P
-The escape sequence \eC can be used to match a single code unit, in a UTF mode,
+The escape sequence \eC can be used to match a single code unit in a UTF mode,
 but its use can lead to some strange effects because it breaks up multi-unit
 characters (see the description of \eC in the
 .\" HREF
 \fBpcre2pattern\fP
 .\"
-documentation). The use of \eC is not supported by the alternative matching
-function \fBpcre2_dfa_match()\fP when in UTF mode. Its use provokes a
-match-time error. The JIT optimization also does not support \eC in UTF mode.
-If JIT optimization is requested for a UTF pattern that contains \eC, it will
-not succeed, and so the matching will be carried out by the normal interpretive
-function.
+documentation).
+.P
+The use of \eC is not supported by the alternative matching function
+\fBpcre2_dfa_match()\fP when in UTF-8 or UTF-16 mode, that is, when a character
+may consist of more than one code unit. The use of \eC in these modes provokes
+a match-time error. Also, the JIT optimization does not support \eC in these
+modes. If JIT optimization is requested for a UTF-8 or UTF-16 pattern that
+contains \eC, it will not succeed, and so when \fBpcre2_match()\fP is called,
+the matching will be carried out by the normal interpretive function.
 .P
 The character escapes \eb, \eB, \ed, \eD, \es, \eS, \ew, and \eW correctly test
 characters of any code value, but, by default, the characters that PCRE2
@@ -232,9 +235,9 @@ never occur in a valid UTF-8 string.
 .sp
 The following negative error codes are given for invalid UTF-16 strings:
 .sp
-  PCRE_UTF16_ERR1  Missing low surrogate at end of string
-  PCRE_UTF16_ERR2  Invalid low surrogate follows high surrogate
-  PCRE_UTF16_ERR3  Isolated low surrogate
+  PCRE2_ERROR_UTF16_ERR1  Missing low surrogate at end of string
+  PCRE2_ERROR_UTF16_ERR2  Invalid low surrogate follows high surrogate
+  PCRE2_ERROR_UTF16_ERR3  Isolated low surrogate
 .sp
 .
 .
@@ -244,8 +247,8 @@ The following negative error codes are given for invalid UTF-16 strings:
 .sp
 The following negative error codes are given for invalid UTF-32 strings:
 .sp
-  PCRE_UTF32_ERR1  Surrogate character (range from 0xd800 to 0xdfff)
-  PCRE_UTF32_ERR2  Code point is greater than 0x10ffff
+  PCRE2_ERROR_UTF32_ERR1  Surrogate character (0xd800 to 0xdfff)
+  PCRE2_ERROR_UTF32_ERR2  Code point is greater than 0x10ffff
 .sp
 .
 .
@@ -263,6 +266,6 @@ Cambridge, England.
 .rs
 .sp
 .nf
-Last updated: 16 October 2015
-Copyright (c) 1997-2015 University of Cambridge.
+Last updated: 03 July 2016
+Copyright (c) 1997-2016 University of Cambridge.
 .fi
index 744f19898f7466dc15f7ad6f5516ada6f444c7ff..8a71be01e5f6a2ed91bcea8f262338537bf91903 100644 (file)
@@ -111,6 +111,9 @@ sure both macros are undefined; an emulation function will then be used. */
 /* Define to 1 if you have the <sys/types.h> header file. */
 /* #undef HAVE_SYS_TYPES_H */
 
+/* Define to 1 if you have the <sys/wait.h> header file. */
+/* #undef HAVE_SYS_WAIT_H */
+
 /* Define to 1 if you have the <unistd.h> header file. */
 /* #undef HAVE_UNISTD_H */
 
@@ -203,7 +206,7 @@ sure both macros are undefined; an emulation function will then be used. */
 #define PACKAGE_NAME "PCRE2"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "PCRE2 10.21"
+#define PACKAGE_STRING "PCRE2 10.22"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "pcre2"
@@ -212,7 +215,7 @@ sure both macros are undefined; an emulation function will then be used. */
 #define PACKAGE_URL ""
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "10.21"
+#define PACKAGE_VERSION "10.22"
 
 /* The value of PARENS_NEST_LIMIT specifies the maximum depth of nested
    parentheses (of any kind) in a pattern. This limits the amount of system
@@ -271,6 +274,9 @@ sure both macros are undefined; an emulation function will then be used. */
    is able to handle .gz files. */
 /* #undef SUPPORT_LIBZ */
 
+/* Define to any value to enable callout script support in pcre2grep. */
+/* #undef SUPPORT_PCRE2GREP_CALLOUT */
+
 /* Define to any value to enable JIT support in pcre2grep. */
 /* #undef SUPPORT_PCRE2GREP_JIT */
 
@@ -293,7 +299,7 @@ sure both macros are undefined; an emulation function will then be used. */
 /* #undef SUPPORT_VALGRIND */
 
 /* Version number of package */
-#define VERSION "10.21"
+#define VERSION "10.22"
 
 /* Define to empty if `const' does not conform to ANSI C. */
 /* #undef const */
index e55d0a04842dc0fc31310c0fc900ea80b41047ba..d4821af94f6a10a627cd7502f2b51dbe2a4a7d62 100644 (file)
@@ -111,6 +111,9 @@ sure both macros are undefined; an emulation function will then be used. */
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
+/* Define to 1 if you have the <sys/wait.h> header file. */
+#undef HAVE_SYS_WAIT_H
+
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
@@ -262,6 +265,9 @@ sure both macros are undefined; an emulation function will then be used. */
    is able to handle .gz files. */
 #undef SUPPORT_LIBZ
 
+/* Define to any value to enable callout script support in pcre2grep. */
+#undef SUPPORT_PCRE2GREP_CALLOUT
+
 /* Define to any value to enable JIT support in pcre2grep. */
 #undef SUPPORT_PCRE2GREP_JIT
 
index 7f9ba4f19a96ee90d0d617edef8db27f664e16f8..20d221b8032027176518b7f89f00adf7baa0eee4 100644 (file)
@@ -42,9 +42,9 @@ POSSIBILITY OF SUCH DAMAGE.
 /* The current PCRE version information. */
 
 #define PCRE2_MAJOR          10
-#define PCRE2_MINOR          21
+#define PCRE2_MINOR          22
 #define PCRE2_PRERELEASE     
-#define PCRE2_DATE           2016-01-12
+#define PCRE2_DATE           2016-07-29
 
 /* When an application links to a PCRE DLL in Windows, the symbols that are
 imported have to be identified as such. When building PCRE2, the appropriate
@@ -146,7 +146,8 @@ sanity checks). */
 #define PCRE2_DFA_RESTART         0x00000040u
 #define PCRE2_DFA_SHORTEST        0x00000080u
 
-/* These are additional options for pcre2_substitute(). */
+/* These are additional options for pcre2_substitute(), which passes any others
+through to pcre2_match(). */
 
 #define PCRE2_SUBSTITUTE_GLOBAL           0x00000100u
 #define PCRE2_SUBSTITUTE_EXTENDED         0x00000200u
@@ -154,6 +155,11 @@ sanity checks). */
 #define PCRE2_SUBSTITUTE_UNKNOWN_UNSET    0x00000800u
 #define PCRE2_SUBSTITUTE_OVERFLOW_LENGTH  0x00001000u
 
+/* A further option for pcre2_match(), not allowed for pcre2_dfa_match(),
+ignored for pcre2_jit_match(). */
+
+#define PCRE2_NO_JIT              0x00002000u
+
 /* Newline and \R settings, for use in compile contexts. The newline values
 must be kept in step with values set in config.h and both sets must all be
 greater than zero. */
@@ -245,6 +251,7 @@ numbers must not be changed. */
 #define PCRE2_ERROR_BADSUBSTITUTION   (-59)
 #define PCRE2_ERROR_BADSUBSPATTERN    (-60)
 #define PCRE2_ERROR_TOOMANYREPLACE    (-61)
+#define PCRE2_ERROR_BADSERIALIZEDDATA (-62)
 
 /* Request types for pcre2_pattern_info() */
 
@@ -436,7 +443,9 @@ PCRE2_EXP_DECL int       pcre2_set_recursion_memory_management( \
 PCRE2_EXP_DECL \
   pcre2_code            *pcre2_compile(PCRE2_SPTR, PCRE2_SIZE, uint32_t, \
                            int *, PCRE2_SIZE *, pcre2_compile_context *); \
-PCRE2_EXP_DECL void      pcre2_code_free(pcre2_code *);
+PCRE2_EXP_DECL void      pcre2_code_free(pcre2_code *); \
+PCRE2_EXP_DECL \
+  pcre2_code            *pcre2_code_copy(const pcre2_code *);
 
 
 /* Functions that give information about a compiled pattern. */
@@ -585,6 +594,7 @@ pcre2_compile are called by application code. */
 /* Functions: the complete list in alphabetical order */
 
 #define pcre2_callout_enumerate               PCRE2_SUFFIX(pcre2_callout_enumerate_)
+#define pcre2_code_copy                       PCRE2_SUFFIX(pcre2_code_copy_)
 #define pcre2_code_free                       PCRE2_SUFFIX(pcre2_code_free_)
 #define pcre2_compile                         PCRE2_SUFFIX(pcre2_compile_)
 #define pcre2_compile_context_copy            PCRE2_SUFFIX(pcre2_compile_context_copy_)
index 49f1909654c5adb08a87defd5575771cc88484f3..e1d944dc873276039a54abb241aa496477f01c71 100644 (file)
@@ -146,7 +146,8 @@ sanity checks). */
 #define PCRE2_DFA_RESTART         0x00000040u
 #define PCRE2_DFA_SHORTEST        0x00000080u
 
-/* These are additional options for pcre2_substitute(). */
+/* These are additional options for pcre2_substitute(), which passes any others
+through to pcre2_match(). */
 
 #define PCRE2_SUBSTITUTE_GLOBAL           0x00000100u
 #define PCRE2_SUBSTITUTE_EXTENDED         0x00000200u
@@ -154,6 +155,11 @@ sanity checks). */
 #define PCRE2_SUBSTITUTE_UNKNOWN_UNSET    0x00000800u
 #define PCRE2_SUBSTITUTE_OVERFLOW_LENGTH  0x00001000u
 
+/* A further option for pcre2_match(), not allowed for pcre2_dfa_match(),
+ignored for pcre2_jit_match(). */
+
+#define PCRE2_NO_JIT              0x00002000u
+
 /* Newline and \R settings, for use in compile contexts. The newline values
 must be kept in step with values set in config.h and both sets must all be
 greater than zero. */
@@ -245,6 +251,7 @@ numbers must not be changed. */
 #define PCRE2_ERROR_BADSUBSTITUTION   (-59)
 #define PCRE2_ERROR_BADSUBSPATTERN    (-60)
 #define PCRE2_ERROR_TOOMANYREPLACE    (-61)
+#define PCRE2_ERROR_BADSERIALIZEDDATA (-62)
 
 /* Request types for pcre2_pattern_info() */
 
@@ -436,7 +443,9 @@ PCRE2_EXP_DECL int       pcre2_set_recursion_memory_management( \
 PCRE2_EXP_DECL \
   pcre2_code            *pcre2_compile(PCRE2_SPTR, PCRE2_SIZE, uint32_t, \
                            int *, PCRE2_SIZE *, pcre2_compile_context *); \
-PCRE2_EXP_DECL void      pcre2_code_free(pcre2_code *);
+PCRE2_EXP_DECL void      pcre2_code_free(pcre2_code *); \
+PCRE2_EXP_DECL \
+  pcre2_code            *pcre2_code_copy(const pcre2_code *);
 
 
 /* Functions that give information about a compiled pattern. */
@@ -585,6 +594,7 @@ pcre2_compile are called by application code. */
 /* Functions: the complete list in alphabetical order */
 
 #define pcre2_callout_enumerate               PCRE2_SUFFIX(pcre2_callout_enumerate_)
+#define pcre2_code_copy                       PCRE2_SUFFIX(pcre2_code_copy_)
 #define pcre2_code_free                       PCRE2_SUFFIX(pcre2_code_free_)
 #define pcre2_compile                         PCRE2_SUFFIX(pcre2_compile_)
 #define pcre2_compile_context_copy            PCRE2_SUFFIX(pcre2_compile_context_copy_)
index d4d2334d894644e7b380ea32f8600d41f34e652d..8d0fa896ecabee3a01383d5c66c4fdcdc5ed927f 100644 (file)
@@ -91,6 +91,7 @@ static const uint8_t autoposstab[APTROWS][APTCOLS] = {
   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }   /* \X */
 };
 
+#ifdef SUPPORT_UNICODE
 /* This table is used to check whether auto-possessification is possible
 between adjacent Unicode property opcodes (OP_PROP and OP_NOTPROP). The
 left-hand (repeated) opcode is used to select the row, and the right-hand
@@ -170,6 +171,7 @@ static const uint8_t posspropstab[3][4] = {
   { ucp_Z, ucp_Z, ucp_C, ucp_Cc },  /* SPACE and PXSPACE, 2nd value redundant */
   { ucp_L, ucp_N, ucp_P, ucp_Po }   /* WORD */
 };
+#endif  /* SUPPORT_UNICODE */
 
 
 
index d8528378e7974b86918ca19cfb020f6f7f9f471a..bb9736cd51b14c9efb025060b84db405f807475a 100644 (file)
@@ -81,7 +81,7 @@ by defining macros in order to minimize #if usage. */
 
 /* Function definitions to allow mutual recursion */
 
-static int
+static unsigned int
   add_list_to_class(uint8_t *, PCRE2_UCHAR **, uint32_t, compile_block *,
     const uint32_t *, unsigned int);
 
@@ -149,9 +149,16 @@ have to check them every time. */
 
 #define OFLOW_MAX (INT_MAX - 20)
 
-/* Macro for setting individual bits in class bitmaps. */
+/* Macro for setting individual bits in class bitmaps. It took some
+experimenting to figure out how to stop gcc 5.3.0 from warning with
+-Wconversion. This version gets a warning:
+
+  #define SETBIT(a,b) a[(b)/8] |= (uint8_t)(1 << ((b)&7))
+
+Let's hope the apparently less efficient version isn't actually so bad if the
+compiler is clever with identical subexpressions. */
 
-#define SETBIT(a,b) a[(b)/8] |= (1 << ((b)&7))
+#define SETBIT(a,b) a[(b)/8] = (uint8_t)(a[(b)/8] | (1 << ((b)&7)))
 
 /* Private flags added to firstcu and reqcu. */
 
@@ -722,6 +729,39 @@ static const uint8_t opcode_possessify[] = {
 
 
 
+/*************************************************
+*               Copy compiled code               *
+*************************************************/
+
+/* Compiled JIT code cannot be copied, so the new compiled block has no
+associated JIT data. */
+
+PCRE2_EXP_DEFN pcre2_code * PCRE2_CALL_CONVENTION
+pcre2_code_copy(const pcre2_code *code)
+{
+PCRE2_SIZE* ref_count;
+pcre2_code *newcode;
+
+if (code == NULL) return NULL;
+newcode = code->memctl.malloc(code->blocksize, code->memctl.memory_data);
+if (newcode == NULL) return NULL;
+memcpy(newcode, code, code->blocksize);
+newcode->executable_jit = NULL;
+
+/* If the code is one that has been deserialized, increment the reference count
+in the decoded tables. */
+
+if ((code->flags & PCRE2_DEREF_TABLES) != 0)
+  {
+  ref_count = (PCRE2_SIZE *)(code->tables + tables_length);
+  (*ref_count)++;
+  }
+
+return newcode;
+}
+
+
+
 /*************************************************
 *               Free compiled code               *
 *************************************************/
@@ -804,7 +844,7 @@ static void
 complete_callout(PCRE2_UCHAR *previous_callout, PCRE2_SPTR ptr,
   compile_block *cb)
 {
-size_t length = ptr - cb->start_pattern - GET(previous_callout, 1);
+size_t length = (size_t)(ptr - cb->start_pattern - GET(previous_callout, 1));
 PUT(previous_callout, 1 + LINK_SIZE, length);
 }
 
@@ -839,9 +879,10 @@ Arguments:
 Returns:   if non-negative, the fixed length,
              or -1 if an OP_RECURSE item was encountered and atend is FALSE
              or -2 if there is no fixed length,
-             or -3 if \C was encountered (in UTF-8 mode only)
-             or -4 length is too long
-             or -5 if an unknown opcode was encountered (internal error)
+             or -3 if \C was encountered (in UTF mode only)
+             or -4 if length is too long
+             or -5 if regex is too complicated
+             or -6 if an unknown opcode was encountered (internal error)
 */
 
 #define FFL_LATER           (-1)
@@ -855,11 +896,11 @@ static int
 find_fixedlength(PCRE2_UCHAR *code, BOOL utf, BOOL atend, compile_block *cb,
   recurse_check *recurses, int *countptr)
 {
-int length = -1;
+uint32_t length = 0xffffffffu;   /* Unset */
 uint32_t group = 0;
 uint32_t groupinfo = 0;
 recurse_check this_recurse;
-register int branchlength = 0;
+register uint32_t branchlength = 0;
 register PCRE2_UCHAR *cc = code + 1 + LINK_SIZE;
 
 /* If this is a capturing group, we may have the answer cached, but we can only
@@ -910,7 +951,7 @@ for (;;)
     case OP_COND:
     d = find_fixedlength(cc, utf, atend, cb, recurses, countptr);
     if (d < 0) return d;
-    branchlength += d;
+    branchlength += (uint32_t)d;
     do cc += GET(cc, 1); while (*cc == OP_ALT);
     cc += 1 + LINK_SIZE;
     break;
@@ -926,16 +967,16 @@ for (;;)
     case OP_END:
     case OP_ACCEPT:
     case OP_ASSERT_ACCEPT:
-    if (length < 0) length = branchlength;
+    if (length == 0xffffffffu) length = branchlength;
       else if (length != branchlength) goto ISNOTFIXED;
     if (*cc != OP_ALT)
       {
       if (group > 0)
         {
-        groupinfo |= (GI_SET_FIXED_LENGTH | length);
+        groupinfo |= (uint32_t)(GI_SET_FIXED_LENGTH | length);
         cb->groupinfo[group] = groupinfo;
         }
-      return length;
+      return (int)length;
       }
     cc += 1 + LINK_SIZE;
     branchlength = 0;
@@ -960,7 +1001,7 @@ for (;;)
     this_recurse.group = cs;
     d = find_fixedlength(cs, utf, atend, cb, &this_recurse, countptr);
     if (d < 0) return d;
-    branchlength += d;
+    branchlength += (uint32_t)d;
     cc += 1 + LINK_SIZE;
     break;
 
@@ -1039,7 +1080,7 @@ for (;;)
     case OP_EXACTI:
     case OP_NOTEXACT:
     case OP_NOTEXACTI:
-    branchlength += (int)GET2(cc,1);
+    branchlength += GET2(cc,1);
     cc += 2 + IMM2_SIZE;
 #ifdef SUPPORT_UNICODE
     if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
@@ -1076,8 +1117,8 @@ for (;;)
     cc++;
     break;
 
-    /* The single-byte matcher isn't allowed. This only happens in UTF-8 mode;
-    otherwise \C is coded as OP_ALLANY. */
+    /* The single-byte matcher isn't allowed. This only happens in UTF-8 or
+    UTF-16 mode; otherwise \C is coded as OP_ALLANY. */
 
     case OP_ANYBYTE:
     return FFL_BACKSLASHC;
@@ -1115,7 +1156,7 @@ for (;;)
       case OP_CRMINRANGE:
       case OP_CRPOSRANGE:
       if (GET2(cc,1) != GET2(cc,1+IMM2_SIZE)) goto ISNOTFIXED;
-      branchlength += (int)GET2(cc,1);
+      branchlength += GET2(cc,1);
       cc += 1 + 2 * IMM2_SIZE;
       break;
 
@@ -1941,7 +1982,7 @@ else
         overflow = TRUE;
         break;
         }
-      s = s * 10 + (int)(*(++ptr) - CHAR_0);
+      s = s * 10 + (unsigned int)(*(++ptr) - CHAR_0);
       }
     if (overflow) /* Integer overflow */
       {
@@ -2005,7 +2046,7 @@ else
           overflow = TRUE;
           break;
           }
-        s = s * 10 + (int)(*(++ptr) - CHAR_0);
+        s = s * 10 + (unsigned int)(*(++ptr) - CHAR_0);
         }
       if (overflow) /* Integer overflow */
         {
@@ -2285,7 +2326,7 @@ get_ucp(PCRE2_SPTR *ptrptr, BOOL *negptr, unsigned int *ptypeptr,
   unsigned int *pdataptr, int *errorcodeptr, compile_block *cb)
 {
 register PCRE2_UCHAR c;
-int i, bot, top;
+size_t i, bot, top;
 PCRE2_SPTR ptr = *ptrptr;
 PCRE2_UCHAR name[32];
 
@@ -2753,13 +2794,13 @@ Returns:        the number of < 256 characters added
                 the pointer to extra data is updated
 */
 
-static int
+static unsigned int
 add_to_class(uint8_t *classbits, PCRE2_UCHAR **uchardptr, uint32_t options,
   compile_block *cb, uint32_t start, uint32_t end)
 {
 uint32_t c;
 uint32_t classbits_end = (end <= 0xff ? end : 0xff);
-int n8 = 0;
+unsigned int n8 = 0;
 
 /* If caseless matching is required, scan the range and process alternate
 cases. In Unicode, there are 8-bit characters that have alternate cases that
@@ -2907,14 +2948,14 @@ Returns:        the number of < 256 characters added
                 the pointer to extra data is updated
 */
 
-static int
+static unsigned int
 add_list_to_class(uint8_t *classbits, PCRE2_UCHAR **uchardptr, uint32_t options,
   compile_block *cb, const uint32_t *p, unsigned int except)
 {
-int n8 = 0;
+unsigned int n8 = 0;
 while (p[0] < NOTACHAR)
   {
-  int n = 0;
+  unsigned int n = 0;
   if (p[0] != except)
     {
     while(p[n+1] == p[0] + n + 1) n++;
@@ -2945,12 +2986,12 @@ Returns:        the number of < 256 characters added
                 the pointer to extra data is updated
 */
 
-static int
+static unsigned int
 add_not_list_to_class(uint8_t *classbits, PCRE2_UCHAR **uchardptr,
   uint32_t options, compile_block *cb, const uint32_t *p)
 {
 BOOL utf = (options & PCRE2_UTF) != 0;
-int n8 = 0;
+unsigned int n8 = 0;
 if (p[0] > 0)
   n8 += add_to_class(classbits, uchardptr, options, cb, 0, p[0] - 1);
 while (p[0] < NOTACHAR)
@@ -3099,7 +3140,7 @@ for (; ptr < cb->end_pattern; ptr++)
 
   /* Not UTF */
     {
-    if (code != NULL) *code++ = x;
+    if (code != NULL) *code++ = (PCRE2_UCHAR)x;
     }
 
   arglen++;
@@ -3173,20 +3214,20 @@ typedef struct nest_save {
 #define NSF_EXTENDED 0x0002u
 #define NSF_DUPNAMES 0x0004u
 
-static uint32_t scan_for_captures(PCRE2_SPTR *ptrptr, uint32_t options,
+static int scan_for_captures(PCRE2_SPTR *ptrptr, uint32_t options,
   compile_block *cb)
 {
 uint32_t c;
 uint32_t delimiter;
-uint32_t nest_depth = 0;
 uint32_t set, unset, *optset;
+uint32_t skiptoket = 0;
+uint16_t nest_depth = 0;
 int errorcode = 0;
 int escape;
 int namelen;
 int i;
 BOOL inescq = FALSE;
 BOOL isdupname;
-BOOL skiptoket = FALSE;
 BOOL utf = (options & PCRE2_UTF) != 0;
 BOOL negate_class;
 PCRE2_SPTR name;
@@ -3213,10 +3254,10 @@ for (; ptr < cb->end_pattern; ptr++)
   next closing parenthesis must be ignored. The parenthesis itself must be
   processed (to end the nested parenthesized item). */
 
-  if (skiptoket)
+  if (skiptoket != 0)
     {
     if (c != CHAR_RIGHT_PARENTHESIS) continue;
-    skiptoket = FALSE;
+    skiptoket = 0;
     }
 
   /* Skip over literals */
@@ -3231,17 +3272,16 @@ for (; ptr < cb->end_pattern; ptr++)
     continue;
     }
 
-  /* Skip over comments and whitespace in extended mode. Need a loop to handle
-  whitespace after a comment. */
+  /* Skip over # comments and whitespace in extended mode. */
 
   if ((options & PCRE2_EXTENDED) != 0)
     {
-    for (;;)
+    PCRE2_SPTR wscptr = ptr;
+    while (MAX_255(c) && (cb->ctypes[c] & ctype_space) != 0) c = *(++ptr);
+    if (c == CHAR_NUMBER_SIGN)
       {
-      while (MAX_255(c) && (cb->ctypes[c] & ctype_space) != 0) c = *(++ptr);
-      if (c != CHAR_NUMBER_SIGN) break;
       ptr++;
-      while (*ptr != CHAR_NULL)
+      while (ptr < cb->end_pattern)
         {
         if (IS_NEWLINE(ptr))         /* For non-fixed-length newline cases, */
           {                          /* IS_NEWLINE sets cb->nllen. */
@@ -3253,7 +3293,15 @@ for (; ptr < cb->end_pattern; ptr++)
         if (utf) FORWARDCHAR(ptr);
 #endif
         }
-      c = *ptr;     /* Either NULL or the char after a newline */
+      }
+
+    /* If we skipped any characters, restart the loop. Otherwise, we didn't see
+    a comment. */
+
+    if (ptr > wscptr)
+      {
+      ptr--;
+      continue;
       }
     }
 
@@ -3377,27 +3425,24 @@ for (; ptr < cb->end_pattern; ptr++)
         if ((options & PCRE2_NO_AUTO_CAPTURE) == 0) cb->bracount++;
         }
 
-      /* (*something) - just skip to closing ket unless PCRE2_ALT_VERBNAMES is
-      set, in which case we have to process escapes in the string after the
-      name. */
+      /* (*something) - skip over a name, and then just skip to closing ket
+      unless PCRE2_ALT_VERBNAMES is set, in which case we have to process
+      escapes in the string after a verb name terminated by a colon. */
 
       else
         {
         ptr += 2;
         while (MAX_255(*ptr) && (cb->ctypes[*ptr] & ctype_word) != 0) ptr++;
-        if (*ptr == CHAR_COLON)
+        if (*ptr == CHAR_COLON && (options & PCRE2_ALT_VERBNAMES) != 0)
           {
           ptr++;
-          if ((options & PCRE2_ALT_VERBNAMES) != 0)
-            {
-            if (process_verb_name(&ptr, NULL, &errorcode, options, utf, cb) < 0)
-              goto FAILED;
-            }
-          else
-            {
-            while (ptr < cb->end_pattern && *ptr != CHAR_RIGHT_PARENTHESIS)
-              ptr++;
-            }
+          if (process_verb_name(&ptr, NULL, &errorcode, options, utf, cb) < 0)
+            goto FAILED;
+          }
+        else
+          {
+          while (ptr < cb->end_pattern && *ptr != CHAR_RIGHT_PARENTHESIS)
+            ptr++;
           }
         nest_depth--;
         }
@@ -3414,7 +3459,7 @@ for (; ptr < cb->end_pattern; ptr++)
           IS_DIGIT(ptr[0]) ||                           /* (?n) */
           (ptr[0] == CHAR_MINUS && IS_DIGIT(ptr[1])))   /* (?-n) */
         {
-        skiptoket = TRUE;
+        skiptoket = ptr[0];
         break;
         }
 
@@ -3434,8 +3479,8 @@ for (; ptr < cb->end_pattern; ptr++)
 
       if (*ptr == CHAR_VERTICAL_LINE)
         {
-        top_nest->reset_group = cb->bracount;
-        top_nest->max_group = cb->bracount;
+        top_nest->reset_group = (uint16_t)cb->bracount;
+        top_nest->max_group = (uint16_t)cb->bracount;
         top_nest->flags |= NSF_RESET;
         cb->external_flags |= PCRE2_DUPCAPUSED;
         break;
@@ -3470,9 +3515,10 @@ for (; ptr < cb->end_pattern; ptr++)
           case CHAR_U:
           break;
 
-          default:  errorcode = ERR11;
-                    ptr--;    /* Correct the offset */
-                    goto FAILED;
+          default:
+          errorcode = ERR11;
+          ptr--;    /* Correct the offset */
+          goto FAILED;
           }
         }
 
@@ -3648,7 +3694,7 @@ for (; ptr < cb->end_pattern; ptr++)
         }
 
       if (namelen + IMM2_SIZE + 1 > cb->name_entry_size)
-        cb->name_entry_size = namelen + IMM2_SIZE + 1;
+        cb->name_entry_size = (uint16_t)(namelen + IMM2_SIZE + 1);
 
       /* We have a valid name for this capturing group. */
 
@@ -3666,7 +3712,7 @@ for (; ptr < cb->end_pattern; ptr++)
       for (i = 0; i < cb->names_found; i++, ng++)
         {
         if (namelen == ng->length &&
-            PRIV(strncmp)(name, ng->name, namelen) == 0)
+            PRIV(strncmp)(name, ng->name, (size_t)namelen) == 0)
           {
           if (ng->number == cb->bracount) break;
           if ((options & PCRE2_DUPNAMES) == 0)
@@ -3690,7 +3736,7 @@ for (; ptr < cb->end_pattern; ptr++)
 
       if (cb->names_found >= cb->named_group_list_size)
         {
-        int newsize = cb->named_group_list_size * 2;
+        uint32_t newsize = cb->named_group_list_size * 2;
         named_group *newspace =
           cb->cx->memctl.malloc(newsize * sizeof(named_group),
           cb->cx->memctl.memory_data);
@@ -3712,9 +3758,9 @@ for (; ptr < cb->end_pattern; ptr++)
       /* Add this name to the list */
 
       cb->named_groups[cb->names_found].name = name;
-      cb->named_groups[cb->names_found].length = namelen;
+      cb->named_groups[cb->names_found].length = (uint16_t)namelen;
       cb->named_groups[cb->names_found].number = cb->bracount;
-      cb->named_groups[cb->names_found].isdup = isdupname;
+      cb->named_groups[cb->names_found].isdup = (uint16_t)isdupname;
       cb->names_found++;
       break;
       }        /* End of (? switch */
@@ -3727,7 +3773,7 @@ for (; ptr < cb->end_pattern; ptr++)
         (top_nest->flags & NSF_RESET) != 0)
       {
       if (cb->bracount > top_nest->max_group)
-        top_nest->max_group = cb->bracount;
+        top_nest->max_group = (uint16_t)cb->bracount;
       cb->bracount = top_nest->reset_group;
       }
     break;
@@ -3748,13 +3794,26 @@ for (; ptr < cb->end_pattern; ptr++)
       if (top_nest == (nest_save *)(cb->start_workspace)) top_nest = NULL;
         else top_nest--;
       }
-    if (nest_depth > 0) nest_depth--;  /* Can be 0 for unmatched ) */
+    if (nest_depth == 0)    /* Unmatched closing parenthesis */
+      {
+      errorcode = ERR22;
+      goto FAILED;
+      }
+    nest_depth--;
     break;
     }
   }
 
-cb->final_bracount = cb->bracount;
-return 0;
+if (nest_depth == 0)
+  {
+  cb->final_bracount = cb->bracount;
+  return 0;
+  }
+
+/* We give a special error for a missing closing parentheses after (?# because
+it might otherwise be hard to see where the missing character is. */
+
+errorcode = (skiptoket == CHAR_NUMBER_SIGN)? ERR18 : ERR14;
 
 FAILED:
 *ptrptr = ptr;
@@ -3905,6 +3964,10 @@ for (;; ptr++)
   int32_t subreqcuflags, subfirstcuflags;  /* Must be signed */
   PCRE2_UCHAR mcbuffer[8];
 
+  /* Come here to restart the loop. */
+
+  REDO_LOOP:
+
   /* Get next character in the pattern */
 
   c = *ptr;
@@ -3949,7 +4012,7 @@ for (;; ptr++)
       *errorcodeptr = ERR20;
       goto FAILED;
       }
-    *lengthptr += code - last_code;
+    *lengthptr += (size_t)(code - last_code);
 
     /* If "previous" is set and it is not at the start of the work space, move
     it back to there, in order to avoid filling up the work space. Otherwise,
@@ -3959,7 +4022,7 @@ for (;; ptr++)
       {
       if (previous > orig_code)
         {
-        memmove(orig_code, previous, CU2BYTES(code - previous));
+        memmove(orig_code, previous, (size_t)CU2BYTES(code - previous));
         code -= previous - orig_code;
         previous = orig_code;
         }
@@ -4045,11 +4108,7 @@ for (;; ptr++)
     /* If we skipped any characters, restart the loop. Otherwise, we didn't see
     a comment. */
 
-    if (ptr > wscptr)
-      {
-      ptr--;
-      continue;
-      }
+    if (ptr > wscptr) goto REDO_LOOP;
     }
 
   /* Skip over (?# comments. */
@@ -4120,7 +4179,7 @@ for (;; ptr++)
         *errorcodeptr = ERR20;
         goto FAILED;
         }
-      *lengthptr += code - last_code;   /* To include callout length */
+      *lengthptr += (size_t)(code - last_code);  /* To include callout length */
       }
     return TRUE;
 
@@ -4189,17 +4248,15 @@ for (;; ptr++)
     if (PRIV(strncmp_c8)(ptr+1, STRING_WEIRD_STARTWORD, 6) == 0)
       {
       cb->nestptr[0] = ptr + 7;
-      ptr = sub_start_of_word;  /* Do not combine these statements; clang's */
-      ptr--;                    /* sanitizer moans about a negative index. */
-      continue;
+      ptr = sub_start_of_word;
+      goto REDO_LOOP;
       }
 
     if (PRIV(strncmp_c8)(ptr+1, STRING_WEIRD_ENDWORD, 6) == 0)
       {
       cb->nestptr[0] = ptr + 7;
-      ptr = sub_end_of_word;    /* Do not combine these statements; clang's */
-      ptr--;                    /* sanitizer moans about a negative index. */
-      continue;
+      ptr = sub_end_of_word;
+      goto REDO_LOOP;
       }
 
     /* Handle a real character class. */
@@ -4408,7 +4465,7 @@ for (;; ptr++)
             case PC_PUNCT:
             if (ptype == 0) ptype = PT_PXPUNCT;
             *class_uchardata++ = local_negate? XCL_NOTPROP : XCL_PROP;
-            *class_uchardata++ = ptype;
+            *class_uchardata++ = (PCRE2_UCHAR)ptype;
             *class_uchardata++ = 0;
             xclass_has_prop = TRUE;
             ptr = tempptr + 1;
@@ -4456,9 +4513,9 @@ for (;; ptr++)
         if (taboffset >= 0)
           {
           if (tabopt >= 0)
-            for (c = 0; c < 32; c++) pbits[c] |= cbits[c + taboffset];
+            for (c = 0; c < 32; c++) pbits[c] |= cbits[(int)c + taboffset];
           else
-            for (c = 0; c < 32; c++) pbits[c] &= ~cbits[c + taboffset];
+            for (c = 0; c < 32; c++) pbits[c] &= ~cbits[(int)c + taboffset];
           }
 
         /* Now see if we need to remove any special characters. An option
@@ -5899,10 +5956,22 @@ for (;; ptr++)
               goto FAILED;
               }
             cb->had_accept = TRUE;
+
+            /* In the first pass, just accumulate the length required;
+            otherwise hitting (*ACCEPT) inside many nested parentheses can
+            cause workspace overflow. */
+
             for (oc = cb->open_caps; oc != NULL; oc = oc->next)
               {
-              *code++ = OP_CLOSE;
-              PUT2INC(code, 0, oc->number);
+              if (lengthptr != NULL)
+                {
+                *lengthptr += CU2BYTES(1) + IMM2_SIZE;
+                }
+              else
+                {
+                *code++ = OP_CLOSE;
+                PUT2INC(code, 0, oc->number);
+                }
               }
             setverb = *code++ =
               (cb->assert_depth > 0)? OP_ASSERT_ACCEPT : OP_ACCEPT;
@@ -7042,7 +7111,9 @@ for (;; ptr++)
         }
       }
 
-    /* Error if hit end of pattern */
+    /* At the end of a group, it's an error if we hit end of pattern or
+    any non-closing parenthesis. This check also happens in the pre-scan,
+    so should not trigger here, but leave this code as an insurance. */
 
     if (*ptr != CHAR_RIGHT_PARENTHESIS)
       {
@@ -7349,12 +7420,17 @@ for (;; ptr++)
           }
         else
 #endif
-        /* In non-UTF mode, we turn \C into OP_ALLANY instead of OP_ANYBYTE
-        so that it works in DFA mode and in lookbehinds. */
+        /* In non-UTF mode, and for both 32-bit modes, we turn \C into
+        OP_ALLANY instead of OP_ANYBYTE so that it works in DFA mode and in
+        lookbehinds. */
 
           {
           previous = (escape > ESC_b && escape < ESC_Z)? code : NULL;
+#if PCRE2_CODE_UNIT_WIDTH == 32
+          *code++ = (escape == ESC_C)? OP_ALLANY : escape;
+#else
           *code++ = (!utf && escape == ESC_C)? OP_ALLANY : escape;
+#endif
           }
         }
       continue;
@@ -8704,14 +8780,11 @@ if (cb.had_accept)
   reqcuflags = REQ_NONE;
   }
 
-/* If we have not reached end of pattern after a successful compile, there's an
-excess bracket. Fill in the final opcode and check for disastrous overflow.
-If no overflow, but the estimated length exceeds the really used length, adjust
-the value of re->blocksize, and if valgrind support is configured, mark the
-extra allocated memory as unaddressable, so that any out-of-bound reads can be
-detected. */
+/* Fill in the final opcode and check for disastrous overflow. If no overflow,
+but the estimated length exceeds the really used length, adjust the value of
+re->blocksize, and if valgrind support is configured, mark the extra allocated
+memory as unaddressable, so that any out-of-bound reads can be detected. */
 
-if (errorcode == 0 && ptr < cb.end_pattern) errorcode = ERR22;
 *code++ = OP_END;
 usedlength = code - codestart;
 if (usedlength > length) errorcode = ERR23; else
index 921845949500a9b08bb60a5f9fa15e10e605da2c..e99272f577e082472a67fb19e19f0df8324b113d 100644 (file)
@@ -61,15 +61,16 @@ convenient for user programs that want to test their values. */
 * Return info about what features are configured *
 *************************************************/
 
-/*
+/* If where is NULL, the length of memory required is returned.
+
 Arguments:
   what             what information is required
   where            where to put the information
 
-Returns:           0 if data returned
-                   >= 0 if where is NULL, giving length required
+Returns:           0 if a numerical value is returned
+                   >= 0 if a string value
                    PCRE2_ERROR_BADOPTION if "where" not recognized
-                   or JIT target requested when JIT not enabled
+                     or JIT target requested when JIT not enabled
 */
 
 PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
@@ -127,15 +128,15 @@ switch (what)
 #ifdef SUPPORT_JIT
     {
     const char *v = PRIV(jit_get_target)();
-    return 1 + ((where == NULL)?
-      strlen(v) : PRIV(strcpy_c8)((PCRE2_UCHAR *)where, v));
+    return (int)(1 + ((where == NULL)?
+      strlen(v) : PRIV(strcpy_c8)((PCRE2_UCHAR *)where, v)));
     }
 #else
   return PCRE2_ERROR_BADOPTION;
 #endif
 
   case PCRE2_CONFIG_LINKSIZE:
-  *((uint32_t *)where) = configured_link_size;
+  *((uint32_t *)where) = (uint32_t)configured_link_size;
   break;
 
   case PCRE2_CONFIG_MATCHLIMIT:
@@ -169,8 +170,8 @@ switch (what)
 #else
     const char *v = "Unicode not supported";
 #endif
-    return 1 + ((where == NULL)?
-      strlen(v): PRIV(strcpy_c8)((PCRE2_UCHAR *)where, v));
+    return (int)(1 + ((where == NULL)?
+      strlen(v) : PRIV(strcpy_c8)((PCRE2_UCHAR *)where, v)));
    }
   break;
 
@@ -206,8 +207,8 @@ switch (what)
     const char *v = (XSTRING(Z PCRE2_PRERELEASE)[1] == 0)?
       XSTRING(PCRE2_MAJOR.PCRE2_MINOR PCRE2_DATE) :
       XSTRING(PCRE2_MAJOR.PCRE2_MINOR) XSTRING(PCRE2_PRERELEASE PCRE2_DATE);
-    return 1 + ((where == NULL)?
-      strlen(v) : PRIV(strcpy_c8)((PCRE2_UCHAR *)where, v));
+    return (int)(1 + ((where == NULL)?
+      strlen(v) : PRIV(strcpy_c8)((PCRE2_UCHAR *)where, v)));
     }
   }
 
index 76bc08525cf718eb91b4f8a2e5fcd7388f72193d..12b31b1b3600dfb45c1552954a3191fc58fdef02 100644 (file)
@@ -401,7 +401,7 @@ BOOL utf = FALSE;
 BOOL reset_could_continue = FALSE;
 
 rlevel++;
-offsetcount &= (-2);
+offsetcount &= (uint32_t)(-2);  /* Round down */
 
 wscount -= 2;
 wscount = (wscount - (wscount % (INTS_PER_STATEBLOCK * 2))) /
@@ -439,7 +439,7 @@ if (*first_op == OP_REVERSE)
   end_code = this_start_code;
   do
     {
-    size_t back = GET(end_code, 2+LINK_SIZE);
+    size_t back = (size_t)GET(end_code, 2+LINK_SIZE);
     if (back > max_back) max_back = back;
     end_code += GET(end_code, 1);
     }
@@ -481,11 +481,11 @@ if (*first_op == OP_REVERSE)
   end_code = this_start_code;
   do
     {
-    size_t back = GET(end_code, 2+LINK_SIZE);
+    size_t back = (size_t)GET(end_code, 2+LINK_SIZE);
     if (back <= gone_back)
       {
       int bstate = (int)(end_code - start_code + 2 + 2*LINK_SIZE);
-      ADD_NEW_DATA(-bstate, 0, gone_back - back);
+      ADD_NEW_DATA(-bstate, 0, (int)(gone_back - back));
       }
     end_code += GET(end_code, 1);
     }
@@ -509,7 +509,7 @@ else
     do { end_code += GET(end_code, 1); } while (*end_code == OP_ALT);
     new_count = workspace[1];
     if (!workspace[0])
-      memcpy(new_states, active_states, new_count * sizeof(stateblock));
+      memcpy(new_states, active_states, (size_t)new_count * sizeof(stateblock));
     }
 
   /* Not restarting */
@@ -593,8 +593,9 @@ for (;;)
     stateblock *current_state = active_states + i;
     BOOL caseless = FALSE;
     PCRE2_SPTR code;
+    uint32_t codevalue;
     int state_offset = current_state->offset;
-    int codevalue, rrc;
+    int rrc;
     int count;
 
     /* A negative offset is a special case meaning "hold off going to this
@@ -719,7 +720,7 @@ for (;;)
         ADD_ACTIVE(state_offset + 1 + LINK_SIZE, 0);
         if (codevalue != OP_KET)
           {
-          ADD_ACTIVE(state_offset - GET(code, 1), 0);
+          ADD_ACTIVE(state_offset - (int)GET(code, 1), 0);
           }
         }
       else
@@ -733,11 +734,12 @@ for (;;)
             else if (match_count > 0 && ++match_count * 2 > (int)offsetcount)
               match_count = 0;
           count = ((match_count == 0)? (int)offsetcount : match_count * 2) - 2;
-          if (count > 0) memmove(offsets + 2, offsets, count * sizeof(PCRE2_SIZE));
+          if (count > 0) memmove(offsets + 2, offsets,
+            (size_t)count * sizeof(PCRE2_SIZE));
           if (offsetcount >= 2)
             {
-            offsets[0] = (int)(current_subject - start_subject);
-            offsets[1] = (int)(ptr - start_subject);
+            offsets[0] = (PCRE2_SIZE)(current_subject - start_subject);
+            offsets[1] = (PCRE2_SIZE)(ptr - start_subject);
             }
           if ((mb->moptions & PCRE2_DFA_SHORTEST) != 0) return match_count;
           }
@@ -959,7 +961,7 @@ for (;;)
             {
             if (d == '_') left_word = TRUE; else
               {
-              int cat = UCD_CATEGORY(d);
+              uint32_t cat = UCD_CATEGORY(d);
               left_word = (cat == ucp_L || cat == ucp_N);
               }
             }
@@ -984,7 +986,7 @@ for (;;)
             {
             if (c == '_') right_word = TRUE; else
               {
-              int cat = UCD_CATEGORY(c);
+              uint32_t cat = UCD_CATEGORY(c);
               right_word = (cat == ucp_L || cat == ucp_N);
               }
             }
@@ -1369,7 +1371,7 @@ for (;;)
       if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); }
       if (clen > 0)
         {
-        int lgb, rgb;
+        uint32_t lgb, rgb;
         PCRE2_SPTR nptr = ptr + clen;
         int ncount = 0;
         if (count > 0 && codevalue == OP_EXTUNI_EXTRA + OP_TYPEPOSPLUS)
@@ -1383,7 +1385,7 @@ for (;;)
           dlen = 1;
           if (!utf) d = *nptr; else { GETCHARLEN(d, nptr, dlen); }
           rgb = UCD_GRAPHBREAK(d);
-          if ((PRIV(ucp_gbtable)[lgb] & (1 << rgb)) == 0) break;
+          if ((PRIV(ucp_gbtable)[lgb] & (1u << rgb)) == 0) break;
           ncount++;
           lgb = rgb;
           nptr += dlen;
@@ -1630,7 +1632,7 @@ for (;;)
       ADD_ACTIVE(state_offset + 2, 0);
       if (clen > 0)
         {
-        int lgb, rgb;
+        uint32_t lgb, rgb;
         PCRE2_SPTR nptr = ptr + clen;
         int ncount = 0;
         if (codevalue == OP_EXTUNI_EXTRA + OP_TYPEPOSSTAR ||
@@ -1645,7 +1647,7 @@ for (;;)
           dlen = 1;
           if (!utf) d = *nptr; else { GETCHARLEN(d, nptr, dlen); }
           rgb = UCD_GRAPHBREAK(d);
-          if ((PRIV(ucp_gbtable)[lgb] & (1 << rgb)) == 0) break;
+          if ((PRIV(ucp_gbtable)[lgb] & (1u << rgb)) == 0) break;
           ncount++;
           lgb = rgb;
           nptr += dlen;
@@ -1902,7 +1904,7 @@ for (;;)
       count = current_state->count;  /* Number already matched */
       if (clen > 0)
         {
-        int lgb, rgb;
+        uint32_t lgb, rgb;
         PCRE2_SPTR nptr = ptr + clen;
         int ncount = 0;
         if (codevalue == OP_EXTUNI_EXTRA + OP_TYPEPOSUPTO)
@@ -1916,7 +1918,7 @@ for (;;)
           dlen = 1;
           if (!utf) d = *nptr; else { GETCHARLEN(d, nptr, dlen); }
           rgb = UCD_GRAPHBREAK(d);
-          if ((PRIV(ucp_gbtable)[lgb] & (1 << rgb)) == 0) break;
+          if ((PRIV(ucp_gbtable)[lgb] & (1u << rgb)) == 0) break;
           ncount++;
           lgb = rgb;
           nptr += dlen;
@@ -2097,7 +2099,7 @@ for (;;)
       case OP_EXTUNI:
       if (clen > 0)
         {
-        int lgb, rgb;
+        uint32_t lgb, rgb;
         PCRE2_SPTR nptr = ptr + clen;
         int ncount = 0;
         lgb = UCD_GRAPHBREAK(c);
@@ -2106,7 +2108,7 @@ for (;;)
           dlen = 1;
           if (!utf) d = *nptr; else { GETCHARLEN(d, nptr, dlen); }
           rgb = UCD_GRAPHBREAK(d);
-          if ((PRIV(ucp_gbtable)[lgb] & (1 << rgb)) == 0) break;
+          if ((PRIV(ucp_gbtable)[lgb] & (1u << rgb)) == 0) break;
           ncount++;
           lgb = rgb;
           nptr += dlen;
@@ -2582,7 +2584,7 @@ for (;;)
           mb,                                   /* static match data */
           code,                                 /* this subexpression's code */
           ptr,                                  /* where we currently are */
-          (int)(ptr - start_subject),           /* start offset */
+          (PCRE2_SIZE)(ptr - start_subject),    /* start offset */
           local_offsets,                        /* offset vector */
           sizeof(local_offsets)/sizeof(PCRE2_SIZE), /* size of same */
           local_workspace,                      /* workspace vector */
@@ -2601,8 +2603,8 @@ for (;;)
         {
         PCRE2_SIZE local_offsets[1000];
         int local_workspace[1000];
-        int codelink = GET(code, 1);
-        int condcode;
+        int codelink = (int)GET(code, 1);
+        PCRE2_UCHAR condcode;
 
         /* Because of the way auto-callout works during compile, a callout item
         is inserted between OP_COND and an assertion condition. This does not
@@ -2611,8 +2613,10 @@ for (;;)
         if (code[LINK_SIZE + 1] == OP_CALLOUT
             || code[LINK_SIZE + 1] == OP_CALLOUT_STR)
           {
-          unsigned int callout_length = (code[LINK_SIZE + 1] == OP_CALLOUT)
-              ? PRIV(OP_lengths)[OP_CALLOUT] : GET(code, 2 + 3*LINK_SIZE);
+          PCRE2_SIZE callout_length = (code[LINK_SIZE + 1] == OP_CALLOUT)?
+            (PCRE2_SIZE)PRIV(OP_lengths)[OP_CALLOUT] :
+            (PCRE2_SIZE)GET(code, 2 + 3*LINK_SIZE);
+
           rrc = 0;
           if (mb->callout != NULL)
             {
@@ -2678,7 +2682,7 @@ for (;;)
 
         else if (condcode == OP_RREF)
           {
-          int value = GET2(code, LINK_SIZE + 2);
+          unsigned int value = GET2(code, LINK_SIZE + 2);
           if (value != RREF_ANY) return PCRE2_ERROR_DFA_UCOND;
           if (mb->recursive != NULL)
             { ADD_ACTIVE(state_offset + LINK_SIZE + 2 + IMM2_SIZE, 0); }
@@ -2699,7 +2703,7 @@ for (;;)
             mb,                                   /* fixed match data */
             asscode,                              /* this subexpression's code */
             ptr,                                  /* where we currently are */
-            (int)(ptr - start_subject),           /* start offset */
+            (PCRE2_SIZE)(ptr - start_subject),    /* start offset */
             local_offsets,                        /* offset vector */
             sizeof(local_offsets)/sizeof(PCRE2_SIZE), /* size of same */
             local_workspace,                      /* workspace vector */
@@ -2747,7 +2751,7 @@ for (;;)
           mb,                                   /* fixed match data */
           callpat,                              /* this subexpression's code */
           ptr,                                  /* where we currently are */
-          (int)(ptr - start_subject),           /* start offset */
+          (PCRE2_SIZE)(ptr - start_subject),    /* start offset */
           local_offsets,                        /* offset vector */
           sizeof(local_offsets)/sizeof(PCRE2_SIZE), /* size of same */
           local_workspace,                      /* workspace vector */
@@ -2768,7 +2772,7 @@ for (;;)
           {
           for (rc = rc*2 - 2; rc >= 0; rc -= 2)
             {
-            int charcount = local_offsets[rc+1] - local_offsets[rc];
+            PCRE2_SIZE charcount = local_offsets[rc+1] - local_offsets[rc];
 #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
             if (utf)
               {
@@ -2779,7 +2783,8 @@ for (;;)
 #endif
             if (charcount > 0)
               {
-              ADD_NEW_DATA(-(state_offset + LINK_SIZE + 1), 0, (charcount - 1));
+              ADD_NEW_DATA(-(state_offset + LINK_SIZE + 1), 0,
+                (int)(charcount - 1));
               }
             else
               {
@@ -2798,7 +2803,7 @@ for (;;)
       case OP_SCBRAPOS:
       case OP_BRAPOSZERO:
         {
-        int charcount, matched_count;
+        PCRE2_SIZE charcount, matched_count;
         PCRE2_SPTR local_ptr = ptr;
         BOOL allow_zero;
 
@@ -2821,7 +2826,7 @@ for (;;)
             mb,                                   /* fixed match data */
             code,                                 /* this subexpression's code */
             local_ptr,                            /* where we currently are */
-            (int)(ptr - start_subject),           /* start offset */
+            (PCRE2_SIZE)(ptr - start_subject),    /* start offset */
             local_offsets,                        /* offset vector */
             sizeof(local_offsets)/sizeof(PCRE2_SIZE), /* size of same */
             local_workspace,                      /* workspace vector */
@@ -2872,11 +2877,11 @@ for (;;)
             {
             PCRE2_SPTR p = ptr;
             PCRE2_SPTR pp = local_ptr;
-            charcount = (int)(pp - p);
+            charcount = (PCRE2_SIZE)(pp - p);
 #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
             if (utf) while (p < pp) if (NOT_FIRSTCU(*p++)) charcount--;
 #endif
-            ADD_NEW_DATA(-next_state_offset, 0, (charcount - 1));
+            ADD_NEW_DATA(-next_state_offset, 0, (int)(charcount - 1));
             }
           }
         }
@@ -2893,7 +2898,7 @@ for (;;)
           mb,                                   /* fixed match data */
           code,                                 /* this subexpression's code */
           ptr,                                  /* where we currently are */
-          (int)(ptr - start_subject),           /* start offset */
+          (PCRE2_SIZE)(ptr - start_subject),    /* start offset */
           local_offsets,                        /* offset vector */
           sizeof(local_offsets)/sizeof(PCRE2_SIZE), /* size of same */
           local_workspace,                      /* workspace vector */
@@ -2903,7 +2908,7 @@ for (;;)
         if (rc >= 0)
           {
           PCRE2_SPTR end_subpattern = code;
-          int charcount = local_offsets[1] - local_offsets[0];
+          PCRE2_SIZE charcount = local_offsets[1] - local_offsets[0];
           int next_state_offset, repeat_state_offset;
 
           do { end_subpattern += GET(end_subpattern, 1); }
@@ -2963,9 +2968,9 @@ for (;;)
               while (p < pp) if (NOT_FIRSTCU(*p++)) charcount--;
               }
 #endif
-            ADD_NEW_DATA(-next_state_offset, 0, (charcount - 1));
+            ADD_NEW_DATA(-next_state_offset, 0, (int)(charcount - 1));
             if (repeat_state_offset >= 0)
-              { ADD_NEW_DATA(-repeat_state_offset, 0, (charcount - 1)); }
+              { ADD_NEW_DATA(-repeat_state_offset, 0, (int)(charcount - 1)); }
             }
           }
         else if (rc != PCRE2_ERROR_NOMATCH) return rc;
@@ -3018,7 +3023,7 @@ for (;;)
             return rrc;   /* Abandon */
           }
         if (rrc == 0)
-          { ADD_ACTIVE(state_offset + callout_length, 0); }
+          { ADD_ACTIVE(state_offset + (int)callout_length, 0); }
         }
       break;
 
@@ -3307,10 +3312,10 @@ if (utf && (options & PCRE2_NO_UTF_CHECK) == 0)
   offset to be an absolute offset in the whole string. */
 
   match_data->rc = PRIV(valid_utf)(check_subject,
-    length - (check_subject - subject), &(match_data->startchar));
+    length - (PCRE2_SIZE)(check_subject - subject), &(match_data->startchar));
   if (match_data->rc != 0)
     {
-    match_data->startchar += check_subject - subject;
+    match_data->startchar += (PCRE2_SIZE)(check_subject - subject);
     return match_data->rc;
     }
   }
@@ -3332,7 +3337,8 @@ if (!anchored)
       {
       first_cu2 = TABLE_GET(first_cu, mb->tables + fcc_offset, first_cu);
 #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 8
-      if (utf && first_cu > 127) first_cu2 = UCD_OTHERCASE(first_cu);
+      if (utf && first_cu > 127)
+        first_cu2 = (PCRE2_UCHAR)UCD_OTHERCASE(first_cu);
 #endif
       }
     }
@@ -3352,7 +3358,7 @@ if ((re->flags & PCRE2_LASTSET) != 0)
     {
     req_cu2 = TABLE_GET(req_cu, mb->tables + fcc_offset, req_cu);
 #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 8
-    if (utf && req_cu > 127) req_cu2 = UCD_OTHERCASE(req_cu);
+    if (utf && req_cu > 127) req_cu2 = (PCRE2_UCHAR)UCD_OTHERCASE(req_cu);
 #endif
     }
   }
@@ -3560,9 +3566,9 @@ for (;;)
     start_match,                  /* where we currently are */
     start_offset,                 /* start offset in subject */
     match_data->ovector,          /* offset vector */
-    match_data->oveccount * 2,    /* actual size of same */
+    (uint32_t)match_data->oveccount * 2,  /* actual size of same */
     workspace,                    /* workspace vector */
-    wscount,                      /* size of same */
+    (int)wscount,                 /* size of same */
     0);                           /* function recurse level */
 
   /* Anything other than "no match" means we are done, always; otherwise, carry
@@ -3576,7 +3582,7 @@ for (;;)
       match_data->ovector[1] = (PCRE2_SIZE)(end_subject - subject);
       }
     match_data->leftchar = (PCRE2_SIZE)(mb->start_used_ptr - subject);
-    match_data->rightchar = mb->last_used_ptr - subject;
+    match_data->rightchar = (PCRE2_SIZE)( mb->last_used_ptr - subject);
     match_data->startchar = (PCRE2_SIZE)(start_match - subject);
     match_data->rc = rc;
     return rc;
index 6b4756aec8ae1bdef4101e22c31d5344c57c225c..77fd5f41243fd5b73f2b5063140991f4d4b06e3c 100644 (file)
@@ -62,7 +62,7 @@ Each substring ends with \0 to insert a null character. This includes the final
 substring, so that the whole string ends with \0\0, which can be detected when
 counting through. */
 
-static const char compile_error_texts[] =
+static const unsigned char compile_error_texts[] =
   "no error\0"
   "\\ at end of pattern\0"
   "\\c at end of pattern\0"
@@ -106,7 +106,7 @@ static const char compile_error_texts[] =
   "character code point value in \\x{} or \\o{} is too large\0"
   /* 35 */
   "invalid condition (?(0)\0"
-  "\\C is not allowed in a lookbehind assertion\0"
+  "\\C is not allowed in a lookbehind assertion in UTF-" XSTRING(PCRE2_CODE_UNIT_WIDTH) " mode\0"
   "PCRE does not support \\L, \\l, \\N{name}, \\U, or \\u\0"
   "number after (?C is greater than 255\0"
   "closing parenthesis for (?C expected\0"
@@ -177,7 +177,7 @@ static const char compile_error_texts[] =
 
 /* Match-time and UTF error texts are in the same format. */
 
-static const char match_error_texts[] =
+static const unsigned char match_error_texts[] =
   "no error\0"
   "no match\0"
   "partial match\0"
@@ -252,6 +252,7 @@ static const char match_error_texts[] =
   /* 60 */
   "match with end before start is not supported\0"
   "too many replacements (more than INT_MAX)\0"
+  "bad serialized data\0"
   ;
 
 
@@ -276,32 +277,32 @@ Returns:        length of message if all is well
 PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
 pcre2_get_error_message(int enumber, PCRE2_UCHAR *buffer, size_t size)
 {
-char xbuff[128];
-const char *message;
+const unsigned char *message;
 size_t i;
-uint32_t n;
+int n;
 
 if (size == 0) return PCRE2_ERROR_NOMEMORY;
 
-if (enumber > COMPILE_ERROR_BASE)  /* Compile error */
+if (enumber >= COMPILE_ERROR_BASE)  /* Compile error */
   {
   message = compile_error_texts;
   n = enumber - COMPILE_ERROR_BASE;
   }
-else                               /* Match or UTF error */
+else if (enumber < 0)               /* Match or UTF error */
   {
   message = match_error_texts;
   n = -enumber;
   }
+else                                /* Invalid error number */
+  {
+  message = (unsigned char *)"\0";  /* Empty message list */
+  n = 1;
+  }
 
 for (; n > 0; n--)
   {
   while (*message++ != CHAR_NULL) {};
-  if (*message == CHAR_NULL)
-    {
-    sprintf(xbuff, "No text for error %d", enumber);
-    break;
-    }
+  if (*message == CHAR_NULL) return PCRE2_ERROR_BADDATA;
   }
 
 for (i = 0; *message != 0; i++)
@@ -315,7 +316,7 @@ for (i = 0; *message != 0; i++)
   }
 
 buffer[i] = 0;
-return i;
+return (int)i;
 }
 
 /* End of pcre2_error.c */
index 7c9f66cc043f27a894e41f56892b42cacbfdc1ef..56908708aa13b20a9518946dbb33600b6ef06fe6 100644 (file)
@@ -2,7 +2,7 @@
 *      Perl-Compatible Regular Expressions       *
 *************************************************/
 
-/* PCRE is a library of functions to support regular expressions whose syntax
+/* PCRE2 is a library of functions to support regular expressions whose syntax
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
@@ -73,6 +73,14 @@ typedef int BOOL;
 #include <valgrind/memcheck.h>
 #endif
 
+/* Older versions of MSVC lack snprintf(). This define allows for
+warning/error-free compilation and testing with MSVC compilers back to at least
+MSVC 10/2010. Except for VC6 (which is missing some fundamentals and fails). */
+
+#if defined(_MSC_VER) && (_MSC_VER < 1900)
+#define snprintf _snprintf
+#endif
+
 /* When compiling a DLL for Windows, the exported symbols have to be declared
 using some MS magic. I found some useful information on this web page:
 http://msdn2.microsoft.com/en-us/library/y4h7bcy6(VS.80).aspx. According to the
@@ -169,7 +177,7 @@ by "configure". */
 #endif
 
 /* When compiling for use with the Virtual Pascal compiler, these functions
-need to have their names changed. PCRE must be compiled with the -DVPCOMPAT
+need to have their names changed. PCRE2 must be compiled with the -DVPCOMPAT
 option on the command line. */
 
 #ifdef VPCOMPAT
@@ -192,7 +200,7 @@ neither (there some non-Unix environments where this is the case). */
 #define memmove(a, b, c) bcopy(b, a, c)
 #else  /* HAVE_BCOPY */
 static void *
-pcre_memmove(void *d, const void *s, size_t n)
+pcre2_memmove(void *d, const void *s, size_t n)
 {
 size_t i;
 unsigned char *dest = (unsigned char *)d;
@@ -210,7 +218,7 @@ else
   return (void *)(dest - n);
   }
 }
-#define memmove(a, b, c) pcre_memmove(a, b, c)
+#define memmove(a, b, c) pcre2_memmove(a, b, c)
 #endif   /* not HAVE_BCOPY */
 #endif   /* not HAVE_MEMMOVE */
 #endif   /* not VPCOMPAT */
@@ -234,8 +242,15 @@ Unicode doesn't go beyond 0x0010ffff. */
 
 #define MAX_UTF_CODE_POINT 0x10ffff
 
-/* Compile-time errors are added to this value. As they are documented, it
-should probably never be changed. */
+/* Compile-time positive error numbers (all except UTF errors, which are
+negative) start at this value. It should probably never be changed, in case
+some application is checking for specific numbers. There is a copy of this
+#define in pcre2posix.c (which now no longer includes this file). Ideally, a
+way of having a single definition should be found, but as the number is
+unlikely to change, this is not a pressing issue. The original reason for
+having a base other than 0 was to keep the absolute values of compile-time and
+run-time error numbers numerically different, but in the event the code does
+not rely on this. */
 
 #define COMPILE_ERROR_BASE 100
 
@@ -269,21 +284,21 @@ advancing the pointer. */
 
 #define GETUTF8(c, eptr) \
     { \
-    if ((c & 0x20) == 0) \
-      c = ((c & 0x1f) << 6) | (eptr[1] & 0x3f); \
-    else if ((c & 0x10) == 0) \
-      c = ((c & 0x0f) << 12) | ((eptr[1] & 0x3f) << 6) | (eptr[2] & 0x3f); \
-    else if ((c & 0x08) == 0) \
-      c = ((c & 0x07) << 18) | ((eptr[1] & 0x3f) << 12) | \
-      ((eptr[2] & 0x3f) << 6) | (eptr[3] & 0x3f); \
-    else if ((c & 0x04) == 0) \
-      c = ((c & 0x03) << 24) | ((eptr[1] & 0x3f) << 18) | \
-          ((eptr[2] & 0x3f) << 12) | ((eptr[3] & 0x3f) << 6) | \
-          (eptr[4] & 0x3f); \
+    if ((c & 0x20u) == 0) \
+      c = ((c & 0x1fu) << 6) | (eptr[1] & 0x3fu); \
+    else if ((c & 0x10u) == 0) \
+      c = ((c & 0x0fu) << 12) | ((eptr[1] & 0x3fu) << 6) | (eptr[2] & 0x3fu); \
+    else if ((c & 0x08u) == 0) \
+      c = ((c & 0x07u) << 18) | ((eptr[1] & 0x3fu) << 12) | \
+      ((eptr[2] & 0x3fu) << 6) | (eptr[3] & 0x3fu); \
+    else if ((c & 0x04u) == 0) \
+      c = ((c & 0x03u) << 24) | ((eptr[1] & 0x3fu) << 18) | \
+          ((eptr[2] & 0x3fu) << 12) | ((eptr[3] & 0x3fu) << 6) | \
+          (eptr[4] & 0x3fu); \
     else \
-      c = ((c & 0x01) << 30) | ((eptr[1] & 0x3f) << 24) | \
-          ((eptr[2] & 0x3f) << 18) | ((eptr[3] & 0x3f) << 12) | \
-          ((eptr[4] & 0x3f) << 6) | (eptr[5] & 0x3f); \
+      c = ((c & 0x01u) << 30) | ((eptr[1] & 0x3fu) << 24) | \
+          ((eptr[2] & 0x3fu) << 18) | ((eptr[3] & 0x3fu) << 12) | \
+          ((eptr[4] & 0x3fu) << 6) | (eptr[5] & 0x3fu); \
     }
 
 /* Base macro to pick up the remaining bytes of a UTF-8 character, advancing
@@ -291,31 +306,31 @@ the pointer. */
 
 #define GETUTF8INC(c, eptr) \
     { \
-    if ((c & 0x20) == 0) \
-      c = ((c & 0x1f) << 6) | (*eptr++ & 0x3f); \
-    else if ((c & 0x10) == 0) \
+    if ((c & 0x20u) == 0) \
+      c = ((c & 0x1fu) << 6) | (*eptr++ & 0x3fu); \
+    else if ((c & 0x10u) == 0) \
       { \
-      c = ((c & 0x0f) << 12) | ((*eptr & 0x3f) << 6) | (eptr[1] & 0x3f); \
+      c = ((c & 0x0fu) << 12) | ((*eptr & 0x3fu) << 6) | (eptr[1] & 0x3fu); \
       eptr += 2; \
       } \
-    else if ((c & 0x08) == 0) \
+    else if ((c & 0x08u) == 0) \
       { \
-      c = ((c & 0x07) << 18) | ((*eptr & 0x3f) << 12) | \
-          ((eptr[1] & 0x3f) << 6) | (eptr[2] & 0x3f); \
+      c = ((c & 0x07u) << 18) | ((*eptr & 0x3fu) << 12) | \
+          ((eptr[1] & 0x3fu) << 6) | (eptr[2] & 0x3fu); \
       eptr += 3; \
       } \
-    else if ((c & 0x04) == 0) \
+    else if ((c & 0x04u) == 0) \
       { \
-      c = ((c & 0x03) << 24) | ((*eptr & 0x3f) << 18) | \
-          ((eptr[1] & 0x3f) << 12) | ((eptr[2] & 0x3f) << 6) | \
-          (eptr[3] & 0x3f); \
+      c = ((c & 0x03u) << 24) | ((*eptr & 0x3fu) << 18) | \
+          ((eptr[1] & 0x3fu) << 12) | ((eptr[2] & 0x3fu) << 6) | \
+          (eptr[3] & 0x3fu); \
       eptr += 4; \
       } \
     else \
       { \
-      c = ((c & 0x01) << 30) | ((*eptr & 0x3f) << 24) | \
-          ((eptr[1] & 0x3f) << 18) | ((eptr[2] & 0x3f) << 12) | \
-          ((eptr[3] & 0x3f) << 6) | (eptr[4] & 0x3f); \
+      c = ((c & 0x01u) << 30) | ((*eptr & 0x3fu) << 24) | \
+          ((eptr[1] & 0x3fu) << 18) | ((eptr[2] & 0x3fu) << 12) | \
+          ((eptr[3] & 0x3fu) << 6) | (eptr[4] & 0x3fu); \
       eptr += 5; \
       } \
     }
@@ -325,34 +340,34 @@ advancing the pointer, incrementing the length. */
 
 #define GETUTF8LEN(c, eptr, len) \
     { \
-    if ((c & 0x20) == 0) \
+    if ((c & 0x20u) == 0) \
       { \
-      c = ((c & 0x1f) << 6) | (eptr[1] & 0x3f); \
+      c = ((c & 0x1fu) << 6) | (eptr[1] & 0x3fu); \
       len++; \
       } \
-    else if ((c & 0x10)  == 0) \
+    else if ((c & 0x10u)  == 0) \
       { \
-      c = ((c & 0x0f) << 12) | ((eptr[1] & 0x3f) << 6) | (eptr[2] & 0x3f); \
+      c = ((c & 0x0fu) << 12) | ((eptr[1] & 0x3fu) << 6) | (eptr[2] & 0x3fu); \
       len += 2; \
       } \
-    else if ((c & 0x08)  == 0) \
+    else if ((c & 0x08u)  == 0) \
       {\
-      c = ((c & 0x07) << 18) | ((eptr[1] & 0x3f) << 12) | \
-          ((eptr[2] & 0x3f) << 6) | (eptr[3] & 0x3f); \
+      c = ((c & 0x07u) << 18) | ((eptr[1] & 0x3fu) << 12) | \
+          ((eptr[2] & 0x3fu) << 6) | (eptr[3] & 0x3fu); \
       len += 3; \
       } \
-    else if ((c & 0x04)  == 0) \
+    else if ((c & 0x04u)  == 0) \
       { \
-      c = ((c & 0x03) << 24) | ((eptr[1] & 0x3f) << 18) | \
-          ((eptr[2] & 0x3f) << 12) | ((eptr[3] & 0x3f) << 6) | \
-          (eptr[4] & 0x3f); \
+      c = ((c & 0x03u) << 24) | ((eptr[1] & 0x3fu) << 18) | \
+          ((eptr[2] & 0x3fu) << 12) | ((eptr[3] & 0x3fu) << 6) | \
+          (eptr[4] & 0x3fu); \
       len += 4; \
       } \
     else \
       {\
-      c = ((c & 0x01) << 30) | ((eptr[1] & 0x3f) << 24) | \
-          ((eptr[2] & 0x3f) << 18) | ((eptr[3] & 0x3f) << 12) | \
-          ((eptr[4] & 0x3f) << 6) | (eptr[5] & 0x3f); \
+      c = ((c & 0x01u) << 30) | ((eptr[1] & 0x3fu) << 24) | \
+          ((eptr[2] & 0x3fu) << 18) | ((eptr[3] & 0x3fu) << 12) | \
+          ((eptr[4] & 0x3fu) << 6) | (eptr[5] & 0x3fu); \
       len += 5; \
       } \
     }
@@ -382,7 +397,7 @@ other. NOTE: The values also appear in pcre2_jit_compile.c. */
 /* Character U+180E (Mongolian Vowel Separator) is not included in the list of
 spaces in the Unicode file PropList.txt, and Perl does not recognize it as a
 space. However, in many other sources it is listed as a space and has been in
-PCRE for a long time. */
+PCRE (both APIs) for a long time. */
 
 #define HSPACE_LIST \
   CHAR_HT, CHAR_SPACE, CHAR_NBSP, \
@@ -550,17 +565,9 @@ req_unit match. */
 
 #define REQ_CU_MAX 1000
 
-/* Bit definitions for entries in the pcre_ctypes table. */
-
-#define ctype_space   0x01
-#define ctype_letter  0x02
-#define ctype_digit   0x04
-#define ctype_xdigit  0x08
-#define ctype_word    0x10    /* alphanumeric or '_' */
-#define ctype_meta    0x80    /* regexp meta char or zero (end pattern) */
-
-/* Offsets for the bitmap tables in pcre_cbits. Each table contains a set
-of bits for a class map. Some classes are built by combining these tables. */
+/* Offsets for the bitmap tables in the cbits set of tables. Each table
+contains a set of bits for a class map. Some classes are built by combining
+these tables. */
 
 #define cbit_space     0      /* [:space:] or \s */
 #define cbit_xdigit   32      /* [:xdigit:] */
@@ -574,19 +581,28 @@ of bits for a class map. Some classes are built by combining these tables. */
 #define cbit_cntrl   288      /* [:cntrl:] */
 #define cbit_length  320      /* Length of the cbits table */
 
+/* Bit definitions for entries in the ctypes table. */
+
+#define ctype_space   0x01
+#define ctype_letter  0x02
+#define ctype_digit   0x04
+#define ctype_xdigit  0x08
+#define ctype_word    0x10    /* alphanumeric or '_' */
+#define ctype_meta    0x80    /* regexp meta char or zero (end pattern) */
+
 /* Offsets of the various tables from the base tables pointer, and
-total length. */
+total length of the tables. */
 
-#define lcc_offset      0
-#define fcc_offset    256
-#define cbits_offset  512
-#define ctypes_offset (cbits_offset + cbit_length)
+#define lcc_offset      0                           /* Lower case */
+#define fcc_offset    256                           /* Flip case */
+#define cbits_offset  512                           /* Character classes */
+#define ctypes_offset (cbits_offset + cbit_length)  /* Character types */
 #define tables_length (ctypes_offset + 256)
 
 
 /* -------------------- Character and string names ------------------------ */
 
-/* If PCRE is to support UTF-8 on EBCDIC platforms, we cannot use normal
+/* If PCRE2 is to support UTF-8 on EBCDIC platforms, we cannot use normal
 character constants like '*' because the compiler would emit their EBCDIC code,
 which is different from their ASCII/UTF-8 code. Instead we define macros for
 the characters so that they always use the ASCII/UTF-8 code when UTF-8 support
@@ -594,7 +610,7 @@ is enabled. When UTF-8 support is not enabled, the definitions use character
 literals. Both character and string versions of each character are needed, and
 there are some longer strings as well.
 
-This means that, on EBCDIC platforms, the PCRE library can handle either
+This means that, on EBCDIC platforms, the PCRE2 library can handle either
 EBCDIC, or UTF-8, but not both. To support both in the same compiled library
 would need different lookups depending on whether PCRE2_UTF was set or not.
 This would make it impossible to use characters in switch/case statements,
@@ -606,7 +622,7 @@ macros to give the functions distinct names. */
 #ifndef SUPPORT_UNICODE
 
 /* UTF-8 support is not enabled; use the platform-dependent character literals
-so that PCRE works in both ASCII and EBCDIC environments, but only in non-UTF
+so that PCRE2 works in both ASCII and EBCDIC environments, but only in non-UTF
 mode. Newline characters are problematic in EBCDIC. Though it has CR and LF
 characters, a common practice has been to use its NL (0x15) character as the
 line terminator in C-like processing environments. However, sometimes the LF
@@ -614,7 +630,7 @@ line terminator in C-like processing environments. However, sometimes the LF
 
 http://unicode.org/standard/reports/tr13/tr13-5.html
 
-PCRE defaults EBCDIC NL to 0x15, but has a build-time option to select 0x25
+PCRE2 defaults EBCDIC NL to 0x15, but has a build-time option to select 0x25
 instead. Whichever is *not* chosen is defined as NEL.
 
 In both ASCII and EBCDIC environments, CHAR_NL and CHAR_LF are synonyms for the
@@ -1219,7 +1235,7 @@ only. */
 #define PT_TABSIZE   11    /* Size of square table for autopossessify tests */
 
 /* The following special properties are used only in XCLASS items, when POSIX
-classes are specified and PCRE_UCP is set - in other words, for Unicode
+classes are specified and PCRE2_UCP is set - in other words, for Unicode
 handling of these classes. They are not available via the \p or \P escapes like
 those in the above list, and so they do not take part in the autopossessifying
 table. */
@@ -1283,7 +1299,7 @@ compatibility mode, and for \C in non-utf mode. In non-DOTALL mode, "." behaves
 like \N.
 
 The special values ESC_DU, ESC_du, etc. are used instead of ESC_D, ESC_d, etc.
-when PCRE_UCP is set and replacement of \d etc by \p sequences is required.
+when PCRE2_UCP is set and replacement of \d etc by \p sequences is required.
 They must be contiguous, and remain in order so that the replacements can be
 looked up from a table.
 
@@ -1308,12 +1324,12 @@ enum { ESC_A = 1, ESC_G, ESC_K, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s,
 Starting from 1 (i.e. after OP_END), the values up to OP_EOD must correspond in
 order to the list of escapes immediately above. Furthermore, values up to
 OP_DOLLM must not be changed without adjusting the table called autoposstab in
-pcre_compile.c
+pcre2_auto_possess.c
 
 Whenever this list is updated, the two macro definitions that follow must be
 updated to match. The possessification table called "opcode_possessify" in
-pcre_compile.c must also be updated, and also the tables called "coptable"
-and "poptable" in pcre_dfa_exec.c.
+pcre2_compile.c must also be updated, and also the tables called "coptable"
+and "poptable" in pcre2_dfa_match.c.
 
 ****** NOTE NOTE NOTE ******/
 
@@ -1890,7 +1906,7 @@ private structures. */
 
 /* Private "external" functions. These are internal functions that are called
 from modules other than the one in which they are defined. They have to be
-"external" in the C sense, but are not part of the PCRE public API. They are
+"external" in the C sense, but are not part of the PCRE2 public API. They are
 not referenced from pcre2test, and must not be defined when no code unit width
 is available. */
 
index 90b7959e0596cfb649d1dfce888c71c0d5ea3880..596d62cfdcff2993c0873d7e54853aed29ab636c 100644 (file)
@@ -94,7 +94,7 @@ easier to maintain, the storing and loading of offsets from the compiled code
 unit string is now handled by the macros that are defined here.
 
 The macros are controlled by the value of LINK_SIZE. This defaults to 2, but
-values of 2 or 4 are also supported. */
+values of 3 or 4 are also supported. */
 
 /* ------------------- 8-bit support  ------------------ */
 
@@ -102,29 +102,29 @@ values of 2 or 4 are also supported. */
 
 #if LINK_SIZE == 2
 #define PUT(a,n,d)   \
-  (a[n] = (d) >> 8), \
-  (a[(n)+1] = (d) & 255)
+  (a[n] = (PCRE2_UCHAR)((d) >> 8)), \
+  (a[(n)+1] = (PCRE2_UCHAR)((d) & 255))
 #define GET(a,n) \
-  (((a)[n] << 8) | (a)[(n)+1])
+  (unsigned int)(((a)[n] << 8) | (a)[(n)+1])
 #define MAX_PATTERN_SIZE (1 << 16)
 
 #elif LINK_SIZE == 3
 #define PUT(a,n,d)       \
-  (a[n] = (d) >> 16),    \
-  (a[(n)+1] = (d) >> 8), \
-  (a[(n)+2] = (d) & 255)
+  (a[n] = (PCRE2_UCHAR)((d) >> 16)),    \
+  (a[(n)+1] = (PCRE2_UCHAR)((d) >> 8)), \
+  (a[(n)+2] = (PCRE2_UCHAR)((d) & 255))
 #define GET(a,n) \
-  (((a)[n] << 16) | ((a)[(n)+1] << 8) | (a)[(n)+2])
+  (unsigned int)(((a)[n] << 16) | ((a)[(n)+1] << 8) | (a)[(n)+2])
 #define MAX_PATTERN_SIZE (1 << 24)
 
 #elif LINK_SIZE == 4
 #define PUT(a,n,d)        \
-  (a[n] = (d) >> 24),     \
-  (a[(n)+1] = (d) >> 16), \
-  (a[(n)+2] = (d) >> 8),  \
-  (a[(n)+3] = (d) & 255)
+  (a[n] = (PCRE2_UCHAR)((d) >> 24)),     \
+  (a[(n)+1] = (PCRE2_UCHAR)((d) >> 16)), \
+  (a[(n)+2] = (PCRE2_UCHAR)((d) >> 8)),  \
+  (a[(n)+3] = (PCRE2_UCHAR)((d) & 255))
 #define GET(a,n) \
-  (((a)[n] << 24) | ((a)[(n)+1] << 16) | ((a)[(n)+2] << 8) | (a)[(n)+3])
+  (unsigned int)(((a)[n] << 24) | ((a)[(n)+1] << 16) | ((a)[(n)+2] << 8) | (a)[(n)+3])
 #define MAX_PATTERN_SIZE (1 << 30)   /* Keep it positive */
 
 #else
@@ -149,10 +149,10 @@ values of 2 or 4 are also supported. */
 #undef LINK_SIZE
 #define LINK_SIZE 2
 #define PUT(a,n,d)   \
-  (a[n] = (d) >> 16), \
-  (a[(n)+1] = (d) & 65535)
+  (a[n] = (PCRE2_UCHAR)((d) >> 16)), \
+  (a[(n)+1] = (PCRE2_UCHAR)((d) & 65535))
 #define GET(a,n) \
-  (((a)[n] << 16) | (a)[(n)+1])
+  (unsigned int)(((a)[n] << 16) | (a)[(n)+1])
 #define MAX_PATTERN_SIZE (1 << 30)  /* Keep it positive */
 
 #else
@@ -283,47 +283,47 @@ UTF support is omitted, we don't even define them. */
 /* Returns with the additional number of characters if IS_MULTICHAR(c) is TRUE.
 Otherwise it has an undefined behaviour. */
 
-#define GET_EXTRALEN(c) (PRIV(utf8_table4)[(c) & 0x3f])
+#define GET_EXTRALEN(c) (PRIV(utf8_table4)[(c) & 0x3fu])
 
 /* Returns TRUE, if the given value is not the first code unit of a UTF
 sequence. */
 
-#define NOT_FIRSTCU(c) (((c) & 0xc0) == 0x80)
+#define NOT_FIRSTCU(c) (((c) & 0xc0u) == 0x80u)
 
 /* Get the next UTF-8 character, not advancing the pointer. This is called when
 we know we are in UTF-8 mode. */
 
 #define GETCHAR(c, eptr) \
   c = *eptr; \
-  if (c >= 0xc0) GETUTF8(c, eptr);
+  if (c >= 0xc0u) GETUTF8(c, eptr);
 
 /* Get the next UTF-8 character, testing for UTF-8 mode, and not advancing the
 pointer. */
 
 #define GETCHARTEST(c, eptr) \
   c = *eptr; \
-  if (utf && c >= 0xc0) GETUTF8(c, eptr);
+  if (utf && c >= 0xc0u) GETUTF8(c, eptr);
 
 /* Get the next UTF-8 character, advancing the pointer. This is called when we
 know we are in UTF-8 mode. */
 
 #define GETCHARINC(c, eptr) \
   c = *eptr++; \
-  if (c >= 0xc0) GETUTF8INC(c, eptr);
+  if (c >= 0xc0u) GETUTF8INC(c, eptr);
 
 /* Get the next character, testing for UTF-8 mode, and advancing the pointer.
 This is called when we don't know if we are in UTF-8 mode. */
 
 #define GETCHARINCTEST(c, eptr) \
   c = *eptr++; \
-  if (utf && c >= 0xc0) GETUTF8INC(c, eptr);
+  if (utf && c >= 0xc0u) GETUTF8INC(c, eptr);
 
 /* Get the next UTF-8 character, not advancing the pointer, incrementing length
 if there are extra bytes. This is called when we know we are in UTF-8 mode. */
 
 #define GETCHARLEN(c, eptr, len) \
   c = *eptr; \
-  if (c >= 0xc0) GETUTF8LEN(c, eptr, len);
+  if (c >= 0xc0u) GETUTF8LEN(c, eptr, len);
 
 /* Get the next UTF-8 character, testing for UTF-8 mode, not advancing the
 pointer, incrementing length if there are extra bytes. This is called when we
@@ -331,21 +331,21 @@ do not know if we are in UTF-8 mode. */
 
 #define GETCHARLENTEST(c, eptr, len) \
   c = *eptr; \
-  if (utf && c >= 0xc0) GETUTF8LEN(c, eptr, len);
+  if (utf && c >= 0xc0u) GETUTF8LEN(c, eptr, len);
 
 /* If the pointer is not at the start of a character, move it back until
 it is. This is called only in UTF-8 mode - we don't put a test within the macro
 because almost all calls are already within a block of UTF-8 only code. */
 
-#define BACKCHAR(eptr) while((*eptr & 0xc0) == 0x80) eptr--
+#define BACKCHAR(eptr) while((*eptr & 0xc0u) == 0x80u) eptr--
 
 /* Same as above, just in the other direction. */
-#define FORWARDCHAR(eptr) while((*eptr & 0xc0) == 0x80) eptr++
-#define FORWARDCHARTEST(eptr,end) while(eptr < end && (*eptr & 0xc0) == 0x80) eptr++
+#define FORWARDCHAR(eptr) while((*eptr & 0xc0u) == 0x80u) eptr++
+#define FORWARDCHARTEST(eptr,end) while(eptr < end && (*eptr & 0xc0u) == 0x80u) eptr++
 
 /* Same as above, but it allows a fully customizable form. */
 #define ACROSSCHAR(condition, eptr, action) \
-  while((condition) && ((eptr) & 0xc0) == 0x80) action
+  while((condition) && ((eptr) & 0xc0u) == 0x80u) action
 
 /* Deposit a character into memory, returning the number of code units. */
 
@@ -364,7 +364,7 @@ because almost all calls are already within a block of UTF-8 only code. */
 
 /* Tests whether the code point needs extra characters to decode. */
 
-#define HAS_EXTRALEN(c) (((c) & 0xfc00) == 0xd800)
+#define HAS_EXTRALEN(c) (((c) & 0xfc00u) == 0xd800u)
 
 /* Returns with the additional number of characters if IS_MULTICHAR(c) is TRUE.
 Otherwise it has an undefined behaviour. */
@@ -374,53 +374,53 @@ Otherwise it has an undefined behaviour. */
 /* Returns TRUE, if the given value is not the first code unit of a UTF
 sequence. */
 
-#define NOT_FIRSTCU(c) (((c) & 0xfc00) == 0xdc00)
+#define NOT_FIRSTCU(c) (((c) & 0xfc00u) == 0xdc00u)
 
 /* Base macro to pick up the low surrogate of a UTF-16 character, not
 advancing the pointer. */
 
 #define GETUTF16(c, eptr) \
-   { c = (((c & 0x3ff) << 10) | (eptr[1] & 0x3ff)) + 0x10000; }
+   { c = (((c & 0x3ffu) << 10) | (eptr[1] & 0x3ffu)) + 0x10000u; }
 
 /* Get the next UTF-16 character, not advancing the pointer. This is called when
 we know we are in UTF-16 mode. */
 
 #define GETCHAR(c, eptr) \
   c = *eptr; \
-  if ((c & 0xfc00) == 0xd800) GETUTF16(c, eptr);
+  if ((c & 0xfc00u) == 0xd800u) GETUTF16(c, eptr);
 
 /* Get the next UTF-16 character, testing for UTF-16 mode, and not advancing the
 pointer. */
 
 #define GETCHARTEST(c, eptr) \
   c = *eptr; \
-  if (utf && (c & 0xfc00) == 0xd800) GETUTF16(c, eptr);
+  if (utf && (c & 0xfc00u) == 0xd800u) GETUTF16(c, eptr);
 
 /* Base macro to pick up the low surrogate of a UTF-16 character, advancing
 the pointer. */
 
 #define GETUTF16INC(c, eptr) \
-   { c = (((c & 0x3ff) << 10) | (*eptr++ & 0x3ff)) + 0x10000; }
+   { c = (((c & 0x3ffu) << 10) | (*eptr++ & 0x3ffu)) + 0x10000u; }
 
 /* Get the next UTF-16 character, advancing the pointer. This is called when we
 know we are in UTF-16 mode. */
 
 #define GETCHARINC(c, eptr) \
   c = *eptr++; \
-  if ((c & 0xfc00) == 0xd800) GETUTF16INC(c, eptr);
+  if ((c & 0xfc00u) == 0xd800u) GETUTF16INC(c, eptr);
 
 /* Get the next character, testing for UTF-16 mode, and advancing the pointer.
 This is called when we don't know if we are in UTF-16 mode. */
 
 #define GETCHARINCTEST(c, eptr) \
   c = *eptr++; \
-  if (utf && (c & 0xfc00) == 0xd800) GETUTF16INC(c, eptr);
+  if (utf && (c & 0xfc00u) == 0xd800u) GETUTF16INC(c, eptr);
 
 /* Base macro to pick up the low surrogate of a UTF-16 character, not
 advancing the pointer, incrementing the length. */
 
 #define GETUTF16LEN(c, eptr, len) \
-   { c = (((c & 0x3ff) << 10) | (eptr[1] & 0x3ff)) + 0x10000; len++; }
+   { c = (((c & 0x3ffu) << 10) | (eptr[1] & 0x3ffu)) + 0x10000u; len++; }
 
 /* Get the next UTF-16 character, not advancing the pointer, incrementing
 length if there is a low surrogate. This is called when we know we are in
@@ -428,7 +428,7 @@ UTF-16 mode. */
 
 #define GETCHARLEN(c, eptr, len) \
   c = *eptr; \
-  if ((c & 0xfc00) == 0xd800) GETUTF16LEN(c, eptr, len);
+  if ((c & 0xfc00u) == 0xd800u) GETUTF16LEN(c, eptr, len);
 
 /* Get the next UTF-816character, testing for UTF-16 mode, not advancing the
 pointer, incrementing length if there is a low surrogate. This is called when
@@ -436,22 +436,22 @@ we do not know if we are in UTF-16 mode. */
 
 #define GETCHARLENTEST(c, eptr, len) \
   c = *eptr; \
-  if (utf && (c & 0xfc00) == 0xd800) GETUTF16LEN(c, eptr, len);
+  if (utf && (c & 0xfc00u) == 0xd800u) GETUTF16LEN(c, eptr, len);
 
 /* If the pointer is not at the start of a character, move it back until
 it is. This is called only in UTF-16 mode - we don't put a test within the
 macro because almost all calls are already within a block of UTF-16 only
 code. */
 
-#define BACKCHAR(eptr) if ((*eptr & 0xfc00) == 0xdc00) eptr--
+#define BACKCHAR(eptr) if ((*eptr & 0xfc00u) == 0xdc00u) eptr--
 
 /* Same as above, just in the other direction. */
-#define FORWARDCHAR(eptr) if ((*eptr & 0xfc00) == 0xdc00) eptr++
-#define FORWARDCHARTEST(eptr,end) if (eptr < end && (*eptr & 0xfc00) == 0xdc00) eptr++
+#define FORWARDCHAR(eptr) if ((*eptr & 0xfc00u) == 0xdc00u) eptr++
+#define FORWARDCHARTEST(eptr,end) if (eptr < end && (*eptr & 0xfc00u) == 0xdc00u) eptr++
 
 /* Same as above, but it allows a fully customizable form. */
 #define ACROSSCHAR(condition, eptr, action) \
-  if ((condition) && ((eptr) & 0xfc00) == 0xdc00) action
+  if ((condition) && ((eptr) & 0xfc00u) == 0xdc00u) action
 
 /* Deposit a character into memory, returning the number of code units. */
 
index b46f4e3944f0b06efc84a5028a7a80a3a30b1a69..8dea90a1c5c4f89451374fa7b20362bd3dc0612c 100644 (file)
@@ -38,7 +38,6 @@ POSSIBILITY OF SUCH DAMAGE.
 -----------------------------------------------------------------------------
 */
 
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -187,9 +186,9 @@ typedef struct jit_arguments {
   void *callout_data;
   /* Everything else after. */
   sljit_uw offset_limit;
-  sljit_ui limit_match;
-  uint32_t oveccount;
-  uint32_t options;
+  sljit_u32 limit_match;
+  sljit_u32 oveccount;
+  sljit_u32 options;
 } jit_arguments;
 
 #define JIT_NUMBER_OF_COMPILE_MODES 3
@@ -198,8 +197,8 @@ typedef struct executable_functions {
   void *executable_funcs[JIT_NUMBER_OF_COMPILE_MODES];
   void *read_only_data_heads[JIT_NUMBER_OF_COMPILE_MODES];
   sljit_uw executable_sizes[JIT_NUMBER_OF_COMPILE_MODES];
-  sljit_ui top_bracket;
-  sljit_ui limit_match;
+  sljit_u32 top_bracket;
+  sljit_u32 limit_match;
 } executable_functions;
 
 typedef struct jump_list {
@@ -350,46 +349,46 @@ typedef struct compiler_common {
   /* First byte code. */
   PCRE2_SPTR start;
   /* Maps private data offset to each opcode. */
-  sljit_si *private_data_ptrs;
+  sljit_s32 *private_data_ptrs;
   /* Chain list of read-only data ptrs. */
   void *read_only_data_head;
   /* Tells whether the capturing bracket is optimized. */
-  sljit_ub *optimized_cbracket;
+  sljit_u8 *optimized_cbracket;
   /* Tells whether the starting offset is a target of then. */
-  sljit_ub *then_offsets;
+  sljit_u8 *then_offsets;
   /* Current position where a THEN must jump. */
   then_trap_backtrack *then_trap;
   /* Starting offset of private data for capturing brackets. */
-  sljit_si cbra_ptr;
+  sljit_s32 cbra_ptr;
   /* Output vector starting point. Must be divisible by 2. */
-  sljit_si ovector_start;
+  sljit_s32 ovector_start;
   /* Points to the starting character of the current match. */
-  sljit_si start_ptr;
+  sljit_s32 start_ptr;
   /* Last known position of the requested byte. */
-  sljit_si req_char_ptr;
+  sljit_s32 req_char_ptr;
   /* Head of the last recursion. */
-  sljit_si recursive_head_ptr;
+  sljit_s32 recursive_head_ptr;
   /* First inspected character for partial matching.
      (Needed for avoiding zero length partial matches.) */
-  sljit_si start_used_ptr;
+  sljit_s32 start_used_ptr;
   /* Starting pointer for partial soft matches. */
-  sljit_si hit_start;
+  sljit_s32 hit_start;
   /* Pointer of the match end position. */
-  sljit_si match_end_ptr;
+  sljit_s32 match_end_ptr;
   /* Points to the marked string. */
-  sljit_si mark_ptr;
+  sljit_s32 mark_ptr;
   /* Recursive control verb management chain. */
-  sljit_si control_head_ptr;
+  sljit_s32 control_head_ptr;
   /* Points to the last matched capture block index. */
-  sljit_si capture_last_ptr;
+  sljit_s32 capture_last_ptr;
   /* Fast forward skipping byte code pointer. */
   PCRE2_SPTR fast_forward_bc_ptr;
   /* Locals used by fast fail optimization. */
-  sljit_si fast_fail_start_ptr;
-  sljit_si fast_fail_end_ptr;
+  sljit_s32 fast_fail_start_ptr;
+  sljit_s32 fast_fail_end_ptr;
 
   /* Flipped and lower case tables. */
-  const sljit_ub *fcc;
+  const sljit_u8 *fcc;
   sljit_sw lcc;
   /* Mode can be PCRE2_JIT_COMPLETE and others. */
   int mode;
@@ -409,12 +408,12 @@ typedef struct compiler_common {
   BOOL positive_assert;
   /* Newline control. */
   int nltype;
-  sljit_ui nlmax;
-  sljit_ui nlmin;
+  sljit_u32 nlmax;
+  sljit_u32 nlmin;
   int newline;
   int bsr_nltype;
-  sljit_ui bsr_nlmax;
-  sljit_ui bsr_nlmin;
+  sljit_u32 bsr_nlmax;
+  sljit_u32 bsr_nlmin;
   /* Dollar endonly. */
   int endonly;
   /* Tables. */
@@ -471,27 +470,27 @@ typedef struct compare_context {
 #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
   int ucharptr;
   union {
-    sljit_si asint;
-    sljit_uh asushort;
+    sljit_s32 asint;
+    sljit_u16 asushort;
 #if PCRE2_CODE_UNIT_WIDTH == 8
-    sljit_ub asbyte;
-    sljit_ub asuchars[4];
+    sljit_u8 asbyte;
+    sljit_u8 asuchars[4];
 #elif PCRE2_CODE_UNIT_WIDTH == 16
-    sljit_uh asuchars[2];
+    sljit_u16 asuchars[2];
 #elif PCRE2_CODE_UNIT_WIDTH == 32
-    sljit_ui asuchars[1];
+    sljit_u32 asuchars[1];
 #endif
   } c;
   union {
-    sljit_si asint;
-    sljit_uh asushort;
+    sljit_s32 asint;
+    sljit_u16 asushort;
 #if PCRE2_CODE_UNIT_WIDTH == 8
-    sljit_ub asbyte;
-    sljit_ub asuchars[4];
+    sljit_u8 asbyte;
+    sljit_u8 asuchars[4];
 #elif PCRE2_CODE_UNIT_WIDTH == 16
-    sljit_uh asuchars[2];
+    sljit_u16 asuchars[2];
 #elif PCRE2_CODE_UNIT_WIDTH == 32
-    sljit_ui asuchars[1];
+    sljit_u32 asuchars[1];
 #endif
   } oc;
 #endif
@@ -533,19 +532,19 @@ the start pointers when the end of the capturing group has not yet reached. */
 #define PRIVATE_DATA(cc) (common->private_data_ptrs[(cc) - common->start])
 
 #if PCRE2_CODE_UNIT_WIDTH == 8
-#define MOV_UCHAR  SLJIT_MOV_UB
-#define MOVU_UCHAR SLJIT_MOVU_UB
+#define MOV_UCHAR  SLJIT_MOV_U8
+#define MOVU_UCHAR SLJIT_MOVU_U8
 #define IN_UCHARS(x) (x)
 #elif PCRE2_CODE_UNIT_WIDTH == 16
-#define MOV_UCHAR  SLJIT_MOV_UH
-#define MOVU_UCHAR SLJIT_MOVU_UH
+#define MOV_UCHAR  SLJIT_MOV_U16
+#define MOVU_UCHAR SLJIT_MOVU_U16
 #define UCHAR_SHIFT (1)
-#define IN_UCHARS(x) ((x) << UCHAR_SHIFT)
+#define IN_UCHARS(x) ((x) * 2)
 #elif PCRE2_CODE_UNIT_WIDTH == 32
-#define MOV_UCHAR  SLJIT_MOV_UI
-#define MOVU_UCHAR SLJIT_MOVU_UI
+#define MOV_UCHAR  SLJIT_MOV_U32
+#define MOVU_UCHAR SLJIT_MOVU_U32
 #define UCHAR_SHIFT (2)
-#define IN_UCHARS(x) ((x) << UCHAR_SHIFT)
+#define IN_UCHARS(x) ((x) * 4)
 #else
 #error Unsupported compiling mode
 #endif
@@ -1056,7 +1055,7 @@ if (is_accelerated_repeat(cc))
 return FALSE;
 }
 
-static SLJIT_INLINE void detect_fast_fail(compiler_common *common, PCRE2_SPTR cc, int *private_data_start, sljit_si depth)
+static SLJIT_INLINE void detect_fast_fail(compiler_common *common, PCRE2_SPTR cc, int *private_data_start, sljit_s32 depth)
 {
   PCRE2_SPTR next_alt;
 
@@ -1121,8 +1120,8 @@ static SLJIT_INLINE void detect_fast_fail(compiler_common *common, PCRE2_SPTR cc
 
 static int get_class_iterator_size(PCRE2_SPTR cc)
 {
-sljit_ui min;
-sljit_ui max;
+sljit_u32 min;
+sljit_u32 max;
 switch(*cc)
   {
   case OP_CRSTAR:
@@ -1159,7 +1158,7 @@ PCRE2_SPTR next_end;
 PCRE2_SPTR max_end;
 PCRE2_UCHAR type;
 sljit_sw length = end - begin;
-sljit_si min, max, i;
+sljit_s32 min, max, i;
 
 /* Detect fixed iterations first. */
 if (end[-(1 + LINK_SIZE)] != OP_KET)
@@ -1417,14 +1416,14 @@ while (cc < ccend)
 
     case OP_CLASS:
     case OP_NCLASS:
-    size = 1 + 32 / sizeof(PCRE2_UCHAR);
     space = get_class_iterator_size(cc + size);
+    size = 1 + 32 / sizeof(PCRE2_UCHAR);
     break;
 
 #if defined SUPPORT_UNICODE || PCRE2_CODE_UNIT_WIDTH != 8
     case OP_XCLASS:
-    size = GET(cc, 1);
     space = get_class_iterator_size(cc + size);
+    size = GET(cc, 1);
     break;
 #endif
 
@@ -2224,7 +2223,7 @@ if (save)
 SLJIT_ASSERT(cc == ccend && stackptr == stacktop && (save || (tmp1empty && tmp2empty)));
 }
 
-static SLJIT_INLINE PCRE2_SPTR set_then_offsets(compiler_common *common, PCRE2_SPTR cc, sljit_ub *current_offset)
+static SLJIT_INLINE PCRE2_SPTR set_then_offsets(compiler_common *common, PCRE2_SPTR cc, sljit_u8 *current_offset)
 {
 PCRE2_SPTR end = bracketend(cc);
 BOOL has_alternatives = cc[GET(cc, 1)] == OP_ALT;
@@ -2362,6 +2361,7 @@ add_stub(common, CMP(SLJIT_GREATER, STACK_TOP, 0, STACK_LIMIT, 0));
 static SLJIT_INLINE void free_stack(compiler_common *common, int size)
 {
 DEFINE_COMPILER;
+
 SLJIT_ASSERT(size > 0);
 OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, size * sizeof(sljit_sw));
 }
@@ -2390,7 +2390,7 @@ static SLJIT_INLINE void reset_ovector(compiler_common *common, int length)
 {
 DEFINE_COMPILER;
 struct sljit_label *loop;
-sljit_si i;
+sljit_s32 i;
 
 /* At this point we can freely use all temporary registers. */
 SLJIT_ASSERT(length > 1);
@@ -2415,7 +2415,7 @@ else
 static SLJIT_INLINE void reset_fast_fail(compiler_common *common)
 {
 DEFINE_COMPILER;
-sljit_si i;
+sljit_s32 i;
 
 SLJIT_ASSERT(common->fast_fail_start_ptr < common->fast_fail_end_ptr);
 
@@ -2496,7 +2496,7 @@ OP1(SLJIT_MOV, SLJIT_R0, 0, ARGUMENTS, 0);
 OP1(SLJIT_MOV, SLJIT_S0, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr);
 if (common->mark_ptr != 0)
   OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);
-OP1(SLJIT_MOV_UI, SLJIT_R1, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, oveccount));
+OP1(SLJIT_MOV_U32, SLJIT_R1, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, oveccount));
 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, startchar_ptr), SLJIT_S0, 0);
 if (common->mark_ptr != 0)
   OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, mark_ptr), SLJIT_R2, 0);
@@ -2515,7 +2515,7 @@ OP2(SLJIT_ASHR, SLJIT_S1, 0, SLJIT_S1, 0, SLJIT_IMM, UCHAR_SHIFT);
 #endif
 SLJIT_ASSERT(sizeof(PCRE2_SIZE) == 4 || sizeof(PCRE2_SIZE) == 8);
 if (sizeof(PCRE2_SIZE) == 4)
-  OP1(SLJIT_MOVU_UI, SLJIT_MEM1(SLJIT_R2), sizeof(PCRE2_SIZE), SLJIT_S1, 0);
+  OP1(SLJIT_MOVU_U32, SLJIT_MEM1(SLJIT_R2), sizeof(PCRE2_SIZE), SLJIT_S1, 0);
 else
   OP1(SLJIT_MOVU, SLJIT_MEM1(SLJIT_R2), sizeof(PCRE2_SIZE), SLJIT_S1, 0);
 OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, 1);
@@ -2541,7 +2541,7 @@ else
 static SLJIT_INLINE void return_with_partial_match(compiler_common *common, struct sljit_label *quit)
 {
 DEFINE_COMPILER;
-sljit_si mov_opcode;
+sljit_s32 mov_opcode;
 
 SLJIT_COMPILE_ASSERT(STR_END == SLJIT_S1, str_end_must_be_saved_reg2);
 SLJIT_ASSERT(common->start_used_ptr != 0 && common->start_ptr != 0
@@ -2557,7 +2557,7 @@ OP1(SLJIT_MOV, SLJIT_S0, 0, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments,
 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, startchar_ptr), SLJIT_R2, 0);
 OP1(SLJIT_MOV, SLJIT_R1, 0, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, match_data));
 
-mov_opcode = (sizeof(PCRE2_SIZE) == 4) ? SLJIT_MOV_UI : SLJIT_MOV;
+mov_opcode = (sizeof(PCRE2_SIZE) == 4) ? SLJIT_MOV_U32 : SLJIT_MOV;
 
 OP2(SLJIT_SUB, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_S0, 0);
 #if PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32
@@ -2794,7 +2794,7 @@ else
 JUMPHERE(jump);
 }
 
-static void peek_char(compiler_common *common, sljit_ui max)
+static void peek_char(compiler_common *common, sljit_u32 max)
 {
 /* Reads the character into TMP1, keeps STR_PTR.
 Does not check STR_END. TMP2 Destroyed. */
@@ -2839,12 +2839,12 @@ if (common->utf)
 
 #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8
 
-static BOOL is_char7_bitset(const sljit_ub *bitset, BOOL nclass)
+static BOOL is_char7_bitset(const sljit_u8 *bitset, BOOL nclass)
 {
 /* Tells whether the character codes below 128 are enough
 to determine a match. */
-const sljit_ub value = nclass ? 0xff : 0;
-const sljit_ub *end = bitset + 32;
+const sljit_u8 value = nclass ? 0xff : 0;
+const sljit_u8 *end = bitset + 32;
 
 bitset += 16;
 do
@@ -2869,12 +2869,12 @@ SLJIT_ASSERT(common->utf);
 OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), 0);
 OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
 
-OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
+OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
 
 if (full_read)
   {
   jump = CMP(SLJIT_LESS, TMP2, 0, SLJIT_IMM, 0xc0);
-  OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(utf8_table4) - 0xc0);
+  OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(utf8_table4) - 0xc0);
   OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
   JUMPHERE(jump);
   }
@@ -2882,7 +2882,7 @@ if (full_read)
 
 #endif /* SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8 */
 
-static void read_char_range(compiler_common *common, sljit_ui min, sljit_ui max, BOOL update_str_ptr)
+static void read_char_range(compiler_common *common, sljit_u32 min, sljit_u32 max, BOOL update_str_ptr)
 {
 /* Reads the precise value of a character into TMP1, if the character is
 between min and max (c >= min && c <= max). Otherwise it returns with a value
@@ -2913,7 +2913,7 @@ if (common->utf)
     {
     OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xf0);
     if (update_str_ptr)
-      OP1(SLJIT_MOV_UB, RETURN_ADDR, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
+      OP1(SLJIT_MOV_U8, RETURN_ADDR, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
     OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
     jump2 = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 0x7);
     OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);
@@ -2937,7 +2937,7 @@ if (common->utf)
     {
     OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xe0);
     if (update_str_ptr)
-      OP1(SLJIT_MOV_UB, RETURN_ADDR, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
+      OP1(SLJIT_MOV_U8, RETURN_ADDR, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
     OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
     jump2 = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 0xf);
     OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);
@@ -2957,7 +2957,7 @@ if (common->utf)
     add_jump(compiler, (max < 0x10000) ? &common->utfreadchar16 : &common->utfreadchar, JUMP(SLJIT_FAST_CALL));
   else if (max < 128)
     {
-    OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
+    OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
     OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
     }
   else
@@ -2966,7 +2966,7 @@ if (common->utf)
     if (!update_str_ptr)
       OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
     else
-      OP1(SLJIT_MOV_UB, RETURN_ADDR, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
+      OP1(SLJIT_MOV_U8, RETURN_ADDR, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
     OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x3f);
     OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 6);
     OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
@@ -3036,7 +3036,7 @@ if (common->utf)
   {
   /* This can be an extra read in some situations, but hopefully
   it is needed in most cases. */
-  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
+  OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
   jump = CMP(SLJIT_LESS, TMP2, 0, SLJIT_IMM, 0xc0);
   if (!update_str_ptr)
     {
@@ -3048,7 +3048,7 @@ if (common->utf)
     OP2(SLJIT_OR, TMP2, 0, TMP2, 0, TMP1, 0);
     OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);
     jump2 = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 255);
-    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
+    OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
     JUMPHERE(jump2);
     }
   else
@@ -3063,7 +3063,7 @@ if (common->utf)
 OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);
 jump = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 255);
 #endif
-OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
+OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
 #if PCRE2_CODE_UNIT_WIDTH != 8
 JUMPHERE(jump);
 #endif
@@ -3255,7 +3255,7 @@ compare = CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, 0x3);
 OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);
 OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x3f);
 OP2(SLJIT_OR, TMP2, 0, TMP2, 0, TMP1, 0);
-OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
+OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
 sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
 
 JUMPHERE(compare);
@@ -3264,7 +3264,7 @@ sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
 
 /* We only have types for characters less than 256. */
 JUMPHERE(jump);
-OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(utf8_table4) - 0xc0);
+OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(utf8_table4) - 0xc0);
 OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);
 OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
 sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
@@ -3286,20 +3286,20 @@ SLJIT_ASSERT(UCD_BLOCK_SIZE == 128 && sizeof(ucd_record) == 8);
 
 sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
 OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);
-OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_stage1));
+OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_stage1));
 OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK);
 OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);
 OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, TMP2, 0);
 OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_stage2));
-OP1(SLJIT_MOV_UH, TMP2, 0, SLJIT_MEM2(TMP2, TMP1), 1);
+OP1(SLJIT_MOV_U16, TMP2, 0, SLJIT_MEM2(TMP2, TMP1), 1);
 OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, chartype));
-OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3);
+OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3);
 sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
 }
 
 #endif /* SUPPORT_UNICODE */
 
-static SLJIT_INLINE struct sljit_label *mainloop_entry(compiler_common *common, BOOL hascrorlf, uint32_t overall_options)
+static SLJIT_INLINE struct sljit_label *mainloop_entry(compiler_common *common, BOOL hascrorlf, sljit_u32 overall_options)
 {
 DEFINE_COMPILER;
 struct sljit_label *mainloop;
@@ -3417,7 +3417,7 @@ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
 if (common->utf)
   {
   singlechar = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
-  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
+  OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
   OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
   JUMPHERE(singlechar);
   }
@@ -3478,13 +3478,13 @@ chars[len] = chr;
 chars[0] = len;
 }
 
-static int scan_prefix(compiler_common *common, PCRE2_SPTR cc, PCRE2_UCHAR *chars, int max_chars, uint32_t *rec_count)
+static int scan_prefix(compiler_common *common, PCRE2_SPTR cc, PCRE2_UCHAR *chars, int max_chars, sljit_u32 *rec_count)
 {
 /* Recursive function, which scans prefix literals. */
 BOOL last, any, class, caseless;
 int len, repeat, len_save, consumed = 0;
-sljit_ui chr; /* Any unicode character. */
-sljit_ub *bytes, *bytes_end, byte;
+sljit_u32 chr; /* Any unicode character. */
+sljit_u8 *bytes, *bytes_end, byte;
 PCRE2_SPTR alternative, cc_save, oc;
 #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8
 PCRE2_UCHAR othercase[8];
@@ -3603,7 +3603,8 @@ while (TRUE)
 
     case OP_CLASS:
 #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8
-    if (common->utf && !is_char7_bitset((const sljit_ub *)(cc + 1), FALSE)) return consumed;
+    if (common->utf && !is_char7_bitset((const sljit_u8 *)(cc + 1), FALSE))
+      return consumed;
 #endif
     class = TRUE;
     break;
@@ -3627,7 +3628,7 @@ while (TRUE)
 
     case OP_DIGIT:
 #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8
-    if (common->utf && !is_char7_bitset((const sljit_ub *)common->ctypes - cbit_length + cbit_digit, FALSE))
+    if (common->utf && !is_char7_bitset((const sljit_u8 *)common->ctypes - cbit_length + cbit_digit, FALSE))
       return consumed;
 #endif
     any = TRUE;
@@ -3636,7 +3637,7 @@ while (TRUE)
 
     case OP_WHITESPACE:
 #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8
-    if (common->utf && !is_char7_bitset((const sljit_ub *)common->ctypes - cbit_length + cbit_space, FALSE))
+    if (common->utf && !is_char7_bitset((const sljit_u8 *)common->ctypes - cbit_length + cbit_space, FALSE))
       return consumed;
 #endif
     any = TRUE;
@@ -3645,7 +3646,7 @@ while (TRUE)
 
     case OP_WORDCHAR:
 #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8
-    if (common->utf && !is_char7_bitset((const sljit_ub *)common->ctypes - cbit_length + cbit_word, FALSE))
+    if (common->utf && !is_char7_bitset((const sljit_u8 *)common->ctypes - cbit_length + cbit_word, FALSE))
       return consumed;
 #endif
     any = TRUE;
@@ -3717,7 +3718,7 @@ while (TRUE)
 
   if (class)
     {
-    bytes = (sljit_ub*) (cc + 1);
+    bytes = (sljit_u8*) (cc + 1);
     cc += 1 + 32 / sizeof(PCRE2_UCHAR);
 
     switch (*cc)
@@ -3877,9 +3878,9 @@ while (TRUE)
 
 #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
 
-static sljit_si character_to_int32(PCRE2_UCHAR chr)
+static sljit_s32 character_to_int32(PCRE2_UCHAR chr)
 {
-sljit_si value = (sljit_si)chr;
+sljit_s32 value = (sljit_s32)chr;
 #if PCRE2_CODE_UNIT_WIDTH == 8
 #define SSE2_COMPARE_TYPE_INDEX 0
 return (value << 24) | (value << 16) | (value << 8) | value;
@@ -3900,10 +3901,10 @@ DEFINE_COMPILER;
 struct sljit_label *start;
 struct sljit_jump *quit[3];
 struct sljit_jump *nomatch;
-sljit_ub instruction[8];
-sljit_si tmp1_ind = sljit_get_register_index(TMP1);
-sljit_si tmp2_ind = sljit_get_register_index(TMP2);
-sljit_si str_ptr_ind = sljit_get_register_index(STR_PTR);
+sljit_u8 instruction[8];
+sljit_s32 tmp1_ind = sljit_get_register_index(TMP1);
+sljit_s32 tmp2_ind = sljit_get_register_index(TMP2);
+sljit_s32 str_ptr_ind = sljit_get_register_index(STR_PTR);
 BOOL load_twice = FALSE;
 PCRE2_UCHAR bit;
 
@@ -4026,12 +4027,12 @@ sljit_emit_op_custom(compiler, instruction, 4);
 
 if (load_twice)
   {
-  OP1(SLJIT_MOV, TMP3, 0, TMP2, 0);
+  OP1(SLJIT_MOV, RETURN_ADDR, 0, TMP2, 0);
   instruction[3] = 0xc0 | (tmp2_ind << 3) | 1;
   sljit_emit_op_custom(compiler, instruction, 4);
 
   OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
-  OP1(SLJIT_MOV, TMP2, 0, TMP3, 0);
+  OP1(SLJIT_MOV, TMP2, 0, RETURN_ADDR, 0);
   }
 
 OP2(SLJIT_ASHR, TMP1, 0, TMP1, 0, TMP2, 0);
@@ -4156,7 +4157,7 @@ SET_LABEL(quit[2], start);
 
 #endif
 
-static void fast_forward_first_char2(compiler_common *common, PCRE2_UCHAR char1, PCRE2_UCHAR char2, sljit_si offset)
+static void fast_forward_first_char2(compiler_common *common, PCRE2_UCHAR char1, PCRE2_UCHAR char2, sljit_s32 offset)
 {
 DEFINE_COMPILER;
 struct sljit_label *start;
@@ -4333,14 +4334,14 @@ struct sljit_jump *match;
 /* bytes[0] represent the number of characters between 0
 and MAX_N_BYTES - 1, 255 represents any character. */
 PCRE2_UCHAR chars[MAX_N_CHARS * MAX_DIFF_CHARS];
-sljit_si offset;
+sljit_s32 offset;
 PCRE2_UCHAR mask;
 PCRE2_UCHAR *char_set, *char_set_end;
 int i, max, from;
 int range_right = -1, range_len;
-sljit_ub *update_table = NULL;
+sljit_u8 *update_table = NULL;
 BOOL in_range;
-uint32_t rec_count;
+sljit_u32 rec_count;
 
 for (i = 0; i < MAX_N_CHARS; i++)
   chars[i * MAX_DIFF_CHARS] = 0;
@@ -4378,7 +4379,7 @@ for (i = 0; i <= max; i++)
 
 if (range_right >= 0)
   {
-  update_table = (sljit_ub *)allocate_read_only_data(common, 256);
+  update_table = (sljit_u8 *)allocate_read_only_data(common, 256);
   if (update_table == NULL)
     return TRUE;
   memset(update_table, IN_UCHARS(range_len), 256);
@@ -4464,15 +4465,15 @@ start = LABEL();
 quit = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
 
 #if PCRE2_CODE_UNIT_WIDTH == 8 || (defined SLJIT_LITTLE_ENDIAN && SLJIT_LITTLE_ENDIAN)
-OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(range_right));
+OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(range_right));
 #else
-OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(range_right + 1) - 1);
+OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(range_right + 1) - 1);
 #endif
 
 #if !(defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM2(RETURN_ADDR, TMP1), 0);
+OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(RETURN_ADDR, TMP1), 0);
 #else
-OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)update_table);
+OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)update_table);
 #endif
 OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
 CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0, start);
@@ -4548,7 +4549,6 @@ return TRUE;
 }
 
 #undef MAX_N_CHARS
-#undef MAX_N_BYTES
 
 static SLJIT_INLINE void fast_forward_first_char(compiler_common *common, PCRE2_UCHAR first_char, BOOL caseless)
 {
@@ -4654,9 +4654,9 @@ if (common->match_end_ptr != 0)
   OP1(SLJIT_MOV, STR_END, 0, TMP3, 0);
 }
 
-static BOOL check_class_ranges(compiler_common *common, const sljit_ub *bits, BOOL nclass, BOOL invert, jump_list **backtracks);
+static BOOL check_class_ranges(compiler_common *common, const sljit_u8 *bits, BOOL nclass, BOOL invert, jump_list **backtracks);
 
-static SLJIT_INLINE void fast_forward_start_bits(compiler_common *common, const sljit_ub *start_bits)
+static SLJIT_INLINE void fast_forward_start_bits(compiler_common *common, const sljit_u8 *start_bits)
 {
 DEFINE_COMPILER;
 struct sljit_label *start;
@@ -4690,7 +4690,7 @@ if (!check_class_ranges(common, start_bits, (start_bits[31] & 0x80) != 0, TRUE,
 #endif
   OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
   OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
-  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)start_bits);
+  OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)start_bits);
   OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
   OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
   found = JUMP(SLJIT_NOT_ZERO);
@@ -4706,7 +4706,7 @@ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
 if (common->utf)
   {
   CMPTO(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);
-  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
+  OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
   OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
   }
 #elif PCRE2_CODE_UNIT_WIDTH == 16
@@ -4741,7 +4741,7 @@ struct sljit_jump *alreadyfound;
 struct sljit_jump *found;
 struct sljit_jump *foundoc = NULL;
 struct sljit_jump *notfound;
-sljit_ui oc, bit;
+sljit_u32 oc, bit;
 
 SLJIT_ASSERT(common->req_char_ptr != 0);
 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->req_char_ptr);
@@ -4878,7 +4878,7 @@ else
   if (common->utf)
     jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255);
 #endif /* PCRE2_CODE_UNIT_WIDTH == 8 */
-  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), common->ctypes);
+  OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), common->ctypes);
   OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 4 /* ctype_word */);
   OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
   OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP1, 0);
@@ -4923,7 +4923,7 @@ else
   if (common->utf)
     jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255);
 #endif
-  OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP1), common->ctypes);
+  OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP1), common->ctypes);
   OP2(SLJIT_LSHR, TMP2, 0, TMP2, 0, SLJIT_IMM, 4 /* ctype_word */);
   OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);
 #if PCRE2_CODE_UNIT_WIDTH != 8
@@ -4939,12 +4939,12 @@ OP2(SLJIT_XOR | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_MEM1(SLJIT_SP), LOC
 sljit_emit_fast_return(compiler, SLJIT_MEM1(SLJIT_SP), LOCALS0);
 }
 
-static BOOL check_class_ranges(compiler_common *common, const sljit_ub *bits, BOOL nclass, BOOL invert, jump_list **backtracks)
+static BOOL check_class_ranges(compiler_common *common, const sljit_u8 *bits, BOOL nclass, BOOL invert, jump_list **backtracks)
 {
 /* May destroy TMP1. */
 DEFINE_COMPILER;
 int ranges[MAX_RANGE_SIZE];
-sljit_ub bit, cbit, all;
+sljit_u8 bit, cbit, all;
 int i, byte, length = 0;
 
 bit = bits[0] & 0x1;
@@ -5239,12 +5239,12 @@ OP1(MOVU_UCHAR, CHAR2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
 #if PCRE2_CODE_UNIT_WIDTH != 8
 jump = CMP(SLJIT_GREATER, CHAR1, 0, SLJIT_IMM, 255);
 #endif
-OP1(SLJIT_MOV_UB, CHAR1, 0, SLJIT_MEM2(LCC_TABLE, CHAR1), 0);
+OP1(SLJIT_MOV_U8, CHAR1, 0, SLJIT_MEM2(LCC_TABLE, CHAR1), 0);
 #if PCRE2_CODE_UNIT_WIDTH != 8
 JUMPHERE(jump);
 jump = CMP(SLJIT_GREATER, CHAR2, 0, SLJIT_IMM, 255);
 #endif
-OP1(SLJIT_MOV_UB, CHAR2, 0, SLJIT_MEM2(LCC_TABLE, CHAR2), 0);
+OP1(SLJIT_MOV_U8, CHAR2, 0, SLJIT_MEM2(LCC_TABLE, CHAR2), 0);
 #if PCRE2_CODE_UNIT_WIDTH != 8
 JUMPHERE(jump);
 #endif
@@ -5269,11 +5269,11 @@ sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
 static PCRE2_SPTR SLJIT_CALL do_utf_caselesscmp(PCRE2_SPTR src1, jit_arguments *args, PCRE2_SPTR end1)
 {
 /* This function would be ineffective to do in JIT level. */
-sljit_ui c1, c2;
+sljit_u32 c1, c2;
 PCRE2_SPTR src2 = args->startchar_ptr;
 PCRE2_SPTR end2 = args->end;
 const ucd_record *ur;
-const sljit_ui *pp;
+const sljit_u32 *pp;
 
 while (src1 < end1)
   {
@@ -5297,8 +5297,6 @@ return src2;
 
 #endif /* SUPPORT_UNICODE */
 
-static PCRE2_SPTR compile_char1_matchingpath(compiler_common *common, PCRE2_UCHAR type, PCRE2_SPTR cc, jump_list **backtracks, BOOL check_str_ptr);
-
 static PCRE2_SPTR byte_sequence_compare(compiler_common *common, BOOL caseless, PCRE2_SPTR cc,
     compare_context *context, jump_list **backtracks)
 {
@@ -5335,16 +5333,16 @@ if (context->sourcereg == -1)
 #if PCRE2_CODE_UNIT_WIDTH == 8
 #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
   if (context->length >= 4)
-    OP1(SLJIT_MOV_SI, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
+    OP1(SLJIT_MOV_S32, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
   else if (context->length >= 2)
-    OP1(SLJIT_MOV_UH, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
+    OP1(SLJIT_MOV_U16, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
   else
 #endif
-    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
+    OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
 #elif PCRE2_CODE_UNIT_WIDTH == 16
 #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
   if (context->length >= 4)
-    OP1(SLJIT_MOV_SI, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
+    OP1(SLJIT_MOV_S32, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
   else
 #endif
     OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
@@ -5386,12 +5384,12 @@ do
 #endif
     {
     if (context->length >= 4)
-      OP1(SLJIT_MOV_SI, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
+      OP1(SLJIT_MOV_S32, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
     else if (context->length >= 2)
-      OP1(SLJIT_MOV_UH, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
+      OP1(SLJIT_MOV_U16, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
 #if PCRE2_CODE_UNIT_WIDTH == 8
     else if (context->length >= 1)
-      OP1(SLJIT_MOV_UB, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
+      OP1(SLJIT_MOV_U8, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
 #endif /* PCRE2_CODE_UNIT_WIDTH == 8 */
     context->sourcereg = context->sourcereg == TMP1 ? TMP2 : TMP1;
 
@@ -5474,6 +5472,8 @@ return cc;
     } \
   charoffset = (value);
 
+static PCRE2_SPTR compile_char1_matchingpath(compiler_common *common, PCRE2_UCHAR type, PCRE2_SPTR cc, jump_list **backtracks, BOOL check_str_ptr);
+
 static void compile_xclass_matchingpath(compiler_common *common, PCRE2_SPTR cc, jump_list **backtracks)
 {
 DEFINE_COMPILER;
@@ -5491,7 +5491,7 @@ BOOL utf = common->utf;
 BOOL needstype = FALSE, needsscript = FALSE, needschar = FALSE;
 BOOL charsaved = FALSE;
 int typereg = TMP1;
-const sljit_ui *other_cases;
+const sljit_u32 *other_cases;
 sljit_uw typeoffset;
 #endif
 
@@ -5609,11 +5609,11 @@ if ((cc[-1] & XCL_HASPROP) == 0)
   if ((cc[-1] & XCL_MAP) != 0)
     {
     jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255);
-    if (!check_class_ranges(common, (const sljit_ub *)cc, (((const sljit_ub *)cc)[31] & 0x80) != 0, TRUE, &found))
+    if (!check_class_ranges(common, (const sljit_u8 *)cc, (((const sljit_u8 *)cc)[31] & 0x80) != 0, TRUE, &found))
       {
       OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
       OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
-      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
+      OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
       OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
       OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
       add_jump(compiler, &found, JUMP(SLJIT_NOT_ZERO));
@@ -5636,7 +5636,7 @@ else if ((cc[-1] & XCL_MAP) != 0)
 #ifdef SUPPORT_UNICODE
   charsaved = TRUE;
 #endif
-  if (!check_class_ranges(common, (const sljit_ub *)cc, FALSE, TRUE, list))
+  if (!check_class_ranges(common, (const sljit_u8 *)cc, FALSE, TRUE, list))
     {
 #if PCRE2_CODE_UNIT_WIDTH == 8
     jump = NULL;
@@ -5646,7 +5646,7 @@ else if ((cc[-1] & XCL_MAP) != 0)
 
     OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
     OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
-    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
+    OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
     OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
     OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
     add_jump(compiler, list, JUMP(SLJIT_NOT_ZERO));
@@ -5668,18 +5668,18 @@ if (needstype || needsscript)
     OP1(SLJIT_MOV, RETURN_ADDR, 0, TMP1, 0);
 
   OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);
-  OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_stage1));
+  OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_stage1));
   OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK);
   OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);
   OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, TMP2, 0);
   OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_stage2));
-  OP1(SLJIT_MOV_UH, TMP2, 0, SLJIT_MEM2(TMP2, TMP1), 1);
+  OP1(SLJIT_MOV_U16, TMP2, 0, SLJIT_MEM2(TMP2, TMP1), 1);
 
   /* Before anything else, we deal with scripts. */
   if (needsscript)
     {
     OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, script));
-    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3);
+    OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3);
 
     ccbegin = cc;
 
@@ -5726,12 +5726,12 @@ if (needstype || needsscript)
     if (!needschar)
       {
       OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, chartype));
-      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3);
+      OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3);
       }
     else
       {
       OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 3);
-      OP1(SLJIT_MOV_UB, RETURN_ADDR, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, chartype));
+      OP1(SLJIT_MOV_U8, RETURN_ADDR, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, chartype));
       typereg = RETURN_ADDR;
       }
     }
@@ -6127,47 +6127,9 @@ switch(type)
   check_partial(common, FALSE);
   return cc;
 
-  case OP_CIRC:
-  OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
-  OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin));
-  add_jump(compiler, backtracks, CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0));
-  OP2(SLJIT_IAND | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL);
-  add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO));
-  return cc;
-
-  case OP_CIRCM:
-  OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
-  OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin));
-  jump[1] = CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0);
-  OP2(SLJIT_IAND | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL);
-  add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO));
-  jump[0] = JUMP(SLJIT_JUMP);
-  JUMPHERE(jump[1]);
-
-  if (!common->alt_circumflex)
-    add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
-
-  if (common->nltype == NLTYPE_FIXED && common->newline > 255)
-    {
-    OP2(SLJIT_SUB, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2));
-    add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP2, 0, TMP1, 0));
-    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-2));
-    OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-1));
-    add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));
-    add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff));
-    }
-  else
-    {
-    skip_char_back(common);
-    read_char_range(common, common->nlmin, common->nlmax, TRUE);
-    check_newlinechar(common, common->nltype, backtracks, FALSE);
-    }
-  JUMPHERE(jump[0]);
-  return cc;
-
   case OP_DOLL:
   OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
-  OP2(SLJIT_IAND | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL);
+  OP2(SLJIT_AND32 | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL);
   add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO));
 
   if (!common->endonly)
@@ -6182,7 +6144,7 @@ switch(type)
   case OP_DOLLM:
   jump[1] = CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0);
   OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
-  OP2(SLJIT_IAND | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL);
+  OP2(SLJIT_AND32 | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL);
   add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO));
   check_partial(common, FALSE);
   jump[0] = JUMP(SLJIT_JUMP);
@@ -6216,6 +6178,44 @@ switch(type)
   JUMPHERE(jump[0]);
   return cc;
 
+  case OP_CIRC:
+  OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
+  OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin));
+  add_jump(compiler, backtracks, CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0));
+  OP2(SLJIT_AND32 | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL);
+  add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO));
+  return cc;
+
+  case OP_CIRCM:
+  OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
+  OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin));
+  jump[1] = CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0);
+  OP2(SLJIT_AND32 | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL);
+  add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO));
+  jump[0] = JUMP(SLJIT_JUMP);
+  JUMPHERE(jump[1]);
+
+  if (!common->alt_circumflex)
+    add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
+
+  if (common->nltype == NLTYPE_FIXED && common->newline > 255)
+    {
+    OP2(SLJIT_SUB, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2));
+    add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP2, 0, TMP1, 0));
+    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-2));
+    OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-1));
+    add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));
+    add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff));
+    }
+  else
+    {
+    skip_char_back(common);
+    read_char_range(common, common->nlmin, common->nlmax, TRUE);
+    check_newlinechar(common, common->nltype, backtracks, FALSE);
+    }
+  JUMPHERE(jump[0]);
+  return cc;
+
   case OP_REVERSE:
   length = GET(cc, 0);
   if (length == 0)
@@ -6267,7 +6267,7 @@ switch(type)
   if (check_str_ptr)
     detect_partial_match(common, backtracks);
 #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8
-  if (common->utf && is_char7_bitset((const sljit_ub*)common->ctypes - cbit_length + cbit_digit, FALSE))
+  if (common->utf && is_char7_bitset((const sljit_u8*)common->ctypes - cbit_length + cbit_digit, FALSE))
     read_char7_type(common, type == OP_NOT_DIGIT);
   else
 #endif
@@ -6282,7 +6282,7 @@ switch(type)
   if (check_str_ptr)
     detect_partial_match(common, backtracks);
 #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8
-  if (common->utf && is_char7_bitset((const sljit_ub*)common->ctypes - cbit_length + cbit_space, FALSE))
+  if (common->utf && is_char7_bitset((const sljit_u8*)common->ctypes - cbit_length + cbit_space, FALSE))
     read_char7_type(common, type == OP_NOT_WHITESPACE);
   else
 #endif
@@ -6296,7 +6296,7 @@ switch(type)
   if (check_str_ptr)
     detect_partial_match(common, backtracks);
 #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8
-  if (common->utf && is_char7_bitset((const sljit_ub*)common->ctypes - cbit_length + cbit_word, FALSE))
+  if (common->utf && is_char7_bitset((const sljit_u8*)common->ctypes - cbit_length + cbit_word, FALSE))
     read_char7_type(common, type == OP_NOT_WORDCHAR);
   else
 #endif
@@ -6338,7 +6338,7 @@ switch(type)
 #if PCRE2_CODE_UNIT_WIDTH == 8 || PCRE2_CODE_UNIT_WIDTH == 16
 #if PCRE2_CODE_UNIT_WIDTH == 8
     jump[0] = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
-    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
+    OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
     OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
 #elif PCRE2_CODE_UNIT_WIDTH == 16
     jump[0] = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
@@ -6425,7 +6425,7 @@ switch(type)
   OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, gbprop));
   /* Optimize register allocation: use a real register. */
   OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0);
-  OP1(SLJIT_MOV_UB, STACK_TOP, 0, SLJIT_MEM2(TMP1, TMP2), 3);
+  OP1(SLJIT_MOV_U8, STACK_TOP, 0, SLJIT_MEM2(TMP1, TMP2), 3);
 
   label = LABEL();
   jump[0] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
@@ -6433,10 +6433,10 @@ switch(type)
   read_char(common);
   add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
   OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, gbprop));
-  OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM2(TMP1, TMP2), 3);
+  OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM2(TMP1, TMP2), 3);
 
   OP2(SLJIT_SHL, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 2);
-  OP1(SLJIT_MOV_UI, TMP1, 0, SLJIT_MEM1(STACK_TOP), (sljit_sw)PRIV(ucp_gbtable));
+  OP1(SLJIT_MOV_U32, TMP1, 0, SLJIT_MEM1(STACK_TOP), (sljit_sw)PRIV(ucp_gbtable));
   OP1(SLJIT_MOV, STACK_TOP, 0, TMP2, 0);
   OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
   OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
@@ -6520,7 +6520,7 @@ switch(type)
     c = *cc;
     if (c < 128)
       {
-      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
+      OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
       if (type == OP_NOT || !char_has_othercase(common, cc))
         add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, c));
       else
@@ -6576,13 +6576,13 @@ switch(type)
     detect_partial_match(common, backtracks);
 
 #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8
-  bit = (common->utf && is_char7_bitset((const sljit_ub *)cc, type == OP_NCLASS)) ? 127 : 255;
+  bit = (common->utf && is_char7_bitset((const sljit_u8 *)cc, type == OP_NCLASS)) ? 127 : 255;
   read_char_range(common, 0, bit, type == OP_NCLASS);
 #else
   read_char_range(common, 0, 255, type == OP_NCLASS);
 #endif
 
-  if (check_class_ranges(common, (const sljit_ub *)cc, type == OP_NCLASS, FALSE, backtracks))
+  if (check_class_ranges(common, (const sljit_u8 *)cc, type == OP_NCLASS, FALSE, backtracks))
     return cc + 32 / sizeof(PCRE2_UCHAR);
 
 #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8
@@ -6607,7 +6607,7 @@ switch(type)
 
   OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
   OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
-  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
+  OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
   OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
   OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
   add_jump(compiler, backtracks, JUMP(SLJIT_ZERO));
@@ -7134,8 +7134,8 @@ static int SLJIT_CALL do_callout(struct jit_arguments *arguments, pcre2_callout_
 {
 PCRE2_SPTR begin = arguments->begin;
 PCRE2_SIZE *ovector = arguments->match_data->ovector;
-uint32_t oveccount = arguments->oveccount;
-uint32_t i;
+sljit_u32 oveccount = arguments->oveccount;
+sljit_u32 i;
 
 if (arguments->callout == NULL)
   return 0;
@@ -7176,7 +7176,7 @@ static SLJIT_INLINE PCRE2_SPTR compile_callout_matchingpath(compiler_common *com
 {
 DEFINE_COMPILER;
 backtrack_common *backtrack;
-sljit_si mov_opcode;
+sljit_s32 mov_opcode;
 unsigned int callout_length = (*cc == OP_CALLOUT)
     ? PRIV(OP_lengths)[OP_CALLOUT] : GET(cc, 1 + 2 * LINK_SIZE);
 sljit_sw value1;
@@ -7191,8 +7191,8 @@ SLJIT_ASSERT(common->capture_last_ptr != 0);
 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr);
 OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
 value1 = (*cc == OP_CALLOUT) ? cc[1 + 2 * LINK_SIZE] : 0;
-OP1(SLJIT_MOV_UI, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(callout_number), SLJIT_IMM, value1);
-OP1(SLJIT_MOV_UI, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(capture_last), TMP2, 0);
+OP1(SLJIT_MOV_U32, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(callout_number), SLJIT_IMM, value1);
+OP1(SLJIT_MOV_U32, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(capture_last), TMP2, 0);
 
 /* These pointer sized fields temporarly stores internal variables. */
 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0));
@@ -7201,7 +7201,7 @@ OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(subject), TMP2, 0);
 
 if (common->mark_ptr != 0)
   OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, mark_ptr));
-mov_opcode = (sizeof(PCRE2_SIZE) == 4) ? SLJIT_MOV_UI : SLJIT_MOV;
+mov_opcode = (sizeof(PCRE2_SIZE) == 4) ? SLJIT_MOV_U32 : SLJIT_MOV;
 OP1(mov_opcode, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(pattern_position), SLJIT_IMM, GET(cc, 1));
 OP1(mov_opcode, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(next_item_length), SLJIT_IMM, GET(cc, 1 + LINK_SIZE));
 
@@ -7228,7 +7228,7 @@ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0);
 OP2(SLJIT_SUB, SLJIT_R1, 0, STACK_TOP, 0, SLJIT_IMM, CALLOUT_ARG_SIZE);
 GET_LOCAL_BASE(SLJIT_R2, 0, OVECTOR_START);
 sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_callout));
-OP1(SLJIT_MOV_SI, SLJIT_RETURN_REG, 0, SLJIT_RETURN_REG, 0);
+OP1(SLJIT_MOV_S32, SLJIT_RETURN_REG, 0, SLJIT_RETURN_REG, 0);
 OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
 free_stack(common, CALLOUT_ARG_SIZE / sizeof(sljit_sw));
 
@@ -7257,6 +7257,10 @@ while (TRUE)
 
     case OP_NOT_WORD_BOUNDARY:
     case OP_WORD_BOUNDARY:
+    case OP_CIRC:
+    case OP_CIRCM:
+    case OP_DOLL:
+    case OP_DOLLM:
     case OP_CALLOUT:
     case OP_ALT:
     cc += PRIV(OP_lengths)[*cc];
@@ -8650,7 +8654,7 @@ count_match(common);
 return cc + 1 + LINK_SIZE;
 }
 
-static SLJIT_INLINE PCRE2_SPTR get_iterator_parameters(compiler_common *common, PCRE2_SPTR cc, PCRE2_UCHAR *opcode, PCRE2_UCHAR *type, sljit_ui *max, sljit_ui *exact, PCRE2_SPTR *end)
+static SLJIT_INLINE PCRE2_SPTR get_iterator_parameters(compiler_common *common, PCRE2_SPTR cc, PCRE2_UCHAR *opcode, PCRE2_UCHAR *type, sljit_u32 *max, sljit_u32 *exact, PCRE2_SPTR *end)
 {
 int class_len;
 
@@ -8801,9 +8805,9 @@ DEFINE_COMPILER;
 backtrack_common *backtrack;
 PCRE2_UCHAR opcode;
 PCRE2_UCHAR type;
-sljit_ui max = 0, exact;
+sljit_u32 max = 0, exact;
 BOOL fast_fail;
-sljit_si fast_str_ptr;
+sljit_s32 fast_str_ptr;
 BOOL charpos_enabled;
 PCRE2_UCHAR charpos_char;
 unsigned int charpos_othercasebit;
@@ -8943,9 +8947,7 @@ switch(opcode)
 #elif PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32
         SLJIT_ASSERT((charpos_othercasebit >> 9) == 0);
         if ((charpos_othercasebit & 0x100) != 0)
-          {
           charpos_othercasebit = (charpos_othercasebit & 0xff) << 8;
-          }
 #endif
         if (charpos_othercasebit != 0)
           charpos_char |= charpos_othercasebit;
@@ -9220,7 +9222,7 @@ if (common->accept_label == NULL)
 else
   CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0), common->accept_label);
 OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
-OP1(SLJIT_MOV_UI, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, options));
+OP1(SLJIT_MOV_U32, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, options));
 OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, PCRE2_NOTEMPTY);
 add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_NOT_ZERO));
 OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, PCRE2_NOTEMPTY_ATSTART);
@@ -9347,10 +9349,10 @@ while (cc < ccend)
     case OP_WORD_BOUNDARY:
     case OP_EODN:
     case OP_EOD:
-    case OP_CIRC:
-    case OP_CIRCM:
     case OP_DOLL:
     case OP_DOLLM:
+    case OP_CIRC:
+    case OP_CIRCM:
     case OP_REVERSE:
     cc = compile_simple_assertion_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks);
     break;
@@ -9652,7 +9654,7 @@ DEFINE_COMPILER;
 PCRE2_SPTR cc = current->cc;
 PCRE2_UCHAR opcode;
 PCRE2_UCHAR type;
-sljit_ui max = 0, exact;
+sljit_u32 max = 0, exact;
 struct sljit_label *label = NULL;
 struct sljit_jump *jump = NULL;
 jump_list *jumplist = NULL;
@@ -9771,7 +9773,7 @@ switch(opcode)
   break;
   }
 
-  set_jumps(current->topbacktracks, LABEL());
+set_jumps(current->topbacktracks, LABEL());
 }
 
 static SLJIT_INLINE void compile_ref_iterator_backtrackingpath(compiler_common *common, struct backtrack_common *current)
@@ -10826,14 +10828,14 @@ sljit_emit_fast_return(compiler, SLJIT_MEM1(STACK_TOP), 0);
 #undef COMPILE_BACKTRACKINGPATH
 #undef CURRENT_AS
 
-static int jit_compile(pcre2_code *code, uint32_t mode)
+static int jit_compile(pcre2_code *code, sljit_u32 mode)
 {
 pcre2_real_code *re = (pcre2_real_code *)code;
 struct sljit_compiler *compiler;
 backtrack_common rootbacktrack;
 compiler_common common_data;
 compiler_common *common = &common_data;
-const sljit_ub *tables = re->tables;
+const sljit_u8 *tables = re->tables;
 void *allocator_data = &re->memctl;
 int private_data_size;
 PCRE2_SPTR ccend;
@@ -10930,7 +10932,7 @@ ccend = bracketend(common->start);
 
 /* Calculate the local space size on the stack. */
 common->ovector_start = LIMIT_MATCH + sizeof(sljit_sw);
-common->optimized_cbracket = (sljit_ub *)SLJIT_MALLOC(re->top_bracket + 1, allocator_data);
+common->optimized_cbracket = (sljit_u8 *)SLJIT_MALLOC(re->top_bracket + 1, allocator_data);
 if (!common->optimized_cbracket)
   return PCRE2_ERROR_NOMEMORY;
 #if defined DEBUG_FORCE_UNOPTIMIZED_CBRAS && DEBUG_FORCE_UNOPTIMIZED_CBRAS == 1
@@ -11001,13 +11003,13 @@ SLJIT_ASSERT(!(common->req_char_ptr != 0 && common->start_used_ptr != 0));
 common->cbra_ptr = OVECTOR_START + (re->top_bracket + 1) * 2 * sizeof(sljit_sw);
 
 total_length = ccend - common->start;
-common->private_data_ptrs = (sljit_si *)SLJIT_MALLOC(total_length * (sizeof(sljit_si) + (common->has_then ? 1 : 0)), allocator_data);
+common->private_data_ptrs = (sljit_s32 *)SLJIT_MALLOC(total_length * (sizeof(sljit_s32) + (common->has_then ? 1 : 0)), allocator_data);
 if (!common->private_data_ptrs)
   {
   SLJIT_FREE(common->optimized_cbracket, allocator_data);
   return PCRE2_ERROR_NOMEMORY;
   }
-memset(common->private_data_ptrs, 0, total_length * sizeof(sljit_si));
+memset(common->private_data_ptrs, 0, total_length * sizeof(sljit_s32));
 
 private_data_size = common->cbra_ptr + (re->top_bracket + 1) * sizeof(sljit_sw);
 set_private_data_ptrs(common, &private_data_size, ccend);
@@ -11028,7 +11030,7 @@ if (private_data_size > SLJIT_MAX_LOCAL_SIZE)
 
 if (common->has_then)
   {
-  common->then_offsets = (sljit_ub *)(common->private_data_ptrs + total_length);
+  common->then_offsets = (sljit_u8 *)(common->private_data_ptrs + total_length);
   memset(common->then_offsets, 0, total_length);
   set_then_offsets(common, common->start, NULL);
   }
@@ -11055,7 +11057,7 @@ OP1(SLJIT_MOV, TMP1, 0, SLJIT_S0, 0);
 OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));
 OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, end));
 OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack));
-OP1(SLJIT_MOV_UI, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, limit_match));
+OP1(SLJIT_MOV_U32, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, limit_match));
 OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(struct sljit_stack, base));
 OP1(SLJIT_MOV, STACK_LIMIT, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(struct sljit_stack, limit));
 OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
@@ -11192,10 +11194,8 @@ if ((re->overall_options & PCRE2_ANCHORED) == 0 && common->match_end_ptr != 0)
   OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr);
   }
 
-if (common->fast_forward_bc_ptr != NULL)
-  OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), PRIVATE_DATA(common->fast_forward_bc_ptr + 1));
-else
-  OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr);
+OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP),
+    (common->fast_forward_bc_ptr != NULL) ? (PRIVATE_DATA(common->fast_forward_bc_ptr + 1)) : common->start_ptr);
 
 if ((re->overall_options & PCRE2_ANCHORED) == 0)
   {
@@ -11216,9 +11216,7 @@ if ((re->overall_options & PCRE2_ANCHORED) == 0)
       }
     }
   else
-    {
     CMPTO(SLJIT_LESS, STR_PTR, 0, (common->match_end_ptr == 0) ? STR_END : TMP1, 0, mainloop_label);
-    }
   }
 
 /* No more remaining characters. */
@@ -11237,7 +11235,7 @@ if (common->might_be_empty)
   {
   JUMPHERE(empty_match);
   OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
-  OP1(SLJIT_MOV_UI, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, options));
+  OP1(SLJIT_MOV_U32, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, options));
   OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, PCRE2_NOTEMPTY);
   JUMPTO(SLJIT_NOT_ZERO, empty_match_backtrack_label);
   OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, PCRE2_NOTEMPTY_ATSTART);
index d804cfea4d3871987815ead2e8a7d3cacef2cbbc..a323971ff3ea3328a837fb7882bf5a2c22ac402b 100644 (file)
@@ -46,7 +46,7 @@ POSSIBILITY OF SUCH DAMAGE.
 
 static SLJIT_NOINLINE int jit_machine_stack_exec(jit_arguments *arguments, jit_function executable_func)
 {
-sljit_ub local_space[MACHINE_STACK_SIZE];
+sljit_u8 local_space[MACHINE_STACK_SIZE];
 struct sljit_stack local_stack;
 
 local_stack.top = (sljit_sw)&local_space;
index 78837cf56a30edddca2f01f515e3dafa6c5cf159..705ba181eb3c34f840f11f84df596f99c983b248 100644 (file)
@@ -140,7 +140,6 @@ int main(void)
 #define F_DIFF         0x080000
 #define F_FORCECONV    0x100000
 #define F_PROPERTY     0x200000
-#define F_STUDY                0x400000
 
 struct regression_test_case {
        int compile_options;
@@ -693,6 +692,7 @@ static struct regression_test_case regression_test_cases[] = {
        { PCRE2_FIRSTLINE | PCRE2_DOTALL, PCRE2_NEWLINE_LF, 0, 0 | F_NOMATCH, "ab.", "ab" },
        { MU | PCRE2_FIRSTLINE, A, 0, 1 | F_NOMATCH, "^[a-d0-9]", "\nxx\nd" },
        { PCRE2_FIRSTLINE | PCRE2_DOTALL, PCRE2_NEWLINE_ANY, 0, 0, "....a", "012\n0a" },
+       { MU | PCRE2_FIRSTLINE, A, 0, 0, "[aC]", "a" },
 
        /* Recurse. */
        { MU, A, 0, 0, "(a)(?1)", "aa" },
@@ -779,11 +779,11 @@ static struct regression_test_case regression_test_cases[] = {
        { MU, A, 0, 0, "(?(DEFINE)(a(*:aa)))a(?1)b|aac", "aac" },
        { MU, A, 0, 0, "(a(*:aa)){0}(?:b(?1)b|c)+c", "babbab cc" },
        { MU, A, 0, 0, "(a(*:aa)){0}(?:b(?1)b)+", "babba" },
-       { MU, A, 0, 0 | F_NOMATCH | F_STUDY, "(a(*:aa)){0}(?:b(?1)b)+", "ba" },
+       { MU, A, 0, 0 | F_NOMATCH, "(a(*:aa)){0}(?:b(?1)b)+", "ba" },
        { MU, A, 0, 0, "(a\\K(*:aa)){0}(?:b(?1)b|c)+c", "babbab cc" },
        { MU, A, 0, 0, "(a\\K(*:aa)){0}(?:b(?1)b)+", "babba" },
-       { MU, A, 0, 0 | F_NOMATCH | F_STUDY, "(a\\K(*:aa)){0}(?:b(?1)b)+", "ba" },
-       { MU, A, 0, 0 | F_NOMATCH | F_STUDY, "(*:mark)m", "a" },
+       { MU, A, 0, 0 | F_NOMATCH, "(a\\K(*:aa)){0}(?:b(?1)b)+", "ba" },
+       { MU, A, 0, 0 | F_NOMATCH, "(*:mark)m", "a" },
 
        /* (*COMMIT) verb. */
        { MU, A, 0, 0 | F_NOMATCH, "a(*COMMIT)b", "ac" },
@@ -1533,10 +1533,10 @@ static int regression_tests(void)
                                                        is_successful = 0;
                                                }
 #endif
-#if defined SUPPORT_PCRE2_16 && defined SUPPORT_PCRE2_16
-                                               if (ovector16_1[i] != ovector16_2[i] || ovector16_1[i] != ovector16_1[i] || ovector16_1[i] != ovector16_2[i]) {
-                                                       printf("\n16 and 16 bit: Ovector[%d] value differs(J16:%d,I16:%d,J32:%d,I32:%d): [%d] '%s' @ '%s' \n",
-                                                               i, ovector16_1[i], ovector16_2[i], ovector16_1[i], ovector16_2[i],
+#if defined SUPPORT_PCRE2_16 && defined SUPPORT_PCRE2_32
+                                               if (ovector16_1[i] != ovector16_2[i] || ovector16_1[i] != ovector32_1[i] || ovector16_1[i] != ovector32_2[i]) {
+                                                       printf("\n16 and 32 bit: Ovector[%d] value differs(J16:%d,I16:%d,J32:%d,I32:%d): [%d] '%s' @ '%s' \n",
+                                                               i, ovector16_1[i], ovector16_2[i], ovector32_1[i], ovector32_2[i],
                                                                total, current->pattern, current->input);
                                                        is_successful = 0;
                                                }
index f5275c7c4cdef5379c74bce103af5d3ddf7b8c04..0763a239e120df228ffac100b2517e66fbb4f48f 100644 (file)
@@ -55,7 +55,7 @@ POSSIBILITY OF SUCH DAMAGE.
 #define PUBLIC_MATCH_OPTIONS \
   (PCRE2_ANCHORED|PCRE2_NOTBOL|PCRE2_NOTEOL|PCRE2_NOTEMPTY| \
    PCRE2_NOTEMPTY_ATSTART|PCRE2_NO_UTF_CHECK|PCRE2_PARTIAL_HARD| \
-   PCRE2_PARTIAL_SOFT)
+   PCRE2_PARTIAL_SOFT|PCRE2_NO_JIT)
 
 #define PUBLIC_JIT_MATCH_OPTIONS \
    (PCRE2_NO_UTF_CHECK|PCRE2_NOTBOL|PCRE2_NOTEOL|PCRE2_NOTEMPTY|\
@@ -465,7 +465,7 @@ Returns:      a match() return code
 */
 
 static int
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
 __attribute__ ((noinline))
 #endif
 op_recurse_ovecsave(REGISTER PCRE2_SPTR eptr, PCRE2_SPTR callpat,
index 40a633cfd6895811ee5d1264c835404464bca389..2d30926a744e628fc9433ca74ce61e8e57cdbaf9 100644 (file)
@@ -214,7 +214,7 @@ while (*ptr != '\0')
 static void
 print_custring_bylen(FILE *f, PCRE2_SPTR ptr, PCRE2_UCHAR len)
 {
-while (len-- > 0)
+for (; len > 0; len--)
   {
   register uint32_t c = *ptr++;
   if (PRINTABLE(c)) fprintf(f, "%c", c); else fprintf(f, "\\x{%x}", c);
index 8c44acfdcaf1944a0a8ad7451f035ee54f1d1ec4..0af26d8fc3f195fcb3f9a7a8f103005cc1374dac 100644 (file)
@@ -158,6 +158,7 @@ int32_t i, j;
 
 if (data == NULL || codes == NULL) return PCRE2_ERROR_NULL;
 if (number_of_codes <= 0) return PCRE2_ERROR_BADDATA;
+if (data->number_of_codes <= 0) return PCRE2_ERROR_BADSERIALIZEDDATA;
 if (data->magic != SERIALIZED_DATA_MAGIC) return PCRE2_ERROR_BADMAGIC;
 if (data->version != SERIALIZED_DATA_VERSION) return PCRE2_ERROR_BADMODE;
 if (data->config != SERIALIZED_DATA_CONFIG) return PCRE2_ERROR_BADMODE;
@@ -188,6 +189,8 @@ for (i = 0; i < number_of_codes; i++)
   CODE_BLOCKSIZE_TYPE blocksize;
   memcpy(&blocksize, src_bytes + offsetof(pcre2_real_code, blocksize),
     sizeof(CODE_BLOCKSIZE_TYPE));
+  if (blocksize <= sizeof(pcre2_real_code))
+    return PCRE2_ERROR_BADSERIALIZEDDATA;
 
   /* The allocator provided by gcontext replaces the original one. */
 
@@ -208,6 +211,10 @@ for (i = 0; i < number_of_codes; i++)
 
   memcpy(((uint8_t *)dst_re) + sizeof(pcre2_memctl),
     src_bytes + sizeof(pcre2_memctl), blocksize - sizeof(pcre2_memctl));
+  if (dst_re->magic_number != MAGIC_NUMBER ||
+      dst_re->name_entry_size > MAX_NAME_SIZE + IMM2_SIZE + 1 ||
+      dst_re->name_count > MAX_NAME_COUNT)
+    return PCRE2_ERROR_BADSERIALIZEDDATA;
 
   /* At the moment only one table is supported. */
 
index 18932adeffe98048f88ba0490cc866d84f1e29cd..db08266745e7da8386e51532d12b5c3d5392cd69 100644 (file)
@@ -1452,7 +1452,7 @@ do
           for (c = 0; c < 16; c++) re->start_bitmap[c] |= classmap[c];
           for (c = 128; c < 256; c++)
             {
-            if ((classmap[c/8] && (1 << (c&7))) != 0)
+            if ((classmap[c/8] & (1 << (c&7))) != 0)
               {
               int d = (c >> 6) | 0xc0;            /* Set bit for this starter */
               re->start_bitmap[d/8] |= (1 << (d&7));  /* and then skip on to the */
index 58b504d5ce08a0e7b3feeb18ad3ffd11e9a0146c..f6d7c3972270e84832cb494a42a39dce7ebf458c 100644 (file)
@@ -240,8 +240,11 @@ Returns:      nothing
 PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
 pcre2_substring_free(PCRE2_UCHAR *string)
 {
-pcre2_memctl *memctl = (pcre2_memctl *)((char *)string - sizeof(pcre2_memctl));
-memctl->free(memctl, memctl->memory_data);
+if (string != NULL)
+  {
+  pcre2_memctl *memctl = (pcre2_memctl *)((char *)string - sizeof(pcre2_memctl));
+  memctl->free(memctl, memctl->memory_data);
+  }
 }
 
 
@@ -436,8 +439,11 @@ Returns:      nothing
 PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
 pcre2_substring_list_free(PCRE2_SPTR *list)
 {
-pcre2_memctl *memctl = (pcre2_memctl *)((char *)list - sizeof(pcre2_memctl));
-memctl->free(memctl, memctl->memory_data);
+if (list != NULL)
+  {
+  pcre2_memctl *memctl = (pcre2_memctl *)((char *)list - sizeof(pcre2_memctl));
+  memctl->free(memctl, memctl->memory_data);
+  }
 }
 
 
index ec51cf11cca2ab2cb8689c3315d59abf41b49f8c..8ae49f1006b7c7690861e0808272f772040505ea 100644 (file)
@@ -3,28 +3,31 @@
 *************************************************/
 
 /* This is a demonstration program to illustrate a straightforward way of
-calling the PCRE2 regular expression library from a C program. See the
+using the PCRE2 regular expression library from a C program. See the
 pcre2sample documentation for a short discussion ("man pcre2sample" if you have
 the PCRE2 man pages installed). PCRE2 is a revised API for the library, and is
 incompatible with the original PCRE API.
 
 There are actually three libraries, each supporting a different code unit
-width. This demonstration program uses the 8-bit library.
+width. This demonstration program uses the 8-bit library. The default is to
+process each code unit as a separate character, but if the pattern begins with
+"(*UTF)", both it and the subject are treated as UTF-8 strings, where
+characters may occupy multiple code units.
 
 In Unix-like environments, if PCRE2 is installed in your standard system
 libraries, you should be able to compile this program using this command:
 
-gcc -Wall pcre2demo.c -lpcre2-8 -o pcre2demo
+cc -Wall pcre2demo.c -lpcre2-8 -o pcre2demo
 
 If PCRE2 is not installed in a standard place, it is likely to be installed
 with support for the pkg-config mechanism. If you have pkg-config, you can
 compile this program using this command:
 
-gcc -Wall pcre2demo.c `pkg-config --cflags --libs libpcre2-8` -o pcre2demo
+cc -Wall pcre2demo.c `pkg-config --cflags --libs libpcre2-8` -o pcre2demo
 
-If you do not have pkg-config, you may have to use this:
+If you do not have pkg-config, you may have to use something like this:
 
-gcc -Wall pcre2demo.c -I/usr/local/include -L/usr/local/lib \
+cc -Wall pcre2demo.c -I/usr/local/include -L/usr/local/lib \
   -R/usr/local/lib -lpcre2-8 -o pcre2demo
 
 Replace "/usr/local/include" and "/usr/local/lib" with wherever the include and
@@ -39,9 +42,14 @@ the following line. */
 
 /* #define PCRE2_STATIC */
 
-/* This macro must be defined before including pcre2.h. For a program that uses
-only one code unit width, it makes it possible to use generic function names
-such as pcre2_compile(). */
+/* The PCRE2_CODE_UNIT_WIDTH macro must be defined before including pcre2.h.
+For a program that uses only one code unit width, setting it to 8, 16, or 32
+makes it possible to use generic function names such as pcre2_compile(). Note
+that just changing 8 to 16 (for example) is not sufficient to convert this
+program to process 16-bit characters. Even in a fully 16-bit environment, where
+string-handling functions such as strcmp() and printf() work with 16-bit
+characters, the code for handling the table of named substrings will still need
+to be modified. */
 
 #define PCRE2_CODE_UNIT_WIDTH 8
 
@@ -62,19 +70,19 @@ int main(int argc, char **argv)
 {
 pcre2_code *re;
 PCRE2_SPTR pattern;     /* PCRE2_SPTR is a pointer to unsigned code units of */
-PCRE2_SPTR subject;     /* the appropriate width (8, 16, or 32 bits). */
+PCRE2_SPTR subject;     /* the appropriate width (in this case, 8 bits). */
 PCRE2_SPTR name_table;
 
 int crlf_is_newline;
 int errornumber;
 int find_all;
 int i;
-int namecount;
-int name_entry_size;
 int rc;
 int utf8;
 
 uint32_t option_bits;
+uint32_t namecount;
+uint32_t name_entry_size;
 uint32_t newline;
 
 PCRE2_SIZE erroroffset;
@@ -89,15 +97,19 @@ pcre2_match_data *match_data;
 * First, sort out the command line. There is only one possible option at  *
 * the moment, "-g" to request repeated matching to find all occurrences,  *
 * like Perl's /g option. We set the variable find_all to a non-zero value *
-* if the -g option is present. Apart from that, there must be exactly two *
-* arguments.                                                              *
+* if the -g option is present.                                            *
 **************************************************************************/
 
 find_all = 0;
 for (i = 1; i < argc; i++)
   {
   if (strcmp(argv[i], "-g") == 0) find_all = 1;
-    else break;
+  else if (argv[i][0] == '-')
+    {
+    printf("Unrecognised option %s\n", argv[i]);
+    return 1;
+    }
+  else break;
   }
 
 /* After the options, we require exactly two arguments, which are the pattern,
@@ -105,7 +117,7 @@ and the subject string. */
 
 if (argc - i != 2)
   {
-  printf("Two arguments required: a regex and a subject string\n");
+  printf("Exactly two arguments required: a regex and a subject string\n");
   return 1;
   }
 
@@ -184,7 +196,7 @@ if (rc < 0)
 stored. */
 
 ovector = pcre2_get_ovector_pointer(match_data);
-printf("\nMatch succeeded at offset %d\n", (int)ovector[0]);
+printf("Match succeeded at offset %d\n", (int)ovector[0]);
 
 
 /*************************************************************************
@@ -225,7 +237,7 @@ we have to extract the count of named parentheses from the pattern. */
   PCRE2_INFO_NAMECOUNT, /* get the number of named substrings */
   &namecount);          /* where to put the answer */
 
-if (namecount <= 0) printf("No named substrings\n"); else
+if (namecount == 0) printf("No named substrings\n"); else
   {
   PCRE2_SPTR tabptr;
   printf("Named substrings\n");
@@ -313,8 +325,8 @@ crlf_is_newline = newline == PCRE2_NEWLINE_ANY ||
 
 for (;;)
   {
-  uint32_t options = 0;                    /* Normally no options */
-  PCRE2_SIZE start_offset = ovector[1];  /* Start at end of previous match */
+  uint32_t options = 0;                   /* Normally no options */
+  PCRE2_SIZE start_offset = ovector[1];   /* Start at end of previous match */
 
   /* If the previous match was for an empty string, we are finished if we are
   at the end of the subject. Otherwise, arrange to run another match at the
@@ -354,7 +366,7 @@ for (;;)
     {
     if (options == 0) break;                    /* All matches found */
     ovector[1] = start_offset + 1;              /* Advance one code unit */
-    if (crlf_is_newline &&                      /* If CRLF is newline & */
+    if (crlf_is_newline &&                      /* If CRLF is newline & */
         start_offset < subject_length - 1 &&    /* we are at CRLF, */
         subject[start_offset] == '\r' &&
         subject[start_offset + 1] == '\n')
@@ -400,7 +412,7 @@ for (;;)
     printf("%2d: %.*s\n", i, (int)substring_length, (char *)substring_start);
     }
 
-  if (namecount <= 0) printf("No named substrings\n"); else
+  if (namecount == 0) printf("No named substrings\n"); else
     {
     PCRE2_SPTR tabptr = name_table;
     printf("Named substrings\n");
index aadb22a575ef6bcdd6263c94f36cda0a72e1fc95..49747c0c393392192d51dd194c2a25e84f02ba8c 100644 (file)
@@ -58,6 +58,15 @@ POSSIBILITY OF SUCH DAMAGE.
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#if defined(_WIN32) || defined(WIN32)
+#include <io.h>                /* For _setmode() */
+#include <fcntl.h>             /* For _O_BINARY */
+#endif
+
+#ifdef SUPPORT_PCRE2GREP_CALLOUT
+#include <sys/wait.h>
+#endif
+
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
@@ -121,6 +130,17 @@ apply to fprintf(). */
 
 #define FWRITE(a,b,c,d) if (fwrite(a,b,c,d)) {}
 
+/* Under Windows, we have to set stdout to be binary, so that it does not
+convert \r\n at the ends of output lines to \r\r\n. However, that means that
+any messages written to stdout must have \r\n as their line terminator. This is
+handled by using STDOUT_NL as the newline string. */
+
+#if defined(_WIN32) || defined(WIN32)
+#define STDOUT_NL  "\r\n"
+#else
+#define STDOUT_NL  "\n"
+#endif
+
 
 
 /*************************************************
@@ -885,27 +905,34 @@ help(void)
 {
 option_item *op;
 
-printf("Usage: pcre2grep [OPTION]... [PATTERN] [FILE1 FILE2 ...]\n");
-printf("Search for PATTERN in each FILE or standard input.\n");
-printf("PATTERN must be present if neither -e nor -f is used.\n");
-printf("\"-\" can be used as a file name to mean STDIN.\n");
+printf("Usage: pcre2grep [OPTION]... [PATTERN] [FILE1 FILE2 ...]" STDOUT_NL);
+printf("Search for PATTERN in each FILE or standard input." STDOUT_NL);
+printf("PATTERN must be present if neither -e nor -f is used." STDOUT_NL);
+
+#ifdef SUPPORT_PCRE2GREP_CALLOUT
+printf("Callout scripts in patterns are supported." STDOUT_NL);
+#else
+printf("Callout scripts are not supported in this pcre2grep." STDOUT_NL);
+#endif
+
+printf("\"-\" can be used as a file name to mean STDIN." STDOUT_NL);
 
 #ifdef SUPPORT_LIBZ
-printf("Files whose names end in .gz are read using zlib.\n");
+printf("Files whose names end in .gz are read using zlib." STDOUT_NL);
 #endif
 
 #ifdef SUPPORT_LIBBZ2
-printf("Files whose names end in .bz2 are read using bzlib2.\n");
+printf("Files whose names end in .bz2 are read using bzlib2." STDOUT_NL);
 #endif
 
 #if defined SUPPORT_LIBZ || defined SUPPORT_LIBBZ2
-printf("Other files and the standard input are read as plain files.\n\n");
+printf("Other files and the standard input are read as plain files." STDOUT_NL STDOUT_NL);
 #else
-printf("All files are read as plain files, without any interpretation.\n\n");
+printf("All files are read as plain files, without any interpretation." STDOUT_NL STDOUT_NL);
 #endif
 
-printf("Example: pcre2grep -i 'hello.*world' menu.h main.c\n\n");
-printf("Options:\n");
+printf("Example: pcre2grep -i 'hello.*world' menu.h main.c" STDOUT_NL STDOUT_NL);
+printf("Options:" STDOUT_NL);
 
 for (op = optionlist; op->one_char != 0; op++)
   {
@@ -922,17 +949,17 @@ for (op = optionlist; op->one_char != 0; op++)
     }
 
   if (n < 1) n = 1;
-  printf("%.*s%s\n", n, "                           ", op->help_text);
+  printf("%.*s%s" STDOUT_NL, n, "                           ", op->help_text);
   }
 
-printf("\nNumbers may be followed by K or M, e.g. --buffer-size=100K.\n");
-printf("The default value for --buffer-size is %d.\n", PCRE2GREP_BUFSIZE);
-printf("When reading patterns or file names from a file, trailing white\n");
-printf("space is removed and blank lines are ignored.\n");
-printf("The maximum size of any pattern is %d bytes.\n", MAXPATLEN);
+printf(STDOUT_NL "Numbers may be followed by K or M, e.g. --buffer-size=100K." STDOUT_NL);
+printf("The default value for --buffer-size is %d." STDOUT_NL, PCRE2GREP_BUFSIZE);
+printf("When reading patterns or file names from a file, trailing white" STDOUT_NL);
+printf("space is removed and blank lines are ignored." STDOUT_NL);
+printf("The maximum size of any pattern is %d bytes." STDOUT_NL, MAXPATLEN);
 
-printf("\nWith no FILEs, read standard input. If fewer than two FILEs given, assume -h.\n");
-printf("Exit status is 0 if any matches, 1 if no matches, and 2 if trouble.\n");
+printf(STDOUT_NL "With no FILEs, read standard input. If fewer than two FILEs given, assume -h." STDOUT_NL);
+printf("Exit status is 0 if any matches, 1 if no matches, and 2 if trouble." STDOUT_NL);
 }
 
 
@@ -1473,6 +1500,274 @@ return FALSE;  /* No match, no errors */
 }
 
 
+#ifdef SUPPORT_PCRE2GREP_CALLOUT
+
+/*************************************************
+*        Parse and execute callout scripts       *
+*************************************************/
+
+/* This function parses a callout string block and executes the
+program specified by the string. The string is a list of substrings
+separated by pipe characters. The first substring represents the
+executable name, and the following substrings specify the arguments:
+
+  program_name|param1|param2|...
+
+Any substirng (including the program name) can contain escape sequences
+started by the dollar character. The escape sequences are substituted as
+follows:
+
+  $<digits> or ${<digits>} is replaced by the captured substring of the given
+  decimal number, which must be greater than zero. If the number is greater
+  than the number of capturing substrings, or if the capture is unset, the
+  replacement is empty.
+
+  Any other character is substituted by itself. E.g: $$ is replaced by a single
+  dollar or $| replaced by a pipe character.
+
+Example:
+
+  echo -e "abcde\n12345" | pcre2grep \
+    '(.)(..(.))(?C"/bin/echo|Arg1: [$1] [$2] [$3]|Arg2: $|${1}$| ($4)")()' -
+
+  Output:
+
+    Arg1: [a] [bcd] [d] Arg2: |a| ()
+    abcde
+    Arg1: [1] [234] [4] Arg2: |1| ()
+    12345
+
+Arguments:
+  blockptr     the callout block
+
+Returns:       currently it always returns with 0
+*/
+
+static int
+pcre2grep_callout(pcre2_callout_block *calloutptr, void *unused)
+{
+PCRE2_SIZE length = calloutptr->callout_string_length;
+PCRE2_SPTR string = calloutptr->callout_string;
+PCRE2_SPTR subject = calloutptr->subject;
+PCRE2_SIZE *ovector = calloutptr->offset_vector;
+PCRE2_SIZE capture_top = calloutptr->capture_top;
+PCRE2_SIZE argsvectorlen = 2;
+PCRE2_SIZE argslen = 1;
+char *args;
+char *argsptr;
+char **argsvector;
+char **argsvectorptr;
+pid_t pid;
+int result = 0;
+
+(void)unused;   /* Avoid compiler warning */
+
+/* Only callout with strings are supported. */
+if (string == NULL || length == 0) return 0;
+
+/* Checking syntax and compute the number of string fragments. Callout strings
+are ignored in case of a syntax error. */
+
+while (length > 0)
+  {
+  if (*string == '|')
+    {
+    argsvectorlen++;
+
+    /* Maximum 10000 arguments allowed. */
+    if (argsvectorlen > 10000) return 0;
+    }
+  else if (*string == '$')
+    {
+    PCRE2_SIZE capture_id = 0;
+
+    string++;
+    length--;
+
+    /* Syntax error: a character must be present after $. */
+    if (length == 0) return 0;
+
+    if (*string >= '1' && *string <= '9')
+      {
+      do
+        {
+        /* Maximum capture id is 65535. */
+        if (capture_id <= 65535)
+          capture_id = capture_id * 10 + (*string - '0');
+
+        string++;
+        length--;
+        }
+      while (length > 0 && *string >= '0' && *string <= '9');
+
+      /* To negate the effect of string++ below. */
+      string--;
+      length++;
+      }
+    else if (*string == '{')
+      {
+      /* Must be a decimal number in parenthesis, e.g: (5) or (38) */
+      string++;
+      length--;
+
+      /* Syntax error: a decimal number required. */
+      if (length == 0) return 0;
+      if (*string < '1' || *string > '9') return 0;
+
+      do
+        {
+        /* Maximum capture id is 65535. */
+        if (capture_id <= 65535)
+          capture_id = capture_id * 10 + (*string - '0');
+
+        string++;
+        length--;
+
+        /* Syntax error: no more characters */
+        if (length == 0) return 0;
+        }
+      while (*string >= '0' && *string <= '9');
+
+      /* Syntax error: close paren is missing. */
+      if (*string != '}') return 0;
+      }
+
+    if (capture_id > 0)
+      {
+      if (capture_id < capture_top)
+        {
+        capture_id *= 2;
+        argslen += ovector[capture_id + 1] - ovector[capture_id];
+        }
+
+      /* To negate the effect of argslen++ below. */
+      argslen--;
+      }
+    }
+
+  string++;
+  length--;
+  argslen++;
+  }
+
+args = (char*)malloc(argslen);
+if (args == NULL) return 0;
+
+argsvector = (char**)malloc(argsvectorlen * sizeof(char*));
+if (argsvector == NULL)
+  {
+  free(args);
+  return 0;
+  }
+
+argsptr = args;
+argsvectorptr = argsvector;
+
+*argsvectorptr++ = argsptr;
+
+length = calloutptr->callout_string_length;
+string = calloutptr->callout_string;
+
+while (length > 0)
+  {
+  if (*string == '|')
+    {
+    *argsptr++ = '\0';
+    *argsvectorptr++ = argsptr;
+    }
+  else if (*string == '$')
+    {
+    string++;
+    length--;
+
+    if ((*string >= '1' && *string <= '9') || *string == '{')
+      {
+      PCRE2_SIZE capture_id = 0;
+
+      if (*string != '{')
+        {
+        do
+          {
+          /* Maximum capture id is 65535. */
+          if (capture_id <= 65535)
+            capture_id = capture_id * 10 + (*string - '0');
+
+          string++;
+          length--;
+          }
+        while (length > 0 && *string >= '0' && *string <= '9');
+
+        /* To negate the effect of string++ below. */
+        string--;
+        length++;
+        }
+      else
+        {
+        string++;
+        length--;
+
+        do
+          {
+          /* Maximum capture id is 65535. */
+          if (capture_id <= 65535)
+            capture_id = capture_id * 10 + (*string - '0');
+
+          string++;
+          length--;
+          }
+        while (*string != '}');
+        }
+
+        if (capture_id < capture_top)
+          {
+          PCRE2_SIZE capturesize;
+          capture_id *= 2;
+
+          capturesize = ovector[capture_id + 1] - ovector[capture_id];
+          memcpy(argsptr, subject + ovector[capture_id], capturesize);
+          argsptr += capturesize;
+          }
+      }
+    else
+      {
+      *argsptr++ = *string;
+      }
+    }
+  else
+    {
+    *argsptr++ = *string;
+    }
+
+  string++;
+  length--;
+  }
+
+*argsptr++ = '\0';
+*argsvectorptr = NULL;
+
+pid = fork();
+
+if (pid == 0)
+  {
+  (void)execv(argsvector[0], argsvector);
+  /* Control gets here if there is an error, e.g. a non-existent program */
+  exit(1);
+  }
+else if (pid > 0)
+  (void)waitpid(pid, &result, 0);
+
+free(args);
+free(argsvector);
+
+/* Currently negative return values are not supported, only zero (match
+continues) or non-zero (match fails). */
+
+return result != 0;
+}
+
+#endif
+
+
 
 /*************************************************
 *            Grep an individual file             *
@@ -1591,7 +1886,7 @@ while (ptr < endptr)
   size_t startoffset = 0;
 
   /* At this point, ptr is at the start of a line. We need to find the length
-  of the subject string to pass to pcre_exec(). In multiline mode, it is the
+  of the subject string to pass to pcre2_match(). In multiline mode, it is the
   length remainder of the data in the buffer. Otherwise, it is the length of
   the next line, excluding the terminating newline. After matching, we always
   advance by the length of the next line. In multiline mode the PCRE2_FIRSTLINE
@@ -1609,10 +1904,12 @@ while (ptr < endptr)
   if (endlinelength == 0 && t == main_buffer + bufsize)
     {
     fprintf(stderr, "pcre2grep: line %d%s%s is too long for the internal buffer\n"
-                    "pcre2grep: check the --buffer-size option\n",
+                    "pcre2grep: the buffer size is %d\n"
+                    "pcre2grep: use the --buffer-size option to change it\n",
                     linenumber,
                     (filename == NULL)? "" : " of file ",
-                    (filename == NULL)? "" : filename);
+                    (filename == NULL)? "" : filename,
+                    bufthird);
     return 2;
     }
 
@@ -1705,7 +2002,7 @@ while (ptr < endptr)
 
     else if (binary)
       {
-      fprintf(stdout, "Binary file %s matches\n", filename);
+      fprintf(stdout, "Binary file %s matches" STDOUT_NL, filename);
       return 0;
       }
 
@@ -1714,7 +2011,7 @@ while (ptr < endptr)
 
     else if (filenames == FN_MATCH_ONLY)
       {
-      fprintf(stdout, "%s\n", printname);
+      fprintf(stdout, "%s" STDOUT_NL, printname);
       return 0;
       }
 
@@ -1739,13 +2036,13 @@ while (ptr < endptr)
         /* Handle --line-offsets */
 
         if (line_offsets)
-          fprintf(stdout, "%d,%d\n", (int)(matchptr + offsets[0] - ptr),
+          fprintf(stdout, "%d,%d" STDOUT_NL, (int)(matchptr + offsets[0] - ptr),
             (int)(offsets[1] - offsets[0]));
 
         /* Handle --file-offsets */
 
         else if (file_offsets)
-          fprintf(stdout, "%d,%d\n",
+          fprintf(stdout, "%d,%d" STDOUT_NL,
             (int)(filepos + matchptr + offsets[0] - ptr),
             (int)(offsets[1] - offsets[0]));
 
@@ -1773,17 +2070,26 @@ while (ptr < endptr)
               }
             }
 
-          if (printed || printname != NULL || number) fprintf(stdout, "\n");
+          if (printed || printname != NULL || number)
+            fprintf(stdout, STDOUT_NL);
           }
 
-        /* Prepare to repeat to find the next match. If the pattern contained a
-        lookbehind that included \K, it is possible that the end of the match
-        might be at or before the actual starting offset we have just used. In
-        this case, start one character further on. */
+        /* Prepare to repeat to find the next match in the line. */
 
         match = FALSE;
         if (line_buffered) fflush(stdout);
         rc = 0;                      /* Had some success */
+
+        /* If the current match ended past the end of the line (only possible
+        in multiline mode), we are done with this line. */
+
+        if (offsets[1] > linelength) goto END_ONE_MATCH;
+
+        /* If the pattern contained a lookbehind that included \K, it is
+        possible that the end of the match might be at or before the actual
+        starting offset we have just used. In this case, start one character
+        further on. */
+
         startoffset = offsets[1];    /* Restart after the match */
         oldstartoffset = pcre2_get_startchar(match_data);
         if (startoffset <= oldstartoffset)
@@ -1838,7 +2144,7 @@ while (ptr < endptr)
 
       if (hyphenpending)
         {
-        fprintf(stdout, "--\n");
+        fprintf(stdout, "--" STDOUT_NL);
         hyphenpending = FALSE;
         hyphenprinted = TRUE;
         }
@@ -1859,7 +2165,7 @@ while (ptr < endptr)
           }
 
         if (lastmatchnumber > 0 && p > lastmatchrestart && !hyphenprinted)
-          fprintf(stdout, "--\n");
+          fprintf(stdout, "--" STDOUT_NL);
 
         while (p < ptr)
           {
@@ -2063,7 +2369,7 @@ were none. If we found a match, we won't have got this far. */
 
 if (filenames == FN_NOMATCH_ONLY)
   {
-  fprintf(stdout, "%s\n", printname);
+  fprintf(stdout, "%s" STDOUT_NL, printname);
   return 0;
   }
 
@@ -2075,7 +2381,7 @@ if (count_only && !quiet)
     {
     if (printname != NULL && filenames != FN_NONE)
       fprintf(stdout, "%s:", printname);
-    fprintf(stdout, "%d\n", count);
+    fprintf(stdout, "%d" STDOUT_NL, count);
     }
   }
 
@@ -2396,7 +2702,7 @@ switch(letter)
     {
     unsigned char buffer[128];
     (void)pcre2_config(PCRE2_CONFIG_VERSION, buffer);
-    fprintf(stdout, "pcre2grep version %s\n", buffer);
+    fprintf(stdout, "pcre2grep version %s" STDOUT_NL, buffer);
     }
   pcre2grep_exit(0);
   break;
@@ -2488,11 +2794,26 @@ if ((popts & PO_FIXED_STRINGS) != 0)
   }
 
 sprintf((char *)buffer, "%s%.*s%s", prefix[popts], patlen, ps, suffix[popts]);
-p->compiled = pcre2_compile(buffer, -1, options, &errcode, &erroffset,
-  compile_context);
-if (p->compiled != NULL) return TRUE;
+p->compiled = pcre2_compile(buffer, PCRE2_ZERO_TERMINATED, options, &errcode,
+  &erroffset, compile_context);
 
-/* Handle compile errors */
+/* Handle successful compile */
+
+if (p->compiled != NULL)
+  {
+#ifdef SUPPORT_PCRE2GREP_JIT
+  if (use_jit)
+    {
+    errcode = pcre2_jit_compile(p->compiled, PCRE2_JIT_COMPLETE);
+    if (errcode == 0) return TRUE;
+    erroffset = PCRE2_SIZE_MAX;     /* Will get reduced to patlen below */
+    }
+  else
+#endif
+  return TRUE;
+  }
+
+/* Handle compile and JIT compile errors */
 
 erroffset -= (int)strlen(prefix[popts]);
 if (erroffset > patlen) erroffset = patlen;
@@ -2623,6 +2944,16 @@ const char *locale_from = "--locale";
 pcre2_jit_stack *jit_stack = NULL;
 #endif
 
+/* In Windows, stdout is set up as a text stream, which means that \n is
+converted to \r\n. This causes output lines that are copied from the input to
+change from ....\r\n to ....\r\r\n, which is not right. We therefore ensure
+that stdout is a binary stream. Note that this means all other output to stdout
+must use STDOUT_NL to terminate lines. */
+
+#if defined(_WIN32) || defined(WIN32)
+_setmode( _fileno(stdout), _O_BINARY);
+#endif
+
 /* Set up a default compile and match contexts and a match data block. */
 
 compile_context = pcre2_compile_context_create(NULL);
@@ -2630,6 +2961,13 @@ match_context = pcre2_match_context_create(NULL);
 match_data = pcre2_match_data_create(OFFSET_SIZE, NULL);
 offsets = pcre2_get_ovector_pointer(match_data);
 
+/* If string (script) callouts are supported, set up the callout processing
+function. */
+
+#ifdef SUPPORT_PCRE2GREP_CALLOUT
+pcre2_set_callout(match_context, pcre2grep_callout, NULL);
+#endif
+
 /* Process the options */
 
 for (i = 1; i < argc; i++)
index 1d6e5b7976699a4ef12f3a7ae1b81eb90a3ce205..e7cf9c294f0ab699329d5066f74aa2408555dbf1 100644 (file)
@@ -58,16 +58,49 @@ previously been set. */
 #  define PCRE2POSIX_EXP_DEFN __declspec(dllexport)
 #endif
 
-/* We include pcre2.h before pcre2_internal.h so that the PCRE2 library
-functions are declared as "import" for Windows by defining PCRE2_EXP_DECL as
-"import". This is needed even though pcre2_internal.h itself includes pcre2.h,
-because it does so after it has set PCRE2_EXP_DECL to "export" if it is not
-already set. */
+/* Older versions of MSVC lack snprintf(). This define allows for
+warning/error-free compilation and testing with MSVC compilers back to at least
+MSVC 10/2010. Except for VC6 (which is missing some fundamentals and fails). */
+
+#if defined(_MSC_VER) && (_MSC_VER < 1900)
+#define snprintf _snprintf
+#endif
+
+
+/* Compile-time error numbers start at this value. It should probably never be
+changed. This #define is a copy of the one in pcre2_internal.h. */
+
+#define COMPILE_ERROR_BASE 100
+
+
+/* Standard C headers */
+
+#include <ctype.h>
+#include <limits.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* PCRE2 headers */
 
 #include "pcre2.h"
-#include "pcre2_internal.h"
 #include "pcre2posix.h"
 
+/* When compiling with the MSVC compiler, it is sometimes necessary to include
+a "calling convention" before exported function names. (This is secondhand
+information; I know nothing about MSVC myself). For example, something like
+
+  void __cdecl function(....)
+
+might be needed. In order so make this easy, all the exported functions have
+PCRE2_CALL_CONVENTION just before their names. It is rarely needed; if not
+set, we ensure here that it has no effect. */
+
+#ifndef PCRE2_CALL_CONVENTION
+#define PCRE2_CALL_CONVENTION
+#endif
+
 /* Table to translate PCRE2 compile time error codes into POSIX error codes.
 Only a few PCRE2 errors with a value greater than 23 turn into special POSIX
 codes: most go to REG_BADPAT. The second table lists, in pairs, those that
@@ -205,11 +238,11 @@ int re_nsub = 0;
 if ((cflags & REG_ICASE) != 0)    options |= PCRE2_CASELESS;
 if ((cflags & REG_NEWLINE) != 0)  options |= PCRE2_MULTILINE;
 if ((cflags & REG_DOTALL) != 0)   options |= PCRE2_DOTALL;
-if ((cflags & REG_NOSUB) != 0)    options |= PCRE2_NO_AUTO_CAPTURE;
 if ((cflags & REG_UTF) != 0)      options |= PCRE2_UTF;
 if ((cflags & REG_UCP) != 0)      options |= PCRE2_UCP;
 if ((cflags & REG_UNGREEDY) != 0) options |= PCRE2_UNGREEDY;
 
+preg->re_cflags = cflags;
 preg->re_pcre2_code = pcre2_compile((PCRE2_SPTR)pattern, PCRE2_ZERO_TERMINATED,
    options, &errorcode, &erroffset, NULL);
 preg->re_erroffset = erroffset;
@@ -234,7 +267,6 @@ if (preg->re_pcre2_code == NULL)
 (void)pcre2_pattern_info((const pcre2_code *)preg->re_pcre2_code,
   PCRE2_INFO_CAPTURECOUNT, &re_nsub);
 preg->re_nsub = (size_t)re_nsub;
-if ((options & PCRE2_NO_AUTO_CAPTURE) != 0) re_nsub = -1;
 preg->re_match_data = pcre2_match_data_create(re_nsub + 1, NULL);
 
 if (preg->re_match_data == NULL)
@@ -272,11 +304,11 @@ if ((eflags & REG_NOTEMPTY) != 0) options |= PCRE2_NOTEMPTY;
 
 ((regex_t *)preg)->re_erroffset = (size_t)(-1);  /* Only has meaning after compile */
 
-/* When no string data is being returned, or no vector has been passed in which
-to put it, ensure that nmatch is zero. */
+/* When REG_NOSUB was specified, or if no vector has been passed in which to
+put captured strings, ensure that nmatch is zero. This will stop any attempt to
+write to pmatch. */
 
-if ((((pcre2_real_code *)(preg->re_pcre2_code))->compile_options &
-  PCRE2_NO_AUTO_CAPTURE) != 0 || pmatch == NULL) nmatch = 0;
+if ((preg->re_cflags & REG_NOSUB) != 0 || pmatch == NULL) nmatch = 0;
 
 /* REG_STARTEND is a BSD extension, to allow for non-NUL-terminated strings.
 The man page from OS X says "REG_STARTEND affects only the location of the
@@ -303,11 +335,12 @@ rc = pcre2_match((const pcre2_code *)preg->re_pcre2_code,
 if (rc >= 0)
   {
   size_t i;
+  PCRE2_SIZE *ovector = pcre2_get_ovector_pointer(md);
   if ((size_t)rc > nmatch) rc = (int)nmatch;
   for (i = 0; i < (size_t)rc; i++)
     {
-    pmatch[i].rm_so = md->ovector[i*2];
-    pmatch[i].rm_eo = md->ovector[i*2+1];
+    pmatch[i].rm_so = ovector[i*2];
+    pmatch[i].rm_eo = ovector[i*2+1];
     }
   for (; i < nmatch; i++) pmatch[i].rm_so = pmatch[i].rm_eo = -1;
   return 0;
index 44a2fd8ad4429eb754c6867c0bc6d4233fb03f0a..5f2906a4f32ce03690755f14deb99740598bc82b 100644 (file)
@@ -98,6 +98,7 @@ typedef struct {
   void *re_match_data;
   size_t re_nsub;
   size_t re_erroffset;
+  int re_cflags;
 } regex_t;
 
 /* The structure in which a captured offset is returned. */
index 0a5879e47209362a239b144d949ef3c3af05a968..a8dffa372fe86b617ef21310ec9d5525ebd5ef37 100644 (file)
@@ -353,7 +353,7 @@ typedef struct cmdstruct {
 } cmdstruct;
 
 enum { CMD_FORBID_UTF, CMD_LOAD, CMD_NEWLINE_DEFAULT, CMD_PATTERN,
-  CMD_PERLTEST, CMD_POP, CMD_SAVE, CMD_SUBJECT, CMD_UNKNOWN };
+  CMD_PERLTEST, CMD_POP, CMD_POPCOPY, CMD_SAVE, CMD_SUBJECT, CMD_UNKNOWN };
 
 static cmdstruct cmdlist[] = {
   { "forbid_utf",      CMD_FORBID_UTF },
@@ -362,6 +362,7 @@ static cmdstruct cmdlist[] = {
   { "pattern",         CMD_PATTERN },
   { "perltest",        CMD_PERLTEST },
   { "pop",             CMD_POP },
+  { "popcopy",         CMD_POPCOPY },
   { "save",            CMD_SAVE },
   { "subject",         CMD_SUBJECT }};
 
@@ -425,11 +426,11 @@ so many of them that they are split into two fields. */
 #define CTL_MEMORY                       0x00100000u
 #define CTL_NULLCONTEXT                  0x00200000u
 #define CTL_POSIX                        0x00400000u
-#define CTL_PUSH                         0x00800000u
-#define CTL_STARTCHAR                    0x01000000u
-#define CTL_ZERO_TERMINATE               0x02000000u
-/* Spare                                 0x04000000u  */
-/* Spare                                 0x08000000u  */
+#define CTL_POSIX_NOSUB                  0x00800000u
+#define CTL_PUSH                         0x01000000u
+#define CTL_PUSHCOPY                     0x02000000u
+#define CTL_STARTCHAR                    0x04000000u
+#define CTL_ZERO_TERMINATE               0x08000000u
 /* Spare                                 0x10000000u  */
 /* Spare                                 0x20000000u  */
 #define CTL_NL_SET                       0x40000000u  /* Informational */
@@ -585,6 +586,7 @@ static modstruct modlist[] = {
   { "no_auto_capture",            MOD_PAT,  MOD_OPT, PCRE2_NO_AUTO_CAPTURE,      PO(options) },
   { "no_auto_possess",            MOD_PATP, MOD_OPT, PCRE2_NO_AUTO_POSSESS,      PO(options) },
   { "no_dotstar_anchor",          MOD_PAT,  MOD_OPT, PCRE2_NO_DOTSTAR_ANCHOR,    PO(options) },
+  { "no_jit",                     MOD_DAT,  MOD_OPT, PCRE2_NO_JIT,               DO(options) },
   { "no_start_optimize",          MOD_PATP, MOD_OPT, PCRE2_NO_START_OPTIMIZE,    PO(options) },
   { "no_utf_check",               MOD_PD,   MOD_OPT, PCRE2_NO_UTF_CHECK,         PD(options) },
   { "notbol",                     MOD_DAT,  MOD_OPT, PCRE2_NOTBOL,               DO(options) },
@@ -600,8 +602,10 @@ static modstruct modlist[] = {
   { "partial_soft",               MOD_DAT,  MOD_OPT, PCRE2_PARTIAL_SOFT,         DO(options) },
   { "ph",                         MOD_DAT,  MOD_OPT, PCRE2_PARTIAL_HARD,         DO(options) },
   { "posix",                      MOD_PAT,  MOD_CTL, CTL_POSIX,                  PO(control) },
+  { "posix_nosub",                MOD_PAT,  MOD_CTL, CTL_POSIX|CTL_POSIX_NOSUB,  PO(control) },
   { "ps",                         MOD_DAT,  MOD_OPT, PCRE2_PARTIAL_SOFT,         DO(options) },
   { "push",                       MOD_PAT,  MOD_CTL, CTL_PUSH,                   PO(control) },
+  { "pushcopy",                   MOD_PAT,  MOD_CTL, CTL_PUSHCOPY,              PO(control) },
   { "recursion_limit",            MOD_CTM,  MOD_INT, 0,                          MO(recursion_limit) },
   { "regerror_buffsize",          MOD_PAT,  MOD_INT, 0,                          PO(regerror_buffsize) },
   { "replace",                    MOD_PND,  MOD_STR, REPLACE_MODSIZE,            PO(replacement) },
@@ -625,11 +629,11 @@ static modstruct modlist[] = {
 /* Controls and options that are supported for use with the POSIX interface. */
 
 #define POSIX_SUPPORTED_COMPILE_OPTIONS ( \
-  PCRE2_CASELESS|PCRE2_DOTALL|PCRE2_MULTILINE|PCRE2_NO_AUTO_CAPTURE| \
-  PCRE2_UCP|PCRE2_UTF|PCRE2_UNGREEDY)
+  PCRE2_CASELESS|PCRE2_DOTALL|PCRE2_MULTILINE|PCRE2_UCP|PCRE2_UTF| \
+  PCRE2_UNGREEDY)
 
 #define POSIX_SUPPORTED_COMPILE_CONTROLS ( \
-  CTL_AFTERTEXT|CTL_ALLAFTERTEXT|CTL_EXPAND|CTL_POSIX)
+  CTL_AFTERTEXT|CTL_ALLAFTERTEXT|CTL_EXPAND|CTL_POSIX|CTL_POSIX_NOSUB)
 
 #define POSIX_SUPPORTED_COMPILE_CONTROLS2 (0)
 
@@ -643,7 +647,7 @@ static modstruct modlist[] = {
 
 #define PUSH_SUPPORTED_COMPILE_CONTROLS ( \
   CTL_BINCODE|CTL_CALLOUT_INFO|CTL_FULLBINCODE|CTL_HEXPAT|CTL_INFO| \
-  CTL_JITVERIFY|CTL_MEMORY|CTL_PUSH|CTL_BSR_SET|CTL_NL_SET)
+  CTL_JITVERIFY|CTL_MEMORY|CTL_PUSH|CTL_PUSHCOPY|CTL_BSR_SET|CTL_NL_SET)
 
 #define PUSH_SUPPORTED_COMPILE_CONTROLS2 (0)
 
@@ -652,16 +656,19 @@ static modstruct modlist[] = {
 #define PUSH_COMPILE_ONLY_CONTROLS   CTL_JITVERIFY
 #define PUSH_COMPILE_ONLY_CONTROLS2  (0)
 
-/* Controls that are forbidden with #pop. */
+/* Controls that are forbidden with #pop or #popcopy. */
 
-#define NOTPOP_CONTROLS (CTL_HEXPAT|CTL_POSIX|CTL_PUSH)
+#define NOTPOP_CONTROLS (CTL_HEXPAT|CTL_POSIX|CTL_POSIX_NOSUB|CTL_PUSH| \
+  CTL_PUSHCOPY)
 
 /* Pattern controls that are mutually exclusive. At present these are all in
-the first control word. */
+the first control word. Note that CTL_POSIX_NOSUB is always accompanied by
+CTL_POSIX, so it doesn't need its own entries. */
 
 static uint32_t exclusive_pat_controls[] = {
   CTL_POSIX  | CTL_HEXPAT,
   CTL_POSIX  | CTL_PUSH,
+  CTL_POSIX  | CTL_PUSHCOPY,
   CTL_EXPAND | CTL_HEXPAT };
 
 /* Data controls that are mutually exclusive. At present these are all in the
@@ -811,7 +818,7 @@ static void *patstack[PATSTACKSIZE];
 static int patstacknext = 0;
 
 #ifdef SUPPORT_PCRE2_8
-static regex_t preg = { NULL, NULL, 0, 0 };
+static regex_t preg = { NULL, NULL, 0, 0, 0 };
 #endif
 
 static int *dfa_workspace = NULL;
@@ -943,6 +950,22 @@ are supported. */
      a = pcre2_callout_enumerate_32(compiled_code32, \
        (int (*)(struct pcre2_callout_enumerate_block_32 *, void *))b,c)
 
+#define PCRE2_CODE_COPY_FROM_VOID(a,b) \
+  if (test_mode == PCRE8_MODE) \
+    G(a,8) = pcre2_code_copy_8(b); \
+  else if (test_mode == PCRE16_MODE) \
+    G(a,16) = pcre2_code_copy_16(b); \
+  else \
+    G(a,32) = pcre2_code_copy_32(b)
+
+#define PCRE2_CODE_COPY_TO_VOID(a,b) \
+  if (test_mode == PCRE8_MODE) \
+    a = (void *)pcre2_code_copy_8(G(b,8)); \
+  else if (test_mode == PCRE16_MODE) \
+    a = (void *)pcre2_code_copy_16(G(b,16)); \
+  else \
+    a = (void *)pcre2_code_copy_32(G(b,32))
+
 #define PCRE2_COMPILE(a,b,c,d,e,f,g) \
   if (test_mode == PCRE8_MODE) \
     G(a,8) = pcre2_compile_8(G(b,8),c,d,e,f,g); \
@@ -1394,6 +1417,18 @@ the three different cases. */
      a = G(pcre2_callout_enumerate,BITTWO)(G(compiled_code,BITTWO), \
        (int (*)(struct G(pcre2_callout_enumerate_block_,BITTWO) *, void *))b,c)
 
+#define PCRE2_CODE_COPY_FROM_VOID(a,b) \
+  if (test_mode == G(G(PCRE,BITONE),_MODE)) \
+    G(a,BITONE) = G(pcre2_code_copy_,BITONE)(b); \
+  else \
+    G(a,BITTWO) = G(pcre2_code_copy_,BITTWO)(b)
+
+#define PCRE2_CODE_COPY_TO_VOID(a,b) \
+  if (test_mode == G(G(PCRE,BITONE),_MODE)) \
+    a = (void *)G(pcre2_code_copy_,BITONE)(G(b,BITONE)); \
+  else \
+    a = (void *)G(pcre2_code_copy_,BITTWO)(G(b,BITTWO))
+
 #define PCRE2_COMPILE(a,b,c,d,e,f,g) \
   if (test_mode == G(G(PCRE,BITONE),_MODE)) \
     G(a,BITONE) = G(pcre2_compile_,BITONE)(G(b,BITONE),c,d,e,f,g); \
@@ -1729,6 +1764,8 @@ the three different cases. */
 #define PCRE2_CALLOUT_ENUMERATE(a,b,c) \
    a = pcre2_callout_enumerate_8(compiled_code8, \
      (int (*)(struct pcre2_callout_enumerate_block_8 *, void *))b,c)
+#define PCRE2_CODE_COPY_FROM_VOID(a,b) G(a,8) = pcre2_code_copy_8(b)
+#define PCRE2_CODE_COPY_TO_VOID(a,b) a = (void *)pcre2_code_copy_8(G(b,8))
 #define PCRE2_COMPILE(a,b,c,d,e,f,g) \
   G(a,8) = pcre2_compile_8(G(b,8),c,d,e,f,g)
 #define PCRE2_DFA_MATCH(a,b,c,d,e,f,g,h,i,j) \
@@ -1822,6 +1859,8 @@ the three different cases. */
 #define PCRE2_CALLOUT_ENUMERATE(a,b,c) \
    a = pcre2_callout_enumerate_16(compiled_code16, \
      (int (*)(struct pcre2_callout_enumerate_block_16 *, void *))b,c)
+#define PCRE2_CODE_COPY_FROM_VOID(a,b) G(a,16) = pcre2_code_copy_16(b)
+#define PCRE2_CODE_COPY_TO_VOID(a,b) a = (void *)pcre2_code_copy_16(G(b,16))
 #define PCRE2_COMPILE(a,b,c,d,e,f,g) \
   G(a,16) = pcre2_compile_16(G(b,16),c,d,e,f,g)
 #define PCRE2_DFA_MATCH(a,b,c,d,e,f,g,h,i,j) \
@@ -1915,6 +1954,8 @@ the three different cases. */
 #define PCRE2_CALLOUT_ENUMERATE(a,b,c) \
    a = pcre2_callout_enumerate_32(compiled_code32, \
      (int (*)(struct pcre2_callout_enumerate_block_32 *, void *))b,c)
+#define PCRE2_CODE_COPY_FROM_VOID(a,b) G(a,32) = pcre2_code_copy_32(b)
+#define PCRE2_CODE_COPY_TO_VOID(a,b) a = (void *)pcre2_code_copy_32(G(b,32))
 #define PCRE2_COMPILE(a,b,c,d,e,f,g) \
   G(a,32) = pcre2_compile_32(G(b,32),c,d,e,f,g)
 #define PCRE2_DFA_MATCH(a,b,c,d,e,f,g,h,i,j) \
@@ -2546,12 +2587,13 @@ return (int)(pp - p);
 
 /* Must handle UTF-8 strings in utf8 mode. Yields number of characters printed.
 For printing *MARK strings, a negative length is given. If handed a NULL file,
-just counts chars without printing. */
+just counts chars without printing (because pchar() does that). */
 
 static int pchars8(PCRE2_SPTR8 p, int length, BOOL utf, FILE *f)
 {
 uint32_t c = 0;
 int yield = 0;
+
 if (length < 0) length = p[-1];
 while (length-- > 0)
   {
@@ -2569,6 +2611,7 @@ while (length-- > 0)
   c = *p++;
   yield += pchar(c, utf, f);
   }
+
 return yield;
 }
 #endif
@@ -2913,10 +2956,11 @@ pbuffer8 = new_pbuffer8;
 /* Input lines are read into buffer, but both patterns and data lines can be
 continued over multiple input lines. In addition, if the buffer fills up, we
 want to automatically expand it so as to be able to handle extremely large
-lines that are needed for certain stress tests. When the input buffer is
-expanded, the other two buffers must also be expanded likewise, and the
-contents of pbuffer, which are a copy of the input for callouts, must be
-preserved (for when expansion happens for a data line). This is not the most
+lines that are needed for certain stress tests, although this is less likely
+now that there are repetition features for both patterns and data. When the
+input buffer is expanded, the other two buffers must also be expanded likewise,
+and the contents of pbuffer, which are a copy of the input for callouts, must
+be preserved (for when expansion happens for a data line). This is not the most
 optimal way of handling this, but hey, this is just a test program!
 
 Arguments:
@@ -2940,7 +2984,7 @@ for (;;)
 
   if (rlen > 1000)
     {
-    int dlen;
+    size_t dlen;
 
     /* If libreadline or libedit support is required, use readline() to read a
     line if the input is a terminal. Note that readline() removes the trailing
@@ -2971,9 +3015,27 @@ for (;;)
         return (here == start)? NULL : start;
       }
 
-    dlen = (int)strlen((char *)here);
-    if (dlen > 0 && here[dlen - 1] == '\n') return start;
+    dlen = strlen((char *)here);
     here += dlen;
+
+    /* Check for end of line reached. Take care not to read data from before
+    start (dlen will be zero for a file starting with a binary zero). */
+
+    if (here > start && here[-1] == '\n') return start;
+
+    /* If we have not read a newline when reading a file, we have either filled
+    the buffer or reached the end of the file. We can detect the former by
+    checking that the string fills the buffer, and the latter by feof(). If
+    neither of these is true, it means we read a binary zero which has caused
+    strlen() to give a short length. This is a hard error because pcre2test
+    expects to work with C strings. */
+
+    if (!INTERACTIVE(f) && dlen < rlen - 1 && !feof(f))
+      {
+      fprintf(outfile, "** Binary zero encountered in input\n");
+      fprintf(outfile, "** pcre2test run abandoned\n");
+      exit(1);
+      }
     }
 
   else
@@ -3565,7 +3627,7 @@ Returns:      nothing
 static void
 show_controls(uint32_t controls, uint32_t controls2, const char *before)
 {
-fprintf(outfile, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+fprintf(outfile, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
   before,
   ((controls & CTL_AFTERTEXT) != 0)? " aftertext" : "",
   ((controls & CTL_ALLAFTERTEXT) != 0)? " allaftertext" : "",
@@ -3592,7 +3654,9 @@ fprintf(outfile, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s
   ((controls & CTL_NL_SET) != 0)? " newline" : "",
   ((controls & CTL_NULLCONTEXT) != 0)? " null_context" : "",
   ((controls & CTL_POSIX) != 0)? " posix" : "",
+  ((controls & CTL_POSIX_NOSUB) != 0)? " posix_nosub" : "",
   ((controls & CTL_PUSH) != 0)? " push" : "",
+  ((controls & CTL_PUSHCOPY) != 0)? " pushcopy" : "",
   ((controls & CTL_STARTCHAR) != 0)? " startchar" : "",
   ((controls2 & CTL2_SUBSTITUTE_EXTENDED) != 0)? " substitute_extended" : "",
   ((controls2 & CTL2_SUBSTITUTE_OVERFLOW_LENGTH) != 0)? " substitute_overflow_length" : "",
@@ -3690,6 +3754,10 @@ show_memory_info(void)
 uint32_t name_count, name_entry_size;
 size_t size, cblock_size;
 
+/* One of the test_mode values will always be true, but to stop a compiler
+warning we must initialize cblock_size. */
+
+cblock_size = 0;
 #ifdef SUPPORT_PCRE2_8
 if (test_mode == 8) cblock_size = sizeof(pcre2_real_code_8);
 #endif
@@ -3791,8 +3859,8 @@ if ((pat_patctl.control & (CTL_BINCODE|CTL_FULLBINCODE)) != 0)
 
 if ((pat_patctl.control & CTL_INFO) != 0)
   {
-  const void *nametable;
-  const uint8_t *start_bits;
+  void *nametable;
+  uint8_t *start_bits;
   BOOL match_limit_set, recursion_limit_set;
   uint32_t backrefmax, bsr_convention, capture_count, first_ctype, first_cunit,
     hasbackslashc, hascrorlf, jchanged, last_ctype, last_cunit, match_empty,
@@ -4240,11 +4308,12 @@ switch(cmd)
   local_newline_default = first_listed_newline;
   break;
 
-  /* Pop a compiled pattern off the stack. Modifiers that do not affect the
-  compiled pattern (e.g. to give information) are permitted. The default
+  /* Pop or copy a compiled pattern off the stack. Modifiers that do not affect
+  the compiled pattern (e.g. to give information) are permitted. The default
   pattern modifiers are ignored. */
 
   case CMD_POP:
+  case CMD_POPCOPY:
   if (patstacknext <= 0)
     {
     fprintf(outfile, "** Can't pop off an empty stack\n");
@@ -4253,7 +4322,16 @@ switch(cmd)
   memset(&pat_patctl, 0, sizeof(patctl));   /* Completely unset */
   if (!decode_modifiers(argptr, CTX_POPPAT, &pat_patctl, NULL))
     return PR_SKIP;
-  SET(compiled_code, patstack[--patstacknext]);
+
+  if (cmd == CMD_POP)
+    {
+    SET(compiled_code, patstack[--patstacknext]);
+    }
+  else
+    {
+    PCRE2_CODE_COPY_FROM_VOID(compiled_code, patstack[patstacknext - 1]);
+    }
+
   if (pat_patctl.jit != 0)
     {
     PCRE2_JIT_COMPILE(jitrc, compiled_code, pat_patctl.jit);
@@ -4451,9 +4529,9 @@ if (pat_patctl.jit == 0 &&
   pat_patctl.jit = 7;
 
 /* Now copy the pattern to pbuffer8 for use in 8-bit testing and for reflecting
-in callouts. Convert from hex if required; this must necessarily be fewer
-characters so will always fit in pbuffer8. Alternatively, process for
-repetition if requested. */
+in callouts. Convert from hex if requested (literal strings in quotes may be
+present within the hexadecimal pairs). The result must necessarily be fewer
+characters so will always fit in pbuffer8. */
 
 if ((pat_patctl.control & CTL_HEXPAT) != 0)
   {
@@ -4464,25 +4542,59 @@ if ((pat_patctl.control & CTL_HEXPAT) != 0)
   for (pp = buffer + 1; *pp != 0; pp++)
     {
     if (isspace(*pp)) continue;
-    c = toupper(*pp++);
-    if (*pp == 0)
+    c = *pp++;
+
+    /* Handle a literal substring */
+
+    if (c == '\'' || c == '"')
       {
-      fprintf(outfile, "** Odd number of digits in hex pattern.\n");
-      return PR_SKIP;
+      for (;; pp++)
+        {
+        d = *pp;
+        if (d == 0)
+          {
+          fprintf(outfile, "** Missing closing quote in hex pattern\n");
+          return PR_SKIP;
+          }
+        if (d == c) break;
+        *pt++ = d;
+        }
       }
-    d = toupper(*pp);
-    if (!isxdigit(c) || !isxdigit(d))
+
+    /* Expect a hex pair */
+
+    else
       {
-      fprintf(outfile, "** Non-hex-digit in hex pattern.\n");
-      return PR_SKIP;
+      if (!isxdigit(c))
+        {
+        fprintf(outfile, "** Unexpected non-hex-digit '%c' in hex pattern: "
+          "quote missing?\n", c);
+        return PR_SKIP;
+        }
+      if (*pp == 0)
+        {
+        fprintf(outfile, "** Odd number of digits in hex pattern\n");
+        return PR_SKIP;
+        }
+      d = *pp;
+      if (!isxdigit(d))
+        {
+        fprintf(outfile, "** Unexpected non-hex-digit '%c' in hex pattern: "
+          "quote missing?\n", d);
+        return PR_SKIP;
+        }
+      c = toupper(c);
+      d = toupper(d);
+      *pt++ = ((isdigit(c)? (c - '0') : (c - 'A' + 10)) << 4) +
+               (isdigit(d)? (d - '0') : (d - 'A' + 10));
       }
-    *pt++ = ((isdigit(c)? (c - '0') : (c - 'A' + 10)) << 4) +
-             (isdigit(d)? (d - '0') : (d - 'A' + 10));
     }
   *pt = 0;
   patlen = pt - pbuffer8;
   }
 
+/* If not a hex string, process for repetition expansion if requested. */
+
 else if ((pat_patctl.control & CTL_EXPAND) != 0)
   {
   uint8_t *pp, *pt;
@@ -4506,8 +4618,19 @@ else if ((pat_patctl.control & CTL_EXPAND) != 0)
           {
           uint32_t clen = pe - pc - 2;
           uint32_t i = 0;
+          unsigned long uli;
+          char *endptr;
+
           pe += 2;
-          while (isdigit(*pe)) i = i * 10 + *pe++ - '0';
+          uli = strtoul((const char *)pe, &endptr, 10);
+          if (U32OVERFLOW(uli))
+            {
+            fprintf(outfile, "** Pattern repeat count too large\n");
+            return PR_SKIP;
+            }
+
+          i = (uint32_t)uli;
+          pe = (uint8_t *)endptr;
           if (*pe == '}')
             {
             if (i == 0)
@@ -4540,7 +4663,7 @@ else if ((pat_patctl.control & CTL_EXPAND) != 0)
       pt = pbuffer8 + pt_offset;
       }
 
-    while (count-- > 0)
+    for (; count > 0; count--)
       {
       memcpy(pt, pc, length);
       pt += length;
@@ -4567,7 +4690,7 @@ if (pat_patctl.locale[0] != 0)
   {
   if (pat_patctl.tables_id != 0)
     {
-    fprintf(outfile, "** 'Locale' and 'tables' must not both be set.\n");
+    fprintf(outfile, "** 'Locale' and 'tables' must not both be set\n");
     return PR_SKIP;
     }
   if (setlocale(LC_CTYPE, (const char *)pat_patctl.locale) == NULL)
@@ -4649,21 +4772,24 @@ if ((pat_patctl.control & CTL_POSIX) != 0)
 
   if (msg[0] == 0) fprintf(outfile, "\n");
 
-  /* Translate PCRE2 options to POSIX options and then compile. On success, set
-  up a match_data block to be used for all matches. */
+  /* Translate PCRE2 options to POSIX options and then compile. */
 
   if (utf) cflags |= REG_UTF;
+  if ((pat_patctl.control & CTL_POSIX_NOSUB) != 0) cflags |= REG_NOSUB;
   if ((pat_patctl.options & PCRE2_UCP) != 0) cflags |= REG_UCP;
   if ((pat_patctl.options & PCRE2_CASELESS) != 0) cflags |= REG_ICASE;
   if ((pat_patctl.options & PCRE2_MULTILINE) != 0) cflags |= REG_NEWLINE;
   if ((pat_patctl.options & PCRE2_DOTALL) != 0) cflags |= REG_DOTALL;
-  if ((pat_patctl.options & PCRE2_NO_AUTO_CAPTURE) != 0) cflags |= REG_NOSUB;
   if ((pat_patctl.options & PCRE2_UNGREEDY) != 0) cflags |= REG_UNGREEDY;
 
   rc = regcomp(&preg, (char *)pbuffer8, cflags);
-  if (rc != 0)   /* Failure */
+
+  /* Compiling failed */
+
+  if (rc != 0)
     {
     size_t bsize, usize;
+    int psize;
 
     preg.re_pcre2_code = NULL;     /* In case something was left in there */
     preg.re_match_data = NULL;
@@ -4674,7 +4800,12 @@ if ((pat_patctl.control & CTL_POSIX) != 0)
       memcpy(pbuffer8 + bsize, "DEADBEEF", 8);
     usize = regerror(rc, &preg, (char *)pbuffer8, bsize);
 
-    fprintf(outfile, "Failed: POSIX code %d: %s\n", rc, pbuffer8);
+    /* Inside regerror(), snprintf() is used. If the buffer is too small, some
+    versions of snprintf() put a zero byte at the end, but others do not.
+    Therefore, we print a maximum of one less than the size of the buffer. */
+
+    psize = (int)bsize - 1;
+    fprintf(outfile, "Failed: POSIX code %d: %.*s\n", rc, psize, pbuffer8);
     if (usize > bsize)
       {
       fprintf(outfile, "** regerror() message truncated\n");
@@ -4683,6 +4814,29 @@ if ((pat_patctl.control & CTL_POSIX) != 0)
       }
     return PR_SKIP;
     }
+
+  /* Compiling succeeded. Check that the values in the preg block are sensible.
+  It can happen that pcre2test is accidentally linked with a different POSIX
+  library which succeeds, but of course puts different things into preg. In
+  this situation, calling regfree() may cause a segfault (or invalid free() in
+  valgrind), so ensure that preg.re_pcre2_code is NULL, which suppresses the
+  calling of regfree() on exit. */
+
+  if (preg.re_pcre2_code == NULL ||
+      ((pcre2_real_code_8 *)preg.re_pcre2_code)->magic_number != MAGIC_NUMBER ||
+      ((pcre2_real_code_8 *)preg.re_pcre2_code)->top_bracket != preg.re_nsub ||
+      preg.re_match_data == NULL ||
+      preg.re_cflags != cflags)
+    {
+    fprintf(outfile,
+      "** The regcomp() function returned zero (success), but the values set\n"
+      "** in the preg block are not valid for PCRE2. Check that pcre2test is\n"
+      "** linked with PCRE2's pcre2posix module (-lpcre2-posix) and not with\n"
+      "** some other POSIX regex library.\n**\n");
+    preg.re_pcre2_code = NULL;
+    return PR_ABEND;
+    }
+
   return PR_OK;
 #endif  /* SUPPORT_PCRE2_8 */
   }
@@ -4690,7 +4844,7 @@ if ((pat_patctl.control & CTL_POSIX) != 0)
 /* Handle compiling via the native interface. Controls that act later are
 ignored with "push". Replacements are locked out. */
 
-if ((pat_patctl.control & CTL_PUSH) != 0)
+if ((pat_patctl.control & (CTL_PUSH|CTL_PUSHCOPY)) != 0)
   {
   if (pat_patctl.replacement[0] != 0)
     {
@@ -4717,9 +4871,7 @@ if ((pat_patctl.control & CTL_PUSH) != 0)
 
 /* Convert the input in non-8-bit modes. */
 
-#ifdef SUPPORT_PCRE2_8
-if (test_mode == PCRE8_MODE) errorcode = 0;
-#endif
+errorcode = 0;
 
 #ifdef SUPPORT_PCRE2_16
 if (test_mode == PCRE16_MODE) errorcode = to16(pbuffer8, utf, &patlen);
@@ -4893,6 +5045,19 @@ if ((pat_patctl.control & CTL_PUSH) != 0)
   SET(compiled_code, NULL);
   }
 
+/* The "pushcopy" control is similar, but pushes a copy of the pattern. This
+tests the pcre2_code_copy() function. */
+
+if ((pat_patctl.control & CTL_PUSHCOPY) != 0)
+  {
+  if (patstacknext >= PATSTACKSIZE)
+    {
+    fprintf(outfile, "** Too many pushed patterns (max %d)\n", PATSTACKSIZE);
+    return PR_ABEND;
+    }
+  PCRE2_CODE_COPY_TO_VOID(patstack[patstacknext++], compiled_code);
+  }
+
 return PR_OK;
 }
 
@@ -4975,6 +5140,7 @@ static int
 callout_function(pcre2_callout_block_8 *cb, void *callout_data_ptr)
 {
 uint32_t i, pre_start, post_start, subject_length;
+PCRE2_SIZE current_position;
 BOOL utf = (FLD(compiled_code, overall_options) & PCRE2_UTF) != 0;
 BOOL callout_capture = (dat_datctl.control & CTL_CALLOUT_CAPTURE) != 0;
 
@@ -5025,21 +5191,36 @@ if (callout_capture)
     }
   }
 
-/* Re-print the subject in canonical form, the first time or if giving full
-datails. On subsequent calls in the same match, we use pchars just to find the
-printed lengths of the substrings. */
+/* Re-print the subject in canonical form (with escapes for non-printing
+characters), the first time, or if giving full details. On subsequent calls in
+the same match, we use PCHARS() just to find the printed lengths of the
+substrings. */
 
 if (f != NULL) fprintf(f, "--->");
 
+/* The subject before the match start. */
+
 PCHARS(pre_start, cb->subject, 0, cb->start_match, utf, f);
 
+/* If a lookbehind is involved, the current position may be earlier than the
+match start. If so, use the match start instead. */
+
+current_position = (cb->current_position >= cb->start_match)?
+  cb->current_position : cb->start_match;
+
+/* The subject between the match start and the current position. */
+
 PCHARS(post_start, cb->subject, cb->start_match,
-  cb->current_position - cb->start_match, utf, f);
+  current_position - cb->start_match, utf, f);
 
-PCHARS(subject_length, cb->subject, 0, cb->subject_length, utf, NULL);
+/* Print from the current position to the end. */
+
+PCHARSV(cb->subject, current_position, cb->subject_length - current_position,
+  utf, f);
 
-PCHARSV(cb->subject, cb->current_position,
-  cb->subject_length - cb->current_position, utf, f);
+/* Calculate the total subject printed length (no print). */
+
+PCHARS(subject_length, cb->subject, 0, cb->subject_length, utf, NULL);
 
 if (f != NULL) fprintf(f, "\n");
 
@@ -5445,13 +5626,15 @@ buffer of the appropriate width. In UTF mode, input can be UTF-8. */
 
 while ((c = *p++) != 0)
   {
-  int i = 0;
+  int32_t i = 0;
   size_t replen;
 
   /* ] may mark the end of a replicated sequence */
 
   if (c == ']' && start_rep != NULL)
     {
+    long li;
+    char *endptr;
     size_t qoffset = CAST8VAR(q) - dbuffer;
     size_t rep_offset = start_rep - dbuffer;
 
@@ -5460,12 +5643,22 @@ while ((c = *p++) != 0)
       fprintf(outfile, "** Expected '{' after \\[....]\n");
       return PR_OK;
       }
-    while (isdigit(*p)) i = i * 10 + *p++ - '0';
+
+    li = strtol((const char *)p, &endptr, 10);
+    if (S32OVERFLOW(li))
+      {
+      fprintf(outfile, "** Repeat count too large\n");
+      return PR_OK;
+      }
+
+    p = (uint8_t *)endptr;
     if (*p++ != '}')
       {
       fprintf(outfile, "** Expected '}' after \\[...]{...\n");
       return PR_OK;
       }
+
+    i = (int32_t)li;
     if (i-- == 0)
       {
       fprintf(outfile, "** Zero repeat not allowed\n");
@@ -5780,7 +5973,7 @@ if ((pat_patctl.control & CTL_POSIX) != 0)
     (void)regerror(rc, &preg, (char *)pbuffer8, pbuffer8_size);
     fprintf(outfile, "No match: POSIX code %d: %s\n", rc, pbuffer8);
     }
-  else if ((pat_patctl.options & PCRE2_NO_AUTO_CAPTURE) != 0)
+  else if ((pat_patctl.control & CTL_POSIX_NOSUB) != 0)
     fprintf(outfile, "Matched with REG_NOSUB\n");
   else if (dat_datctl.oveccount == 0)
     fprintf(outfile, "Matched without capture\n");
@@ -6243,15 +6436,23 @@ else for (gmatched = 0;; gmatched++)
 
     /* "allcaptures" requests showing of all captures in the pattern, to check
     unset ones at the end. It may be set on the pattern or the data. Implement
-    by setting capcount to the maximum. */
+    by setting capcount to the maximum. This is not relevant for DFA matching,
+    so ignore it. */
 
     if ((dat_datctl.control & CTL_ALLCAPTURES) != 0)
       {
       uint32_t maxcapcount;
-      if (pattern_info(PCRE2_INFO_CAPTURECOUNT, &maxcapcount, FALSE) < 0)
-        return PR_SKIP;
-      capcount = maxcapcount + 1;   /* Allow for full match */
-      if (capcount > (int)oveccount) capcount = oveccount;
+      if ((dat_datctl.control & CTL_DFA) != 0)
+        {
+        fprintf(outfile, "** Ignored after DFA matching: allcaptures\n");
+        }
+      else
+        {
+        if (pattern_info(PCRE2_INFO_CAPTURECOUNT, &maxcapcount, FALSE) < 0)
+          return PR_SKIP;
+        capcount = maxcapcount + 1;   /* Allow for full match */
+        if (capcount > (int)oveccount) capcount = oveccount;
+        }
       }
 
     /* Output the captured substrings. Note that, for the matched string,
@@ -6717,6 +6918,7 @@ printf("     pcre2-32       32 bit library support enabled [0, 1]\n");
 printf("     unicode        Unicode and UTF support enabled [0, 1]\n");
 printf("  -d            set default pattern control 'debug'\n");
 printf("  -dfa          set default subject control 'dfa'\n");
+printf("  -error <n,m,..>  show messages for error numbers, then exit\n");
 printf("  -help         show usage information\n");
 printf("  -i            set default pattern control 'info'\n");
 printf("  -jit          set default pattern control 'jit'\n");
@@ -6894,6 +7096,7 @@ BOOL showtotaltimes = FALSE;
 BOOL skipping = FALSE;
 char *arg_subject = NULL;
 char *arg_pattern = NULL;
+char *arg_error = NULL;
 
 /* The offsets to the options and control bits fields of the pattern and data
 control blocks must be the same so that common options and controls such as
@@ -7021,7 +7224,7 @@ while (argc > 1 && argv[op][0] == '-' && argv[op][1] != 0)
     struct rlimit rlim;
     if (U32OVERFLOW(uli))
       {
-      fprintf(stderr, "+++ Argument for -S is too big\n");
+      fprintf(stderr, "** Argument for -S is too big\n");
       exit(1);
       }
     stack_size = (uint32_t)uli;
@@ -7073,7 +7276,7 @@ while (argc > 1 && argv[op][0] == '-' && argv[op][1] != 0)
       {
       if (U32OVERFLOW(uli))
         {
-        fprintf(stderr, "+++ Argument for %s is too big\n", arg);
+        fprintf(stderr, "** Argument for %s is too big\n", arg);
         exit(1);
         }
       timeitm = (int)uli;
@@ -7105,6 +7308,12 @@ while (argc > 1 && argv[op][0] == '-' && argv[op][1] != 0)
   /* The following options save their data for processing once we know what
   the running mode is. */
 
+  else if (strcmp(arg, "-error") == 0)
+    {
+    arg_error = argv[op+1];
+    goto CHECK_VALUE_EXISTS;
+    }
+
   else if (strcmp(arg, "-subject") == 0)
     {
     arg_subject = argv[op+1];
@@ -7138,6 +7347,88 @@ while (argc > 1 && argv[op][0] == '-' && argv[op][1] != 0)
   argc--;
   }
 
+/* If -error was present, get the error numbers, show the messages, and exit.
+We wait to do this until we know which mode we are in. */
+
+if (arg_error != NULL)
+  {
+  int len;
+  int errcode;
+  char *endptr;
+
+/* Ensure the relevant non-8-bit buffer is available. */
+
+#ifdef SUPPORT_PCRE2_16
+  if (test_mode == PCRE16_MODE)
+    {
+    pbuffer16_size = 256;
+    pbuffer16 = (uint16_t *)malloc(pbuffer16_size);
+    if (pbuffer16 == NULL)
+      {
+      fprintf(stderr, "pcre2test: malloc(%lu) failed for pbuffer16\n",
+        (unsigned long int)pbuffer16_size);
+      yield = 1;
+      goto EXIT;
+      }
+    }
+#endif
+
+#ifdef SUPPORT_PCRE2_32
+  if (test_mode == PCRE32_MODE)
+    {
+    pbuffer32_size = 256;
+    pbuffer32 = (uint32_t *)malloc(pbuffer32_size);
+    if (pbuffer32 == NULL)
+      {
+      fprintf(stderr, "pcre2test: malloc(%lu) failed for pbuffer32\n",
+        (unsigned long int)pbuffer32_size);
+      yield = 1;
+      goto EXIT;
+      }
+    }
+#endif
+
+  /* Loop along a list of error numbers. */
+
+  for (;;)
+    {
+    errcode = strtol(arg_error, &endptr, 10);
+    if (*endptr != 0 && *endptr != CHAR_COMMA)
+      {
+      fprintf(stderr, "** '%s' is not a valid error number list\n", arg_error);
+      yield = 1;
+      goto EXIT;
+      }
+    printf("Error %d: ", errcode);
+    PCRE2_GET_ERROR_MESSAGE(len, errcode, pbuffer);
+    if (len < 0)
+      {
+      switch (len)
+        {
+        case PCRE2_ERROR_BADDATA:
+        printf("PCRE2_ERROR_BADDATA (unknown error number)");
+        break;
+
+        case PCRE2_ERROR_NOMEMORY:
+        printf("PCRE2_ERROR_NOMEMORY (buffer too small)");
+        break;
+
+        default:
+        printf("Unexpected return (%d) from pcre2_get_error_message()", len);
+        break;
+        }
+      }
+    else
+      {
+      PCHARSV(CASTVAR(void *, pbuffer), 0, len, FALSE, stdout);
+      }
+    printf("\n");
+    if (*endptr == 0) goto EXIT;
+    arg_error = endptr + 1;
+    }
+  /* Control never reaches here */
+  }  /* End of -error handling */
+
 /* Initialize things that cannot be done until we know which test mode we are
 running in. When HEAP_MATCH_RECURSE is undefined, calling pcre2_set_recursion_
 memory_management() is a no-op, but we call it in order to exercise it. Also
@@ -7398,7 +7689,7 @@ if (jit_stack != NULL)
 #ifdef SUPPORT_PCRE2_8
 #undef BITS
 #define BITS 8
-regfree(&preg);
+if (preg.re_pcre2_code != NULL) regfree(&preg);
 FREECONTEXTS;
 #endif
 
index 1c8a521aa890d2ddb360df81ee87c69e913b5d57..a548c37ab688b6921cab51eb52dc2372a9c89c2c 100644 (file)
@@ -82,7 +82,7 @@
 /* --------------------------------------------------------------------- */
 
 /* If SLJIT_STD_MACROS_DEFINED is not defined, the application should
-   define SLJIT_MALLOC, SLJIT_FREE, SLJIT_MEMMOVE, and NULL. */
+   define SLJIT_MALLOC, SLJIT_FREE, SLJIT_MEMCPY, and NULL. */
 #ifndef SLJIT_STD_MACROS_DEFINED
 /* Disabled by default. */
 #define SLJIT_STD_MACROS_DEFINED 0
index 16e3547c938f046455116a469d6ab7a6fcfb80c1..566c368063011aa84e6b9d12156d97a8d3452c6f 100644 (file)
    SLJIT defines the following architecture dependent types and macros:
 
    Types:
-     sljit_sb, sljit_ub : signed and unsigned 8 bit byte
-     sljit_sh, sljit_uh : signed and unsigned 16 bit half-word (short) type
-     sljit_si, sljit_ui : signed and unsigned 32 bit integer type
-     sljit_sw, sljit_uw : signed and unsigned machine word, enough to store a pointer
-     sljit_p : unsgined pointer value (usually the same as sljit_uw, but
-               some 64 bit ABIs may use 32 bit pointers)
-     sljit_s : single precision floating point value
-     sljit_d : double precision floating point value
+     sljit_s8, sljit_u8   : signed and unsigned 8 bit integer type
+     sljit_s16, sljit_u16 : signed and unsigned 16 bit integer type
+     sljit_s32, sljit_u32 : signed and unsigned 32 bit integer type
+     sljit_sw, sljit_uw   : signed and unsigned machine word, enough to store a pointer
+     sljit_p              : unsgined pointer value (usually the same as sljit_uw, but
+                            some 64 bit ABIs may use 32 bit pointers)
+     sljit_f32            : 32 bit single precision floating point value
+     sljit_f64            : 64 bit double precision floating point value
 
    Macros for feature detection (boolean):
      SLJIT_32BIT_ARCHITECTURE : 32 bit architecture
      SLJIT_NUMBER_OF_SCRATCH_FLOAT_REGISTERS : number of available floating point scratch registers
      SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS : number of available floating point saved registers
      SLJIT_WORD_SHIFT : the shift required to apply when accessing a sljit_sw/sljit_uw array by index
-     SLJIT_DOUBLE_SHIFT : the shift required to apply when accessing
-                          a double precision floating point array by index
-     SLJIT_SINGLE_SHIFT : the shift required to apply when accessing
-                          a single precision floating point array by index
+     SLJIT_F32_SHIFT : the shift required to apply when accessing
+                       a single precision floating point array by index
+     SLJIT_F64_SHIFT : the shift required to apply when accessing
+                       a double precision floating point array by index
      SLJIT_LOCALS_OFFSET : local space starting offset (SLJIT_SP + SLJIT_LOCALS_OFFSET)
      SLJIT_RETURN_ADDRESS_OFFSET : a return instruction always adds this offset to the return address
 
 #define SLJIT_FREE(ptr, allocator_data) free(ptr)
 #endif
 
-#ifndef SLJIT_MEMMOVE
-#define SLJIT_MEMMOVE(dest, src, len) memmove(dest, src, len)
+#ifndef SLJIT_MEMCPY
+#define SLJIT_MEMCPY(dest, src, len) memcpy(dest, src, len)
 #endif
 
 #ifndef SLJIT_ZEROMEM
 #endif
 #endif /* !SLJIT_INLINE */
 
-#ifndef SLJIT_CONST
-/* Const variables. */
-#define SLJIT_CONST const
-#endif
-
 #ifndef SLJIT_UNUSED_ARG
 /* Unused arguments. */
 #define SLJIT_UNUSED_ARG(arg) (void)arg
 /* Instruction cache flush. */
 /****************************/
 
+#if (!defined SLJIT_CACHE_FLUSH && defined __has_builtin)
+#if __has_builtin(__builtin___clear_cache)
+
+#define SLJIT_CACHE_FLUSH(from, to) \
+       __builtin___clear_cache((char*)from, (char*)to)
+
+#endif /* __has_builtin(__builtin___clear_cache) */
+#endif /* (!defined SLJIT_CACHE_FLUSH && defined __has_builtin) */
+
 #ifndef SLJIT_CACHE_FLUSH
 
 #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
 #define SLJIT_CACHE_FLUSH(from, to) \
        sys_icache_invalidate((char*)(from), (char*)(to) - (char*)(from))
 
+#elif (defined(__GNUC__) && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
+
+#define SLJIT_CACHE_FLUSH(from, to) \
+       __builtin___clear_cache((char*)from, (char*)to)
+
 #elif defined __ANDROID__
 
 /* Android lacks __clear_cache; instead, cacheflush should be used. */
 /* The __clear_cache() implementation of GCC is a dummy function on PowerPC. */
 #define SLJIT_CACHE_FLUSH(from, to) \
        ppc_cache_flush((from), (to))
+#define SLJIT_CACHE_FLUSH_OWN_IMPL 1
 
 #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
 
 /* The __clear_cache() implementation of GCC is a dummy function on Sparc. */
 #define SLJIT_CACHE_FLUSH(from, to) \
        sparc_cache_flush((from), (to))
+#define SLJIT_CACHE_FLUSH_OWN_IMPL 1
 
 #else
 
 #endif /* !SLJIT_CACHE_FLUSH */
 
 /******************************************************/
-/* Byte/half/int/word/single/double type definitions. */
+/*    Integer and floating point type definitions.    */
 /******************************************************/
 
 /* 8 bit byte type. */
-typedef unsigned char sljit_ub;
-typedef signed char sljit_sb;
+typedef unsigned char sljit_u8;
+typedef signed char sljit_s8;
 
 /* 16 bit half-word type. */
-typedef unsigned short int sljit_uh;
-typedef signed short int sljit_sh;
+typedef unsigned short int sljit_u16;
+typedef signed short int sljit_s16;
 
 /* 32 bit integer type. */
-typedef unsigned int sljit_ui;
-typedef signed int sljit_si;
+typedef unsigned int sljit_u32;
+typedef signed int sljit_s32;
 
 /* Machine word type. Enough for storing a pointer.
      32 bit for 32 bit machines.
@@ -377,15 +388,15 @@ typedef long int sljit_sw;
 typedef sljit_uw sljit_p;
 
 /* Floating point types. */
-typedef float sljit_s;
-typedef double sljit_d;
+typedef float sljit_f32;
+typedef double sljit_f64;
 
 /* Shift for pointer sized data. */
 #define SLJIT_POINTER_SHIFT SLJIT_WORD_SHIFT
 
 /* Shift for double precision sized data. */
-#define SLJIT_DOUBLE_SHIFT 3
-#define SLJIT_SINGLE_SHIFT 2
+#define SLJIT_F32_SHIFT 2
+#define SLJIT_F64_SHIFT 3
 
 #ifndef SLJIT_W
 
index f24ed337973e7f07510f6bf81664ae8c79c8c463..54f05f5dd70f98bc99a69520eda48f062c539515 100644 (file)
@@ -137,10 +137,10 @@ struct free_block {
 };
 
 #define AS_BLOCK_HEADER(base, offset) \
-       ((struct block_header*)(((sljit_ub*)base) + offset))
+       ((struct block_header*)(((sljit_u8*)base) + offset))
 #define AS_FREE_BLOCK(base, offset) \
-       ((struct free_block*)(((sljit_ub*)base) + offset))
-#define MEM_START(base)                ((void*)(((sljit_ub*)base) + sizeof(struct block_header)))
+       ((struct free_block*)(((sljit_u8*)base) + offset))
+#define MEM_START(base)                ((void*)(((sljit_u8*)base) + sizeof(struct block_header)))
 #define ALIGN_SIZE(size)       (((size) + sizeof(struct block_header) + 7) & ~7)
 
 static struct free_block* free_blocks;
@@ -153,7 +153,7 @@ static SLJIT_INLINE void sljit_insert_free_block(struct free_block *free_block,
        free_block->size = size;
 
        free_block->next = free_blocks;
-       free_block->prev = 0;
+       free_block->prev = NULL;
        if (free_blocks)
                free_blocks->prev = free_block;
        free_blocks = free_block;
index 0f1b1c9ccee1e11213a40a7d4027c1912531d34d..ec1781e4c7f745e08e1cf727fa82c8847bd9310d 100644 (file)
 #if !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
 
 #define GET_OPCODE(op) \
-       ((op) & ~(SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))
+       ((op) & ~(SLJIT_I32_OP | SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))
 
 #define GET_FLAGS(op) \
        ((op) & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C))
 
 #define GET_ALL_FLAGS(op) \
-       ((op) & (SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))
+       ((op) & (SLJIT_I32_OP | SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))
 
 #define TYPE_CAST_NEEDED(op) \
-       (((op) >= SLJIT_MOV_UB && (op) <= SLJIT_MOV_SH) || ((op) >= SLJIT_MOVU_UB && (op) <= SLJIT_MOVU_SH))
+       (((op) >= SLJIT_MOV_U8 && (op) <= SLJIT_MOV_S16) || ((op) >= SLJIT_MOVU_U8 && (op) <= SLJIT_MOVU_S16))
 
 #define BUF_SIZE       4096
 
                        return 1; \
        } while (0)
 
-#define CHECK_RETURN_TYPE sljit_si
+#define CHECK_RETURN_TYPE sljit_s32
 #define CHECK_RETURN_OK return 0
 
 #define CHECK(x) \
 
 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
 #define SLJIT_NEEDS_COMPILER_INIT 1
-static sljit_si compiler_initialized = 0;
+static sljit_s32 compiler_initialized = 0;
 /* A thread safe initialization. */
 static void init_compiler(void);
 #endif
@@ -333,17 +333,17 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_compiler* sljit_create_compiler(void *allo
        SLJIT_ZEROMEM(compiler, sizeof(struct sljit_compiler));
 
        SLJIT_COMPILE_ASSERT(
-               sizeof(sljit_sb) == 1 && sizeof(sljit_ub) == 1
-               && sizeof(sljit_sh) == 2 && sizeof(sljit_uh) == 2
-               && sizeof(sljit_si) == 4 && sizeof(sljit_ui) == 4
+               sizeof(sljit_s8) == 1 && sizeof(sljit_u8) == 1
+               && sizeof(sljit_s16) == 2 && sizeof(sljit_u16) == 2
+               && sizeof(sljit_s32) == 4 && sizeof(sljit_u32) == 4
                && (sizeof(sljit_p) == 4 || sizeof(sljit_p) == 8)
                && sizeof(sljit_p) <= sizeof(sljit_sw)
                && (sizeof(sljit_sw) == 4 || sizeof(sljit_sw) == 8)
                && (sizeof(sljit_uw) == 4 || sizeof(sljit_uw) == 8),
                invalid_integer_types);
-       SLJIT_COMPILE_ASSERT(SLJIT_INT_OP == SLJIT_SINGLE_OP,
+       SLJIT_COMPILE_ASSERT(SLJIT_I32_OP == SLJIT_F32_OP,
                int_op_and_single_op_must_be_the_same);
-       SLJIT_COMPILE_ASSERT(SLJIT_REWRITABLE_JUMP != SLJIT_SINGLE_OP,
+       SLJIT_COMPILE_ASSERT(SLJIT_REWRITABLE_JUMP != SLJIT_F32_OP,
                rewritable_jump_and_single_op_must_not_be_the_same);
 
        /* Only the non-zero members must be set. */
@@ -379,14 +379,14 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_compiler* sljit_create_compiler(void *allo
 
 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
        compiler->cpool = (sljit_uw*)SLJIT_MALLOC(CPOOL_SIZE * sizeof(sljit_uw)
-               + CPOOL_SIZE * sizeof(sljit_ub), allocator_data);
+               + CPOOL_SIZE * sizeof(sljit_u8), allocator_data);
        if (!compiler->cpool) {
                SLJIT_FREE(compiler->buf, allocator_data);
                SLJIT_FREE(compiler->abuf, allocator_data);
                SLJIT_FREE(compiler, allocator_data);
                return NULL;
        }
-       compiler->cpool_unique = (sljit_ub*)(compiler->cpool + CPOOL_SIZE);
+       compiler->cpool_unique = (sljit_u8*)(compiler->cpool + CPOOL_SIZE);
        compiler->cpool_diff = 0xffffffff;
 #endif
 
@@ -485,7 +485,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_target(struct sljit_jump *jump, sljit_uw
 
 static void* ensure_buf(struct sljit_compiler *compiler, sljit_uw size)
 {
-       sljit_ub *ret;
+       sljit_u8 *ret;
        struct sljit_memory_fragment *new_frag;
 
        SLJIT_ASSERT(size <= 256);
@@ -504,7 +504,7 @@ static void* ensure_buf(struct sljit_compiler *compiler, sljit_uw size)
 
 static void* ensure_abuf(struct sljit_compiler *compiler, sljit_uw size)
 {
-       sljit_ub *ret;
+       sljit_u8 *ret;
        struct sljit_memory_fragment *new_frag;
 
        SLJIT_ASSERT(size <= 256);
@@ -521,7 +521,7 @@ static void* ensure_abuf(struct sljit_compiler *compiler, sljit_uw size)
        return new_frag->memory;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, sljit_si size)
+SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, sljit_s32 size)
 {
        CHECK_ERROR_PTR();
 
@@ -554,8 +554,8 @@ static SLJIT_INLINE void reverse_buf(struct sljit_compiler *compiler)
 }
 
 static SLJIT_INLINE void set_emit_enter(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
        SLJIT_UNUSED_ARG(args);
        SLJIT_UNUSED_ARG(local_size);
@@ -571,8 +571,8 @@ static SLJIT_INLINE void set_emit_enter(struct sljit_compiler *compiler,
 }
 
 static SLJIT_INLINE void set_set_context(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
        SLJIT_UNUSED_ARG(args);
        SLJIT_UNUSED_ARG(local_size);
@@ -598,7 +598,7 @@ static SLJIT_INLINE void set_label(struct sljit_label *label, struct sljit_compi
        compiler->last_label = label;
 }
 
-static SLJIT_INLINE void set_jump(struct sljit_jump *jump, struct sljit_compiler *compiler, sljit_si flags)
+static SLJIT_INLINE void set_jump(struct sljit_jump *jump, struct sljit_compiler *compiler, sljit_s32 flags)
 {
        jump->next = NULL;
        jump->flags = flags;
@@ -654,19 +654,19 @@ static SLJIT_INLINE void set_const(struct sljit_const *const_, struct sljit_comp
                break; \
        case SLJIT_BREAKPOINT: \
        case SLJIT_NOP: \
-       case SLJIT_LUMUL: \
-       case SLJIT_LSMUL: \
+       case SLJIT_LMUL_UW: \
+       case SLJIT_LMUL_SW: \
        case SLJIT_MOV: \
-       case SLJIT_MOV_UI: \
+       case SLJIT_MOV_U32: \
        case SLJIT_MOV_P: \
        case SLJIT_MOVU: \
-       case SLJIT_MOVU_UI: \
+       case SLJIT_MOVU_U32: \
        case SLJIT_MOVU_P: \
                /* Nothing allowed */ \
-               CHECK_ARGUMENT(!(op & (SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
+               CHECK_ARGUMENT(!(op & (SLJIT_I32_OP | SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
                break; \
        default: \
-               /* Only SLJIT_INT_OP or SLJIT_SINGLE_OP is allowed. */ \
+               /* Only SLJIT_I32_OP or SLJIT_F32_OP is allowed. */ \
                CHECK_ARGUMENT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
                break; \
        }
@@ -674,12 +674,12 @@ static SLJIT_INLINE void set_const(struct sljit_const *const_, struct sljit_comp
 #define FUNCTION_CHECK_FOP() \
        CHECK_ARGUMENT(!GET_FLAGS(op) || !(op & SLJIT_KEEP_FLAGS)); \
        switch (GET_OPCODE(op)) { \
-       case SLJIT_DCMP: \
+       case SLJIT_CMP_F64: \
                CHECK_ARGUMENT(!(op & (SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
                CHECK_ARGUMENT((op & (SLJIT_SET_E | SLJIT_SET_S))); \
                break; \
        default: \
-               /* Only SLJIT_INT_OP or SLJIT_SINGLE_OP is allowed. */ \
+               /* Only SLJIT_I32_OP or SLJIT_F32_OP is allowed. */ \
                CHECK_ARGUMENT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
                break; \
        }
@@ -844,38 +844,38 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_compiler_verbose(struct sljit_compiler *comp
                        fprintf(compiler->verbose, "fs%d", SLJIT_NUMBER_OF_FLOAT_REGISTERS - (p)); \
        }
 
-static SLJIT_CONST char* op0_names[] = {
-       (char*)"breakpoint", (char*)"nop", (char*)"lumul", (char*)"lsmul",
-       (char*)"udivmod", (char*)"sdivmod", (char*)"udivi", (char*)"sdivi"
+static const char* op0_names[] = {
+       (char*)"breakpoint", (char*)"nop", (char*)"lmul.uw", (char*)"lmul.sw",
+       (char*)"divmod.u", (char*)"divmod.s", (char*)"div.u", (char*)"div.s"
 };
 
-static SLJIT_CONST char* op1_names[] = {
-       (char*)"mov", (char*)"mov_ub", (char*)"mov_sb", (char*)"mov_uh",
-       (char*)"mov_sh", (char*)"mov_ui", (char*)"mov_si", (char*)"mov_p",
-       (char*)"movu", (char*)"movu_ub", (char*)"movu_sb", (char*)"movu_uh",
-       (char*)"movu_sh", (char*)"movu_ui", (char*)"movu_si", (char*)"movu_p",
+static const char* op1_names[] = {
+       (char*)"", (char*)".u8", (char*)".s8", (char*)".u16",
+       (char*)".s16", (char*)".u32", (char*)".s32", (char*)".p",
+       (char*)"", (char*)".u8", (char*)".s8", (char*)".u16",
+       (char*)".s16", (char*)".u32", (char*)".s32", (char*)".p",
        (char*)"not", (char*)"neg", (char*)"clz",
 };
 
-static SLJIT_CONST char* op2_names[] = {
+static const char* op2_names[] = {
        (char*)"add", (char*)"addc", (char*)"sub", (char*)"subc",
        (char*)"mul", (char*)"and", (char*)"or", (char*)"xor",
        (char*)"shl", (char*)"lshr", (char*)"ashr",
 };
 
-static SLJIT_CONST char* fop1_names[] = {
+static const char* fop1_names[] = {
        (char*)"mov", (char*)"conv", (char*)"conv", (char*)"conv",
        (char*)"conv", (char*)"conv", (char*)"cmp", (char*)"neg",
        (char*)"abs",
 };
 
-static SLJIT_CONST char* fop2_names[] = {
+static const char* fop2_names[] = {
        (char*)"add", (char*)"sub", (char*)"mul", (char*)"div"
 };
 
-#define JUMP_PREFIX(type) \
-       ((type & 0xff) <= SLJIT_MUL_NOT_OVERFLOW ? ((type & SLJIT_INT_OP) ? "i_" : "") \
-       : ((type & 0xff) <= SLJIT_D_ORDERED ? ((type & SLJIT_SINGLE_OP) ? "s_" : "d_") : ""))
+#define JUMP_POSTFIX(type) \
+       ((type & 0xff) <= SLJIT_MUL_NOT_OVERFLOW ? ((type & SLJIT_I32_OP) ? "32" : "") \
+       : ((type & 0xff) <= SLJIT_ORDERED_F64 ? ((type & SLJIT_F32_OP) ? ".f32" : ".f64") : ""))
 
 static char* jump_names[] = {
        (char*)"equal", (char*)"not_equal",
@@ -923,8 +923,8 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_generate_code(struct sljit_com
 }
 
 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_enter(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
        SLJIT_UNUSED_ARG(compiler);
 
@@ -949,8 +949,8 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_enter(struct sljit_compil
 }
 
 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_set_context(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
        if (SLJIT_UNLIKELY(compiler->skip_checks)) {
                compiler->skip_checks = 0;
@@ -977,7 +977,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_set_context(struct sljit_compi
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
 {
 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
        CHECK_ARGUMENT(compiler->scratches >= 0);
@@ -993,7 +993,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_return(struct sljit_compi
                if (op == SLJIT_UNUSED)
                        fprintf(compiler->verbose, "  return\n");
                else {
-                       fprintf(compiler->verbose, "  return.%s ", op1_names[op - SLJIT_OP1_BASE]);
+                       fprintf(compiler->verbose, "  return%s ", op1_names[op - SLJIT_OP1_BASE]);
                        sljit_verbose_param(compiler, src, srcw);
                        fprintf(compiler->verbose, "\n");
                }
@@ -1002,7 +1002,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_return(struct sljit_compi
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
 {
 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
        FUNCTION_CHECK_DST(dst, dstw);
@@ -1017,7 +1017,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fast_enter(struct sljit_c
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw)
 {
 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
        FUNCTION_CHECK_SRC(src, srcw);
@@ -1032,23 +1032,29 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fast_return(struct sljit_
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op0(struct sljit_compiler *compiler, sljit_si op)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op)
 {
 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
-       CHECK_ARGUMENT((op >= SLJIT_BREAKPOINT && op <= SLJIT_LSMUL)
-               || ((op & ~SLJIT_INT_OP) >= SLJIT_UDIVMOD && (op & ~SLJIT_INT_OP) <= SLJIT_SDIVI));
-       CHECK_ARGUMENT(op < SLJIT_LUMUL || compiler->scratches >= 2);
+       CHECK_ARGUMENT((op >= SLJIT_BREAKPOINT && op <= SLJIT_LMUL_SW)
+               || ((op & ~SLJIT_I32_OP) >= SLJIT_DIVMOD_UW && (op & ~SLJIT_I32_OP) <= SLJIT_DIV_SW));
+       CHECK_ARGUMENT(op < SLJIT_LMUL_UW || compiler->scratches >= 2);
 #endif
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
        if (SLJIT_UNLIKELY(!!compiler->verbose))
-               fprintf(compiler->verbose, "  %s%s\n", !(op & SLJIT_INT_OP) ? "" : "i", op0_names[GET_OPCODE(op) - SLJIT_OP0_BASE]);
+       {
+               fprintf(compiler->verbose, "  %s", op0_names[GET_OPCODE(op) - SLJIT_OP0_BASE]);
+               if (GET_OPCODE(op) >= SLJIT_DIVMOD_UW) {
+                       fprintf(compiler->verbose, (op & SLJIT_I32_OP) ? "32" : "w");
+               }
+               fprintf(compiler->verbose, "\n");
+       }
 #endif
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
        if (SLJIT_UNLIKELY(compiler->skip_checks)) {
                compiler->skip_checks = 0;
@@ -1064,9 +1070,18 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op1(struct sljit_compiler
 #endif
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
        if (SLJIT_UNLIKELY(!!compiler->verbose)) {
-               fprintf(compiler->verbose, "  %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op1_names[GET_OPCODE(op) - SLJIT_OP1_BASE],
-                       !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_U) ? "" : ".u", !(op & SLJIT_SET_S) ? "" : ".s",
-                       !(op & SLJIT_SET_O) ? "" : ".o", !(op & SLJIT_SET_C) ? "" : ".c", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");
+               if (GET_OPCODE(op) <= SLJIT_MOVU_P)
+               {
+                       fprintf(compiler->verbose, "  mov%s%s%s ", (GET_OPCODE(op) >= SLJIT_MOVU) ? "u" : "",
+                               !(op & SLJIT_I32_OP) ? "" : "32", (op != SLJIT_MOV32 && op != SLJIT_MOVU32) ? op1_names[GET_OPCODE(op) - SLJIT_OP1_BASE] : "");
+               }
+               else
+               {
+                       fprintf(compiler->verbose, "  %s%s%s%s%s%s%s%s ", op1_names[GET_OPCODE(op) - SLJIT_OP1_BASE], !(op & SLJIT_I32_OP) ? "" : "32",
+                               !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_U) ? "" : ".u", !(op & SLJIT_SET_S) ? "" : ".s",
+                               !(op & SLJIT_SET_O) ? "" : ".o", !(op & SLJIT_SET_C) ? "" : ".c", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");
+               }
+
                sljit_verbose_param(compiler, dst, dstw);
                fprintf(compiler->verbose, ", ");
                sljit_verbose_param(compiler, src, srcw);
@@ -1076,10 +1091,10 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op1(struct sljit_compiler
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        if (SLJIT_UNLIKELY(compiler->skip_checks)) {
                compiler->skip_checks = 0;
@@ -1095,7 +1110,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op2(struct sljit_compiler
 #endif
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
        if (SLJIT_UNLIKELY(!!compiler->verbose)) {
-               fprintf(compiler->verbose, "  %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op2_names[GET_OPCODE(op) - SLJIT_OP2_BASE],
+               fprintf(compiler->verbose, "  %s%s%s%s%s%s%s%s ", op2_names[GET_OPCODE(op) - SLJIT_OP2_BASE], !(op & SLJIT_I32_OP) ? "" : "32",
                        !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_U) ? "" : ".u", !(op & SLJIT_SET_S) ? "" : ".s",
                        !(op & SLJIT_SET_O) ? "" : ".o", !(op & SLJIT_SET_C) ? "" : ".c", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");
                sljit_verbose_param(compiler, dst, dstw);
@@ -1109,7 +1124,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op2(struct sljit_compiler
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_get_register_index(sljit_si reg)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_get_register_index(sljit_s32 reg)
 {
        SLJIT_UNUSED_ARG(reg);
 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
@@ -1118,7 +1133,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_get_register_index(sljit_si re
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_get_float_register_index(sljit_si reg)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_get_float_register_index(sljit_s32 reg)
 {
        SLJIT_UNUSED_ARG(reg);
 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
@@ -1128,7 +1143,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_get_float_register_index(sljit
 }
 
 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op_custom(struct sljit_compiler *compiler,
-       void *instruction, sljit_si size)
+       void *instruction, sljit_s32 size)
 {
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
        int i;
@@ -1152,16 +1167,16 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op_custom(struct sljit_co
        if (SLJIT_UNLIKELY(!!compiler->verbose)) {
                fprintf(compiler->verbose, "  op_custom");
                for (i = 0; i < size; i++)
-                       fprintf(compiler->verbose, " 0x%x", ((sljit_ub*)instruction)[i]);
+                       fprintf(compiler->verbose, " 0x%x", ((sljit_u8*)instruction)[i]);
                fprintf(compiler->verbose, "\n");
        }
 #endif
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
        if (SLJIT_UNLIKELY(compiler->skip_checks)) {
                compiler->skip_checks = 0;
@@ -1170,19 +1185,19 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1(struct sljit_compile
 
 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
        CHECK_ARGUMENT(sljit_is_fpu_available());
-       CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_DMOV && GET_OPCODE(op) <= SLJIT_DABS);
+       CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_MOV_F64 && GET_OPCODE(op) <= SLJIT_ABS_F64);
        FUNCTION_CHECK_FOP();
        FUNCTION_FCHECK(src, srcw);
        FUNCTION_FCHECK(dst, dstw);
 #endif
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
        if (SLJIT_UNLIKELY(!!compiler->verbose)) {
-               if (GET_OPCODE(op) == SLJIT_CONVD_FROMS)
-                       fprintf(compiler->verbose, "  %s%s ", fop1_names[SLJIT_CONVD_FROMS - SLJIT_FOP1_BASE],
-                               (op & SLJIT_SINGLE_OP) ? "s.fromd" : "d.froms");
+               if (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_F32)
+                       fprintf(compiler->verbose, "  %s%s ", fop1_names[SLJIT_CONV_F64_FROM_F32 - SLJIT_FOP1_BASE],
+                               (op & SLJIT_F32_OP) ? ".f32.from.f64" : ".f64.from.f32");
                else
-                       fprintf(compiler->verbose, "  %s%s ", (op & SLJIT_SINGLE_OP) ? "s" : "d",
-                               fop1_names[GET_OPCODE(op) - SLJIT_FOP1_BASE]);
+                       fprintf(compiler->verbose, "  %s%s ", fop1_names[GET_OPCODE(op) - SLJIT_FOP1_BASE],
+                               (op & SLJIT_F32_OP) ? ".f32" : ".f64");
 
                sljit_verbose_fparam(compiler, dst, dstw);
                fprintf(compiler->verbose, ", ");
@@ -1193,9 +1208,9 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1(struct sljit_compile
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        if (SLJIT_UNLIKELY(compiler->skip_checks)) {
                compiler->skip_checks = 0;
@@ -1204,14 +1219,14 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_cmp(struct sljit_com
 
 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
        CHECK_ARGUMENT(sljit_is_fpu_available());
-       CHECK_ARGUMENT(GET_OPCODE(op) == SLJIT_DCMP);
+       CHECK_ARGUMENT(GET_OPCODE(op) == SLJIT_CMP_F64);
        FUNCTION_CHECK_FOP();
        FUNCTION_FCHECK(src1, src1w);
        FUNCTION_FCHECK(src2, src2w);
 #endif
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
        if (SLJIT_UNLIKELY(!!compiler->verbose)) {
-               fprintf(compiler->verbose, "  %s%s%s%s ", (op & SLJIT_SINGLE_OP) ? "s" : "d", fop1_names[SLJIT_DCMP - SLJIT_FOP1_BASE],
+               fprintf(compiler->verbose, "  %s%s%s%s ", fop1_names[SLJIT_CMP_F64 - SLJIT_FOP1_BASE], (op & SLJIT_F32_OP) ? ".f32" : ".f64",
                        (op & SLJIT_SET_E) ? ".e" : "", (op & SLJIT_SET_S) ? ".s" : "");
                sljit_verbose_fparam(compiler, src1, src1w);
                fprintf(compiler->verbose, ", ");
@@ -1222,9 +1237,9 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_cmp(struct sljit_com
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_convw_fromd(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_conv_sw_from_f64(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
        if (SLJIT_UNLIKELY(compiler->skip_checks)) {
                compiler->skip_checks = 0;
@@ -1233,7 +1248,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_convw_fromd(struct s
 
 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
        CHECK_ARGUMENT(sljit_is_fpu_available());
-       CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_CONVW_FROMD && GET_OPCODE(op) <= SLJIT_CONVI_FROMD);
+       CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_CONV_SW_FROM_F64 && GET_OPCODE(op) <= SLJIT_CONV_S32_FROM_F64);
        FUNCTION_CHECK_FOP();
        FUNCTION_FCHECK(src, srcw);
        FUNCTION_CHECK_DST(dst, dstw);
@@ -1241,8 +1256,8 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_convw_fromd(struct s
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
        if (SLJIT_UNLIKELY(!!compiler->verbose)) {
                fprintf(compiler->verbose, "  %s%s.from%s ", fop1_names[GET_OPCODE(op) - SLJIT_FOP1_BASE],
-                       (GET_OPCODE(op) == SLJIT_CONVI_FROMD) ? "i" : "w",
-                       (op & SLJIT_SINGLE_OP) ? "s" : "d");
+                       (GET_OPCODE(op) == SLJIT_CONV_S32_FROM_F64) ? ".s32" : ".sw",
+                       (op & SLJIT_F32_OP) ? ".f32" : ".f64");
                sljit_verbose_param(compiler, dst, dstw);
                fprintf(compiler->verbose, ", ");
                sljit_verbose_fparam(compiler, src, srcw);
@@ -1252,9 +1267,9 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_convw_fromd(struct s
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_convd_fromw(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_conv_f64_from_sw(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
        if (SLJIT_UNLIKELY(compiler->skip_checks)) {
                compiler->skip_checks = 0;
@@ -1263,7 +1278,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_convd_fromw(struct s
 
 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
        CHECK_ARGUMENT(sljit_is_fpu_available());
-       CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_CONVD_FROMW && GET_OPCODE(op) <= SLJIT_CONVD_FROMI);
+       CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_CONV_F64_FROM_SW && GET_OPCODE(op) <= SLJIT_CONV_F64_FROM_S32);
        FUNCTION_CHECK_FOP();
        FUNCTION_CHECK_SRC(src, srcw);
        FUNCTION_FCHECK(dst, dstw);
@@ -1271,8 +1286,8 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_convd_fromw(struct s
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
        if (SLJIT_UNLIKELY(!!compiler->verbose)) {
                fprintf(compiler->verbose, "  %s%s.from%s ", fop1_names[GET_OPCODE(op) - SLJIT_FOP1_BASE],
-                       (op & SLJIT_SINGLE_OP) ? "s" : "d",
-                       (GET_OPCODE(op) == SLJIT_CONVD_FROMI) ? "i" : "w");
+                       (op & SLJIT_F32_OP) ? ".f32" : ".f64",
+                       (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_S32) ? ".s32" : ".sw");
                sljit_verbose_fparam(compiler, dst, dstw);
                fprintf(compiler->verbose, ", ");
                sljit_verbose_param(compiler, src, srcw);
@@ -1282,14 +1297,14 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_convd_fromw(struct s
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
        CHECK_ARGUMENT(sljit_is_fpu_available());
-       CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_DADD && GET_OPCODE(op) <= SLJIT_DDIV);
+       CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_ADD_F64 && GET_OPCODE(op) <= SLJIT_DIV_F64);
        FUNCTION_CHECK_FOP();
        FUNCTION_FCHECK(src1, src1w);
        FUNCTION_FCHECK(src2, src2w);
@@ -1297,7 +1312,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop2(struct sljit_compile
 #endif
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
        if (SLJIT_UNLIKELY(!!compiler->verbose)) {
-               fprintf(compiler->verbose, "  %s%s ", (op & SLJIT_SINGLE_OP) ? "s" : "d", fop2_names[GET_OPCODE(op) - SLJIT_FOP2_BASE]);
+               fprintf(compiler->verbose, "  %s%s ", fop2_names[GET_OPCODE(op) - SLJIT_FOP2_BASE], (op & SLJIT_F32_OP) ? ".f32" : ".f64");
                sljit_verbose_fparam(compiler, dst, dstw);
                fprintf(compiler->verbose, ", ");
                sljit_verbose_fparam(compiler, src1, src1w);
@@ -1320,7 +1335,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_label(struct sljit_compil
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_jump(struct sljit_compiler *compiler, sljit_si type)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_jump(struct sljit_compiler *compiler, sljit_s32 type)
 {
        if (SLJIT_UNLIKELY(compiler->skip_checks)) {
                compiler->skip_checks = 0;
@@ -1328,33 +1343,33 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_jump(struct sljit_compile
        }
 
 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
-       CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP | SLJIT_INT_OP)));
+       CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP | SLJIT_I32_OP)));
        CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL && (type & 0xff) <= SLJIT_CALL3);
-       CHECK_ARGUMENT((type & 0xff) < SLJIT_JUMP || !(type & SLJIT_INT_OP));
+       CHECK_ARGUMENT((type & 0xff) < SLJIT_JUMP || !(type & SLJIT_I32_OP));
        CHECK_ARGUMENT((type & 0xff) <= SLJIT_CALL0 || ((type & 0xff) - SLJIT_CALL0) <= compiler->scratches);
 #endif
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
        if (SLJIT_UNLIKELY(!!compiler->verbose))
-               fprintf(compiler->verbose, "  jump%s.%s%s\n", !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r",
-                       JUMP_PREFIX(type), jump_names[type & 0xff]);
+               fprintf(compiler->verbose, "  jump%s %s%s\n", !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r",
+                       jump_names[type & 0xff], JUMP_POSTFIX(type));
 #endif
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_cmp(struct sljit_compiler *compiler, sljit_si type,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_cmp(struct sljit_compiler *compiler, sljit_s32 type,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
-       CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP | SLJIT_INT_OP)));
+       CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP | SLJIT_I32_OP)));
        CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL && (type & 0xff) <= SLJIT_SIG_LESS_EQUAL);
        FUNCTION_CHECK_SRC(src1, src1w);
        FUNCTION_CHECK_SRC(src2, src2w);
 #endif
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
        if (SLJIT_UNLIKELY(!!compiler->verbose)) {
-               fprintf(compiler->verbose, "  cmp%s.%s%s ", !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r",
-                       (type & SLJIT_INT_OP) ? "i_" : "", jump_names[type & 0xff]);
+               fprintf(compiler->verbose, "  cmp%s %s%s, ", !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r",
+                       jump_names[type & 0xff], (type & SLJIT_I32_OP) ? "32" : "");
                sljit_verbose_param(compiler, src1, src1w);
                fprintf(compiler->verbose, ", ");
                sljit_verbose_param(compiler, src2, src2w);
@@ -1364,21 +1379,21 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_cmp(struct sljit_compiler
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_si type,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_s32 type,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
        CHECK_ARGUMENT(sljit_is_fpu_available());
-       CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP | SLJIT_SINGLE_OP)));
-       CHECK_ARGUMENT((type & 0xff) >= SLJIT_D_EQUAL && (type & 0xff) <= SLJIT_D_ORDERED);
+       CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP | SLJIT_F32_OP)));
+       CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL_F64 && (type & 0xff) <= SLJIT_ORDERED_F64);
        FUNCTION_FCHECK(src1, src1w);
        FUNCTION_FCHECK(src2, src2w);
 #endif
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
        if (SLJIT_UNLIKELY(!!compiler->verbose)) {
-               fprintf(compiler->verbose, "  fcmp%s.%s%s ", !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r",
-                       (type & SLJIT_SINGLE_OP) ? "s_" : "d_", jump_names[type & 0xff]);
+               fprintf(compiler->verbose, "  fcmp%s %s%s, ", !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r",
+                       jump_names[type & 0xff], (type & SLJIT_F32_OP) ? ".f32" : ".f64");
                sljit_verbose_fparam(compiler, src1, src1w);
                fprintf(compiler->verbose, ", ");
                sljit_verbose_fparam(compiler, src2, src2w);
@@ -1388,7 +1403,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fcmp(struct sljit_compile
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_ijump(struct sljit_compiler *compiler, sljit_si type, sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
 {
        if (SLJIT_UNLIKELY(compiler->skip_checks)) {
                compiler->skip_checks = 0;
@@ -1410,15 +1425,15 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_ijump(struct sljit_compil
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw,
-       sljit_si type)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw,
+       sljit_s32 type)
 {
 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
-       CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_INT_OP)));
-       CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL && (type & 0xff) <= SLJIT_D_ORDERED);
-       CHECK_ARGUMENT(op == SLJIT_MOV || GET_OPCODE(op) == SLJIT_MOV_UI || GET_OPCODE(op) == SLJIT_MOV_SI
+       CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_I32_OP)));
+       CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL && (type & 0xff) <= SLJIT_ORDERED_F64);
+       CHECK_ARGUMENT(op == SLJIT_MOV || GET_OPCODE(op) == SLJIT_MOV_U32 || GET_OPCODE(op) == SLJIT_MOV_S32
                || (GET_OPCODE(op) >= SLJIT_AND && GET_OPCODE(op) <= SLJIT_XOR));
        CHECK_ARGUMENT((op & (SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C)) == 0);
        CHECK_ARGUMENT((op & (SLJIT_SET_E | SLJIT_KEEP_FLAGS)) != (SLJIT_SET_E | SLJIT_KEEP_FLAGS));
@@ -1431,21 +1446,22 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op_flags(struct sljit_com
 #endif
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
        if (SLJIT_UNLIKELY(!!compiler->verbose)) {
-               fprintf(compiler->verbose, "  flags.%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i",
-                       GET_OPCODE(op) >= SLJIT_OP2_BASE ? op2_names[GET_OPCODE(op) - SLJIT_OP2_BASE] : op1_names[GET_OPCODE(op) - SLJIT_OP1_BASE],
-                       !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");
+               fprintf(compiler->verbose, "  flags %s%s%s%s, ",
+                       !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k",
+                       GET_OPCODE(op) < SLJIT_OP2_BASE ? "mov" : op2_names[GET_OPCODE(op) - SLJIT_OP2_BASE],
+                       GET_OPCODE(op) < SLJIT_OP2_BASE ? op1_names[GET_OPCODE(op) - SLJIT_OP1_BASE] : ((op & SLJIT_I32_OP) ? "32" : ""));
                sljit_verbose_param(compiler, dst, dstw);
                if (src != SLJIT_UNUSED) {
                        fprintf(compiler->verbose, ", ");
                        sljit_verbose_param(compiler, src, srcw);
                }
-               fprintf(compiler->verbose, ", %s%s\n", JUMP_PREFIX(type), jump_names[type & 0xff]);
+               fprintf(compiler->verbose, ", %s%s\n", jump_names[type & 0xff], JUMP_POSTFIX(type));
        }
 #endif
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_get_local_base(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw offset)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset)
 {
        SLJIT_UNUSED_ARG(offset);
 
@@ -1462,7 +1478,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_get_local_base(struct sljit_co
        CHECK_RETURN_OK;
 }
 
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw init_value)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
 {
        SLJIT_UNUSED_ARG(init_value);
 
@@ -1482,31 +1498,31 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_const(struct sljit_compil
 #endif /* SLJIT_ARGUMENT_CHECKS || SLJIT_VERBOSE */
 
 #define SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw) \
-       SLJIT_COMPILE_ASSERT(!(SLJIT_CONVW_FROMD & 0x1) && !(SLJIT_CONVD_FROMW & 0x1), \
+       SLJIT_COMPILE_ASSERT(!(SLJIT_CONV_SW_FROM_F64 & 0x1) && !(SLJIT_CONV_F64_FROM_SW & 0x1), \
                invalid_float_opcodes); \
-       if (GET_OPCODE(op) >= SLJIT_CONVW_FROMD && GET_OPCODE(op) <= SLJIT_DCMP) { \
-               if (GET_OPCODE(op) == SLJIT_DCMP) { \
+       if (GET_OPCODE(op) >= SLJIT_CONV_SW_FROM_F64 && GET_OPCODE(op) <= SLJIT_CMP_F64) { \
+               if (GET_OPCODE(op) == SLJIT_CMP_F64) { \
                        CHECK(check_sljit_emit_fop1_cmp(compiler, op, dst, dstw, src, srcw)); \
                        ADJUST_LOCAL_OFFSET(dst, dstw); \
                        ADJUST_LOCAL_OFFSET(src, srcw); \
                        return sljit_emit_fop1_cmp(compiler, op, dst, dstw, src, srcw); \
                } \
-               if ((GET_OPCODE(op) | 0x1) == SLJIT_CONVI_FROMD) { \
-                       CHECK(check_sljit_emit_fop1_convw_fromd(compiler, op, dst, dstw, src, srcw)); \
+               if ((GET_OPCODE(op) | 0x1) == SLJIT_CONV_S32_FROM_F64) { \
+                       CHECK(check_sljit_emit_fop1_conv_sw_from_f64(compiler, op, dst, dstw, src, srcw)); \
                        ADJUST_LOCAL_OFFSET(dst, dstw); \
                        ADJUST_LOCAL_OFFSET(src, srcw); \
-                       return sljit_emit_fop1_convw_fromd(compiler, op, dst, dstw, src, srcw); \
+                       return sljit_emit_fop1_conv_sw_from_f64(compiler, op, dst, dstw, src, srcw); \
                } \
-               CHECK(check_sljit_emit_fop1_convd_fromw(compiler, op, dst, dstw, src, srcw)); \
+               CHECK(check_sljit_emit_fop1_conv_f64_from_sw(compiler, op, dst, dstw, src, srcw)); \
                ADJUST_LOCAL_OFFSET(dst, dstw); \
                ADJUST_LOCAL_OFFSET(src, srcw); \
-               return sljit_emit_fop1_convd_fromw(compiler, op, dst, dstw, src, srcw); \
+               return sljit_emit_fop1_conv_f64_from_sw(compiler, op, dst, dstw, src, srcw); \
        } \
        CHECK(check_sljit_emit_fop1(compiler, op, dst, dstw, src, srcw)); \
        ADJUST_LOCAL_OFFSET(dst, dstw); \
        ADJUST_LOCAL_OFFSET(src, srcw);
 
-static SLJIT_INLINE sljit_si emit_mov_before_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE sljit_s32 emit_mov_before_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
 {
        /* Return if don't need to do anything. */
        if (op == SLJIT_UNUSED)
@@ -1517,7 +1533,7 @@ static SLJIT_INLINE sljit_si emit_mov_before_return(struct sljit_compiler *compi
        if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_P))
                return SLJIT_SUCCESS;
 #else
-       if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_UI || op == SLJIT_MOV_SI || op == SLJIT_MOV_P))
+       if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_U32 || op == SLJIT_MOV_S32 || op == SLJIT_MOV_P))
                return SLJIT_SUCCESS;
 #endif
 
@@ -1576,12 +1592,12 @@ static SLJIT_INLINE sljit_si emit_mov_before_return(struct sljit_compiler *compi
 
 #if !(defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_si type,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_s32 type,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        /* Default compare for most architectures. */
-       sljit_si flags, tmp_src, condition;
+       sljit_s32 flags, tmp_src, condition;
        sljit_sw tmp_srcw;
 
        CHECK_ERROR_PTR();
@@ -1629,7 +1645,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler
                        condition = SLJIT_SIG_GREATER_EQUAL;
                        break;
                }
-               type = condition | (type & (SLJIT_INT_OP | SLJIT_REWRITABLE_JUMP));
+               type = condition | (type & (SLJIT_I32_OP | SLJIT_REWRITABLE_JUMP));
                tmp_src = src1;
                src1 = src2;
                src2 = tmp_src;
@@ -1649,7 +1665,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler
                || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
        compiler->skip_checks = 1;
 #endif
-       PTR_FAIL_IF(sljit_emit_op2(compiler, SLJIT_SUB | flags | (type & SLJIT_INT_OP),
+       PTR_FAIL_IF(sljit_emit_op2(compiler, SLJIT_SUB | flags | (type & SLJIT_I32_OP),
                SLJIT_UNUSED, 0, src1, src1w, src2, src2w));
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
                || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
@@ -1658,25 +1674,25 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler
        return sljit_emit_jump(compiler, condition | (type & SLJIT_REWRITABLE_JUMP));
 }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_si type,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_s32 type,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_si flags, condition;
+       sljit_s32 flags, condition;
 
        CHECK_ERROR_PTR();
        CHECK_PTR(check_sljit_emit_fcmp(compiler, type, src1, src1w, src2, src2w));
 
        condition = type & 0xff;
-       flags = (condition <= SLJIT_D_NOT_EQUAL) ? SLJIT_SET_E : SLJIT_SET_S;
-       if (type & SLJIT_SINGLE_OP)
-               flags |= SLJIT_SINGLE_OP;
+       flags = (condition <= SLJIT_NOT_EQUAL_F64) ? SLJIT_SET_E : SLJIT_SET_S;
+       if (type & SLJIT_F32_OP)
+               flags |= SLJIT_F32_OP;
 
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
                || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
        compiler->skip_checks = 1;
 #endif
-       sljit_emit_fop1(compiler, SLJIT_DCMP | flags, src1, src1w, src2, src2w);
+       sljit_emit_fop1(compiler, SLJIT_CMP_F64 | flags, src1, src1w, src2, src2w);
 
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
                || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
@@ -1689,7 +1705,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compile
 
 #if !(defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_local_base(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw offset)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset)
 {
        CHECK_ERROR();
        CHECK(check_sljit_get_local_base(compiler, dst, dstw, offset));
@@ -1710,7 +1726,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_local_base(struct sljit_compiler *co
 
 /* Empty function bodies for those machines, which are not (yet) supported. */
 
-SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void)
+SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void)
 {
        return "unsupported";
 }
@@ -1727,7 +1743,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free_compiler(struct sljit_compiler *compile
        SLJIT_ASSERT_STOP();
 }
 
-SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, sljit_si size)
+SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, sljit_s32 size)
 {
        SLJIT_UNUSED_ARG(compiler);
        SLJIT_UNUSED_ARG(size);
@@ -1757,9 +1773,9 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free_code(void* code)
        SLJIT_ASSERT_STOP();
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
        SLJIT_UNUSED_ARG(compiler);
        SLJIT_UNUSED_ARG(options);
@@ -1773,9 +1789,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
        return SLJIT_ERR_UNSUPPORTED;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
        SLJIT_UNUSED_ARG(compiler);
        SLJIT_UNUSED_ARG(options);
@@ -1789,7 +1805,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compi
        return SLJIT_ERR_UNSUPPORTED;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
 {
        SLJIT_UNUSED_ARG(compiler);
        SLJIT_UNUSED_ARG(op);
@@ -1799,7 +1815,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
        return SLJIT_ERR_UNSUPPORTED;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
 {
        SLJIT_UNUSED_ARG(compiler);
        SLJIT_UNUSED_ARG(dst);
@@ -1808,7 +1824,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *c
        return SLJIT_ERR_UNSUPPORTED;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw)
 {
        SLJIT_UNUSED_ARG(compiler);
        SLJIT_UNUSED_ARG(src);
@@ -1817,7 +1833,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *
        return SLJIT_ERR_UNSUPPORTED;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler, sljit_si op)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op)
 {
        SLJIT_UNUSED_ARG(compiler);
        SLJIT_UNUSED_ARG(op);
@@ -1825,9 +1841,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
        return SLJIT_ERR_UNSUPPORTED;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
        SLJIT_UNUSED_ARG(compiler);
        SLJIT_UNUSED_ARG(op);
@@ -1839,10 +1855,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
        return SLJIT_ERR_UNSUPPORTED;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        SLJIT_UNUSED_ARG(compiler);
        SLJIT_UNUSED_ARG(op);
@@ -1856,14 +1872,14 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
        return SLJIT_ERR_UNSUPPORTED;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
 {
        SLJIT_ASSERT_STOP();
        return reg;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *compiler,
-       void *instruction, sljit_si size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
+       void *instruction, sljit_s32 size)
 {
        SLJIT_UNUSED_ARG(compiler);
        SLJIT_UNUSED_ARG(instruction);
@@ -1872,15 +1888,15 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *co
        return SLJIT_ERR_UNSUPPORTED;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
 {
        SLJIT_ASSERT_STOP();
        return 0;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
        SLJIT_UNUSED_ARG(compiler);
        SLJIT_UNUSED_ARG(op);
@@ -1892,10 +1908,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compile
        return SLJIT_ERR_UNSUPPORTED;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        SLJIT_UNUSED_ARG(compiler);
        SLJIT_UNUSED_ARG(op);
@@ -1916,7 +1932,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compi
        return NULL;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_si type)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_s32 type)
 {
        SLJIT_UNUSED_ARG(compiler);
        SLJIT_UNUSED_ARG(type);
@@ -1924,9 +1940,9 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
        return NULL;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_si type,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_s32 type,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        SLJIT_UNUSED_ARG(compiler);
        SLJIT_UNUSED_ARG(type);
@@ -1938,9 +1954,9 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler
        return NULL;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_si type,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_s32 type,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        SLJIT_UNUSED_ARG(compiler);
        SLJIT_UNUSED_ARG(type);
@@ -1966,7 +1982,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_target(struct sljit_jump *jump, sljit_uw
        SLJIT_ASSERT_STOP();
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compiler, sljit_si type, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
 {
        SLJIT_UNUSED_ARG(compiler);
        SLJIT_UNUSED_ARG(type);
@@ -1976,10 +1992,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compil
        return SLJIT_ERR_UNSUPPORTED;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw,
-       sljit_si type)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw,
+       sljit_s32 type)
 {
        SLJIT_UNUSED_ARG(compiler);
        SLJIT_UNUSED_ARG(op);
@@ -1992,7 +2008,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
        return SLJIT_ERR_UNSUPPORTED;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_local_base(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw offset)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset)
 {
        SLJIT_UNUSED_ARG(compiler);
        SLJIT_UNUSED_ARG(dst);
@@ -2002,7 +2018,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_local_base(struct sljit_compiler *co
        return SLJIT_ERR_UNSUPPORTED;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw initval)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw initval)
 {
        SLJIT_UNUSED_ARG(compiler);
        SLJIT_UNUSED_ARG(dst);
index 2e2e9ac09cd660883f7c362b2260c7730a6060ca..df69b8656f8a2f3a2124b1f9bff9342039054383 100644 (file)
@@ -226,7 +226,7 @@ of sljitConfigInternal.h */
 /*  Floating point registers                                             */
 /* --------------------------------------------------------------------- */
 
-/* Each floating point register can store a double or single precision
+/* Each floating point register can store a 32 or a 64 bit precision
    value. The FR and FS register sets are overlap in the same way as R
    and S register sets. See above. */
 
@@ -271,7 +271,7 @@ struct sljit_memory_fragment {
        struct sljit_memory_fragment *next;
        sljit_uw used_size;
        /* Must be aligned to sljit_sw. */
-       sljit_ub memory[1];
+       sljit_u8 memory[1];
 };
 
 struct sljit_label {
@@ -297,8 +297,8 @@ struct sljit_const {
 };
 
 struct sljit_compiler {
-       sljit_si error;
-       sljit_si options;
+       sljit_s32 error;
+       sljit_s32 options;
 
        struct sljit_label *labels;
        struct sljit_jump *jumps;
@@ -312,36 +312,36 @@ struct sljit_compiler {
        struct sljit_memory_fragment *abuf;
 
        /* Used scratch registers. */
-       sljit_si scratches;
+       sljit_s32 scratches;
        /* Used saved registers. */
-       sljit_si saveds;
+       sljit_s32 saveds;
        /* Used float scratch registers. */
-       sljit_si fscratches;
+       sljit_s32 fscratches;
        /* Used float saved registers. */
-       sljit_si fsaveds;
+       sljit_s32 fsaveds;
        /* Local stack size. */
-       sljit_si local_size;
+       sljit_s32 local_size;
        /* Code size. */
        sljit_uw size;
        /* For statistical purposes. */
        sljit_uw executable_size;
 
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-       sljit_si args;
+       sljit_s32 args;
 #endif
 
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-       sljit_si mode32;
+       sljit_s32 mode32;
 #endif
 
 #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
-       sljit_si flags_saved;
+       sljit_s32 flags_saved;
 #endif
 
 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
        /* Constant pool handling. */
        sljit_uw *cpool;
-       sljit_ub *cpool_unique;
+       sljit_u8 *cpool_unique;
        sljit_uw cpool_diff;
        sljit_uw cpool_fill;
        /* Other members. */
@@ -352,40 +352,40 @@ struct sljit_compiler {
 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
        /* Temporary fields. */
        sljit_uw shift_imm;
-       sljit_si cache_arg;
+       sljit_s32 cache_arg;
        sljit_sw cache_argw;
 #endif
 
 #if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
-       sljit_si cache_arg;
+       sljit_s32 cache_arg;
        sljit_sw cache_argw;
 #endif
 
 #if (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
-       sljit_si cache_arg;
+       sljit_s32 cache_arg;
        sljit_sw cache_argw;
 #endif
 
 #if (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
        sljit_sw imm;
-       sljit_si cache_arg;
+       sljit_s32 cache_arg;
        sljit_sw cache_argw;
 #endif
 
 #if (defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
-       sljit_si delay_slot;
-       sljit_si cache_arg;
+       sljit_s32 delay_slot;
+       sljit_s32 cache_arg;
        sljit_sw cache_argw;
 #endif
 
 #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
-       sljit_si delay_slot;
-       sljit_si cache_arg;
+       sljit_s32 delay_slot;
+       sljit_s32 cache_arg;
        sljit_sw cache_argw;
 #endif
 
 #if (defined SLJIT_CONFIG_TILEGX && SLJIT_CONFIG_TILEGX)
-       sljit_si cache_arg;
+       sljit_s32 cache_arg;
        sljit_sw cache_argw;
 #endif
 
@@ -396,13 +396,13 @@ struct sljit_compiler {
 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS) \
                || (defined SLJIT_DEBUG && SLJIT_DEBUG)
        /* Local size passed to the functions. */
-       sljit_si logical_local_size;
+       sljit_s32 logical_local_size;
 #endif
 
 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS) \
                || (defined SLJIT_DEBUG && SLJIT_DEBUG) \
                || (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
-       sljit_si skip_checks;
+       sljit_s32 skip_checks;
 #endif
 };
 
@@ -427,7 +427,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free_compiler(struct sljit_compiler *compile
    error code. Thus there is no need for checking the error after every
    call, it is enough to do it before the code is compiled. Removing
    these checks increases the performance of the compiling process. */
-static SLJIT_INLINE sljit_si sljit_get_compiler_error(struct sljit_compiler *compiler) { return compiler->error; }
+static SLJIT_INLINE sljit_s32 sljit_get_compiler_error(struct sljit_compiler *compiler) { return compiler->error; }
 
 /* Sets the compiler error code to SLJIT_ERR_ALLOC_FAILED except
    if an error was detected before. After the error code is set
@@ -448,7 +448,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_compiler_memory_error(struct sljit_compi
    indicate that there is no more memory (does not set the current error code
    of the compiler to out-of-memory status).
 */
-SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, sljit_si size);
+SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, sljit_s32 size);
 
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 /* Passing NULL disables verbose. */
@@ -518,9 +518,9 @@ offset 0 is aligned to sljit_d. Otherwise it is aligned to sljit_uw. */
 /* The local_size must be >= 0 and <= SLJIT_MAX_LOCAL_SIZE. */
 #define SLJIT_MAX_LOCAL_SIZE   65536
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size);
 
 /* The machine code has a context (which contains the local stack space size,
    number of used registers, etc.) which initialized by sljit_emit_enter. Several
@@ -532,9 +532,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
    Note: every call of sljit_emit_enter and sljit_set_context overwrites
          the previous context. */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size);
 
 /* Return from machine code.  The op argument can be SLJIT_UNUSED which means the
    function does not return with anything or any opcode between SLJIT_MOV and
@@ -542,8 +542,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compi
    is SLJIT_UNUSED, otherwise see below the description about source and
    destination arguments. */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si src, sljit_sw srcw);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 src, sljit_sw srcw);
 
 /* Fast calling mechanism for utility functions (see SLJIT_FAST_CALL). All registers and
    even the stack frame is passed to the callee. The return address is preserved in
@@ -560,8 +560,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
 /* Note: although sljit_emit_fast_return could be replaced by an ijump, it is not suggested,
    since many architectures do clever branch prediction on call / return instruction pairs. */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw);
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_si src, sljit_sw srcw);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw);
 
 /*
    Source and destination values for arithmetical instructions
@@ -624,31 +624,29 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *
 #define SLJIT_MEM2(r1, r2)     (SLJIT_MEM | (r1) | ((r2) << 8))
 #define SLJIT_IMM              0x40
 
-/* Set 32 bit operation mode (I) on 64 bit CPUs. The flag is totally ignored on
-   32 bit CPUs. If this flag is set for an arithmetic operation, it uses only the
-   lower 32 bit of the input register(s), and set the CPU status flags according
-   to the 32 bit result. The higher 32 bits are undefined for both the input and
-   output. However, the CPU might not ignore those higher 32 bits, like MIPS, which
-   expects it to be the sign extension of the lower 32 bit. All 32 bit operations
-   are undefined, if this condition is not fulfilled. Therefore, when SLJIT_INT_OP
-   is specified, all register arguments must be the result of other operations with
-   the same SLJIT_INT_OP flag. In other words, although a register can hold either
-   a 64 or 32 bit value, these values cannot be mixed. The only exceptions are
-   SLJIT_IMOV and SLJIT_IMOVU (SLJIT_MOV_SI/SLJIT_MOVU_SI with SLJIT_INT_OP flag)
-   which can convert any source argument to SLJIT_INT_OP compatible result. This
-   conversion might be unnecessary on some CPUs like x86-64, since the upper 32
-   bit is always ignored. In this case SLJIT is clever enough to not generate any
-   instructions if the source and destination operands are the same registers.
-   Affects sljit_emit_op0, sljit_emit_op1 and sljit_emit_op2. */
-#define SLJIT_INT_OP           0x100
-
-/* Single precision mode (SP). This flag is similar to SLJIT_INT_OP, just
+/* Set 32 bit operation mode (I) on 64 bit CPUs. This flag is ignored on 32
+   bit CPUs. When this flag is set for an arithmetic operation, only the
+   lower 32 bit of the input register(s) are used, and the CPU status flags
+   are set according to the 32 bit result. Although the higher 32 bit of
+   the input and the result registers are not defined by SLJIT, it might be
+   defined by the CPU architecture (e.g. MIPS). To satisfy these requirements
+   all source registers must be computed by operations where this flag is
+   also set. In other words 32 and 64 bit arithmetic operations cannot be
+   mixed. The only exception is SLJIT_IMOV and SLJIT_IMOVU whose source
+   register can hold any 32 or 64 bit value. This source register is
+   converted to a 32 bit compatible format. SLJIT does not generate any
+   instructions on certain CPUs (e.g. on x86 and ARM) if the source and
+   destination operands are the same registers. Affects sljit_emit_op0,
+   sljit_emit_op1 and sljit_emit_op2. */
+#define SLJIT_I32_OP           0x100
+
+/* F32 precision mode (SP). This flag is similar to SLJIT_I32_OP, just
    it applies to floating point registers (it is even the same bit). When
-   this flag is passed, the CPU performs single precision floating point
-   operations. Similar to SLJIT_INT_OP, all register arguments must be the
-   result of other floating point operations with this flag. Affects
+   this flag is passed, the CPU performs 32 bit floating point operations.
+   Similar to SLJIT_I32_OP, all register arguments must be computed by
+   floating point operations where this flag is also set. Affects
    sljit_emit_fop1, sljit_emit_fop2 and sljit_emit_fcmp. */
-#define SLJIT_SINGLE_OP                0x100
+#define SLJIT_F32_OP           0x100
 
 /* Common CPU status flags for all architectures (x86, ARM, PPC)
     - carry flag
@@ -697,43 +695,41 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *
 /* Flags: - (may destroy flags)
    Unsigned multiplication of SLJIT_R0 and SLJIT_R1.
    Result is placed into SLJIT_R1:SLJIT_R0 (high:low) word */
-#define SLJIT_LUMUL                    (SLJIT_OP0_BASE + 2)
+#define SLJIT_LMUL_UW                  (SLJIT_OP0_BASE + 2)
 /* Flags: - (may destroy flags)
    Signed multiplication of SLJIT_R0 and SLJIT_R1.
    Result is placed into SLJIT_R1:SLJIT_R0 (high:low) word */
-#define SLJIT_LSMUL                    (SLJIT_OP0_BASE + 3)
+#define SLJIT_LMUL_SW                  (SLJIT_OP0_BASE + 3)
 /* Flags: I - (may destroy flags)
    Unsigned divide of the value in SLJIT_R0 by the value in SLJIT_R1.
    The result is placed into SLJIT_R0 and the remainder into SLJIT_R1.
    Note: if SLJIT_R1 is 0, the behaviour is undefined. */
-#define SLJIT_UDIVMOD                  (SLJIT_OP0_BASE + 4)
-#define SLJIT_IUDIVMOD                 (SLJIT_UDIVMOD | SLJIT_INT_OP)
+#define SLJIT_DIVMOD_UW                        (SLJIT_OP0_BASE + 4)
+#define SLJIT_DIVMOD_U32               (SLJIT_DIVMOD_UW | SLJIT_I32_OP)
 /* Flags: I - (may destroy flags)
    Signed divide of the value in SLJIT_R0 by the value in SLJIT_R1.
    The result is placed into SLJIT_R0 and the remainder into SLJIT_R1.
    Note: if SLJIT_R1 is 0, the behaviour is undefined.
    Note: if SLJIT_R1 is -1 and SLJIT_R0 is integer min (0x800..00),
          the behaviour is undefined. */
-#define SLJIT_SDIVMOD                  (SLJIT_OP0_BASE + 5)
-#define SLJIT_ISDIVMOD                 (SLJIT_SDIVMOD | SLJIT_INT_OP)
+#define SLJIT_DIVMOD_SW                        (SLJIT_OP0_BASE + 5)
+#define SLJIT_DIVMOD_S32               (SLJIT_DIVMOD_SW | SLJIT_I32_OP)
 /* Flags: I - (may destroy flags)
    Unsigned divide of the value in SLJIT_R0 by the value in SLJIT_R1.
    The result is placed into SLJIT_R0. SLJIT_R1 preserves its value.
-   Note: if SLJIT_R1 is 0, the behaviour is undefined.
-   Note: SLJIT_SDIV is single precision divide. */
-#define SLJIT_UDIVI                    (SLJIT_OP0_BASE + 6)
-#define SLJIT_IUDIVI                   (SLJIT_UDIVI | SLJIT_INT_OP)
+   Note: if SLJIT_R1 is 0, the behaviour is undefined. */
+#define SLJIT_DIV_UW                   (SLJIT_OP0_BASE + 6)
+#define SLJIT_DIV_U32                  (SLJIT_DIV_UW | SLJIT_I32_OP)
 /* Flags: I - (may destroy flags)
    Signed divide of the value in SLJIT_R0 by the value in SLJIT_R1.
    The result is placed into SLJIT_R0. SLJIT_R1 preserves its value.
    Note: if SLJIT_R1 is 0, the behaviour is undefined.
    Note: if SLJIT_R1 is -1 and SLJIT_R0 is integer min (0x800..00),
-         the behaviour is undefined.
-   Note: SLJIT_SDIV is single precision divide. */
-#define SLJIT_SDIVI                    (SLJIT_OP0_BASE + 7)
-#define SLJIT_ISDIVI                   (SLJIT_SDIVI | SLJIT_INT_OP)
+         the behaviour is undefined. */
+#define SLJIT_DIV_SW                   (SLJIT_OP0_BASE + 7)
+#define SLJIT_DIV_S32                  (SLJIT_DIV_SW | SLJIT_I32_OP)
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler, sljit_si op);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op);
 
 /* Starting index of opcodes for sljit_emit_op1. */
 #define SLJIT_OP1_BASE                 32
@@ -752,188 +748,188 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
 /* Flags: - (never set any flags) */
 #define SLJIT_MOV                      (SLJIT_OP1_BASE + 0)
 /* Flags: I - (never set any flags) */
-#define SLJIT_MOV_UB                   (SLJIT_OP1_BASE + 1)
-#define SLJIT_IMOV_UB                  (SLJIT_MOV_UB | SLJIT_INT_OP)
+#define SLJIT_MOV_U8                   (SLJIT_OP1_BASE + 1)
+#define SLJIT_MOV32_U8                 (SLJIT_MOV_U8 | SLJIT_I32_OP)
 /* Flags: I - (never set any flags) */
-#define SLJIT_MOV_SB                   (SLJIT_OP1_BASE + 2)
-#define SLJIT_IMOV_SB                  (SLJIT_MOV_SB | SLJIT_INT_OP)
+#define SLJIT_MOV_S8                   (SLJIT_OP1_BASE + 2)
+#define SLJIT_MOV32_S8                 (SLJIT_MOV_S8 | SLJIT_I32_OP)
 /* Flags: I - (never set any flags) */
-#define SLJIT_MOV_U                  (SLJIT_OP1_BASE + 3)
-#define SLJIT_IMOV_UH                  (SLJIT_MOV_UH | SLJIT_INT_OP)
+#define SLJIT_MOV_U16                  (SLJIT_OP1_BASE + 3)
+#define SLJIT_MOV32_U16                        (SLJIT_MOV_U16 | SLJIT_I32_OP)
 /* Flags: I - (never set any flags) */
-#define SLJIT_MOV_S                  (SLJIT_OP1_BASE + 4)
-#define SLJIT_IMOV_SH                  (SLJIT_MOV_SH | SLJIT_INT_OP)
+#define SLJIT_MOV_S16                  (SLJIT_OP1_BASE + 4)
+#define SLJIT_MOV32_S16                        (SLJIT_MOV_S16 | SLJIT_I32_OP)
 /* Flags: I - (never set any flags)
-   Note: see SLJIT_INT_OP for further details. */
-#define SLJIT_MOV_UI                   (SLJIT_OP1_BASE + 5)
-/* No SLJIT_INT_OP form, since it is the same as SLJIT_IMOV. */
+   Note: no SLJIT_MOV32_U32 form, since it is the same as SLJIT_MOV32 */
+#define SLJIT_MOV_U32                  (SLJIT_OP1_BASE + 5)
 /* Flags: I - (never set any flags)
-   Note: see SLJIT_INT_OP for further details. */
-#define SLJIT_MOV_SI                   (SLJIT_OP1_BASE + 6)
-#define SLJIT_IMOV                     (SLJIT_MOV_SI | SLJIT_INT_OP)
+   Note: no SLJIT_MOV32_S32 form, since it is the same as SLJIT_MOV32 */
+#define SLJIT_MOV_S32                  (SLJIT_OP1_BASE + 6)
+/* Flags: I - (never set any flags) */
+#define SLJIT_MOV32                    (SLJIT_MOV_S32 | SLJIT_I32_OP)
 /* Flags: - (never set any flags) */
 #define SLJIT_MOV_P                    (SLJIT_OP1_BASE + 7)
 /* Flags: - (never set any flags) */
 #define SLJIT_MOVU                     (SLJIT_OP1_BASE + 8)
 /* Flags: I - (never set any flags) */
-#define SLJIT_MOVU_UB                  (SLJIT_OP1_BASE + 9)
-#define SLJIT_IMOVU_UB                 (SLJIT_MOVU_UB | SLJIT_INT_OP)
+#define SLJIT_MOVU_U8                  (SLJIT_OP1_BASE + 9)
+#define SLJIT_MOVU32_U8                        (SLJIT_MOVU_U8 | SLJIT_I32_OP)
 /* Flags: I - (never set any flags) */
-#define SLJIT_MOVU_SB                  (SLJIT_OP1_BASE + 10)
-#define SLJIT_IMOVU_SB                 (SLJIT_MOVU_SB | SLJIT_INT_OP)
+#define SLJIT_MOVU_S8                  (SLJIT_OP1_BASE + 10)
+#define SLJIT_MOVU32_S8                        (SLJIT_MOVU_S8 | SLJIT_I32_OP)
 /* Flags: I - (never set any flags) */
-#define SLJIT_MOVU_U                 (SLJIT_OP1_BASE + 11)
-#define SLJIT_IMOVU_UH                 (SLJIT_MOVU_UH | SLJIT_INT_OP)
+#define SLJIT_MOVU_U16                 (SLJIT_OP1_BASE + 11)
+#define SLJIT_MOVU32_U16                       (SLJIT_MOVU_U16 | SLJIT_I32_OP)
 /* Flags: I - (never set any flags) */
-#define SLJIT_MOVU_S                 (SLJIT_OP1_BASE + 12)
-#define SLJIT_IMOVU_SH                 (SLJIT_MOVU_SH | SLJIT_INT_OP)
+#define SLJIT_MOVU_S16                 (SLJIT_OP1_BASE + 12)
+#define SLJIT_MOVU32_S16               (SLJIT_MOVU_S16 | SLJIT_I32_OP)
 /* Flags: I - (never set any flags)
-   Note: see SLJIT_INT_OP for further details. */
-#define SLJIT_MOVU_UI                  (SLJIT_OP1_BASE + 13)
-/* No SLJIT_INT_OP form, since it is the same as SLJIT_IMOVU. */
+   Note: no SLJIT_MOVU32_U32 form, since it is the same as SLJIT_MOVU32 */
+#define SLJIT_MOVU_U32                 (SLJIT_OP1_BASE + 13)
 /* Flags: I - (never set any flags)
-   Note: see SLJIT_INT_OP for further details. */
-#define SLJIT_MOVU_SI                  (SLJIT_OP1_BASE + 14)
-#define SLJIT_IMOVU                    (SLJIT_MOVU_SI | SLJIT_INT_OP)
+   Note: no SLJIT_MOVU32_S32 form, since it is the same as SLJIT_MOVU32 */
+#define SLJIT_MOVU_S32                 (SLJIT_OP1_BASE + 14)
+/* Flags: I - (never set any flags) */
+#define SLJIT_MOVU32                   (SLJIT_MOVU_S32 | SLJIT_I32_OP)
 /* Flags: - (never set any flags) */
 #define SLJIT_MOVU_P                   (SLJIT_OP1_BASE + 15)
 /* Flags: I | E | K */
 #define SLJIT_NOT                      (SLJIT_OP1_BASE + 16)
-#define SLJIT_INOT                     (SLJIT_NOT | SLJIT_INT_OP)
+#define SLJIT_NOT32                    (SLJIT_NOT | SLJIT_I32_OP)
 /* Flags: I | E | O | K */
 #define SLJIT_NEG                      (SLJIT_OP1_BASE + 17)
-#define SLJIT_INEG                     (SLJIT_NEG | SLJIT_INT_OP)
+#define SLJIT_NEG32                    (SLJIT_NEG | SLJIT_I32_OP)
 /* Count leading zeroes
    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                      (SLJIT_OP1_BASE + 18)
-#define SLJIT_ICLZ                     (SLJIT_CLZ | SLJIT_INT_OP)
+#define SLJIT_CLZ32                    (SLJIT_CLZ | SLJIT_I32_OP)
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw);
 
 /* Starting index of opcodes for sljit_emit_op2. */
 #define SLJIT_OP2_BASE                 96
 
 /* Flags: I | E | O | C | K */
 #define SLJIT_ADD                      (SLJIT_OP2_BASE + 0)
-#define SLJIT_IADD                     (SLJIT_ADD | SLJIT_INT_OP)
+#define SLJIT_ADD32                    (SLJIT_ADD | SLJIT_I32_OP)
 /* Flags: I | C | K */
 #define SLJIT_ADDC                     (SLJIT_OP2_BASE + 1)
-#define SLJIT_IADDC                    (SLJIT_ADDC | SLJIT_INT_OP)
+#define SLJIT_ADDC32                   (SLJIT_ADDC | SLJIT_I32_OP)
 /* Flags: I | E | U | S | O | C | K */
 #define SLJIT_SUB                      (SLJIT_OP2_BASE + 2)
-#define SLJIT_ISUB                     (SLJIT_SUB | SLJIT_INT_OP)
+#define SLJIT_SUB32                    (SLJIT_SUB | SLJIT_I32_OP)
 /* Flags: I | C | K */
 #define SLJIT_SUBC                     (SLJIT_OP2_BASE + 3)
-#define SLJIT_ISUBC                    (SLJIT_SUBC | SLJIT_INT_OP)
+#define SLJIT_SUBC32                   (SLJIT_SUBC | SLJIT_I32_OP)
 /* Note: integer mul
    Flags: I | O (see SLJIT_C_MUL_*) | K */
 #define SLJIT_MUL                      (SLJIT_OP2_BASE + 4)
-#define SLJIT_IMUL                     (SLJIT_MUL | SLJIT_INT_OP)
+#define SLJIT_MUL32                    (SLJIT_MUL | SLJIT_I32_OP)
 /* Flags: I | E | K */
 #define SLJIT_AND                      (SLJIT_OP2_BASE + 5)
-#define SLJIT_IAND                     (SLJIT_AND | SLJIT_INT_OP)
+#define SLJIT_AND32                    (SLJIT_AND | SLJIT_I32_OP)
 /* Flags: I | E | K */
 #define SLJIT_OR                       (SLJIT_OP2_BASE + 6)
-#define SLJIT_IOR                      (SLJIT_OR | SLJIT_INT_OP)
+#define SLJIT_OR32                     (SLJIT_OR | SLJIT_I32_OP)
 /* Flags: I | E | K */
 #define SLJIT_XOR                      (SLJIT_OP2_BASE + 7)
-#define SLJIT_IXOR                     (SLJIT_XOR | SLJIT_INT_OP)
+#define SLJIT_XOR32                    (SLJIT_XOR | SLJIT_I32_OP)
 /* Flags: I | E | K
    Let bit_length be the length of the shift operation: 32 or 64.
    If src2 is immediate, src2w is masked by (bit_length - 1).
    Otherwise, if the content of src2 is outside the range from 0
    to bit_length - 1, the result is undefined. */
 #define SLJIT_SHL                      (SLJIT_OP2_BASE + 8)
-#define SLJIT_ISHL                     (SLJIT_SHL | SLJIT_INT_OP)
+#define SLJIT_SHL32                    (SLJIT_SHL | SLJIT_I32_OP)
 /* Flags: I | E | K
    Let bit_length be the length of the shift operation: 32 or 64.
    If src2 is immediate, src2w is masked by (bit_length - 1).
    Otherwise, if the content of src2 is outside the range from 0
    to bit_length - 1, the result is undefined. */
 #define SLJIT_LSHR                     (SLJIT_OP2_BASE + 9)
-#define SLJIT_ILSHR                    (SLJIT_LSHR | SLJIT_INT_OP)
+#define SLJIT_LSHR32                   (SLJIT_LSHR | SLJIT_I32_OP)
 /* Flags: I | E | K
    Let bit_length be the length of the shift operation: 32 or 64.
    If src2 is immediate, src2w is masked by (bit_length - 1).
    Otherwise, if the content of src2 is outside the range from 0
    to bit_length - 1, the result is undefined. */
 #define SLJIT_ASHR                     (SLJIT_OP2_BASE + 10)
-#define SLJIT_IASHR                    (SLJIT_ASHR | SLJIT_INT_OP)
+#define SLJIT_ASHR32                   (SLJIT_ASHR | SLJIT_I32_OP)
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w);
 
 /* Returns with non-zero if fpu is available. */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void);
 
 /* Starting index of opcodes for sljit_emit_fop1. */
 #define SLJIT_FOP1_BASE                        128
 
 /* Flags: SP - (never set any flags) */
-#define SLJIT_DMOV                     (SLJIT_FOP1_BASE + 0)
-#define SLJIT_SMOV                     (SLJIT_DMOV | SLJIT_SINGLE_OP)
+#define SLJIT_MOV_F64                  (SLJIT_FOP1_BASE + 0)
+#define SLJIT_MOV_F32                  (SLJIT_MOV_F64 | SLJIT_F32_OP)
 /* Convert opcodes: CONV[DST_TYPE].FROM[SRC_TYPE]
    SRC/DST TYPE can be: D - double, S - single, W - signed word, I - signed int
    Rounding mode when the destination is W or I: round towards zero. */
 /* Flags: SP - (never set any flags) */
-#define SLJIT_CONVD_FROMS              (SLJIT_FOP1_BASE + 1)
-#define SLJIT_CONVS_FROMD              (SLJIT_CONVD_FROMS | SLJIT_SINGLE_OP)
+#define SLJIT_CONV_F64_FROM_F32                (SLJIT_FOP1_BASE + 1)
+#define SLJIT_CONV_F32_FROM_F64                (SLJIT_CONV_F64_FROM_F32 | SLJIT_F32_OP)
 /* Flags: SP - (never set any flags) */
-#define SLJIT_CONVW_FROMD              (SLJIT_FOP1_BASE + 2)
-#define SLJIT_CONVW_FROMS              (SLJIT_CONVW_FROMD | SLJIT_SINGLE_OP)
+#define SLJIT_CONV_SW_FROM_F64         (SLJIT_FOP1_BASE + 2)
+#define SLJIT_CONV_SW_FROM_F32         (SLJIT_CONV_SW_FROM_F64 | SLJIT_F32_OP)
 /* Flags: SP - (never set any flags) */
-#define SLJIT_CONVI_FROMD              (SLJIT_FOP1_BASE + 3)
-#define SLJIT_CONVI_FROMS              (SLJIT_CONVI_FROMD | SLJIT_SINGLE_OP)
+#define SLJIT_CONV_S32_FROM_F64                (SLJIT_FOP1_BASE + 3)
+#define SLJIT_CONV_S32_FROM_F32                (SLJIT_CONV_S32_FROM_F64 | SLJIT_F32_OP)
 /* Flags: SP - (never set any flags) */
-#define SLJIT_CONVD_FROMW              (SLJIT_FOP1_BASE + 4)
-#define SLJIT_CONVS_FROMW              (SLJIT_CONVD_FROMW | SLJIT_SINGLE_OP)
+#define SLJIT_CONV_F64_FROM_SW         (SLJIT_FOP1_BASE + 4)
+#define SLJIT_CONV_F32_FROM_SW         (SLJIT_CONV_F64_FROM_SW | SLJIT_F32_OP)
 /* Flags: SP - (never set any flags) */
-#define SLJIT_CONVD_FROMI              (SLJIT_FOP1_BASE + 5)
-#define SLJIT_CONVS_FROMI              (SLJIT_CONVD_FROMI | SLJIT_SINGLE_OP)
+#define SLJIT_CONV_F64_FROM_S32                (SLJIT_FOP1_BASE + 5)
+#define SLJIT_CONV_F32_FROM_S32                (SLJIT_CONV_F64_FROM_S32 | SLJIT_F32_OP)
 /* Note: dst is the left and src is the right operand for SLJIT_CMPD.
    Note: NaN check is always performed. If SLJIT_C_FLOAT_UNORDERED flag
          is set, the comparison result is unpredictable.
    Flags: SP | E | S (see SLJIT_C_FLOAT_*) */
-#define SLJIT_DCMP                     (SLJIT_FOP1_BASE + 6)
-#define SLJIT_SCMP                     (SLJIT_DCMP | SLJIT_SINGLE_OP)
+#define SLJIT_CMP_F64                  (SLJIT_FOP1_BASE + 6)
+#define SLJIT_CMP_F32                  (SLJIT_CMP_F64 | SLJIT_F32_OP)
 /* Flags: SP - (never set any flags) */
-#define SLJIT_DNEG                     (SLJIT_FOP1_BASE + 7)
-#define SLJIT_SNEG                     (SLJIT_DNEG | SLJIT_SINGLE_OP)
+#define SLJIT_NEG_F64                  (SLJIT_FOP1_BASE + 7)
+#define SLJIT_NEG_F32                  (SLJIT_NEG_F64 | SLJIT_F32_OP)
 /* Flags: SP - (never set any flags) */
-#define SLJIT_DABS                     (SLJIT_FOP1_BASE + 8)
-#define SLJIT_SABS                     (SLJIT_DABS | SLJIT_SINGLE_OP)
+#define SLJIT_ABS_F64                  (SLJIT_FOP1_BASE + 8)
+#define SLJIT_ABS_F32                  (SLJIT_ABS_F64 | SLJIT_F32_OP)
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw);
 
 /* Starting index of opcodes for sljit_emit_fop2. */
 #define SLJIT_FOP2_BASE                        160
 
 /* Flags: SP - (never set any flags) */
-#define SLJIT_DADD                     (SLJIT_FOP2_BASE + 0)
-#define SLJIT_SADD                     (SLJIT_DADD | SLJIT_SINGLE_OP)
+#define SLJIT_ADD_F64                  (SLJIT_FOP2_BASE + 0)
+#define SLJIT_ADD_F32                  (SLJIT_ADD_F64 | SLJIT_F32_OP)
 /* Flags: SP - (never set any flags) */
-#define SLJIT_DSUB                     (SLJIT_FOP2_BASE + 1)
-#define SLJIT_SSUB                     (SLJIT_DSUB | SLJIT_SINGLE_OP)
+#define SLJIT_SUB_F64                  (SLJIT_FOP2_BASE + 1)
+#define SLJIT_SUB_F32                  (SLJIT_SUB_F64 | SLJIT_F32_OP)
 /* Flags: SP - (never set any flags) */
-#define SLJIT_DMUL                     (SLJIT_FOP2_BASE + 2)
-#define SLJIT_SMUL                     (SLJIT_DMUL | SLJIT_SINGLE_OP)
+#define SLJIT_MUL_F64                  (SLJIT_FOP2_BASE + 2)
+#define SLJIT_MUL_F32                  (SLJIT_MUL_F64 | SLJIT_F32_OP)
 /* Flags: SP - (never set any flags) */
-#define SLJIT_DDIV                     (SLJIT_FOP2_BASE + 3)
-#define SLJIT_SDIV                     (SLJIT_DDIV | SLJIT_SINGLE_OP)
+#define SLJIT_DIV_F64                  (SLJIT_FOP2_BASE + 3)
+#define SLJIT_DIV_F32                  (SLJIT_DIV_F64 | SLJIT_F32_OP)
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w);
 
 /* Label and jump instructions. */
 
@@ -943,58 +939,58 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compi
 
 /* Integer comparison types. */
 #define SLJIT_EQUAL                    0
-#define SLJIT_I_EQUAL                  (SLJIT_EQUAL | SLJIT_INT_OP)
+#define SLJIT_EQUAL32                  (SLJIT_EQUAL | SLJIT_I32_OP)
 #define SLJIT_ZERO                     0
-#define SLJIT_I_ZERO                   (SLJIT_ZERO | SLJIT_INT_OP)
+#define SLJIT_ZERO32                   (SLJIT_ZERO | SLJIT_I32_OP)
 #define SLJIT_NOT_EQUAL                        1
-#define SLJIT_I_NOT_EQUAL              (SLJIT_NOT_EQUAL | SLJIT_INT_OP)
+#define SLJIT_NOT_EQUAL32              (SLJIT_NOT_EQUAL | SLJIT_I32_OP)
 #define SLJIT_NOT_ZERO                 1
-#define SLJIT_I_NOT_ZERO               (SLJIT_NOT_ZERO | SLJIT_INT_OP)
+#define SLJIT_NOT_ZERO32               (SLJIT_NOT_ZERO | SLJIT_I32_OP)
 
 #define SLJIT_LESS                     2
-#define SLJIT_I_LESS                   (SLJIT_LESS | SLJIT_INT_OP)
+#define SLJIT_LESS32                   (SLJIT_LESS | SLJIT_I32_OP)
 #define SLJIT_GREATER_EQUAL            3
-#define SLJIT_I_GREATER_EQUAL          (SLJIT_GREATER_EQUAL | SLJIT_INT_OP)
+#define SLJIT_GREATER_EQUAL32          (SLJIT_GREATER_EQUAL | SLJIT_I32_OP)
 #define SLJIT_GREATER                  4
-#define SLJIT_I_GREATER                        (SLJIT_GREATER | SLJIT_INT_OP)
+#define SLJIT_GREATER32                        (SLJIT_GREATER | SLJIT_I32_OP)
 #define SLJIT_LESS_EQUAL               5
-#define SLJIT_I_LESS_EQUAL             (SLJIT_LESS_EQUAL | SLJIT_INT_OP)
+#define SLJIT_LESS_EQUAL32             (SLJIT_LESS_EQUAL | SLJIT_I32_OP)
 #define SLJIT_SIG_LESS                 6
-#define SLJIT_I_SIG_LESS               (SLJIT_SIG_LESS | SLJIT_INT_OP)
+#define SLJIT_SIG_LESS32               (SLJIT_SIG_LESS | SLJIT_I32_OP)
 #define SLJIT_SIG_GREATER_EQUAL                7
-#define SLJIT_I_SIG_GREATER_EQUAL      (SLJIT_SIG_GREATER_EQUAL | SLJIT_INT_OP)
+#define SLJIT_SIG_GREATER_EQUAL32      (SLJIT_SIG_GREATER_EQUAL | SLJIT_I32_OP)
 #define SLJIT_SIG_GREATER              8
-#define SLJIT_I_SIG_GREATER            (SLJIT_SIG_GREATER | SLJIT_INT_OP)
+#define SLJIT_SIG_GREATER32            (SLJIT_SIG_GREATER | SLJIT_I32_OP)
 #define SLJIT_SIG_LESS_EQUAL           9
-#define SLJIT_I_SIG_LESS_EQUAL         (SLJIT_SIG_LESS_EQUAL | SLJIT_INT_OP)
+#define SLJIT_SIG_LESS_EQUAL32         (SLJIT_SIG_LESS_EQUAL | SLJIT_I32_OP)
 
 #define SLJIT_OVERFLOW                 10
-#define SLJIT_I_OVERFLOW               (SLJIT_OVERFLOW | SLJIT_INT_OP)
+#define SLJIT_OVERFLOW32               (SLJIT_OVERFLOW | SLJIT_I32_OP)
 #define SLJIT_NOT_OVERFLOW             11
-#define SLJIT_I_NOT_OVERFLOW           (SLJIT_NOT_OVERFLOW | SLJIT_INT_OP)
+#define SLJIT_NOT_OVERFLOW32           (SLJIT_NOT_OVERFLOW | SLJIT_I32_OP)
 
 #define SLJIT_MUL_OVERFLOW             12
-#define SLJIT_I_MUL_OVERFLOW           (SLJIT_MUL_OVERFLOW | SLJIT_INT_OP)
+#define SLJIT_MUL_OVERFLOW32           (SLJIT_MUL_OVERFLOW | SLJIT_I32_OP)
 #define SLJIT_MUL_NOT_OVERFLOW         13
-#define SLJIT_I_MUL_NOT_OVERFLOW       (SLJIT_MUL_NOT_OVERFLOW | SLJIT_INT_OP)
+#define SLJIT_MUL_NOT_OVERFLOW32       (SLJIT_MUL_NOT_OVERFLOW | SLJIT_I32_OP)
 
 /* Floating point comparison types. */
-#define SLJIT_D_EQUAL                  14
-#define SLJIT_S_EQUAL                  (SLJIT_D_EQUAL | SLJIT_SINGLE_OP)
-#define SLJIT_D_NOT_EQUAL              15
-#define SLJIT_S_NOT_EQUAL              (SLJIT_D_NOT_EQUAL | SLJIT_SINGLE_OP)
-#define SLJIT_D_LESS                   16
-#define SLJIT_S_LESS                   (SLJIT_D_LESS | SLJIT_SINGLE_OP)
-#define SLJIT_D_GREATER_EQUAL          17
-#define SLJIT_S_GREATER_EQUAL          (SLJIT_D_GREATER_EQUAL | SLJIT_SINGLE_OP)
-#define SLJIT_D_GREATER                        18
-#define SLJIT_S_GREATER                        (SLJIT_D_GREATER | SLJIT_SINGLE_OP)
-#define SLJIT_D_LESS_EQUAL             19
-#define SLJIT_S_LESS_EQUAL             (SLJIT_D_LESS_EQUAL | SLJIT_SINGLE_OP)
-#define SLJIT_D_UNORDERED              20
-#define SLJIT_S_UNORDERED              (SLJIT_D_UNORDERED | SLJIT_SINGLE_OP)
-#define SLJIT_D_ORDERED                        21
-#define SLJIT_S_ORDERED                        (SLJIT_D_ORDERED | SLJIT_SINGLE_OP)
+#define SLJIT_EQUAL_F64                        14
+#define SLJIT_EQUAL_F32                        (SLJIT_EQUAL_F64 | SLJIT_F32_OP)
+#define SLJIT_NOT_EQUAL_F64            15
+#define SLJIT_NOT_EQUAL_F32            (SLJIT_NOT_EQUAL_F64 | SLJIT_F32_OP)
+#define SLJIT_LESS_F64                 16
+#define SLJIT_LESS_F32                 (SLJIT_LESS_F64 | SLJIT_F32_OP)
+#define SLJIT_GREATER_EQUAL_F64                17
+#define SLJIT_GREATER_EQUAL_F32                (SLJIT_GREATER_EQUAL_F64 | SLJIT_F32_OP)
+#define SLJIT_GREATER_F64              18
+#define SLJIT_GREATER_F32              (SLJIT_GREATER_F64 | SLJIT_F32_OP)
+#define SLJIT_LESS_EQUAL_F64           19
+#define SLJIT_LESS_EQUAL_F32           (SLJIT_LESS_EQUAL_F64 | SLJIT_F32_OP)
+#define SLJIT_UNORDERED_F64            20
+#define SLJIT_UNORDERED_F32            (SLJIT_UNORDERED_F64 | SLJIT_F32_OP)
+#define SLJIT_ORDERED_F64              21
+#define SLJIT_ORDERED_F32              (SLJIT_ORDERED_F64 | SLJIT_F32_OP)
 
 /* Unconditional jump types. */
 #define SLJIT_JUMP                     22
@@ -1014,7 +1010,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compi
     type can be combined (or'ed) with SLJIT_REWRITABLE_JUMP
    Flags: - (never set any flags) for both conditional and unconditional jumps.
    Flags: destroy all flags for calls. */
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_si type);
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_s32 type);
 
 /* Basic arithmetic comparison. In most architectures it is implemented as
    an SLJIT_SUB operation (with SLJIT_UNUSED destination and setting
@@ -1024,23 +1020,23 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
     type must be between SLJIT_EQUAL and SLJIT_I_SIG_LESS_EQUAL
     type can be combined (or'ed) with SLJIT_REWRITABLE_JUMP
    Flags: destroy flags. */
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_si type,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w);
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_s32 type,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w);
 
 /* Basic floating point comparison. In most architectures it is implemented as
    an SLJIT_FCMP operation (setting appropriate flags) followed by a
    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_D_EQUAL and SLJIT_S_ORDERED
+    type must be between SLJIT_EQUAL_F64 and SLJIT_ORDERED_F32
     type can be combined (or'ed) with SLJIT_REWRITABLE_JUMP
    Flags: destroy flags.
    Note: if either operand is NaN, the behaviour is undefined for
          types up to SLJIT_S_LESS_EQUAL. */
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_si type,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w);
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_s32 type,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w);
 
 /* Set the destination of the jump to this label. */
 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_label(struct sljit_jump *jump, struct sljit_label* label);
@@ -1053,14 +1049,14 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_target(struct sljit_jump *jump, sljit_uw
     Indirect form: any other valid addressing mode
    Flags: - (never set any flags) for unconditional jumps.
    Flags: destroy all flags for calls. */
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compiler, sljit_si type, sljit_si src, sljit_sw srcw);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw);
 
 /* Perform the operation using the conditional flags as the second argument.
    Type must always be between SLJIT_EQUAL and SLJIT_S_ORDERED. The value
    represented by the type is 1, if the condition represented by the type
    is fulfilled, and 0 otherwise.
 
-   If op == SLJIT_MOV, SLJIT_MOV_SI, SLJIT_MOV_UI:
+   If op == SLJIT_MOV, SLJIT_MOV_S32, SLJIT_MOV_U32:
      Set dst to the value represented by the type (0 or 1).
      Src must be SLJIT_UNUSED, and srcw must be 0
      Flags: - (never set any flags)
@@ -1070,18 +1066,18 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compil
      Important note: only dst=src and dstw=srcw is supported at the moment!
      Flags: I | E | K
    Note: sljit_emit_op_flags does nothing, if dst is SLJIT_UNUSED (regardless of op). */
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw,
-       sljit_si type);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw,
+       sljit_s32 type);
 
 /* Copies the base address of SLJIT_SP + offset to dst.
    Flags: - (never set any flags) */
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_local_base(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw offset);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset);
 
 /* The constant can be changed runtime (see: sljit_set_const)
    Flags: - (never set any flags) */
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw init_value);
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value);
 
 /* After the code generation the address for label, jump and const instructions
    are computed. Since these structures are freed by sljit_free_compiler, the
@@ -1104,7 +1100,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_consta
 /* Get the human readable name of the platform. Can be useful on platforms
    like ARM, where ARM and Thumb2 functions can be mixed, and
    it is useful to know the type of the code generator. */
-SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void);
+SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void);
 
 /* Portable helper function to get an offset of a member. */
 #define SLJIT_OFFSETOF(base, member) ((sljit_sw)(&((base*)0x10)->member) - 0x10)
@@ -1196,14 +1192,14 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_function_context(void** func_ptr, struct
 
    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);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 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 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);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_float_register_index(sljit_s32 reg);
 
 /* Any instruction can be inserted into the instruction stream by
    sljit_emit_op_custom. It has a similar purpose as inline assembly.
@@ -1215,18 +1211,18 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_float_register_index(sljit_si reg);
               if size == 4, the instruction argument must be 4 byte aligned.
    Otherwise: size must be 4 and instruction argument must be 4 byte aligned. */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *compiler,
-       void *instruction, sljit_si size);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
+       void *instruction, sljit_s32 size);
 
 #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
 
 /* Returns with non-zero if sse2 is available. */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_x86_is_sse2_available(void);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_x86_is_sse2_available(void);
 
 /* Returns with non-zero if cmov instruction is available. */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_x86_is_cmov_available(void);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_x86_is_cmov_available(void);
 
 /* Emit a conditional mov instruction on x86 CPUs. This instruction
    moves src to destination, if the condition is satisfied. Unlike
@@ -1235,14 +1231,14 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_x86_is_cmov_available(void);
    checked by sljit_x86_is_cmov_available function.
     type must be between SLJIT_EQUAL and SLJIT_S_ORDERED
     dst_reg must be a valid register and it can be combined
-      with SLJIT_INT_OP to perform 32 bit arithmetic
+      with SLJIT_I32_OP to perform 32 bit arithmetic
    Flags: I - (never set any flags)
  */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_x86_emit_cmov(struct sljit_compiler *compiler,
-       sljit_si type,
-       sljit_si dst_reg,
-       sljit_si src, sljit_sw srcw);
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_x86_emit_cmov(struct sljit_compiler *compiler,
+       sljit_s32 type,
+       sljit_s32 dst_reg,
+       sljit_s32 src, sljit_sw srcw);
 
 #endif
 
index 5cd4c71a298f6f1891fb05291b1c8ada65cebc00..b92808f5268feee99d4667bfb86340952d3b623e 100644 (file)
@@ -24,7 +24,7 @@
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void)
+SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void)
 {
 #if (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
        return "ARMv7" SLJIT_CPUINFO;
@@ -52,10 +52,10 @@ SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void)
 #define ALIGN_INSTRUCTION(ptr) \
        (sljit_uw*)(((sljit_uw)(ptr) + (CONST_POOL_ALIGNMENT * sizeof(sljit_uw)) - 1) & ~((CONST_POOL_ALIGNMENT * sizeof(sljit_uw)) - 1))
 #define MAX_DIFFERENCE(max_diff) \
-       (((max_diff) / (sljit_si)sizeof(sljit_uw)) - (CONST_POOL_ALIGNMENT - 1))
+       (((max_diff) / (sljit_s32)sizeof(sljit_uw)) - (CONST_POOL_ALIGNMENT - 1))
 
 /* See sljit_emit_enter and sljit_emit_op0 if you want to change them. */
-static SLJIT_CONST sljit_ub reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
+static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
        0, 0, 1, 2, 11, 10, 9, 8, 7, 6, 5, 4, 13, 3, 12, 14, 15
 };
 
@@ -126,13 +126,13 @@ static SLJIT_CONST sljit_ub reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
 
 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
 
-static sljit_si push_cpool(struct sljit_compiler *compiler)
+static sljit_s32 push_cpool(struct sljit_compiler *compiler)
 {
        /* Pushing the constant pool into the instruction stream. */
        sljit_uw* inst;
        sljit_uw* cpool_ptr;
        sljit_uw* cpool_end;
-       sljit_si i;
+       sljit_s32 i;
 
        /* The label could point the address after the constant pool. */
        if (compiler->last_label && compiler->last_label->size == compiler->size)
@@ -164,7 +164,7 @@ static sljit_si push_cpool(struct sljit_compiler *compiler)
        return SLJIT_SUCCESS;
 }
 
-static sljit_si push_inst(struct sljit_compiler *compiler, sljit_uw inst)
+static sljit_s32 push_inst(struct sljit_compiler *compiler, sljit_uw inst)
 {
        sljit_uw* ptr;
 
@@ -178,13 +178,13 @@ static sljit_si push_inst(struct sljit_compiler *compiler, sljit_uw inst)
        return SLJIT_SUCCESS;
 }
 
-static sljit_si push_inst_with_literal(struct sljit_compiler *compiler, sljit_uw inst, sljit_uw literal)
+static sljit_s32 push_inst_with_literal(struct sljit_compiler *compiler, sljit_uw inst, sljit_uw literal)
 {
        sljit_uw* ptr;
        sljit_uw cpool_index = CPOOL_SIZE;
        sljit_uw* cpool_ptr;
        sljit_uw* cpool_end;
-       sljit_ub* cpool_unique_ptr;
+       sljit_u8* cpool_unique_ptr;
 
        if (SLJIT_UNLIKELY(compiler->cpool_diff != CONST_POOL_EMPTY && compiler->size - compiler->cpool_diff >= MAX_DIFFERENCE(4092)))
                FAIL_IF(push_cpool(compiler));
@@ -228,7 +228,7 @@ static sljit_si push_inst_with_literal(struct sljit_compiler *compiler, sljit_uw
        return SLJIT_SUCCESS;
 }
 
-static sljit_si push_inst_with_unique_literal(struct sljit_compiler *compiler, sljit_uw inst, sljit_uw literal)
+static sljit_s32 push_inst_with_unique_literal(struct sljit_compiler *compiler, sljit_uw inst, sljit_uw literal)
 {
        sljit_uw* ptr;
        if (SLJIT_UNLIKELY((compiler->cpool_diff != CONST_POOL_EMPTY && compiler->size - compiler->cpool_diff >= MAX_DIFFERENCE(4092)) || compiler->cpool_fill >= CPOOL_SIZE))
@@ -248,7 +248,7 @@ static sljit_si push_inst_with_unique_literal(struct sljit_compiler *compiler, s
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si prepare_blx(struct sljit_compiler *compiler)
+static SLJIT_INLINE sljit_s32 prepare_blx(struct sljit_compiler *compiler)
 {
        /* Place for at least two instruction (doesn't matter whether the first has a literal). */
        if (SLJIT_UNLIKELY(compiler->cpool_diff != CONST_POOL_EMPTY && compiler->size - compiler->cpool_diff >= MAX_DIFFERENCE(4088)))
@@ -256,7 +256,7 @@ static SLJIT_INLINE sljit_si prepare_blx(struct sljit_compiler *compiler)
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si emit_blx(struct sljit_compiler *compiler)
+static SLJIT_INLINE sljit_s32 emit_blx(struct sljit_compiler *compiler)
 {
        /* Must follow tightly the previous instruction (to be able to convert it to bl instruction). */
        SLJIT_ASSERT(compiler->cpool_diff == CONST_POOL_EMPTY || compiler->size - compiler->cpool_diff < MAX_DIFFERENCE(4092));
@@ -286,7 +286,7 @@ static sljit_uw patch_pc_relative_loads(sljit_uw *last_pc_patch, sljit_uw *code_
 
                        /* Must be a load instruction with immediate offset. */
                        SLJIT_ASSERT(ind < cpool_size && !(*last_pc_patch & (1 << 25)) && (*last_pc_patch & (1 << 20)));
-                       if ((sljit_si)const_pool[ind] < 0) {
+                       if ((sljit_s32)const_pool[ind] < 0) {
                                const_pool[ind] = counter;
                                ind = counter;
                                counter++;
@@ -311,26 +311,26 @@ static sljit_uw patch_pc_relative_loads(sljit_uw *last_pc_patch, sljit_uw *code_
 /* In some rare ocasions we may need future patches. The probability is close to 0 in practice. */
 struct future_patch {
        struct future_patch* next;
-       sljit_si index;
-       sljit_si value;
+       sljit_s32 index;
+       sljit_s32 value;
 };
 
-static sljit_si resolve_const_pool_index(struct sljit_compiler *compiler, struct future_patch **first_patch, sljit_uw cpool_current_index, sljit_uw *cpool_start_address, sljit_uw *buf_ptr)
+static sljit_s32 resolve_const_pool_index(struct sljit_compiler *compiler, struct future_patch **first_patch, sljit_uw cpool_current_index, sljit_uw *cpool_start_address, sljit_uw *buf_ptr)
 {
-       sljit_si value;
+       sljit_s32 value;
        struct future_patch *curr_patch, *prev_patch;
 
        SLJIT_UNUSED_ARG(compiler);
 
        /* Using the values generated by patch_pc_relative_loads. */
        if (!*first_patch)
-               value = (sljit_si)cpool_start_address[cpool_current_index];
+               value = (sljit_s32)cpool_start_address[cpool_current_index];
        else {
                curr_patch = *first_patch;
-               prev_patch = 0;
+               prev_patch = NULL;
                while (1) {
                        if (!curr_patch) {
-                               value = (sljit_si)cpool_start_address[cpool_current_index];
+                               value = (sljit_s32)cpool_start_address[cpool_current_index];
                                break;
                        }
                        if ((sljit_uw)curr_patch->index == cpool_current_index) {
@@ -370,7 +370,7 @@ static sljit_si resolve_const_pool_index(struct sljit_compiler *compiler, struct
 
 #else
 
-static sljit_si push_inst(struct sljit_compiler *compiler, sljit_uw inst)
+static sljit_s32 push_inst(struct sljit_compiler *compiler, sljit_uw inst)
 {
        sljit_uw* ptr;
 
@@ -381,7 +381,7 @@ static sljit_si push_inst(struct sljit_compiler *compiler, sljit_uw inst)
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si emit_imm(struct sljit_compiler *compiler, sljit_si reg, sljit_sw imm)
+static SLJIT_INLINE sljit_s32 emit_imm(struct sljit_compiler *compiler, sljit_s32 reg, sljit_sw imm)
 {
        FAIL_IF(push_inst(compiler, MOVW | RD(reg) | ((imm << 4) & 0xf0000) | (imm & 0xfff)));
        return push_inst(compiler, MOVT | RD(reg) | ((imm >> 12) & 0xf0000) | ((imm >> 16) & 0xfff));
@@ -389,7 +389,7 @@ static SLJIT_INLINE sljit_si emit_imm(struct sljit_compiler *compiler, sljit_si
 
 #endif
 
-static SLJIT_INLINE sljit_si detect_jump_type(struct sljit_jump *jump, sljit_uw *code_ptr, sljit_uw *code)
+static SLJIT_INLINE sljit_s32 detect_jump_type(struct sljit_jump *jump, sljit_uw *code_ptr, sljit_uw *code)
 {
        sljit_sw diff;
 
@@ -446,13 +446,13 @@ static SLJIT_INLINE sljit_si detect_jump_type(struct sljit_jump *jump, sljit_uw
        return 0;
 }
 
-static SLJIT_INLINE void inline_set_jump_addr(sljit_uw addr, sljit_uw new_addr, sljit_si flush)
+static SLJIT_INLINE void inline_set_jump_addr(sljit_uw addr, sljit_uw new_addr, sljit_s32 flush)
 {
 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
        sljit_uw *ptr = (sljit_uw*)addr;
        sljit_uw *inst = (sljit_uw*)ptr[0];
        sljit_uw mov_pc = ptr[1];
-       sljit_si bl = (mov_pc & 0x0000f000) != RD(TMP_PC);
+       sljit_s32 bl = (mov_pc & 0x0000f000) != RD(TMP_PC);
        sljit_sw diff = (sljit_sw)(((sljit_sw)new_addr - (sljit_sw)(inst + 2)) >> 2);
 
        if (diff <= 0x7fffff && diff >= -0x800000) {
@@ -504,7 +504,7 @@ static SLJIT_INLINE void inline_set_jump_addr(sljit_uw addr, sljit_uw new_addr,
 
 static sljit_uw get_imm(sljit_uw imm);
 
-static SLJIT_INLINE void inline_set_const(sljit_uw addr, sljit_sw new_constant, sljit_si flush)
+static SLJIT_INLINE void inline_set_const(sljit_uw addr, sljit_sw new_constant, sljit_s32 flush)
 {
 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
        sljit_uw *ptr = (sljit_uw*)addr;
@@ -789,7 +789,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
        }
 #endif
 
-       SLJIT_ASSERT(code_ptr - code <= (sljit_si)size);
+       SLJIT_ASSERT(code_ptr - code <= (sljit_s32)size);
 
        compiler->error = SLJIT_ERR_COMPILED;
        compiler->executable_size = (code_ptr - code) * sizeof(sljit_uw);
@@ -820,16 +820,16 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
 #define EMIT_DATA_PROCESS_INS(opcode, set_flags, dst, src1, src2) \
        (0xe0000000 | ((opcode) << 21) | (set_flags) | RD(dst) | RN(src1) | (src2))
 
-static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si inp_flags,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w);
+static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 inp_flags,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w);
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
-       sljit_si size, i, tmp;
+       sljit_s32 size, i, tmp;
        sljit_uw push;
 
        CHECK_ERROR();
@@ -866,11 +866,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
-       sljit_si size;
+       sljit_s32 size;
 
        CHECK_ERROR();
        CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
@@ -881,9 +881,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compi
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si i, tmp;
+       sljit_s32 i, tmp;
        sljit_uw pop;
 
        CHECK_ERROR();
@@ -983,8 +983,8 @@ static sljit_sw data_transfer_insts[16] = {
        } \
        return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, flags & SET_FLAGS, dst, SLJIT_UNUSED, (reg_map[(flags & ARGS_SWAPPED) ? src1 : src2] << 8) | (opcode << 5) | 0x10 | ((flags & ARGS_SWAPPED) ? reg_map[src2] : reg_map[src1])));
 
-static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, sljit_si op, sljit_si flags,
-       sljit_si dst, sljit_si src1, sljit_si src2)
+static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 flags,
+       sljit_s32 dst, sljit_s32 src1, sljit_s32 src2)
 {
        sljit_sw mul_inst;
 
@@ -1001,17 +1001,17 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
                }
                return SLJIT_SUCCESS;
 
-       case SLJIT_MOV_UB:
-       case SLJIT_MOV_SB:
+       case SLJIT_MOV_U8:
+       case SLJIT_MOV_S8:
                SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & ARGS_SWAPPED));
                if ((flags & (REG_DEST | REG_SOURCE)) == (REG_DEST | REG_SOURCE)) {
 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
-                       if (op == SLJIT_MOV_UB)
+                       if (op == SLJIT_MOV_U8)
                                return push_inst(compiler, EMIT_DATA_PROCESS_INS(AND_DP, 0, dst, src2, SRC2_IMM | 0xff));
                        FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst, SLJIT_UNUSED, (24 << 7) | reg_map[src2])));
-                       return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst, SLJIT_UNUSED, (24 << 7) | (op == SLJIT_MOV_UB ? 0x20 : 0x40) | reg_map[dst]));
+                       return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst, SLJIT_UNUSED, (24 << 7) | (op == SLJIT_MOV_U8 ? 0x20 : 0x40) | reg_map[dst]));
 #else
-                       return push_inst(compiler, (op == SLJIT_MOV_UB ? UXTB : SXTB) | RD(dst) | RM(src2));
+                       return push_inst(compiler, (op == SLJIT_MOV_U8 ? UXTB : SXTB) | RD(dst) | RM(src2));
 #endif
                }
                else if (dst != src2) {
@@ -1022,15 +1022,15 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
                }
                return SLJIT_SUCCESS;
 
-       case SLJIT_MOV_UH:
-       case SLJIT_MOV_SH:
+       case SLJIT_MOV_U16:
+       case SLJIT_MOV_S16:
                SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & ARGS_SWAPPED));
                if ((flags & (REG_DEST | REG_SOURCE)) == (REG_DEST | REG_SOURCE)) {
 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
                        FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst, SLJIT_UNUSED, (16 << 7) | reg_map[src2])));
-                       return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst, SLJIT_UNUSED, (16 << 7) | (op == SLJIT_MOV_UH ? 0x20 : 0x40) | reg_map[dst]));
+                       return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst, SLJIT_UNUSED, (16 << 7) | (op == SLJIT_MOV_U16 ? 0x20 : 0x40) | reg_map[dst]));
 #else
-                       return push_inst(compiler, (op == SLJIT_MOV_UH ? UXTH : SXTH) | RD(dst) | RM(src2));
+                       return push_inst(compiler, (op == SLJIT_MOV_U16 ? UXTH : SXTH) | RD(dst) | RM(src2));
 #endif
                }
                else if (dst != src2) {
@@ -1139,7 +1139,7 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
    Returns with 0 if not possible. */
 static sljit_uw get_imm(sljit_uw imm)
 {
-       sljit_si rol;
+       sljit_s32 rol;
 
        if (imm <= 0xff)
                return SRC2_IMM | imm;
@@ -1175,12 +1175,12 @@ static sljit_uw get_imm(sljit_uw imm)
 }
 
 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
-static sljit_si generate_int(struct sljit_compiler *compiler, sljit_si reg, sljit_uw imm, sljit_si positive)
+static sljit_s32 generate_int(struct sljit_compiler *compiler, sljit_s32 reg, sljit_uw imm, sljit_s32 positive)
 {
        sljit_uw mask;
        sljit_uw imm1;
        sljit_uw imm2;
-       sljit_si rol;
+       sljit_s32 rol;
 
        /* Step1: Search a zero byte (8 continous zero bit). */
        mask = 0xff000000;
@@ -1286,7 +1286,7 @@ static sljit_si generate_int(struct sljit_compiler *compiler, sljit_si reg, slji
 }
 #endif
 
-static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si reg, sljit_uw imm)
+static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 reg, sljit_uw imm)
 {
        sljit_uw tmp;
 
@@ -1317,7 +1317,7 @@ static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si reg, sl
 }
 
 /* Helper function. Dst should be reg + value, using at most 1 instruction, flags does not set. */
-static sljit_si emit_set_delta(struct sljit_compiler *compiler, sljit_si dst, sljit_si reg, sljit_sw value)
+static sljit_s32 emit_set_delta(struct sljit_compiler *compiler, sljit_s32 dst, sljit_s32 reg, sljit_sw value)
 {
        if (value >= 0) {
                value = get_imm(value);
@@ -1333,7 +1333,7 @@ static sljit_si emit_set_delta(struct sljit_compiler *compiler, sljit_si dst, sl
 }
 
 /* Can perform an operation using at most 1 instruction. */
-static sljit_si getput_arg_fast(struct sljit_compiler *compiler, sljit_si inp_flags, sljit_si reg, sljit_si arg, sljit_sw argw)
+static sljit_s32 getput_arg_fast(struct sljit_compiler *compiler, sljit_s32 inp_flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
 {
        sljit_uw imm;
 
@@ -1408,7 +1408,7 @@ static sljit_si getput_arg_fast(struct sljit_compiler *compiler, sljit_si inp_fl
 /* See getput_arg below.
    Note: can_cache is called only for binary operators. Those
    operators always uses word arguments without write back. */
-static sljit_si can_cache(sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_sw next_argw)
+static sljit_s32 can_cache(sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
 {
        /* Immediate caching is not supported as it would be an operation on constant arguments. */
        if (arg & SLJIT_IMM)
@@ -1456,9 +1456,9 @@ static sljit_si can_cache(sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_
        }
 
 /* Emit the necessary instructions. See can_cache above. */
-static sljit_si getput_arg(struct sljit_compiler *compiler, sljit_si inp_flags, sljit_si reg, sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_sw next_argw)
+static sljit_s32 getput_arg(struct sljit_compiler *compiler, sljit_s32 inp_flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
 {
-       sljit_si tmp_r;
+       sljit_s32 tmp_r;
        sljit_sw max_delta;
        sljit_sw sign;
        sljit_uw imm;
@@ -1583,7 +1583,7 @@ static sljit_si getput_arg(struct sljit_compiler *compiler, sljit_si inp_flags,
        return push_inst(compiler, EMIT_DATA_TRANSFER(inp_flags, 1, inp_flags & WRITE_BACK, reg, arg & REG_MASK, reg_map[tmp_r] | (max_delta & 0xf00 ? SRC2_IMM : 0)));
 }
 
-static SLJIT_INLINE sljit_si emit_op_mem(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg, sljit_si arg, sljit_sw argw)
+static SLJIT_INLINE sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
 {
        if (getput_arg_fast(compiler, flags, reg, arg, argw))
                return compiler->error;
@@ -1592,17 +1592,17 @@ static SLJIT_INLINE sljit_si emit_op_mem(struct sljit_compiler *compiler, sljit_
        return getput_arg(compiler, flags, reg, arg, argw, 0, 0);
 }
 
-static SLJIT_INLINE sljit_si emit_op_mem2(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg, sljit_si arg1, sljit_sw arg1w, sljit_si arg2, sljit_sw arg2w)
+static SLJIT_INLINE sljit_s32 emit_op_mem2(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg1, sljit_sw arg1w, sljit_s32 arg2, sljit_sw arg2w)
 {
        if (getput_arg_fast(compiler, flags, reg, arg1, arg1w))
                return compiler->error;
        return getput_arg(compiler, flags, reg, arg1, arg1w, arg2, arg2w);
 }
 
-static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si inp_flags,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 inp_flags,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        /* arg1 goes to TMP_REG1 or src reg
           arg2 goes to TMP_REG2, imm or src reg
@@ -1610,25 +1610,25 @@ static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si i
           result goes to TMP_REG2, so put result can use TMP_REG1 and TMP_REG3. */
 
        /* We prefers register and simple consts. */
-       sljit_si dst_r;
-       sljit_si src1_r;
-       sljit_si src2_r = 0;
-       sljit_si sugg_src2_r = TMP_REG2;
-       sljit_si flags = GET_FLAGS(op) ? SET_FLAGS : 0;
+       sljit_s32 dst_r;
+       sljit_s32 src1_r;
+       sljit_s32 src2_r = 0;
+       sljit_s32 sugg_src2_r = TMP_REG2;
+       sljit_s32 flags = GET_FLAGS(op) ? SET_FLAGS : 0;
 
        compiler->cache_arg = 0;
        compiler->cache_argw = 0;
 
        /* Destination check. */
        if (SLJIT_UNLIKELY(dst == SLJIT_UNUSED)) {
-               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_SI && !(src2 & SLJIT_MEM))
+               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_S32 && !(src2 & SLJIT_MEM))
                        return SLJIT_SUCCESS;
                dst_r = TMP_REG2;
        }
        else if (FAST_IS_REG(dst)) {
                dst_r = dst;
                flags |= REG_DEST;
-               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_SI)
+               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_S32)
                        sugg_src2_r = dst_r;
        }
        else {
@@ -1695,7 +1695,7 @@ static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si i
                if (FAST_IS_REG(src2)) {
                        src2_r = src2;
                        flags |= REG_SOURCE;
-                       if (!(flags & REG_DEST) && op >= SLJIT_MOV && op <= SLJIT_MOVU_SI)
+                       if (!(flags & REG_DEST) && op >= SLJIT_MOV && op <= SLJIT_MOVU_S32)
                                dst_r = src2_r;
                }
                else do { /* do { } while(0) is used because of breaks. */
@@ -1804,7 +1804,7 @@ extern int __aeabi_idivmod(int numerator, int denominator);
 }
 #endif
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler, sljit_si op)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_op0(compiler, op));
@@ -1817,58 +1817,58 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
        case SLJIT_NOP:
                FAIL_IF(push_inst(compiler, NOP));
                break;
-       case SLJIT_LUMUL:
-       case SLJIT_LSMUL:
+       case SLJIT_LMUL_UW:
+       case SLJIT_LMUL_SW:
 #if (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
-               return push_inst(compiler, (op == SLJIT_LUMUL ? UMULL : SMULL)
+               return push_inst(compiler, (op == SLJIT_LMUL_UW ? UMULL : SMULL)
                        | (reg_map[SLJIT_R1] << 16)
                        | (reg_map[SLJIT_R0] << 12)
                        | (reg_map[SLJIT_R0] << 8)
                        | reg_map[SLJIT_R1]);
 #else
                FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, TMP_REG1, SLJIT_UNUSED, RM(SLJIT_R1))));
-               return push_inst(compiler, (op == SLJIT_LUMUL ? UMULL : SMULL)
+               return push_inst(compiler, (op == SLJIT_LMUL_UW ? UMULL : SMULL)
                        | (reg_map[SLJIT_R1] << 16)
                        | (reg_map[SLJIT_R0] << 12)
                        | (reg_map[SLJIT_R0] << 8)
                        | reg_map[TMP_REG1]);
 #endif
-       case SLJIT_UDIVMOD:
-       case SLJIT_SDIVMOD:
-       case SLJIT_UDIVI:
-       case SLJIT_SDIVI:
-               SLJIT_COMPILE_ASSERT((SLJIT_UDIVMOD & 0x2) == 0 && SLJIT_UDIVI - 0x2 == SLJIT_UDIVMOD, bad_div_opcode_assignments);
+       case SLJIT_DIVMOD_UW:
+       case SLJIT_DIVMOD_SW:
+       case SLJIT_DIV_UW:
+       case SLJIT_DIV_SW:
+               SLJIT_COMPILE_ASSERT((SLJIT_DIVMOD_UW & 0x2) == 0 && SLJIT_DIV_UW - 0x2 == SLJIT_DIVMOD_UW, bad_div_opcode_assignments);
                SLJIT_COMPILE_ASSERT(reg_map[2] == 1 && reg_map[3] == 2, bad_register_mapping);
 
-               if ((op >= SLJIT_UDIVI) && (compiler->scratches >= 3)) {
+               if ((op >= SLJIT_DIV_UW) && (compiler->scratches >= 3)) {
                        FAIL_IF(push_inst(compiler, 0xe52d2008 /* str r2, [sp, #-8]! */));
                        FAIL_IF(push_inst(compiler, 0xe58d1004 /* str r1, [sp, #4] */));
                }
-               else if ((op >= SLJIT_UDIVI) || (compiler->scratches >= 3))
-                       FAIL_IF(push_inst(compiler, 0xe52d0008 | (op >= SLJIT_UDIVI ? 0x1000 : 0x2000) /* str r1/r2, [sp, #-8]! */));
+               else if ((op >= SLJIT_DIV_UW) || (compiler->scratches >= 3))
+                       FAIL_IF(push_inst(compiler, 0xe52d0008 | (op >= SLJIT_DIV_UW ? 0x1000 : 0x2000) /* str r1/r2, [sp, #-8]! */));
 
 #if defined(__GNUC__)
                FAIL_IF(sljit_emit_ijump(compiler, SLJIT_FAST_CALL, SLJIT_IMM,
-                       ((op | 0x2) == SLJIT_UDIVI ? SLJIT_FUNC_OFFSET(__aeabi_uidivmod) : SLJIT_FUNC_OFFSET(__aeabi_idivmod))));
+                       ((op | 0x2) == SLJIT_DIV_UW ? SLJIT_FUNC_OFFSET(__aeabi_uidivmod) : SLJIT_FUNC_OFFSET(__aeabi_idivmod))));
 #else
 #error "Software divmod functions are needed"
 #endif
 
-               if ((op >= SLJIT_UDIVI) && (compiler->scratches >= 3)) {
+               if ((op >= SLJIT_DIV_UW) && (compiler->scratches >= 3)) {
                        FAIL_IF(push_inst(compiler, 0xe59d1004 /* ldr r1, [sp, #4] */));
                        FAIL_IF(push_inst(compiler, 0xe49d2008 /* ldr r2, [sp], #8 */));
                }
-               else if ((op >= SLJIT_UDIVI) || (compiler->scratches >= 3))
-                       return push_inst(compiler, 0xe49d0008 | (op >= SLJIT_UDIVI ? 0x1000 : 0x2000) /* ldr r1/r2, [sp], #8 */);
+               else if ((op >= SLJIT_DIV_UW) || (compiler->scratches >= 3))
+                       return push_inst(compiler, 0xe49d0008 | (op >= SLJIT_DIV_UW ? 0x1000 : 0x2000) /* ldr r1/r2, [sp], #8 */);
                return SLJIT_SUCCESS;
        }
 
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_op1(compiler, op, dst, dstw, src, srcw));
@@ -1877,40 +1877,40 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
 
        switch (GET_OPCODE(op)) {
        case SLJIT_MOV:
-       case SLJIT_MOV_UI:
-       case SLJIT_MOV_SI:
+       case SLJIT_MOV_U32:
+       case SLJIT_MOV_S32:
        case SLJIT_MOV_P:
                return emit_op(compiler, SLJIT_MOV, ALLOW_ANY_IMM, dst, dstw, TMP_REG1, 0, src, srcw);
 
-       case SLJIT_MOV_UB:
-               return emit_op(compiler, SLJIT_MOV_UB, ALLOW_ANY_IMM | BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_ub)srcw : srcw);
+       case SLJIT_MOV_U8:
+               return emit_op(compiler, SLJIT_MOV_U8, ALLOW_ANY_IMM | BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u8)srcw : srcw);
 
-       case SLJIT_MOV_SB:
-               return emit_op(compiler, SLJIT_MOV_SB, ALLOW_ANY_IMM | SIGNED_DATA | BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_sb)srcw : srcw);
+       case SLJIT_MOV_S8:
+               return emit_op(compiler, SLJIT_MOV_S8, ALLOW_ANY_IMM | SIGNED_DATA | BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s8)srcw : srcw);
 
-       case SLJIT_MOV_UH:
-               return emit_op(compiler, SLJIT_MOV_UH, ALLOW_ANY_IMM | HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_uh)srcw : srcw);
+       case SLJIT_MOV_U16:
+               return emit_op(compiler, SLJIT_MOV_U16, ALLOW_ANY_IMM | HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u16)srcw : srcw);
 
-       case SLJIT_MOV_SH:
-               return emit_op(compiler, SLJIT_MOV_SH, ALLOW_ANY_IMM | SIGNED_DATA | HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_sh)srcw : srcw);
+       case SLJIT_MOV_S16:
+               return emit_op(compiler, SLJIT_MOV_S16, ALLOW_ANY_IMM | SIGNED_DATA | HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s16)srcw : srcw);
 
        case SLJIT_MOVU:
-       case SLJIT_MOVU_UI:
-       case SLJIT_MOVU_SI:
+       case SLJIT_MOVU_U32:
+       case SLJIT_MOVU_S32:
        case SLJIT_MOVU_P:
                return emit_op(compiler, SLJIT_MOV, ALLOW_ANY_IMM | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
 
-       case SLJIT_MOVU_UB:
-               return emit_op(compiler, SLJIT_MOV_UB, ALLOW_ANY_IMM | BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_ub)srcw : srcw);
+       case SLJIT_MOVU_U8:
+               return emit_op(compiler, SLJIT_MOV_U8, ALLOW_ANY_IMM | BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u8)srcw : srcw);
 
-       case SLJIT_MOVU_SB:
-               return emit_op(compiler, SLJIT_MOV_SB, ALLOW_ANY_IMM | SIGNED_DATA | BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_sb)srcw : srcw);
+       case SLJIT_MOVU_S8:
+               return emit_op(compiler, SLJIT_MOV_S8, ALLOW_ANY_IMM | SIGNED_DATA | BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s8)srcw : srcw);
 
-       case SLJIT_MOVU_UH:
-               return emit_op(compiler, SLJIT_MOV_UH, ALLOW_ANY_IMM | HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_uh)srcw : srcw);
+       case SLJIT_MOVU_U16:
+               return emit_op(compiler, SLJIT_MOV_U16, ALLOW_ANY_IMM | HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u16)srcw : srcw);
 
-       case SLJIT_MOVU_SH:
-               return emit_op(compiler, SLJIT_MOV_SH, ALLOW_ANY_IMM | SIGNED_DATA | HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_sh)srcw : srcw);
+       case SLJIT_MOVU_S16:
+               return emit_op(compiler, SLJIT_MOV_S16, ALLOW_ANY_IMM | SIGNED_DATA | HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s16)srcw : srcw);
 
        case SLJIT_NOT:
                return emit_op(compiler, op, ALLOW_ANY_IMM, dst, dstw, TMP_REG1, 0, src, srcw);
@@ -1929,10 +1929,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_op2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
@@ -1971,20 +1971,20 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
 {
        CHECK_REG_INDEX(check_sljit_get_register_index(reg));
        return reg_map[reg];
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_float_register_index(sljit_si reg)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_float_register_index(sljit_s32 reg)
 {
        CHECK_REG_INDEX(check_sljit_get_float_register_index(reg));
        return reg << 1;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *compiler,
-       void *instruction, sljit_si size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
+       void *instruction, sljit_s32 size)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_op_custom(compiler, instruction, size));
@@ -2000,7 +2000,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *co
 
 /* 0 - no fpu
    1 - vfp */
-static sljit_si arm_fpu_type = -1;
+static sljit_s32 arm_fpu_type = -1;
 
 static void init_compiler(void)
 {
@@ -2011,7 +2011,7 @@ static void init_compiler(void)
        arm_fpu_type = 1;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
 {
 #ifdef SLJIT_IS_FPU_AVAILABLE
        return SLJIT_IS_FPU_AVAILABLE;
@@ -2026,7 +2026,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
 
 #define arm_fpu_type 1
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
 {
        /* Always available. */
        return 1;
@@ -2040,11 +2040,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
 #define EMIT_FPU_OPERATION(opcode, mode, dst, src1, src2) \
        ((opcode) | (mode) | ((dst) << 12) | (src1) | ((src2) << 16))
 
-static sljit_si emit_fop_mem(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg, sljit_si arg, sljit_sw argw)
+static sljit_s32 emit_fop_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
 {
        sljit_sw tmp;
        sljit_uw imm;
-       sljit_sw inst = VSTR_F32 | (flags & (SLJIT_SINGLE_OP | FPU_LOAD));
+       sljit_sw inst = VSTR_F32 | (flags & (SLJIT_F32_OP | FPU_LOAD));
        SLJIT_ASSERT(arg & SLJIT_MEM);
 
        if (SLJIT_UNLIKELY(arg & OFFS_REG_MASK)) {
@@ -2104,16 +2104,16 @@ static sljit_si emit_fop_mem(struct sljit_compiler *compiler, sljit_si flags, sl
        return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 1, TMP_REG3, reg, 0));
 }
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_convw_fromd(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
        if (src & SLJIT_MEM) {
-               FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_SINGLE_OP) | FPU_LOAD, TMP_FREG1, src, srcw));
+               FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, TMP_FREG1, src, srcw));
                src = TMP_FREG1;
        }
 
-       FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCVT_S32_F32, op & SLJIT_SINGLE_OP, TMP_FREG1, src, 0)));
+       FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCVT_S32_F32, op & SLJIT_F32_OP, TMP_FREG1, src, 0)));
 
        if (dst == SLJIT_UNUSED)
                return SLJIT_SUCCESS;
@@ -2125,11 +2125,11 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_convw_fromd(struct sljit_compiler *
        return emit_fop_mem(compiler, 0, TMP_FREG1, dst, dstw);
 }
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_convd_fromw(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
+       sljit_s32 dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
 
        if (FAST_IS_REG(src))
                FAIL_IF(push_inst(compiler, VMOV | RD(src) | (TMP_FREG1 << 16)));
@@ -2142,85 +2142,85 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_convd_fromw(struct sljit_compiler *
                FAIL_IF(push_inst(compiler, VMOV | RD(TMP_REG1) | (TMP_FREG1 << 16)));
        }
 
-       FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCVT_F32_S32, op & SLJIT_SINGLE_OP, dst_r, TMP_FREG1, 0)));
+       FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCVT_F32_S32, op & SLJIT_F32_OP, dst_r, TMP_FREG1, 0)));
 
        if (dst & SLJIT_MEM)
-               return emit_fop_mem(compiler, (op & SLJIT_SINGLE_OP), TMP_FREG1, dst, dstw);
+               return emit_fop_mem(compiler, (op & SLJIT_F32_OP), TMP_FREG1, dst, dstw);
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        if (src1 & SLJIT_MEM) {
-               FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_SINGLE_OP) | FPU_LOAD, TMP_FREG1, src1, src1w));
+               FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, TMP_FREG1, src1, src1w));
                src1 = TMP_FREG1;
        }
 
        if (src2 & SLJIT_MEM) {
-               FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_SINGLE_OP) | FPU_LOAD, TMP_FREG2, src2, src2w));
+               FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, TMP_FREG2, src2, src2w));
                src2 = TMP_FREG2;
        }
 
-       FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCMP_F32, op & SLJIT_SINGLE_OP, src1, src2, 0)));
+       FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCMP_F32, op & SLJIT_F32_OP, src1, src2, 0)));
        return push_inst(compiler, VMRS);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si dst_r;
+       sljit_s32 dst_r;
 
        CHECK_ERROR();
        compiler->cache_arg = 0;
        compiler->cache_argw = 0;
-       if (GET_OPCODE(op) != SLJIT_CONVD_FROMS)
-               op ^= SLJIT_SINGLE_OP;
+       if (GET_OPCODE(op) != SLJIT_CONV_F64_FROM_F32)
+               op ^= SLJIT_F32_OP;
 
-       SLJIT_COMPILE_ASSERT((SLJIT_SINGLE_OP == 0x100), float_transfer_bit_error);
+       SLJIT_COMPILE_ASSERT((SLJIT_F32_OP == 0x100), float_transfer_bit_error);
        SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw);
 
        dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
 
        if (src & SLJIT_MEM) {
-               FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_SINGLE_OP) | FPU_LOAD, dst_r, src, srcw));
+               FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, dst_r, src, srcw));
                src = dst_r;
        }
 
        switch (GET_OPCODE(op)) {
-       case SLJIT_DMOV:
+       case SLJIT_MOV_F64:
                if (src != dst_r) {
                        if (dst_r != TMP_FREG1)
-                               FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VMOV_F32, op & SLJIT_SINGLE_OP, dst_r, src, 0)));
+                               FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VMOV_F32, op & SLJIT_F32_OP, dst_r, src, 0)));
                        else
                                dst_r = src;
                }
                break;
-       case SLJIT_DNEG:
-               FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VNEG_F32, op & SLJIT_SINGLE_OP, dst_r, src, 0)));
+       case SLJIT_NEG_F64:
+               FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VNEG_F32, op & SLJIT_F32_OP, dst_r, src, 0)));
                break;
-       case SLJIT_DABS:
-               FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VABS_F32, op & SLJIT_SINGLE_OP, dst_r, src, 0)));
+       case SLJIT_ABS_F64:
+               FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VABS_F32, op & SLJIT_F32_OP, dst_r, src, 0)));
                break;
-       case SLJIT_CONVD_FROMS:
-               FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCVT_F64_F32, op & SLJIT_SINGLE_OP, dst_r, src, 0)));
-               op ^= SLJIT_SINGLE_OP;
+       case SLJIT_CONV_F64_FROM_F32:
+               FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCVT_F64_F32, op & SLJIT_F32_OP, dst_r, src, 0)));
+               op ^= SLJIT_F32_OP;
                break;
        }
 
        if (dst & SLJIT_MEM)
-               return emit_fop_mem(compiler, (op & SLJIT_SINGLE_OP), dst_r, dst, dstw);
+               return emit_fop_mem(compiler, (op & SLJIT_F32_OP), dst_r, dst, dstw);
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_si dst_r;
+       sljit_s32 dst_r;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_fop2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
@@ -2230,40 +2230,40 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compile
 
        compiler->cache_arg = 0;
        compiler->cache_argw = 0;
-       op ^= SLJIT_SINGLE_OP;
+       op ^= SLJIT_F32_OP;
 
        dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
 
        if (src2 & SLJIT_MEM) {
-               FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_SINGLE_OP) | FPU_LOAD, TMP_FREG2, src2, src2w));
+               FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, TMP_FREG2, src2, src2w));
                src2 = TMP_FREG2;
        }
 
        if (src1 & SLJIT_MEM) {
-               FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_SINGLE_OP) | FPU_LOAD, TMP_FREG1, src1, src1w));
+               FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, TMP_FREG1, src1, src1w));
                src1 = TMP_FREG1;
        }
 
        switch (GET_OPCODE(op)) {
-       case SLJIT_DADD:
-               FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VADD_F32, op & SLJIT_SINGLE_OP, dst_r, src2, src1)));
+       case SLJIT_ADD_F64:
+               FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VADD_F32, op & SLJIT_F32_OP, dst_r, src2, src1)));
                break;
 
-       case SLJIT_DSUB:
-               FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VSUB_F32, op & SLJIT_SINGLE_OP, dst_r, src2, src1)));
+       case SLJIT_SUB_F64:
+               FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VSUB_F32, op & SLJIT_F32_OP, dst_r, src2, src1)));
                break;
 
-       case SLJIT_DMUL:
-               FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VMUL_F32, op & SLJIT_SINGLE_OP, dst_r, src2, src1)));
+       case SLJIT_MUL_F64:
+               FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VMUL_F32, op & SLJIT_F32_OP, dst_r, src2, src1)));
                break;
 
-       case SLJIT_DDIV:
-               FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VDIV_F32, op & SLJIT_SINGLE_OP, dst_r, src2, src1)));
+       case SLJIT_DIV_F64:
+               FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VDIV_F32, op & SLJIT_F32_OP, dst_r, src2, src1)));
                break;
        }
 
        if (dst_r == TMP_FREG1)
-               FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_SINGLE_OP), TMP_FREG1, dst, dstw));
+               FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_F32_OP), TMP_FREG1, dst, dstw));
 
        return SLJIT_SUCCESS;
 }
@@ -2276,7 +2276,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compile
 /*  Other instructions                                                   */
 /* --------------------------------------------------------------------- */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw));
@@ -2299,7 +2299,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *c
        return getput_arg(compiler, WORD_DATA, TMP_REG2, dst, dstw, 0, 0);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_fast_return(compiler, src, srcw));
@@ -2326,33 +2326,33 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *
 /*  Conditional instructions                                             */
 /* --------------------------------------------------------------------- */
 
-static sljit_uw get_cc(sljit_si type)
+static sljit_uw get_cc(sljit_s32 type)
 {
        switch (type) {
        case SLJIT_EQUAL:
        case SLJIT_MUL_NOT_OVERFLOW:
-       case SLJIT_D_EQUAL:
+       case SLJIT_EQUAL_F64:
                return 0x00000000;
 
        case SLJIT_NOT_EQUAL:
        case SLJIT_MUL_OVERFLOW:
-       case SLJIT_D_NOT_EQUAL:
+       case SLJIT_NOT_EQUAL_F64:
                return 0x10000000;
 
        case SLJIT_LESS:
-       case SLJIT_D_LESS:
+       case SLJIT_LESS_F64:
                return 0x30000000;
 
        case SLJIT_GREATER_EQUAL:
-       case SLJIT_D_GREATER_EQUAL:
+       case SLJIT_GREATER_EQUAL_F64:
                return 0x20000000;
 
        case SLJIT_GREATER:
-       case SLJIT_D_GREATER:
+       case SLJIT_GREATER_F64:
                return 0x80000000;
 
        case SLJIT_LESS_EQUAL:
-       case SLJIT_D_LESS_EQUAL:
+       case SLJIT_LESS_EQUAL_F64:
                return 0x90000000;
 
        case SLJIT_SIG_LESS:
@@ -2368,11 +2368,11 @@ static sljit_uw get_cc(sljit_si type)
                return 0xd0000000;
 
        case SLJIT_OVERFLOW:
-       case SLJIT_D_UNORDERED:
+       case SLJIT_UNORDERED_F64:
                return 0x60000000;
 
        case SLJIT_NOT_OVERFLOW:
-       case SLJIT_D_ORDERED:
+       case SLJIT_ORDERED_F64:
                return 0x70000000;
 
        default:
@@ -2397,7 +2397,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compi
        return label;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_si type)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_s32 type)
 {
        struct sljit_jump *jump;
 
@@ -2438,7 +2438,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
        return jump;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compiler, sljit_si type, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
 {
        struct sljit_jump *jump;
 
@@ -2475,12 +2475,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compil
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw,
-       sljit_si type)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw,
+       sljit_s32 type)
 {
-       sljit_si dst_r, flags = GET_ALL_FLAGS(op);
+       sljit_s32 dst_r, flags = GET_ALL_FLAGS(op);
        sljit_uw cc, ins;
 
        CHECK_ERROR();
@@ -2528,10 +2528,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
        return (flags & SLJIT_SET_E) ? push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, SET_FLAGS, TMP_REG1, SLJIT_UNUSED, RM(dst_r))) : SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw init_value)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
 {
        struct sljit_const *const_;
-       sljit_si reg;
+       sljit_s32 reg;
 
        CHECK_ERROR_PTR();
        CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value));
index 044a675eee79e1bfc71e334f71075ff7d482e06d..d9958512c80ddefe8050b09844a0ef9fabf6381a 100644 (file)
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void)
+SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void)
 {
        return "ARM-64" SLJIT_CPUINFO;
 }
 
 /* Length of an instruction word */
-typedef sljit_ui sljit_ins;
+typedef sljit_u32 sljit_ins;
 
 #define TMP_ZERO       (0)
 
@@ -43,7 +43,7 @@ typedef sljit_ui sljit_ins;
 #define TMP_FREG1      (0)
 #define TMP_FREG2      (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1)
 
-static SLJIT_CONST sljit_ub reg_map[SLJIT_NUMBER_OF_REGISTERS + 8] = {
+static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 8] = {
   31, 0, 1, 2, 3, 4, 5, 6, 7, 12, 13, 14, 15, 16, 17, 8, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 29, 9, 10, 11, 30, 31
 };
 
@@ -124,7 +124,7 @@ static SLJIT_CONST sljit_ub reg_map[SLJIT_NUMBER_OF_REGISTERS + 8] = {
 
 /* dest_reg is the absolute name of the register
    Useful for reordering instructions in the delay slot. */
-static sljit_si push_inst(struct sljit_compiler *compiler, sljit_ins ins)
+static sljit_s32 push_inst(struct sljit_compiler *compiler, sljit_ins ins)
 {
        sljit_ins *ptr = (sljit_ins*)ensure_buf(compiler, sizeof(sljit_ins));
        FAIL_IF(!ptr);
@@ -133,7 +133,7 @@ static sljit_si push_inst(struct sljit_compiler *compiler, sljit_ins ins)
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si emit_imm64_const(struct sljit_compiler *compiler, sljit_si dst, sljit_uw imm)
+static SLJIT_INLINE sljit_s32 emit_imm64_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_uw imm)
 {
        FAIL_IF(push_inst(compiler, MOVZ | RD(dst) | ((imm & 0xffff) << 5)));
        FAIL_IF(push_inst(compiler, MOVK | RD(dst) | (((imm >> 16) & 0xffff) << 5) | (1 << 21)));
@@ -143,7 +143,7 @@ static SLJIT_INLINE sljit_si emit_imm64_const(struct sljit_compiler *compiler, s
 
 static SLJIT_INLINE void modify_imm64_const(sljit_ins* inst, sljit_uw new_imm)
 {
-       sljit_si dst = inst[0] & 0x1f;
+       sljit_s32 dst = inst[0] & 0x1f;
        SLJIT_ASSERT((inst[0] & 0xffe00000) == MOVZ && (inst[1] & 0xffe00000) == (MOVK | (1 << 21)));
        inst[0] = MOVZ | dst | ((new_imm & 0xffff) << 5);
        inst[1] = MOVK | dst | (((new_imm >> 16) & 0xffff) << 5) | (1 << 21);
@@ -151,7 +151,7 @@ static SLJIT_INLINE void modify_imm64_const(sljit_ins* inst, sljit_uw new_imm)
        inst[3] = MOVK | dst | ((new_imm >> 48) << 5) | (3 << 21);
 }
 
-static SLJIT_INLINE sljit_si detect_jump_type(struct sljit_jump *jump, sljit_ins *code_ptr, sljit_ins *code)
+static SLJIT_INLINE sljit_s32 detect_jump_type(struct sljit_jump *jump, sljit_ins *code_ptr, sljit_ins *code)
 {
        sljit_sw diff;
        sljit_uw target_addr;
@@ -212,7 +212,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
        sljit_ins *buf_end;
        sljit_uw word_count;
        sljit_uw addr;
-       sljit_si dst;
+       sljit_s32 dst;
 
        struct sljit_label *label;
        struct sljit_jump *jump;
@@ -346,9 +346,9 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
 
 #define LOGICAL_IMM_CHECK 0x100
 
-static sljit_ins logical_imm(sljit_sw imm, sljit_si len)
+static sljit_ins logical_imm(sljit_sw imm, sljit_s32 len)
 {
-       sljit_si negated, ones, right;
+       sljit_s32 negated, ones, right;
        sljit_uw mask, uimm;
        sljit_ins ins;
 
@@ -356,12 +356,12 @@ static sljit_ins logical_imm(sljit_sw imm, sljit_si len)
                len &= ~LOGICAL_IMM_CHECK;
                if (len == 32 && (imm == 0 || imm == -1))
                        return 0;
-               if (len == 16 && ((sljit_si)imm == 0 || (sljit_si)imm == -1))
+               if (len == 16 && ((sljit_s32)imm == 0 || (sljit_s32)imm == -1))
                        return 0;
        }
 
        SLJIT_ASSERT((len == 32 && imm != 0 && imm != -1)
-               || (len == 16 && (sljit_si)imm != 0 && (sljit_si)imm != -1));
+               || (len == 16 && (sljit_s32)imm != 0 && (sljit_s32)imm != -1));
        uimm = (sljit_uw)imm;
        while (1) {
                if (len <= 0) {
@@ -410,10 +410,10 @@ static sljit_ins logical_imm(sljit_sw imm, sljit_si len)
 
 #undef COUNT_TRAILING_ZERO
 
-static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si dst, sljit_sw simm)
+static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw simm)
 {
        sljit_uw imm = (sljit_uw)simm;
-       sljit_si i, zeros, ones, first;
+       sljit_s32 i, zeros, ones, first;
        sljit_ins bitmask;
 
        if (imm <= 0xffff)
@@ -512,15 +512,15 @@ static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si dst, sl
                        dst = TMP_ZERO; \
        }
 
-static sljit_si emit_op_imm(struct sljit_compiler *compiler, sljit_si flags, sljit_si dst, sljit_sw arg1, sljit_sw arg2)
+static sljit_s32 emit_op_imm(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 dst, sljit_sw arg1, sljit_sw arg2)
 {
        /* dst must be register, TMP_REG1
           arg1 must be register, TMP_REG1, imm
           arg2 must be register, TMP_REG2, imm */
        sljit_ins inv_bits = (flags & INT_OP) ? (1 << 31) : 0;
        sljit_ins inst_bits;
-       sljit_si op = (flags & 0xffff);
-       sljit_si reg;
+       sljit_s32 op = (flags & 0xffff);
+       sljit_s32 reg;
        sljit_sw imm, nimm;
 
        if (SLJIT_UNLIKELY((flags & (ARG1_IMM | ARG2_IMM)) == (ARG1_IMM | ARG2_IMM))) {
@@ -667,34 +667,34 @@ static sljit_si emit_op_imm(struct sljit_compiler *compiler, sljit_si flags, slj
                if (dst == arg2)
                        return SLJIT_SUCCESS;
                return push_inst(compiler, ORR | RD(dst) | RN(TMP_ZERO) | RM(arg2));
-       case SLJIT_MOV_UB:
-       case SLJIT_MOVU_UB:
+       case SLJIT_MOV_U8:
+       case SLJIT_MOVU_U8:
                SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
                return push_inst(compiler, (UBFM ^ (1 << 31)) | RD(dst) | RN(arg2) | (7 << 10));
-       case SLJIT_MOV_SB:
-       case SLJIT_MOVU_SB:
+       case SLJIT_MOV_S8:
+       case SLJIT_MOVU_S8:
                SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
                if (!(flags & INT_OP))
                        inv_bits |= 1 << 22;
                return push_inst(compiler, (SBFM ^ inv_bits) | RD(dst) | RN(arg2) | (7 << 10));
-       case SLJIT_MOV_UH:
-       case SLJIT_MOVU_UH:
+       case SLJIT_MOV_U16:
+       case SLJIT_MOVU_U16:
                SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
                return push_inst(compiler, (UBFM ^ (1 << 31)) | RD(dst) | RN(arg2) | (15 << 10));
-       case SLJIT_MOV_SH:
-       case SLJIT_MOVU_SH:
+       case SLJIT_MOV_S16:
+       case SLJIT_MOVU_S16:
                SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
                if (!(flags & INT_OP))
                        inv_bits |= 1 << 22;
                return push_inst(compiler, (SBFM ^ inv_bits) | RD(dst) | RN(arg2) | (15 << 10));
-       case SLJIT_MOV_UI:
-       case SLJIT_MOVU_UI:
+       case SLJIT_MOV_U32:
+       case SLJIT_MOVU_U32:
                SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
                if ((flags & INT_OP) && dst == arg2)
                        return SLJIT_SUCCESS;
                return push_inst(compiler, (ORR ^ (1 << 31)) | RD(dst) | RN(TMP_ZERO) | RM(arg2));
-       case SLJIT_MOV_SI:
-       case SLJIT_MOVU_SI:
+       case SLJIT_MOV_S32:
+       case SLJIT_MOVU_S32:
                SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
                if ((flags & INT_OP) && dst == arg2)
                        return SLJIT_SUCCESS;
@@ -777,28 +777,28 @@ set_flags:
 
 #define MEM_SIZE_SHIFT(flags) ((flags) >> 8)
 
-static SLJIT_CONST sljit_ins sljit_mem_imm[4] = {
+static const sljit_ins sljit_mem_imm[4] = {
 /* u l */ 0x39400000 /* ldrb [reg,imm] */,
 /* u s */ 0x39000000 /* strb [reg,imm] */,
 /* s l */ 0x39800000 /* ldrsb [reg,imm] */,
 /* s s */ 0x39000000 /* strb [reg,imm] */,
 };
 
-static SLJIT_CONST sljit_ins sljit_mem_simm[4] = {
+static const sljit_ins sljit_mem_simm[4] = {
 /* u l */ 0x38400000 /* ldurb [reg,imm] */,
 /* u s */ 0x38000000 /* sturb [reg,imm] */,
 /* s l */ 0x38800000 /* ldursb [reg,imm] */,
 /* s s */ 0x38000000 /* sturb [reg,imm] */,
 };
 
-static SLJIT_CONST sljit_ins sljit_mem_pre_simm[4] = {
+static const sljit_ins sljit_mem_pre_simm[4] = {
 /* u l */ 0x38400c00 /* ldrb [reg,imm]! */,
 /* u s */ 0x38000c00 /* strb [reg,imm]! */,
 /* s l */ 0x38800c00 /* ldrsb [reg,imm]! */,
 /* s s */ 0x38000c00 /* strb [reg,imm]! */,
 };
 
-static SLJIT_CONST sljit_ins sljit_mem_reg[4] = {
+static const sljit_ins sljit_mem_reg[4] = {
 /* u l */ 0x38606800 /* ldrb [reg,reg] */,
 /* u s */ 0x38206800 /* strb [reg,reg] */,
 /* s l */ 0x38a06800 /* ldrsb [reg,reg] */,
@@ -806,7 +806,7 @@ static SLJIT_CONST sljit_ins sljit_mem_reg[4] = {
 };
 
 /* Helper function. Dst should be reg + value, using at most 1 instruction, flags does not set. */
-static sljit_si emit_set_delta(struct sljit_compiler *compiler, sljit_si dst, sljit_si reg, sljit_sw value)
+static sljit_s32 emit_set_delta(struct sljit_compiler *compiler, sljit_s32 dst, sljit_s32 reg, sljit_sw value)
 {
        if (value >= 0) {
                if (value <= 0xfff)
@@ -825,9 +825,9 @@ static sljit_si emit_set_delta(struct sljit_compiler *compiler, sljit_si dst, sl
 }
 
 /* Can perform an operation using at most 1 instruction. */
-static sljit_si getput_arg_fast(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg, sljit_si arg, sljit_sw argw)
+static sljit_s32 getput_arg_fast(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
 {
-       sljit_ui shift = MEM_SIZE_SHIFT(flags);
+       sljit_u32 shift = MEM_SIZE_SHIFT(flags);
 
        SLJIT_ASSERT(arg & SLJIT_MEM);
 
@@ -882,7 +882,7 @@ static sljit_si getput_arg_fast(struct sljit_compiler *compiler, sljit_si flags,
 /* see getput_arg below.
    Note: can_cache is called only for binary operators. Those
    operators always uses word arguments without write back. */
-static sljit_si can_cache(sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_sw next_argw)
+static sljit_s32 can_cache(sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
 {
        sljit_sw diff;
        if ((arg & OFFS_REG_MASK) || !(next_arg & SLJIT_MEM))
@@ -906,11 +906,11 @@ static sljit_si can_cache(sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_
 }
 
 /* Emit the necessary instructions. See can_cache above. */
-static sljit_si getput_arg(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg,
-       sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_sw next_argw)
+static sljit_s32 getput_arg(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg,
+       sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
 {
-       sljit_ui shift = MEM_SIZE_SHIFT(flags);
-       sljit_si tmp_r, other_r;
+       sljit_u32 shift = MEM_SIZE_SHIFT(flags);
+       sljit_s32 tmp_r, other_r;
        sljit_sw diff;
 
        SLJIT_ASSERT(arg & SLJIT_MEM);
@@ -1040,7 +1040,7 @@ static sljit_si getput_arg(struct sljit_compiler *compiler, sljit_si flags, slji
        return push_inst(compiler, sljit_mem_imm[flags & 0x3] | (shift << 30) | RT(reg) | RN(TMP_REG3));
 }
 
-static SLJIT_INLINE sljit_si emit_op_mem(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg, sljit_si arg, sljit_sw argw)
+static SLJIT_INLINE sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
 {
        if (getput_arg_fast(compiler, flags, reg, arg, argw))
                return compiler->error;
@@ -1049,7 +1049,7 @@ static SLJIT_INLINE sljit_si emit_op_mem(struct sljit_compiler *compiler, sljit_
        return getput_arg(compiler, flags, reg, arg, argw, 0, 0);
 }
 
-static SLJIT_INLINE sljit_si emit_op_mem2(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg, sljit_si arg1, sljit_sw arg1w, sljit_si arg2, sljit_sw arg2w)
+static SLJIT_INLINE sljit_s32 emit_op_mem2(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg1, sljit_sw arg1w, sljit_s32 arg2, sljit_sw arg2w)
 {
        if (getput_arg_fast(compiler, flags, reg, arg1, arg1w))
                return compiler->error;
@@ -1060,11 +1060,11 @@ static SLJIT_INLINE sljit_si emit_op_mem2(struct sljit_compiler *compiler, sljit
 /*  Entry, exit                                                          */
 /* --------------------------------------------------------------------- */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
-       sljit_si i, tmp, offs, prev, saved_regs_size;
+       sljit_s32 i, tmp, offs, prev, saved_regs_size;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
@@ -1148,9 +1148,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
        CHECK_ERROR();
        CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
@@ -1162,10 +1162,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compi
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si local_size;
-       sljit_si i, tmp, offs, prev, saved_regs_size;
+       sljit_s32 local_size;
+       sljit_s32 i, tmp, offs, prev, saved_regs_size;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_return(compiler, op, src, srcw));
@@ -1243,9 +1243,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
 /*  Operators                                                            */
 /* --------------------------------------------------------------------- */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler, sljit_si op)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op)
 {
-       sljit_ins inv_bits = (op & SLJIT_INT_OP) ? (1 << 31) : 0;
+       sljit_ins inv_bits = (op & SLJIT_I32_OP) ? (1 << 31) : 0;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_op0(compiler, op));
@@ -1256,31 +1256,31 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
                return push_inst(compiler, BRK);
        case SLJIT_NOP:
                return push_inst(compiler, NOP);
-       case SLJIT_LUMUL:
-       case SLJIT_LSMUL:
+       case SLJIT_LMUL_UW:
+       case SLJIT_LMUL_SW:
                FAIL_IF(push_inst(compiler, ORR | RD(TMP_REG1) | RN(TMP_ZERO) | RM(SLJIT_R0)));
                FAIL_IF(push_inst(compiler, MADD | RD(SLJIT_R0) | RN(SLJIT_R0) | RM(SLJIT_R1) | RT2(TMP_ZERO)));
-               return push_inst(compiler, (op == SLJIT_LUMUL ? UMULH : SMULH) | RD(SLJIT_R1) | RN(TMP_REG1) | RM(SLJIT_R1));
-       case SLJIT_UDIVMOD:
-       case SLJIT_SDIVMOD:
+               return push_inst(compiler, (op == SLJIT_LMUL_UW ? UMULH : SMULH) | RD(SLJIT_R1) | RN(TMP_REG1) | RM(SLJIT_R1));
+       case SLJIT_DIVMOD_UW:
+       case SLJIT_DIVMOD_SW:
                FAIL_IF(push_inst(compiler, (ORR ^ inv_bits) | RD(TMP_REG1) | RN(TMP_ZERO) | RM(SLJIT_R0)));
-               FAIL_IF(push_inst(compiler, ((op == SLJIT_UDIVMOD ? UDIV : SDIV) ^ inv_bits) | RD(SLJIT_R0) | RN(SLJIT_R0) | RM(SLJIT_R1)));
+               FAIL_IF(push_inst(compiler, ((op == SLJIT_DIVMOD_UW ? UDIV : SDIV) ^ inv_bits) | RD(SLJIT_R0) | RN(SLJIT_R0) | RM(SLJIT_R1)));
                FAIL_IF(push_inst(compiler, (MADD ^ inv_bits) | RD(SLJIT_R1) | RN(SLJIT_R0) | RM(SLJIT_R1) | RT2(TMP_ZERO)));
                return push_inst(compiler, (SUB ^ inv_bits) | RD(SLJIT_R1) | RN(TMP_REG1) | RM(SLJIT_R1));
-       case SLJIT_UDIVI:
-       case SLJIT_SDIVI:
-               return push_inst(compiler, ((op == SLJIT_UDIVI ? UDIV : SDIV) ^ inv_bits) | RD(SLJIT_R0) | RN(SLJIT_R0) | RM(SLJIT_R1));
+       case SLJIT_DIV_UW:
+       case SLJIT_DIV_SW:
+               return push_inst(compiler, ((op == SLJIT_DIV_UW ? UDIV : SDIV) ^ inv_bits) | RD(SLJIT_R0) | RN(SLJIT_R0) | RM(SLJIT_R1));
        }
 
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si dst_r, flags, mem_flags;
-       sljit_si op_flags = GET_ALL_FLAGS(op);
+       sljit_s32 dst_r, flags, mem_flags;
+       sljit_s32 op_flags = GET_ALL_FLAGS(op);
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_op1(compiler, op, dst, dstw, src, srcw));
@@ -1299,69 +1299,69 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
                case SLJIT_MOV_P:
                        flags = WORD_SIZE;
                        break;
-               case SLJIT_MOV_UB:
+               case SLJIT_MOV_U8:
                        flags = BYTE_SIZE;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_ub)srcw;
+                               srcw = (sljit_u8)srcw;
                        break;
-               case SLJIT_MOV_SB:
+               case SLJIT_MOV_S8:
                        flags = BYTE_SIZE | SIGNED;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_sb)srcw;
+                               srcw = (sljit_s8)srcw;
                        break;
-               case SLJIT_MOV_UH:
+               case SLJIT_MOV_U16:
                        flags = HALF_SIZE;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_uh)srcw;
+                               srcw = (sljit_u16)srcw;
                        break;
-               case SLJIT_MOV_SH:
+               case SLJIT_MOV_S16:
                        flags = HALF_SIZE | SIGNED;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_sh)srcw;
+                               srcw = (sljit_s16)srcw;
                        break;
-               case SLJIT_MOV_UI:
+               case SLJIT_MOV_U32:
                        flags = INT_SIZE;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_ui)srcw;
+                               srcw = (sljit_u32)srcw;
                        break;
-               case SLJIT_MOV_SI:
+               case SLJIT_MOV_S32:
                        flags = INT_SIZE | SIGNED;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_si)srcw;
+                               srcw = (sljit_s32)srcw;
                        break;
                case SLJIT_MOVU:
                case SLJIT_MOVU_P:
                        flags = WORD_SIZE | UPDATE;
                        break;
-               case SLJIT_MOVU_UB:
+               case SLJIT_MOVU_U8:
                        flags = BYTE_SIZE | UPDATE;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_ub)srcw;
+                               srcw = (sljit_u8)srcw;
                        break;
-               case SLJIT_MOVU_SB:
+               case SLJIT_MOVU_S8:
                        flags = BYTE_SIZE | SIGNED | UPDATE;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_sb)srcw;
+                               srcw = (sljit_s8)srcw;
                        break;
-               case SLJIT_MOVU_UH:
+               case SLJIT_MOVU_U16:
                        flags = HALF_SIZE | UPDATE;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_uh)srcw;
+                               srcw = (sljit_u16)srcw;
                        break;
-               case SLJIT_MOVU_SH:
+               case SLJIT_MOVU_S16:
                        flags = HALF_SIZE | SIGNED | UPDATE;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_sh)srcw;
+                               srcw = (sljit_s16)srcw;
                        break;
-               case SLJIT_MOVU_UI:
+               case SLJIT_MOVU_U32:
                        flags = INT_SIZE | UPDATE;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_ui)srcw;
+                               srcw = (sljit_u32)srcw;
                        break;
-               case SLJIT_MOVU_SI:
+               case SLJIT_MOVU_S32:
                        flags = INT_SIZE | SIGNED | UPDATE;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_si)srcw;
+                               srcw = (sljit_s32)srcw;
                        break;
                default:
                        SLJIT_ASSERT_STOP();
@@ -1378,7 +1378,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
                                FAIL_IF(getput_arg(compiler, flags, dst_r, src, srcw, dst, dstw));
                } else {
                        if (dst_r != TMP_REG1)
-                               return emit_op_imm(compiler, op | ((op_flags & SLJIT_INT_OP) ? INT_OP : 0), dst_r, TMP_REG1, src);
+                               return emit_op_imm(compiler, op | ((op_flags & SLJIT_I32_OP) ? INT_OP : 0), dst_r, TMP_REG1, src);
                        dst_r = src;
                }
 
@@ -1393,7 +1393,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
 
        flags = GET_FLAGS(op_flags) ? SET_FLAGS : 0;
        mem_flags = WORD_SIZE;
-       if (op_flags & SLJIT_INT_OP) {
+       if (op_flags & SLJIT_I32_OP) {
                flags |= INT_OP;
                mem_flags = INT_SIZE;
        }
@@ -1411,8 +1411,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
 
        if (src & SLJIT_IMM) {
                flags |= ARG2_IMM;
-               if (op_flags & SLJIT_INT_OP)
-                       srcw = (sljit_si)srcw;
+               if (op_flags & SLJIT_I32_OP)
+                       srcw = (sljit_s32)srcw;
        } else
                srcw = src;
 
@@ -1427,12 +1427,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_si dst_r, flags, mem_flags;
+       sljit_s32 dst_r, flags, mem_flags;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_op2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
@@ -1446,7 +1446,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
        dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG1;
        flags = GET_FLAGS(op) ? SET_FLAGS : 0;
        mem_flags = WORD_SIZE;
-       if (op & SLJIT_INT_OP) {
+       if (op & SLJIT_I32_OP) {
                flags |= INT_OP;
                mem_flags = INT_SIZE;
        }
@@ -1512,20 +1512,20 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
 {
        CHECK_REG_INDEX(check_sljit_get_register_index(reg));
        return reg_map[reg];
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_float_register_index(sljit_si reg)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_float_register_index(sljit_s32 reg)
 {
        CHECK_REG_INDEX(check_sljit_get_float_register_index(reg));
        return reg;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *compiler,
-       void *instruction, sljit_si size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
+       void *instruction, sljit_s32 size)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_op_custom(compiler, instruction, size));
@@ -1537,7 +1537,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *co
 /*  Floating point operators                                             */
 /* --------------------------------------------------------------------- */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
 {
 #ifdef SLJIT_IS_FPU_AVAILABLE
        return SLJIT_IS_FPU_AVAILABLE;
@@ -1547,11 +1547,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
 #endif
 }
 
-static sljit_si emit_fop_mem(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg, sljit_si arg, sljit_sw argw)
+static sljit_s32 emit_fop_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
 {
-       sljit_ui shift = MEM_SIZE_SHIFT(flags);
+       sljit_u32 shift = MEM_SIZE_SHIFT(flags);
        sljit_ins ins_bits = (shift << 30);
-       sljit_si other_r;
+       sljit_s32 other_r;
        sljit_sw diff;
 
        SLJIT_ASSERT(arg & SLJIT_MEM);
@@ -1600,45 +1600,45 @@ static sljit_si emit_fop_mem(struct sljit_compiler *compiler, sljit_si flags, sl
        return push_inst(compiler, STR_FI | ins_bits | VT(reg) | RN(TMP_REG3));
 }
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_convw_fromd(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG1;
-       sljit_ins inv_bits = (op & SLJIT_SINGLE_OP) ? (1 << 22) : 0;
+       sljit_s32 dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG1;
+       sljit_ins inv_bits = (op & SLJIT_F32_OP) ? (1 << 22) : 0;
 
-       if (GET_OPCODE(op) == SLJIT_CONVI_FROMD)
+       if (GET_OPCODE(op) == SLJIT_CONV_S32_FROM_F64)
                inv_bits |= (1 << 31);
 
        if (src & SLJIT_MEM) {
-               emit_fop_mem(compiler, (op & SLJIT_SINGLE_OP) ? INT_SIZE : WORD_SIZE, TMP_FREG1, src, srcw);
+               emit_fop_mem(compiler, (op & SLJIT_F32_OP) ? INT_SIZE : WORD_SIZE, TMP_FREG1, src, srcw);
                src = TMP_FREG1;
        }
 
        FAIL_IF(push_inst(compiler, (FCVTZS ^ inv_bits) | RD(dst_r) | VN(src)));
 
        if (dst_r == TMP_REG1 && dst != SLJIT_UNUSED)
-               return emit_op_mem(compiler, ((GET_OPCODE(op) == SLJIT_CONVI_FROMD) ? INT_SIZE : WORD_SIZE) | STORE, TMP_REG1, dst, dstw);
+               return emit_op_mem(compiler, ((GET_OPCODE(op) == SLJIT_CONV_S32_FROM_F64) ? INT_SIZE : WORD_SIZE) | STORE, TMP_REG1, dst, dstw);
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_convd_fromw(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
-       sljit_ins inv_bits = (op & SLJIT_SINGLE_OP) ? (1 << 22) : 0;
+       sljit_s32 dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
+       sljit_ins inv_bits = (op & SLJIT_F32_OP) ? (1 << 22) : 0;
 
-       if (GET_OPCODE(op) == SLJIT_CONVD_FROMI)
+       if (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_S32)
                inv_bits |= (1 << 31);
 
        if (src & SLJIT_MEM) {
-               emit_op_mem(compiler, ((GET_OPCODE(op) == SLJIT_CONVD_FROMI) ? INT_SIZE : WORD_SIZE), TMP_REG1, src, srcw);
+               emit_op_mem(compiler, ((GET_OPCODE(op) == SLJIT_CONV_F64_FROM_S32) ? INT_SIZE : WORD_SIZE), TMP_REG1, src, srcw);
                src = TMP_REG1;
        } else if (src & SLJIT_IMM) {
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-               if (GET_OPCODE(op) == SLJIT_CONVD_FROMI)
-                       srcw = (sljit_si)srcw;
+               if (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_S32)
+                       srcw = (sljit_s32)srcw;
 #endif
                FAIL_IF(load_immediate(compiler, TMP_REG1, srcw));
                src = TMP_REG1;
@@ -1647,16 +1647,16 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_convd_fromw(struct sljit_compiler *
        FAIL_IF(push_inst(compiler, (SCVTF ^ inv_bits) | VD(dst_r) | RN(src)));
 
        if (dst & SLJIT_MEM)
-               return emit_fop_mem(compiler, ((op & SLJIT_SINGLE_OP) ? INT_SIZE : WORD_SIZE) | STORE, TMP_FREG1, dst, dstw);
+               return emit_fop_mem(compiler, ((op & SLJIT_F32_OP) ? INT_SIZE : WORD_SIZE) | STORE, TMP_FREG1, dst, dstw);
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_si mem_flags = (op & SLJIT_SINGLE_OP) ? INT_SIZE : WORD_SIZE;
-       sljit_ins inv_bits = (op & SLJIT_SINGLE_OP) ? (1 << 22) : 0;
+       sljit_s32 mem_flags = (op & SLJIT_F32_OP) ? INT_SIZE : WORD_SIZE;
+       sljit_ins inv_bits = (op & SLJIT_F32_OP) ? (1 << 22) : 0;
 
        if (src1 & SLJIT_MEM) {
                emit_fop_mem(compiler, mem_flags, TMP_FREG1, src1, src1w);
@@ -1671,11 +1671,11 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_cmp(struct sljit_compiler *compiler
        return push_inst(compiler, (FCMP ^ inv_bits) | VN(src1) | VM(src2));
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si dst_r, mem_flags = (op & SLJIT_SINGLE_OP) ? INT_SIZE : WORD_SIZE;
+       sljit_s32 dst_r, mem_flags = (op & SLJIT_F32_OP) ? INT_SIZE : WORD_SIZE;
        sljit_ins inv_bits;
 
        CHECK_ERROR();
@@ -1685,16 +1685,16 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compile
        SLJIT_COMPILE_ASSERT((INT_SIZE ^ 0x100) == WORD_SIZE, must_be_one_bit_difference);
        SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw);
 
-       inv_bits = (op & SLJIT_SINGLE_OP) ? (1 << 22) : 0;
+       inv_bits = (op & SLJIT_F32_OP) ? (1 << 22) : 0;
        dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
 
        if (src & SLJIT_MEM) {
-               emit_fop_mem(compiler, (GET_OPCODE(op) == SLJIT_CONVD_FROMS) ? (mem_flags ^ 0x100) : mem_flags, dst_r, src, srcw);
+               emit_fop_mem(compiler, (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_F32) ? (mem_flags ^ 0x100) : mem_flags, dst_r, src, srcw);
                src = dst_r;
        }
 
        switch (GET_OPCODE(op)) {
-       case SLJIT_DMOV:
+       case SLJIT_MOV_F64:
                if (src != dst_r) {
                        if (dst_r != TMP_FREG1)
                                FAIL_IF(push_inst(compiler, (FMOV ^ inv_bits) | VD(dst_r) | VN(src)));
@@ -1702,14 +1702,14 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compile
                                dst_r = src;
                }
                break;
-       case SLJIT_DNEG:
+       case SLJIT_NEG_F64:
                FAIL_IF(push_inst(compiler, (FNEG ^ inv_bits) | VD(dst_r) | VN(src)));
                break;
-       case SLJIT_DABS:
+       case SLJIT_ABS_F64:
                FAIL_IF(push_inst(compiler, (FABS ^ inv_bits) | VD(dst_r) | VN(src)));
                break;
-       case SLJIT_CONVD_FROMS:
-               FAIL_IF(push_inst(compiler, FCVT | ((op & SLJIT_SINGLE_OP) ? (1 << 22) : (1 << 15)) | VD(dst_r) | VN(src)));
+       case SLJIT_CONV_F64_FROM_F32:
+               FAIL_IF(push_inst(compiler, FCVT | ((op & SLJIT_F32_OP) ? (1 << 22) : (1 << 15)) | VD(dst_r) | VN(src)));
                break;
        }
 
@@ -1718,13 +1718,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compile
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_si dst_r, mem_flags = (op & SLJIT_SINGLE_OP) ? INT_SIZE : WORD_SIZE;
-       sljit_ins inv_bits = (op & SLJIT_SINGLE_OP) ? (1 << 22) : 0;
+       sljit_s32 dst_r, mem_flags = (op & SLJIT_F32_OP) ? INT_SIZE : WORD_SIZE;
+       sljit_ins inv_bits = (op & SLJIT_F32_OP) ? (1 << 22) : 0;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_fop2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
@@ -1746,16 +1746,16 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compile
        }
 
        switch (GET_OPCODE(op)) {
-       case SLJIT_DADD:
+       case SLJIT_ADD_F64:
                FAIL_IF(push_inst(compiler, (FADD ^ inv_bits) | VD(dst_r) | VN(src1) | VM(src2)));
                break;
-       case SLJIT_DSUB:
+       case SLJIT_SUB_F64:
                FAIL_IF(push_inst(compiler, (FSUB ^ inv_bits) | VD(dst_r) | VN(src1) | VM(src2)));
                break;
-       case SLJIT_DMUL:
+       case SLJIT_MUL_F64:
                FAIL_IF(push_inst(compiler, (FMUL ^ inv_bits) | VD(dst_r) | VN(src1) | VM(src2)));
                break;
-       case SLJIT_DDIV:
+       case SLJIT_DIV_F64:
                FAIL_IF(push_inst(compiler, (FDIV ^ inv_bits) | VD(dst_r) | VN(src1) | VM(src2)));
                break;
        }
@@ -1769,7 +1769,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compile
 /*  Other instructions                                                   */
 /* --------------------------------------------------------------------- */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw));
@@ -1786,7 +1786,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *c
        return emit_op_mem(compiler, WORD_SIZE | STORE, TMP_LR, dst, dstw);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_fast_return(compiler, src, srcw));
@@ -1806,33 +1806,33 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *
 /*  Conditional instructions                                             */
 /* --------------------------------------------------------------------- */
 
-static sljit_uw get_cc(sljit_si type)
+static sljit_uw get_cc(sljit_s32 type)
 {
        switch (type) {
        case SLJIT_EQUAL:
        case SLJIT_MUL_NOT_OVERFLOW:
-       case SLJIT_D_EQUAL:
+       case SLJIT_EQUAL_F64:
                return 0x1;
 
        case SLJIT_NOT_EQUAL:
        case SLJIT_MUL_OVERFLOW:
-       case SLJIT_D_NOT_EQUAL:
+       case SLJIT_NOT_EQUAL_F64:
                return 0x0;
 
        case SLJIT_LESS:
-       case SLJIT_D_LESS:
+       case SLJIT_LESS_F64:
                return 0x2;
 
        case SLJIT_GREATER_EQUAL:
-       case SLJIT_D_GREATER_EQUAL:
+       case SLJIT_GREATER_EQUAL_F64:
                return 0x3;
 
        case SLJIT_GREATER:
-       case SLJIT_D_GREATER:
+       case SLJIT_GREATER_F64:
                return 0x9;
 
        case SLJIT_LESS_EQUAL:
-       case SLJIT_D_LESS_EQUAL:
+       case SLJIT_LESS_EQUAL_F64:
                return 0x8;
 
        case SLJIT_SIG_LESS:
@@ -1848,11 +1848,11 @@ static sljit_uw get_cc(sljit_si type)
                return 0xc;
 
        case SLJIT_OVERFLOW:
-       case SLJIT_D_UNORDERED:
+       case SLJIT_UNORDERED_F64:
                return 0x7;
 
        case SLJIT_NOT_OVERFLOW:
-       case SLJIT_D_ORDERED:
+       case SLJIT_ORDERED_F64:
                return 0x6;
 
        default:
@@ -1877,7 +1877,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compi
        return label;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_si type)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_s32 type)
 {
        struct sljit_jump *jump;
 
@@ -1903,11 +1903,11 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
        return jump;
 }
 
-static SLJIT_INLINE struct sljit_jump* emit_cmp_to0(struct sljit_compiler *compiler, sljit_si type,
-       sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE struct sljit_jump* emit_cmp_to0(struct sljit_compiler *compiler, sljit_s32 type,
+       sljit_s32 src, sljit_sw srcw)
 {
        struct sljit_jump *jump;
-       sljit_ins inv_bits = (type & SLJIT_INT_OP) ? (1 << 31) : 0;
+       sljit_ins inv_bits = (type & SLJIT_I32_OP) ? (1 << 31) : 0;
 
        SLJIT_ASSERT((type & 0xff) == SLJIT_EQUAL || (type & 0xff) == SLJIT_NOT_EQUAL);
        ADJUST_LOCAL_OFFSET(src, srcw);
@@ -1937,7 +1937,7 @@ static SLJIT_INLINE struct sljit_jump* emit_cmp_to0(struct sljit_compiler *compi
        return jump;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compiler, sljit_si type, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
 {
        struct sljit_jump *jump;
 
@@ -1964,12 +1964,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compil
        return push_inst(compiler, ((type >= SLJIT_FAST_CALL) ? BLR : BR) | RN(TMP_REG1));
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw,
-       sljit_si type)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw,
+       sljit_s32 type)
 {
-       sljit_si dst_r, flags, mem_flags;
+       sljit_s32 dst_r, flags, mem_flags;
        sljit_ins cc;
 
        CHECK_ERROR();
@@ -1994,7 +1994,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
        compiler->cache_argw = 0;
        flags = GET_FLAGS(op) ? SET_FLAGS : 0;
        mem_flags = WORD_SIZE;
-       if (op & SLJIT_INT_OP) {
+       if (op & SLJIT_I32_OP) {
                flags |= INT_OP;
                mem_flags = INT_SIZE;
        }
@@ -2014,10 +2014,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
        return emit_op_mem2(compiler, mem_flags | STORE, TMP_REG1, dst, dstw, 0, 0);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw init_value)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
 {
        struct sljit_const *const_;
-       sljit_si dst_r;
+       sljit_s32 dst_r;
 
        CHECK_ERROR_PTR();
        CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value));
index f9803f5d44f7b102a60f94384e083a7c8d1fdd1e..1ed44a8130388d4cc5d9d8eb8efd6494db8edc7b 100644 (file)
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void)
+SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void)
 {
        return "ARM-Thumb2" SLJIT_CPUINFO;
 }
 
 /* Length of an instruction word. */
-typedef sljit_ui sljit_ins;
+typedef sljit_u32 sljit_ins;
 
 /* Last register + 1. */
 #define TMP_REG1       (SLJIT_NUMBER_OF_REGISTERS + 2)
@@ -42,7 +42,7 @@ typedef sljit_ui sljit_ins;
 #define TMP_FREG2      (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1)
 
 /* See sljit_emit_enter and sljit_emit_op0 if you want to change them. */
-static SLJIT_CONST sljit_ub reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
+static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
        0, 0, 1, 2, 12, 11, 10, 9, 8, 7, 6, 5, 13, 3, 4, 14, 15
 };
 
@@ -181,21 +181,21 @@ static SLJIT_CONST sljit_ub reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
 #define VSTR_F32       0xed000a00
 #define VSUB_F32       0xee300a40
 
-static sljit_si push_inst16(struct sljit_compiler *compiler, sljit_ins inst)
+static sljit_s32 push_inst16(struct sljit_compiler *compiler, sljit_ins inst)
 {
-       sljit_uh *ptr;
+       sljit_u16 *ptr;
        SLJIT_ASSERT(!(inst & 0xffff0000));
 
-       ptr = (sljit_uh*)ensure_buf(compiler, sizeof(sljit_uh));
+       ptr = (sljit_u16*)ensure_buf(compiler, sizeof(sljit_u16));
        FAIL_IF(!ptr);
        *ptr = inst;
        compiler->size++;
        return SLJIT_SUCCESS;
 }
 
-static sljit_si push_inst32(struct sljit_compiler *compiler, sljit_ins inst)
+static sljit_s32 push_inst32(struct sljit_compiler *compiler, sljit_ins inst)
 {
-       sljit_uh *ptr = (sljit_uh*)ensure_buf(compiler, sizeof(sljit_ins));
+       sljit_u16 *ptr = (sljit_u16*)ensure_buf(compiler, sizeof(sljit_ins));
        FAIL_IF(!ptr);
        *ptr++ = inst >> 16;
        *ptr = inst;
@@ -203,7 +203,7 @@ static sljit_si push_inst32(struct sljit_compiler *compiler, sljit_ins inst)
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si emit_imm32_const(struct sljit_compiler *compiler, sljit_si dst, sljit_uw imm)
+static SLJIT_INLINE sljit_s32 emit_imm32_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_uw imm)
 {
        FAIL_IF(push_inst32(compiler, MOVW | RD4(dst) |
                COPY_BITS(imm, 12, 16, 4) | COPY_BITS(imm, 11, 26, 1) | COPY_BITS(imm, 8, 12, 3) | (imm & 0xff)));
@@ -211,9 +211,9 @@ static SLJIT_INLINE sljit_si emit_imm32_const(struct sljit_compiler *compiler, s
                COPY_BITS(imm, 12 + 16, 16, 4) | COPY_BITS(imm, 11 + 16, 26, 1) | COPY_BITS(imm, 8 + 16, 12, 3) | ((imm & 0xff0000) >> 16));
 }
 
-static SLJIT_INLINE void modify_imm32_const(sljit_uh *inst, sljit_uw new_imm)
+static SLJIT_INLINE void modify_imm32_const(sljit_u16 *inst, sljit_uw new_imm)
 {
-       sljit_si dst = inst[1] & 0x0f00;
+       sljit_s32 dst = inst[1] & 0x0f00;
        SLJIT_ASSERT(((inst[0] & 0xfbf0) == (MOVW >> 16)) && ((inst[2] & 0xfbf0) == (MOVT >> 16)) && dst == (inst[3] & 0x0f00));
        inst[0] = (MOVW >> 16) | COPY_BITS(new_imm, 12, 0, 4) | COPY_BITS(new_imm, 11, 10, 1);
        inst[1] = dst | COPY_BITS(new_imm, 8, 12, 3) | (new_imm & 0xff);
@@ -221,7 +221,7 @@ static SLJIT_INLINE void modify_imm32_const(sljit_uh *inst, sljit_uw new_imm)
        inst[3] = dst | COPY_BITS(new_imm, 8 + 16, 12, 3) | ((new_imm & 0xff0000) >> 16);
 }
 
-static SLJIT_INLINE sljit_si detect_jump_type(struct sljit_jump *jump, sljit_uh *code_ptr, sljit_uh *code)
+static SLJIT_INLINE sljit_s32 detect_jump_type(struct sljit_jump *jump, sljit_u16 *code_ptr, sljit_u16 *code)
 {
        sljit_sw diff;
 
@@ -278,13 +278,13 @@ static SLJIT_INLINE sljit_si detect_jump_type(struct sljit_jump *jump, sljit_uh
 
 static SLJIT_INLINE void set_jump_instruction(struct sljit_jump *jump)
 {
-       sljit_si type = (jump->flags >> 4) & 0xf;
+       sljit_s32 type = (jump->flags >> 4) & 0xf;
        sljit_sw diff;
-       sljit_uh *jump_inst;
-       sljit_si s, j1, j2;
+       sljit_u16 *jump_inst;
+       sljit_s32 s, j1, j2;
 
        if (SLJIT_UNLIKELY(type == 0)) {
-               modify_imm32_const((sljit_uh*)jump->addr, (jump->flags & JUMP_LABEL) ? jump->u.label->addr : jump->u.target);
+               modify_imm32_const((sljit_u16*)jump->addr, (jump->flags & JUMP_LABEL) ? jump->u.label->addr : jump->u.target);
                return;
        }
 
@@ -294,7 +294,7 @@ static SLJIT_INLINE void set_jump_instruction(struct sljit_jump *jump)
        }
        else
                diff = ((sljit_sw)(jump->u.label->addr) - (sljit_sw)(jump->addr + 4)) >> 1;
-       jump_inst = (sljit_uh*)jump->addr;
+       jump_inst = (sljit_u16*)jump->addr;
 
        switch (type) {
        case 1:
@@ -342,10 +342,10 @@ static SLJIT_INLINE void set_jump_instruction(struct sljit_jump *jump)
 SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler)
 {
        struct sljit_memory_fragment *buf;
-       sljit_uh *code;
-       sljit_uh *code_ptr;
-       sljit_uh *buf_ptr;
-       sljit_uh *buf_end;
+       sljit_u16 *code;
+       sljit_u16 *code_ptr;
+       sljit_u16 *buf_ptr;
+       sljit_u16 *buf_end;
        sljit_uw half_count;
 
        struct sljit_label *label;
@@ -356,7 +356,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
        CHECK_PTR(check_sljit_generate_code(compiler));
        reverse_buf(compiler);
 
-       code = (sljit_uh*)SLJIT_MALLOC_EXEC(compiler->size * sizeof(sljit_uh));
+       code = (sljit_u16*)SLJIT_MALLOC_EXEC(compiler->size * sizeof(sljit_u16));
        PTR_FAIL_WITH_EXEC_IF(code);
        buf = compiler->buf;
 
@@ -367,7 +367,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
        const_ = compiler->consts;
 
        do {
-               buf_ptr = (sljit_uh*)buf->memory;
+               buf_ptr = (sljit_u16*)buf->memory;
                buf_end = buf_ptr + (buf->used_size >> 1);
                do {
                        *code_ptr = *buf_ptr++;
@@ -414,7 +414,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
        }
 
        compiler->error = SLJIT_ERR_COMPILED;
-       compiler->executable_size = (code_ptr - code) * sizeof(sljit_uh);
+       compiler->executable_size = (code_ptr - code) * sizeof(sljit_u16);
        SLJIT_CACHE_FLUSH(code, code_ptr);
        /* Set thumb mode flag. */
        return (void*)((sljit_uw)code | 0x1);
@@ -428,7 +428,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
 static sljit_uw get_imm(sljit_uw imm)
 {
        /* Thumb immediate form. */
-       sljit_si counter;
+       sljit_s32 counter;
 
        if (imm <= 0xff)
                return imm;
@@ -474,7 +474,7 @@ static sljit_uw get_imm(sljit_uw imm)
        return ((imm >> 24) & 0x7f) | COPY_BITS(counter, 4, 26, 1) | COPY_BITS(counter, 1, 12, 3) | COPY_BITS(counter, 0, 7, 1);
 }
 
-static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si dst, sljit_uw imm)
+static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 dst, sljit_uw imm)
 {
        sljit_uw tmp;
 
@@ -508,12 +508,12 @@ static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si dst, sl
 #define SLOW_SRC1      0x0800000
 #define SLOW_SRC2      0x1000000
 
-static sljit_si emit_op_imm(struct sljit_compiler *compiler, sljit_si flags, sljit_si dst, sljit_uw arg1, sljit_uw arg2)
+static sljit_s32 emit_op_imm(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 dst, sljit_uw arg1, sljit_uw arg2)
 {
        /* dst must be register, TMP_REG1
           arg1 must be register, TMP_REG1, imm
           arg2 must be register, TMP_REG2, imm */
-       sljit_si reg;
+       sljit_s32 reg;
        sljit_uw imm, nimm;
 
        if (SLJIT_UNLIKELY((flags & (ARG1_IMM | ARG2_IMM)) == (ARG1_IMM | ARG2_IMM))) {
@@ -677,37 +677,37 @@ static sljit_si emit_op_imm(struct sljit_compiler *compiler, sljit_si flags, slj
        /* Both arguments are registers. */
        switch (flags & 0xffff) {
        case SLJIT_MOV:
-       case SLJIT_MOV_UI:
-       case SLJIT_MOV_SI:
+       case SLJIT_MOV_U32:
+       case SLJIT_MOV_S32:
        case SLJIT_MOV_P:
        case SLJIT_MOVU:
-       case SLJIT_MOVU_UI:
-       case SLJIT_MOVU_SI:
+       case SLJIT_MOVU_U32:
+       case SLJIT_MOVU_S32:
        case SLJIT_MOVU_P:
                SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
                if (dst == arg2)
                        return SLJIT_SUCCESS;
                return push_inst16(compiler, MOV | SET_REGS44(dst, arg2));
-       case SLJIT_MOV_UB:
-       case SLJIT_MOVU_UB:
+       case SLJIT_MOV_U8:
+       case SLJIT_MOVU_U8:
                SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
                if (IS_2_LO_REGS(dst, arg2))
                        return push_inst16(compiler, UXTB | RD3(dst) | RN3(arg2));
                return push_inst32(compiler, UXTB_W | RD4(dst) | RM4(arg2));
-       case SLJIT_MOV_SB:
-       case SLJIT_MOVU_SB:
+       case SLJIT_MOV_S8:
+       case SLJIT_MOVU_S8:
                SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
                if (IS_2_LO_REGS(dst, arg2))
                        return push_inst16(compiler, SXTB | RD3(dst) | RN3(arg2));
                return push_inst32(compiler, SXTB_W | RD4(dst) | RM4(arg2));
-       case SLJIT_MOV_UH:
-       case SLJIT_MOVU_UH:
+       case SLJIT_MOV_U16:
+       case SLJIT_MOVU_U16:
                SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
                if (IS_2_LO_REGS(dst, arg2))
                        return push_inst16(compiler, UXTH | RD3(dst) | RN3(arg2));
                return push_inst32(compiler, UXTH_W | RD4(dst) | RM4(arg2));
-       case SLJIT_MOV_SH:
-       case SLJIT_MOVU_SH:
+       case SLJIT_MOV_S16:
+       case SLJIT_MOVU_S16:
                SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
                if (IS_2_LO_REGS(dst, arg2))
                        return push_inst16(compiler, SXTH | RD3(dst) | RN3(arg2));
@@ -813,7 +813,7 @@ static sljit_si emit_op_imm(struct sljit_compiler *compiler, sljit_si flags, slj
   s = store
 */
 
-static SLJIT_CONST sljit_ins sljit_mem16[12] = {
+static const sljit_ins sljit_mem16[12] = {
 /* w u l */ 0x5800 /* ldr */,
 /* w u s */ 0x5000 /* str */,
 /* w s l */ 0x5800 /* ldr */,
@@ -830,7 +830,7 @@ static SLJIT_CONST sljit_ins sljit_mem16[12] = {
 /* h s s */ 0x5200 /* strh */,
 };
 
-static SLJIT_CONST sljit_ins sljit_mem16_imm5[12] = {
+static const sljit_ins sljit_mem16_imm5[12] = {
 /* w u l */ 0x6800 /* ldr imm5 */,
 /* w u s */ 0x6000 /* str imm5 */,
 /* w s l */ 0x6800 /* ldr imm5 */,
@@ -849,7 +849,7 @@ static SLJIT_CONST sljit_ins sljit_mem16_imm5[12] = {
 
 #define MEM_IMM8       0xc00
 #define MEM_IMM12      0x800000
-static SLJIT_CONST sljit_ins sljit_mem32[12] = {
+static const sljit_ins sljit_mem32[12] = {
 /* w u l */ 0xf8500000 /* ldr.w */,
 /* w u s */ 0xf8400000 /* str.w */,
 /* w s l */ 0xf8500000 /* ldr.w */,
@@ -867,7 +867,7 @@ static SLJIT_CONST sljit_ins sljit_mem32[12] = {
 };
 
 /* Helper function. Dst should be reg + value, using at most 1 instruction, flags does not set. */
-static sljit_si emit_set_delta(struct sljit_compiler *compiler, sljit_si dst, sljit_si reg, sljit_sw value)
+static sljit_s32 emit_set_delta(struct sljit_compiler *compiler, sljit_s32 dst, sljit_s32 reg, sljit_sw value)
 {
        if (value >= 0) {
                if (value <= 0xfff)
@@ -888,9 +888,9 @@ static sljit_si emit_set_delta(struct sljit_compiler *compiler, sljit_si dst, sl
 }
 
 /* Can perform an operation using at most 1 instruction. */
-static sljit_si getput_arg_fast(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg, sljit_si arg, sljit_sw argw)
+static sljit_s32 getput_arg_fast(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
 {
-       sljit_si other_r, shift;
+       sljit_s32 other_r, shift;
 
        SLJIT_ASSERT(arg & SLJIT_MEM);
 
@@ -975,7 +975,7 @@ static sljit_si getput_arg_fast(struct sljit_compiler *compiler, sljit_si flags,
 /* see getput_arg below.
    Note: can_cache is called only for binary operators. Those
    operators always uses word arguments without write back. */
-static sljit_si can_cache(sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_sw next_argw)
+static sljit_s32 can_cache(sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
 {
        sljit_sw diff;
        if ((arg & OFFS_REG_MASK) || !(next_arg & SLJIT_MEM))
@@ -999,10 +999,10 @@ static sljit_si can_cache(sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_
 }
 
 /* Emit the necessary instructions. See can_cache above. */
-static sljit_si getput_arg(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg,
-       sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_sw next_argw)
+static sljit_s32 getput_arg(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg,
+       sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
 {
-       sljit_si tmp_r, other_r;
+       sljit_s32 tmp_r, other_r;
        sljit_sw diff;
 
        SLJIT_ASSERT(arg & SLJIT_MEM);
@@ -1107,7 +1107,7 @@ static sljit_si getput_arg(struct sljit_compiler *compiler, sljit_si flags, slji
        return push_inst32(compiler, sljit_mem32[flags] | MEM_IMM12 | RT4(reg) | RN4(TMP_REG3) | 0);
 }
 
-static SLJIT_INLINE sljit_si emit_op_mem(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg, sljit_si arg, sljit_sw argw)
+static SLJIT_INLINE sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
 {
        if (getput_arg_fast(compiler, flags, reg, arg, argw))
                return compiler->error;
@@ -1116,7 +1116,7 @@ static SLJIT_INLINE sljit_si emit_op_mem(struct sljit_compiler *compiler, sljit_
        return getput_arg(compiler, flags, reg, arg, argw, 0, 0);
 }
 
-static SLJIT_INLINE sljit_si emit_op_mem2(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg, sljit_si arg1, sljit_sw arg1w, sljit_si arg2, sljit_sw arg2w)
+static SLJIT_INLINE sljit_s32 emit_op_mem2(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg1, sljit_sw arg1w, sljit_s32 arg2, sljit_sw arg2w)
 {
        if (getput_arg_fast(compiler, flags, reg, arg1, arg1w))
                return compiler->error;
@@ -1127,11 +1127,11 @@ static SLJIT_INLINE sljit_si emit_op_mem2(struct sljit_compiler *compiler, sljit
 /*  Entry, exit                                                          */
 /* --------------------------------------------------------------------- */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
-       sljit_si size, i, tmp;
+       sljit_s32 size, i, tmp;
        sljit_ins push;
 
        CHECK_ERROR();
@@ -1172,11 +1172,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
-       sljit_si size;
+       sljit_s32 size;
 
        CHECK_ERROR();
        CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
@@ -1187,9 +1187,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compi
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si i, tmp;
+       sljit_s32 i, tmp;
        sljit_ins pop;
 
        CHECK_ERROR();
@@ -1237,7 +1237,7 @@ extern int __aeabi_idivmod(int numerator, int denominator);
 }
 #endif
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler, sljit_si op)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op)
 {
        sljit_sw saved_reg_list[3];
        sljit_sw saved_reg_count;
@@ -1251,18 +1251,18 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
                return push_inst16(compiler, BKPT);
        case SLJIT_NOP:
                return push_inst16(compiler, NOP);
-       case SLJIT_LUMUL:
-       case SLJIT_LSMUL:
-               return push_inst32(compiler, (op == SLJIT_LUMUL ? UMULL : SMULL)
+       case SLJIT_LMUL_UW:
+       case SLJIT_LMUL_SW:
+               return push_inst32(compiler, (op == SLJIT_LMUL_UW ? UMULL : SMULL)
                        | (reg_map[SLJIT_R1] << 8)
                        | (reg_map[SLJIT_R0] << 12)
                        | (reg_map[SLJIT_R0] << 16)
                        | reg_map[SLJIT_R1]);
-       case SLJIT_UDIVMOD:
-       case SLJIT_SDIVMOD:
-       case SLJIT_UDIVI:
-       case SLJIT_SDIVI:
-               SLJIT_COMPILE_ASSERT((SLJIT_UDIVMOD & 0x2) == 0 && SLJIT_UDIVI - 0x2 == SLJIT_UDIVMOD, bad_div_opcode_assignments);
+       case SLJIT_DIVMOD_UW:
+       case SLJIT_DIVMOD_SW:
+       case SLJIT_DIV_UW:
+       case SLJIT_DIV_SW:
+               SLJIT_COMPILE_ASSERT((SLJIT_DIVMOD_UW & 0x2) == 0 && SLJIT_DIV_UW - 0x2 == SLJIT_DIVMOD_UW, bad_div_opcode_assignments);
                SLJIT_COMPILE_ASSERT(reg_map[2] == 1 && reg_map[3] == 2 && reg_map[4] == 12, bad_register_mapping);
 
                saved_reg_count = 0;
@@ -1270,7 +1270,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
                        saved_reg_list[saved_reg_count++] = 12;
                if (compiler->scratches >= 3)
                        saved_reg_list[saved_reg_count++] = 2;
-               if (op >= SLJIT_UDIVI)
+               if (op >= SLJIT_DIV_UW)
                        saved_reg_list[saved_reg_count++] = 1;
 
                if (saved_reg_count > 0) {
@@ -1288,7 +1288,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
 
 #if defined(__GNUC__)
                FAIL_IF(sljit_emit_ijump(compiler, SLJIT_FAST_CALL, SLJIT_IMM,
-                       ((op | 0x2) == SLJIT_UDIVI ? SLJIT_FUNC_OFFSET(__aeabi_uidivmod) : SLJIT_FUNC_OFFSET(__aeabi_idivmod))));
+                       ((op | 0x2) == SLJIT_DIV_UW ? SLJIT_FUNC_OFFSET(__aeabi_uidivmod) : SLJIT_FUNC_OFFSET(__aeabi_idivmod))));
 #else
 #error "Software divmod functions are needed"
 #endif
@@ -1311,12 +1311,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si dst_r, flags;
-       sljit_si op_flags = GET_ALL_FLAGS(op);
+       sljit_s32 dst_r, flags;
+       sljit_s32 op_flags = GET_ALL_FLAGS(op);
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_op1(compiler, op, dst, dstw, src, srcw));
@@ -1332,56 +1332,56 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
        if (op >= SLJIT_MOV && op <= SLJIT_MOVU_P) {
                switch (op) {
                case SLJIT_MOV:
-               case SLJIT_MOV_UI:
-               case SLJIT_MOV_SI:
+               case SLJIT_MOV_U32:
+               case SLJIT_MOV_S32:
                case SLJIT_MOV_P:
                        flags = WORD_SIZE;
                        break;
-               case SLJIT_MOV_UB:
+               case SLJIT_MOV_U8:
                        flags = BYTE_SIZE;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_ub)srcw;
+                               srcw = (sljit_u8)srcw;
                        break;
-               case SLJIT_MOV_SB:
+               case SLJIT_MOV_S8:
                        flags = BYTE_SIZE | SIGNED;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_sb)srcw;
+                               srcw = (sljit_s8)srcw;
                        break;
-               case SLJIT_MOV_UH:
+               case SLJIT_MOV_U16:
                        flags = HALF_SIZE;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_uh)srcw;
+                               srcw = (sljit_u16)srcw;
                        break;
-               case SLJIT_MOV_SH:
+               case SLJIT_MOV_S16:
                        flags = HALF_SIZE | SIGNED;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_sh)srcw;
+                               srcw = (sljit_s16)srcw;
                        break;
                case SLJIT_MOVU:
-               case SLJIT_MOVU_UI:
-               case SLJIT_MOVU_SI:
+               case SLJIT_MOVU_U32:
+               case SLJIT_MOVU_S32:
                case SLJIT_MOVU_P:
                        flags = WORD_SIZE | UPDATE;
                        break;
-               case SLJIT_MOVU_UB:
+               case SLJIT_MOVU_U8:
                        flags = BYTE_SIZE | UPDATE;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_ub)srcw;
+                               srcw = (sljit_u8)srcw;
                        break;
-               case SLJIT_MOVU_SB:
+               case SLJIT_MOVU_S8:
                        flags = BYTE_SIZE | SIGNED | UPDATE;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_sb)srcw;
+                               srcw = (sljit_s8)srcw;
                        break;
-               case SLJIT_MOVU_UH:
+               case SLJIT_MOVU_U16:
                        flags = HALF_SIZE | UPDATE;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_uh)srcw;
+                               srcw = (sljit_u16)srcw;
                        break;
-               case SLJIT_MOVU_SH:
+               case SLJIT_MOVU_S16:
                        flags = HALF_SIZE | SIGNED | UPDATE;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_sh)srcw;
+                               srcw = (sljit_s16)srcw;
                        break;
                default:
                        SLJIT_ASSERT_STOP();
@@ -1444,12 +1444,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_si dst_r, flags;
+       sljit_s32 dst_r, flags;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_op2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
@@ -1523,26 +1523,26 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
 {
        CHECK_REG_INDEX(check_sljit_get_register_index(reg));
        return reg_map[reg];
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_float_register_index(sljit_si reg)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_float_register_index(sljit_s32 reg)
 {
        CHECK_REG_INDEX(check_sljit_get_float_register_index(reg));
        return reg << 1;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *compiler,
-       void *instruction, sljit_si size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
+       void *instruction, sljit_s32 size)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_op_custom(compiler, instruction, size));
 
        if (size == 2)
-               return push_inst16(compiler, *(sljit_uh*)instruction);
+               return push_inst16(compiler, *(sljit_u16*)instruction);
        return push_inst32(compiler, *(sljit_ins*)instruction);
 }
 
@@ -1550,7 +1550,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *co
 /*  Floating point operators                                             */
 /* --------------------------------------------------------------------- */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
 {
 #ifdef SLJIT_IS_FPU_AVAILABLE
        return SLJIT_IS_FPU_AVAILABLE;
@@ -1562,11 +1562,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
 
 #define FPU_LOAD (1 << 20)
 
-static sljit_si emit_fop_mem(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg, sljit_si arg, sljit_sw argw)
+static sljit_s32 emit_fop_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
 {
        sljit_sw tmp;
        sljit_uw imm;
-       sljit_sw inst = VSTR_F32 | (flags & (SLJIT_SINGLE_OP | FPU_LOAD));
+       sljit_sw inst = VSTR_F32 | (flags & (SLJIT_F32_OP | FPU_LOAD));
 
        SLJIT_ASSERT(arg & SLJIT_MEM);
 
@@ -1626,16 +1626,16 @@ static sljit_si emit_fop_mem(struct sljit_compiler *compiler, sljit_si flags, sl
        return push_inst32(compiler, inst | 0x800000 | RN4(TMP_REG3) | DD4(reg));
 }
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_convw_fromd(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
        if (src & SLJIT_MEM) {
-               FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_SINGLE_OP) | FPU_LOAD, TMP_FREG1, src, srcw));
+               FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, TMP_FREG1, src, srcw));
                src = TMP_FREG1;
        }
 
-       FAIL_IF(push_inst32(compiler, VCVT_S32_F32 | (op & SLJIT_SINGLE_OP) | DD4(TMP_FREG1) | DM4(src)));
+       FAIL_IF(push_inst32(compiler, VCVT_S32_F32 | (op & SLJIT_F32_OP) | DD4(TMP_FREG1) | DM4(src)));
 
        if (dst == SLJIT_UNUSED)
                return SLJIT_SUCCESS;
@@ -1647,11 +1647,11 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_convw_fromd(struct sljit_compiler *
        return emit_fop_mem(compiler, 0, TMP_FREG1, dst, dstw);
 }
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_convd_fromw(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
+       sljit_s32 dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
 
        if (FAST_IS_REG(src))
                FAIL_IF(push_inst32(compiler, VMOV | RT4(src) | DN4(TMP_FREG1)));
@@ -1664,85 +1664,85 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_convd_fromw(struct sljit_compiler *
                FAIL_IF(push_inst32(compiler, VMOV | RT4(TMP_REG1) | DN4(TMP_FREG1)));
        }
 
-       FAIL_IF(push_inst32(compiler, VCVT_F32_S32 | (op & SLJIT_SINGLE_OP) | DD4(dst_r) | DM4(TMP_FREG1)));
+       FAIL_IF(push_inst32(compiler, VCVT_F32_S32 | (op & SLJIT_F32_OP) | DD4(dst_r) | DM4(TMP_FREG1)));
 
        if (dst & SLJIT_MEM)
-               return emit_fop_mem(compiler, (op & SLJIT_SINGLE_OP), TMP_FREG1, dst, dstw);
+               return emit_fop_mem(compiler, (op & SLJIT_F32_OP), TMP_FREG1, dst, dstw);
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        if (src1 & SLJIT_MEM) {
-               emit_fop_mem(compiler, (op & SLJIT_SINGLE_OP) | FPU_LOAD, TMP_FREG1, src1, src1w);
+               emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, TMP_FREG1, src1, src1w);
                src1 = TMP_FREG1;
        }
 
        if (src2 & SLJIT_MEM) {
-               emit_fop_mem(compiler, (op & SLJIT_SINGLE_OP) | FPU_LOAD, TMP_FREG2, src2, src2w);
+               emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, TMP_FREG2, src2, src2w);
                src2 = TMP_FREG2;
        }
 
-       FAIL_IF(push_inst32(compiler, VCMP_F32 | (op & SLJIT_SINGLE_OP) | DD4(src1) | DM4(src2)));
+       FAIL_IF(push_inst32(compiler, VCMP_F32 | (op & SLJIT_F32_OP) | DD4(src1) | DM4(src2)));
        return push_inst32(compiler, VMRS);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si dst_r;
+       sljit_s32 dst_r;
 
        CHECK_ERROR();
        compiler->cache_arg = 0;
        compiler->cache_argw = 0;
-       if (GET_OPCODE(op) != SLJIT_CONVD_FROMS)
-               op ^= SLJIT_SINGLE_OP;
+       if (GET_OPCODE(op) != SLJIT_CONV_F64_FROM_F32)
+               op ^= SLJIT_F32_OP;
 
-       SLJIT_COMPILE_ASSERT((SLJIT_SINGLE_OP == 0x100), float_transfer_bit_error);
+       SLJIT_COMPILE_ASSERT((SLJIT_F32_OP == 0x100), float_transfer_bit_error);
        SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw);
 
        dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
 
        if (src & SLJIT_MEM) {
-               emit_fop_mem(compiler, (op & SLJIT_SINGLE_OP) | FPU_LOAD, dst_r, src, srcw);
+               emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, dst_r, src, srcw);
                src = dst_r;
        }
 
        switch (GET_OPCODE(op)) {
-       case SLJIT_DMOV:
+       case SLJIT_MOV_F64:
                if (src != dst_r) {
                        if (dst_r != TMP_FREG1)
-                               FAIL_IF(push_inst32(compiler, VMOV_F32 | (op & SLJIT_SINGLE_OP) | DD4(dst_r) | DM4(src)));
+                               FAIL_IF(push_inst32(compiler, VMOV_F32 | (op & SLJIT_F32_OP) | DD4(dst_r) | DM4(src)));
                        else
                                dst_r = src;
                }
                break;
-       case SLJIT_DNEG:
-               FAIL_IF(push_inst32(compiler, VNEG_F32 | (op & SLJIT_SINGLE_OP) | DD4(dst_r) | DM4(src)));
+       case SLJIT_NEG_F64:
+               FAIL_IF(push_inst32(compiler, VNEG_F32 | (op & SLJIT_F32_OP) | DD4(dst_r) | DM4(src)));
                break;
-       case SLJIT_DABS:
-               FAIL_IF(push_inst32(compiler, VABS_F32 | (op & SLJIT_SINGLE_OP) | DD4(dst_r) | DM4(src)));
+       case SLJIT_ABS_F64:
+               FAIL_IF(push_inst32(compiler, VABS_F32 | (op & SLJIT_F32_OP) | DD4(dst_r) | DM4(src)));
                break;
-       case SLJIT_CONVD_FROMS:
-               FAIL_IF(push_inst32(compiler, VCVT_F64_F32 | (op & SLJIT_SINGLE_OP) | DD4(dst_r) | DM4(src)));
-               op ^= SLJIT_SINGLE_OP;
+       case SLJIT_CONV_F64_FROM_F32:
+               FAIL_IF(push_inst32(compiler, VCVT_F64_F32 | (op & SLJIT_F32_OP) | DD4(dst_r) | DM4(src)));
+               op ^= SLJIT_F32_OP;
                break;
        }
 
        if (dst & SLJIT_MEM)
-               return emit_fop_mem(compiler, (op & SLJIT_SINGLE_OP), dst_r, dst, dstw);
+               return emit_fop_mem(compiler, (op & SLJIT_F32_OP), dst_r, dst, dstw);
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_si dst_r;
+       sljit_s32 dst_r;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_fop2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
@@ -1752,36 +1752,36 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compile
 
        compiler->cache_arg = 0;
        compiler->cache_argw = 0;
-       op ^= SLJIT_SINGLE_OP;
+       op ^= SLJIT_F32_OP;
 
        dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
        if (src1 & SLJIT_MEM) {
-               emit_fop_mem(compiler, (op & SLJIT_SINGLE_OP) | FPU_LOAD, TMP_FREG1, src1, src1w);
+               emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, TMP_FREG1, src1, src1w);
                src1 = TMP_FREG1;
        }
        if (src2 & SLJIT_MEM) {
-               emit_fop_mem(compiler, (op & SLJIT_SINGLE_OP) | FPU_LOAD, TMP_FREG2, src2, src2w);
+               emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, TMP_FREG2, src2, src2w);
                src2 = TMP_FREG2;
        }
 
        switch (GET_OPCODE(op)) {
-       case SLJIT_DADD:
-               FAIL_IF(push_inst32(compiler, VADD_F32 | (op & SLJIT_SINGLE_OP) | DD4(dst_r) | DN4(src1) | DM4(src2)));
+       case SLJIT_ADD_F64:
+               FAIL_IF(push_inst32(compiler, VADD_F32 | (op & SLJIT_F32_OP) | DD4(dst_r) | DN4(src1) | DM4(src2)));
                break;
-       case SLJIT_DSUB:
-               FAIL_IF(push_inst32(compiler, VSUB_F32 | (op & SLJIT_SINGLE_OP) | DD4(dst_r) | DN4(src1) | DM4(src2)));
+       case SLJIT_SUB_F64:
+               FAIL_IF(push_inst32(compiler, VSUB_F32 | (op & SLJIT_F32_OP) | DD4(dst_r) | DN4(src1) | DM4(src2)));
                break;
-       case SLJIT_DMUL:
-               FAIL_IF(push_inst32(compiler, VMUL_F32 | (op & SLJIT_SINGLE_OP) | DD4(dst_r) | DN4(src1) | DM4(src2)));
+       case SLJIT_MUL_F64:
+               FAIL_IF(push_inst32(compiler, VMUL_F32 | (op & SLJIT_F32_OP) | DD4(dst_r) | DN4(src1) | DM4(src2)));
                break;
-       case SLJIT_DDIV:
-               FAIL_IF(push_inst32(compiler, VDIV_F32 | (op & SLJIT_SINGLE_OP) | DD4(dst_r) | DN4(src1) | DM4(src2)));
+       case SLJIT_DIV_F64:
+               FAIL_IF(push_inst32(compiler, VDIV_F32 | (op & SLJIT_F32_OP) | DD4(dst_r) | DN4(src1) | DM4(src2)));
                break;
        }
 
        if (!(dst & SLJIT_MEM))
                return SLJIT_SUCCESS;
-       return emit_fop_mem(compiler, (op & SLJIT_SINGLE_OP), TMP_FREG1, dst, dstw);
+       return emit_fop_mem(compiler, (op & SLJIT_F32_OP), TMP_FREG1, dst, dstw);
 }
 
 #undef FPU_LOAD
@@ -1790,7 +1790,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compile
 /*  Other instructions                                                   */
 /* --------------------------------------------------------------------- */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw));
@@ -1813,7 +1813,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *c
        return getput_arg(compiler, WORD_SIZE | STORE, TMP_REG2, dst, dstw, 0, 0);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_fast_return(compiler, src, srcw));
@@ -1840,33 +1840,33 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *
 /*  Conditional instructions                                             */
 /* --------------------------------------------------------------------- */
 
-static sljit_uw get_cc(sljit_si type)
+static sljit_uw get_cc(sljit_s32 type)
 {
        switch (type) {
        case SLJIT_EQUAL:
        case SLJIT_MUL_NOT_OVERFLOW:
-       case SLJIT_D_EQUAL:
+       case SLJIT_EQUAL_F64:
                return 0x0;
 
        case SLJIT_NOT_EQUAL:
        case SLJIT_MUL_OVERFLOW:
-       case SLJIT_D_NOT_EQUAL:
+       case SLJIT_NOT_EQUAL_F64:
                return 0x1;
 
        case SLJIT_LESS:
-       case SLJIT_D_LESS:
+       case SLJIT_LESS_F64:
                return 0x3;
 
        case SLJIT_GREATER_EQUAL:
-       case SLJIT_D_GREATER_EQUAL:
+       case SLJIT_GREATER_EQUAL_F64:
                return 0x2;
 
        case SLJIT_GREATER:
-       case SLJIT_D_GREATER:
+       case SLJIT_GREATER_F64:
                return 0x8;
 
        case SLJIT_LESS_EQUAL:
-       case SLJIT_D_LESS_EQUAL:
+       case SLJIT_LESS_EQUAL_F64:
                return 0x9;
 
        case SLJIT_SIG_LESS:
@@ -1882,11 +1882,11 @@ static sljit_uw get_cc(sljit_si type)
                return 0xd;
 
        case SLJIT_OVERFLOW:
-       case SLJIT_D_UNORDERED:
+       case SLJIT_UNORDERED_F64:
                return 0x6;
 
        case SLJIT_NOT_OVERFLOW:
-       case SLJIT_D_ORDERED:
+       case SLJIT_ORDERED_F64:
                return 0x7;
 
        default: /* SLJIT_JUMP */
@@ -1911,7 +1911,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compi
        return label;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_si type)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_s32 type)
 {
        struct sljit_jump *jump;
        sljit_ins cc;
@@ -1944,7 +1944,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
        return jump;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compiler, sljit_si type, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
 {
        struct sljit_jump *jump;
 
@@ -1972,12 +1972,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compil
        return push_inst16(compiler, (type <= SLJIT_JUMP ? BX : BLX) | RN3(TMP_REG1));
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw,
-       sljit_si type)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw,
+       sljit_s32 type)
 {
-       sljit_si dst_r, flags = GET_ALL_FLAGS(op);
+       sljit_s32 dst_r, flags = GET_ALL_FLAGS(op);
        sljit_ins cc, ins;
 
        CHECK_ERROR();
@@ -2054,10 +2054,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw init_value)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
 {
        struct sljit_const *const_;
-       sljit_si dst_r;
+       sljit_s32 dst_r;
 
        CHECK_ERROR_PTR();
        CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value));
@@ -2077,14 +2077,14 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
 
 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_addr)
 {
-       sljit_uh *inst = (sljit_uh*)addr;
+       sljit_u16 *inst = (sljit_u16*)addr;
        modify_imm32_const(inst, new_addr);
        SLJIT_CACHE_FLUSH(inst, inst + 4);
 }
 
 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_constant)
 {
-       sljit_uh *inst = (sljit_uh*)addr;
+       sljit_u16 *inst = (sljit_u16*)addr;
        modify_imm32_const(inst, new_constant);
        SLJIT_CACHE_FLUSH(inst, inst + 4);
 }
index b2b60d7a4c9d576ce41020378857bdabd0633e72..5096e4f55eab3f393a5fa6b65d5e322002211822 100644 (file)
@@ -26,7 +26,7 @@
 
 /* mips 32-bit arch dependent functions. */
 
-static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si dst_ar, sljit_sw imm)
+static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 dst_ar, sljit_sw imm)
 {
        if (!(imm & ~0xffff))
                return push_inst(compiler, ORI | SA(0) | TA(dst_ar) | IMM(imm), dst_ar);
@@ -66,24 +66,24 @@ static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si dst_ar,
                        FAIL_IF(push_inst(compiler, op_v | S(src2) | T(src1) | D(dst), DR(dst))); \
        }
 
-static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, sljit_si op, sljit_si flags,
-       sljit_si dst, sljit_si src1, sljit_sw src2)
+static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 flags,
+       sljit_s32 dst, sljit_s32 src1, sljit_sw src2)
 {
        switch (GET_OPCODE(op)) {
        case SLJIT_MOV:
-       case SLJIT_MOV_UI:
-       case SLJIT_MOV_SI:
+       case SLJIT_MOV_U32:
+       case SLJIT_MOV_S32:
        case SLJIT_MOV_P:
                SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
                if (dst != src2)
                        return push_inst(compiler, ADDU | S(src2) | TA(0) | D(dst), DR(dst));
                return SLJIT_SUCCESS;
 
-       case SLJIT_MOV_UB:
-       case SLJIT_MOV_SB:
+       case SLJIT_MOV_U8:
+       case SLJIT_MOV_S8:
                SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
                if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) {
-                       if (op == SLJIT_MOV_SB) {
+                       if (op == SLJIT_MOV_S8) {
 #if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1)
                                return push_inst(compiler, SEB | T(src2) | D(dst), DR(dst));
 #else
@@ -97,11 +97,11 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
                        SLJIT_ASSERT_STOP();
                return SLJIT_SUCCESS;
 
-       case SLJIT_MOV_UH:
-       case SLJIT_MOV_SH:
+       case SLJIT_MOV_U16:
+       case SLJIT_MOV_S16:
                SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
                if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) {
-                       if (op == SLJIT_MOV_SH) {
+                       if (op == SLJIT_MOV_S16) {
 #if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1)
                                return push_inst(compiler, SEH | T(src2) | D(dst), DR(dst));
 #else
@@ -341,7 +341,7 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw init_value)
+static SLJIT_INLINE sljit_s32 emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw init_value)
 {
        FAIL_IF(push_inst(compiler, LUI | T(dst) | IMM(init_value >> 16), DR(dst)));
        return push_inst(compiler, ORI | S(dst) | T(dst) | IMM(init_value), DR(dst));
index 185fb5768e2a6c5054c98ff994bfd938b3f213a1..c7ee8c9c2e6137befe6f13587611ebbe6924b5be 100644 (file)
 
 /* mips 64-bit arch dependent functions. */
 
-static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si dst_ar, sljit_sw imm)
+static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 dst_ar, sljit_sw imm)
 {
-       sljit_si shift = 32;
-       sljit_si shift2;
-       sljit_si inv = 0;
+       sljit_s32 shift = 32;
+       sljit_s32 shift2;
+       sljit_s32 inv = 0;
        sljit_ins ins;
        sljit_uw uimm;
 
@@ -119,7 +119,7 @@ static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si dst_ar,
 }
 
 #define SELECT_OP(a, b) \
-       (!(op & SLJIT_INT_OP) ? a : b)
+       (!(op & SLJIT_I32_OP) ? a : b)
 
 #define EMIT_LOGICAL(op_imm, op_norm) \
        if (flags & SRC2_IMM) { \
@@ -138,27 +138,27 @@ static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si dst_ar,
 #define EMIT_SHIFT(op_dimm, op_dimm32, op_imm, op_dv, op_v) \
        if (flags & SRC2_IMM) { \
                if (src2 >= 32) { \
-                       SLJIT_ASSERT(!(op & SLJIT_INT_OP)); \
+                       SLJIT_ASSERT(!(op & SLJIT_I32_OP)); \
                        ins = op_dimm32; \
                        src2 -= 32; \
                } \
                else \
-                       ins = (op & SLJIT_INT_OP) ? op_imm : op_dimm; \
+                       ins = (op & SLJIT_I32_OP) ? op_imm : op_dimm; \
                if (op & SLJIT_SET_E) \
                        FAIL_IF(push_inst(compiler, ins | T(src1) | DA(EQUAL_FLAG) | SH_IMM(src2), EQUAL_FLAG)); \
                if (CHECK_FLAGS(SLJIT_SET_E)) \
                        FAIL_IF(push_inst(compiler, ins | T(src1) | D(dst) | SH_IMM(src2), DR(dst))); \
        } \
        else { \
-               ins = (op & SLJIT_INT_OP) ? op_v : op_dv; \
+               ins = (op & SLJIT_I32_OP) ? op_v : op_dv; \
                if (op & SLJIT_SET_E) \
                        FAIL_IF(push_inst(compiler, ins | S(src2) | T(src1) | DA(EQUAL_FLAG), EQUAL_FLAG)); \
                if (CHECK_FLAGS(SLJIT_SET_E)) \
                        FAIL_IF(push_inst(compiler, ins | S(src2) | T(src1) | D(dst), DR(dst))); \
        }
 
-static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, sljit_si op, sljit_si flags,
-       sljit_si dst, sljit_si src1, sljit_sw src2)
+static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 flags,
+       sljit_s32 dst, sljit_s32 src1, sljit_sw src2)
 {
        sljit_ins ins;
 
@@ -170,11 +170,11 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
                        return push_inst(compiler, SELECT_OP(DADDU, ADDU) | S(src2) | TA(0) | D(dst), DR(dst));
                return SLJIT_SUCCESS;
 
-       case SLJIT_MOV_UB:
-       case SLJIT_MOV_SB:
+       case SLJIT_MOV_U8:
+       case SLJIT_MOV_S8:
                SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
                if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) {
-                       if (op == SLJIT_MOV_SB) {
+                       if (op == SLJIT_MOV_S8) {
                                FAIL_IF(push_inst(compiler, DSLL32 | T(src2) | D(dst) | SH_IMM(24), DR(dst)));
                                return push_inst(compiler, DSRA32 | T(dst) | D(dst) | SH_IMM(24), DR(dst));
                        }
@@ -184,11 +184,11 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
                        SLJIT_ASSERT_STOP();
                return SLJIT_SUCCESS;
 
-       case SLJIT_MOV_UH:
-       case SLJIT_MOV_SH:
+       case SLJIT_MOV_U16:
+       case SLJIT_MOV_S16:
                SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
                if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) {
-                       if (op == SLJIT_MOV_SH) {
+                       if (op == SLJIT_MOV_S16) {
                                FAIL_IF(push_inst(compiler, DSLL32 | T(src2) | D(dst) | SH_IMM(16), DR(dst)));
                                return push_inst(compiler, DSRA32 | T(dst) | D(dst) | SH_IMM(16), DR(dst));
                        }
@@ -198,12 +198,12 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
                        SLJIT_ASSERT_STOP();
                return SLJIT_SUCCESS;
 
-       case SLJIT_MOV_UI:
-               SLJIT_ASSERT(!(op & SLJIT_INT_OP));
+       case SLJIT_MOV_U32:
+               SLJIT_ASSERT(!(op & SLJIT_I32_OP));
                FAIL_IF(push_inst(compiler, DSLL32 | T(src2) | D(dst) | SH_IMM(0), DR(dst)));
                return push_inst(compiler, DSRL32 | T(dst) | D(dst) | SH_IMM(0), DR(dst));
 
-       case SLJIT_MOV_SI:
+       case SLJIT_MOV_S32:
                SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
                return push_inst(compiler, SLL | T(src2) | D(dst) | SH_IMM(0), DR(dst));
 
@@ -231,7 +231,7 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
                FAIL_IF(push_inst(compiler, SELECT_OP(DADDU, ADDU) | S(src2) | TA(0) | D(TMP_REG1), DR(TMP_REG1)));
                /* Check zero. */
                FAIL_IF(push_inst(compiler, BEQ | S(TMP_REG1) | TA(0) | IMM(5), UNMOVABLE_INS));
-               FAIL_IF(push_inst(compiler, ORI | SA(0) | T(dst) | IMM((op & SLJIT_INT_OP) ? 32 : 64), UNMOVABLE_INS));
+               FAIL_IF(push_inst(compiler, ORI | SA(0) | T(dst) | IMM((op & SLJIT_I32_OP) ? 32 : 64), UNMOVABLE_INS));
                FAIL_IF(push_inst(compiler, SELECT_OP(DADDIU, ADDIU) | SA(0) | T(dst) | IMM(-1), DR(dst)));
                /* Loop for searching the highest bit. */
                FAIL_IF(push_inst(compiler, SELECT_OP(DADDIU, ADDIU) | S(dst) | T(dst) | IMM(1), DR(dst)));
@@ -392,7 +392,7 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
                SLJIT_ASSERT(!(flags & SRC2_IMM));
                if (!(op & SLJIT_SET_O)) {
 #if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1)
-                       if (op & SLJIT_INT_OP)
+                       if (op & SLJIT_I32_OP)
                                return push_inst(compiler, MUL | S(src1) | T(src2) | D(dst), DR(dst));
                        FAIL_IF(push_inst(compiler, DMULT | S(src1) | T(src2), MOVABLE_INS));
                        return push_inst(compiler, MFLO | D(dst), DR(dst));
@@ -436,7 +436,7 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw init_value)
+static SLJIT_INLINE sljit_s32 emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw init_value)
 {
        FAIL_IF(push_inst(compiler, LUI | T(dst) | IMM(init_value >> 48), DR(dst)));
        FAIL_IF(push_inst(compiler, ORI | S(dst) | T(dst) | IMM(init_value >> 32), DR(dst)));
index cf3535f81a77c7383068b4198bc159701eb9892f..c2c251b1ff46943e54e3c6c17f69579411bc4310 100644 (file)
@@ -27,7 +27,7 @@
 /* Latest MIPS architecture. */
 /* Automatically detect SLJIT_MIPS_R1 */
 
-SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void)
+SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void)
 {
 #if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1)
 #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
@@ -42,7 +42,7 @@ SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void)
 
 /* Length of an instruction word
    Both for mips-32 and mips-64 */
-typedef sljit_ui sljit_ins;
+typedef sljit_u32 sljit_ins;
 
 #define TMP_REG1       (SLJIT_NUMBER_OF_REGISTERS + 2)
 #define TMP_REG2       (SLJIT_NUMBER_OF_REGISTERS + 3)
@@ -68,7 +68,7 @@ typedef sljit_ui sljit_ins;
 #define TMP_FREG1      (0)
 #define TMP_FREG2      ((SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1) << 1)
 
-static SLJIT_CONST sljit_ub reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = {
+static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = {
        0, 2, 5, 6, 7, 8, 9, 10, 11, 24, 23, 22, 21, 20, 19, 18, 17, 16, 29, 3, 25, 4
 };
 
@@ -201,7 +201,7 @@ static SLJIT_CONST sljit_ub reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = {
 
 /* dest_reg is the absolute name of the register
    Useful for reordering instructions in the delay slot. */
-static sljit_si push_inst(struct sljit_compiler *compiler, sljit_ins ins, sljit_si delay_slot)
+static sljit_s32 push_inst(struct sljit_compiler *compiler, sljit_ins ins, sljit_s32 delay_slot)
 {
        SLJIT_ASSERT(delay_slot == MOVABLE_INS || delay_slot >= UNMOVABLE_INS
                || delay_slot == ((ins >> 11) & 0x1f) || delay_slot == ((ins >> 16) & 0x1f));
@@ -213,7 +213,7 @@ static sljit_si push_inst(struct sljit_compiler *compiler, sljit_ins ins, sljit_
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_ins invert_branch(sljit_si flags)
+static SLJIT_INLINE sljit_ins invert_branch(sljit_s32 flags)
 {
        return (flags & IS_BIT26_COND) ? (1 << 26) : (1 << 16);
 }
@@ -538,12 +538,12 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
 #include "sljitNativeMIPS_64.c"
 #endif
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
        sljit_ins base;
-       sljit_si i, tmp, offs;
+       sljit_s32 i, tmp, offs;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
@@ -575,12 +575,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
 
        tmp = saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? (SLJIT_S0 + 1 - saveds) : SLJIT_FIRST_SAVED_REG;
        for (i = SLJIT_S0; i >= tmp; i--) {
-               offs -= (sljit_si)(sizeof(sljit_sw));
+               offs -= (sljit_s32)(sizeof(sljit_sw));
                FAIL_IF(push_inst(compiler, STACK_STORE | base | T(i) | IMM(offs), MOVABLE_INS));
        }
 
        for (i = scratches; i >= SLJIT_FIRST_SAVED_REG; i--) {
-               offs -= (sljit_si)(sizeof(sljit_sw));
+               offs -= (sljit_s32)(sizeof(sljit_sw));
                FAIL_IF(push_inst(compiler, STACK_STORE | base | T(i) | IMM(offs), MOVABLE_INS));
        }
 
@@ -594,9 +594,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
        CHECK_ERROR();
        CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
@@ -611,9 +611,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compi
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si local_size, i, tmp, offs;
+       sljit_s32 local_size, i, tmp, offs;
        sljit_ins base;
 
        CHECK_ERROR();
@@ -631,19 +631,19 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
                local_size = 0;
        }
 
-       FAIL_IF(push_inst(compiler, STACK_LOAD | base | TA(RETURN_ADDR_REG) | IMM(local_size - (sljit_si)sizeof(sljit_sw)), RETURN_ADDR_REG));
-       offs = local_size - (sljit_si)GET_SAVED_REGISTERS_SIZE(compiler->scratches, compiler->saveds, 1);
+       FAIL_IF(push_inst(compiler, STACK_LOAD | base | TA(RETURN_ADDR_REG) | IMM(local_size - (sljit_s32)sizeof(sljit_sw)), RETURN_ADDR_REG));
+       offs = local_size - (sljit_s32)GET_SAVED_REGISTERS_SIZE(compiler->scratches, compiler->saveds, 1);
 
        tmp = compiler->scratches;
        for (i = SLJIT_FIRST_SAVED_REG; i <= tmp; i++) {
                FAIL_IF(push_inst(compiler, STACK_LOAD | base | T(i) | IMM(offs), DR(i)));
-               offs += (sljit_si)(sizeof(sljit_sw));
+               offs += (sljit_s32)(sizeof(sljit_sw));
        }
 
        tmp = compiler->saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? (SLJIT_S0 + 1 - compiler->saveds) : SLJIT_FIRST_SAVED_REG;
        for (i = tmp; i <= SLJIT_S0; i++) {
                FAIL_IF(push_inst(compiler, STACK_LOAD | base | T(i) | IMM(offs), DR(i)));
-               offs += (sljit_si)(sizeof(sljit_sw));
+               offs += (sljit_s32)(sizeof(sljit_sw));
        }
 
        SLJIT_ASSERT(offs == local_size - (sljit_sw)(sizeof(sljit_sw)));
@@ -668,7 +668,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
 #define ARCH_32_64(a, b)       b
 #endif
 
-static SLJIT_CONST sljit_ins data_transfer_insts[16 + 4] = {
+static const sljit_ins data_transfer_insts[16 + 4] = {
 /* u w s */ ARCH_32_64(HI(43) /* sw */, HI(63) /* sd */),
 /* u w l */ ARCH_32_64(HI(35) /* lw */, HI(55) /* ld */),
 /* u b s */ HI(40) /* sb */,
@@ -698,7 +698,7 @@ static SLJIT_CONST sljit_ins data_transfer_insts[16 + 4] = {
 /* reg_ar is an absoulute register! */
 
 /* Can perform an operation using at most 1 instruction. */
-static sljit_si getput_arg_fast(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg_ar, sljit_si arg, sljit_sw argw)
+static sljit_s32 getput_arg_fast(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg_ar, sljit_s32 arg, sljit_sw argw)
 {
        SLJIT_ASSERT(arg & SLJIT_MEM);
 
@@ -716,7 +716,7 @@ static sljit_si getput_arg_fast(struct sljit_compiler *compiler, sljit_si flags,
 /* See getput_arg below.
    Note: can_cache is called only for binary operators. Those
    operators always uses word arguments without write back. */
-static sljit_si can_cache(sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_sw next_argw)
+static sljit_s32 can_cache(sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
 {
        SLJIT_ASSERT((arg & SLJIT_MEM) && (next_arg & SLJIT_MEM));
 
@@ -739,9 +739,9 @@ static sljit_si can_cache(sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_
 }
 
 /* Emit the necessary instructions. See can_cache above. */
-static sljit_si getput_arg(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg_ar, sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_sw next_argw)
+static sljit_s32 getput_arg(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg_ar, sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
 {
-       sljit_si tmp_ar, base, delay_slot;
+       sljit_s32 tmp_ar, base, delay_slot;
 
        SLJIT_ASSERT(arg & SLJIT_MEM);
        if (!(next_arg & SLJIT_MEM)) {
@@ -878,7 +878,7 @@ static sljit_si getput_arg(struct sljit_compiler *compiler, sljit_si flags, slji
        return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | SA(tmp_ar) | TA(reg_ar), delay_slot);
 }
 
-static SLJIT_INLINE sljit_si emit_op_mem(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg_ar, sljit_si arg, sljit_sw argw)
+static SLJIT_INLINE sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg_ar, sljit_s32 arg, sljit_sw argw)
 {
        if (getput_arg_fast(compiler, flags, reg_ar, arg, argw))
                return compiler->error;
@@ -887,26 +887,26 @@ static SLJIT_INLINE sljit_si emit_op_mem(struct sljit_compiler *compiler, sljit_
        return getput_arg(compiler, flags, reg_ar, arg, argw, 0, 0);
 }
 
-static SLJIT_INLINE sljit_si emit_op_mem2(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg, sljit_si arg1, sljit_sw arg1w, sljit_si arg2, sljit_sw arg2w)
+static SLJIT_INLINE sljit_s32 emit_op_mem2(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg1, sljit_sw arg1w, sljit_s32 arg2, sljit_sw arg2w)
 {
        if (getput_arg_fast(compiler, flags, reg, arg1, arg1w))
                return compiler->error;
        return getput_arg(compiler, flags, reg, arg1, arg1w, arg2, arg2w);
 }
 
-static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si flags,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 flags,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        /* arg1 goes to TMP_REG1 or src reg
           arg2 goes to TMP_REG2, imm or src reg
           TMP_REG3 can be used for caching
           result goes to TMP_REG2, so put result can use TMP_REG1 and TMP_REG3. */
-       sljit_si dst_r = TMP_REG2;
-       sljit_si src1_r;
+       sljit_s32 dst_r = TMP_REG2;
+       sljit_s32 src1_r;
        sljit_sw src2_r = 0;
-       sljit_si sugg_src2_r = TMP_REG2;
+       sljit_s32 sugg_src2_r = TMP_REG2;
 
        if (!(flags & ALT_KEEP_CACHE)) {
                compiler->cache_arg = 0;
@@ -914,7 +914,7 @@ static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si f
        }
 
        if (SLJIT_UNLIKELY(dst == SLJIT_UNUSED)) {
-               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_SI && !(src2 & SLJIT_MEM))
+               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_S32 && !(src2 & SLJIT_MEM))
                        return SLJIT_SUCCESS;
                if (GET_FLAGS(op))
                        flags |= UNUSED_DEST;
@@ -922,7 +922,7 @@ static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si f
        else if (FAST_IS_REG(dst)) {
                dst_r = dst;
                flags |= REG_DEST;
-               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_SI)
+               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_S32)
                        sugg_src2_r = dst_r;
        }
        else if ((dst & SLJIT_MEM) && !getput_arg_fast(compiler, flags | ARG_TEST, DR(TMP_REG1), dst, dstw))
@@ -976,7 +976,7 @@ static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si f
        if (FAST_IS_REG(src2)) {
                src2_r = src2;
                flags |= REG2_SOURCE;
-               if (!(flags & REG_DEST) && op >= SLJIT_MOV && op <= SLJIT_MOVU_SI)
+               if (!(flags & REG_DEST) && op >= SLJIT_MOV && op <= SLJIT_MOVU_S32)
                        dst_r = src2_r;
        }
        else if (src2 & SLJIT_IMM) {
@@ -987,7 +987,7 @@ static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si f
                        }
                        else {
                                src2_r = 0;
-                               if ((op >= SLJIT_MOV && op <= SLJIT_MOVU_SI) && (dst & SLJIT_MEM))
+                               if ((op >= SLJIT_MOV && op <= SLJIT_MOVU_S32) && (dst & SLJIT_MEM))
                                        dst_r = 0;
                        }
                }
@@ -1029,10 +1029,10 @@ static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si f
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler, sljit_si op)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op)
 {
 #if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
-       sljit_si int_op = op & SLJIT_INT_OP;
+       sljit_s32 int_op = op & SLJIT_I32_OP;
 #endif
 
        CHECK_ERROR();
@@ -1044,20 +1044,20 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
                return push_inst(compiler, BREAK, UNMOVABLE_INS);
        case SLJIT_NOP:
                return push_inst(compiler, NOP, UNMOVABLE_INS);
-       case SLJIT_LUMUL:
-       case SLJIT_LSMUL:
+       case SLJIT_LMUL_UW:
+       case SLJIT_LMUL_SW:
 #if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
-               FAIL_IF(push_inst(compiler, (op == SLJIT_LUMUL ? DMULTU : DMULT) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
+               FAIL_IF(push_inst(compiler, (op == SLJIT_LMUL_UW ? DMULTU : DMULT) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
 #else
-               FAIL_IF(push_inst(compiler, (op == SLJIT_LUMUL ? MULTU : MULT) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
+               FAIL_IF(push_inst(compiler, (op == SLJIT_LMUL_UW ? MULTU : MULT) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
 #endif
                FAIL_IF(push_inst(compiler, MFLO | D(SLJIT_R0), DR(SLJIT_R0)));
                return push_inst(compiler, MFHI | D(SLJIT_R1), DR(SLJIT_R1));
-       case SLJIT_UDIVMOD:
-       case SLJIT_SDIVMOD:
-       case SLJIT_UDIVI:
-       case SLJIT_SDIVI:
-               SLJIT_COMPILE_ASSERT((SLJIT_UDIVMOD & 0x2) == 0 && SLJIT_UDIVI - 0x2 == SLJIT_UDIVMOD, bad_div_opcode_assignments);
+       case SLJIT_DIVMOD_UW:
+       case SLJIT_DIVMOD_SW:
+       case SLJIT_DIV_UW:
+       case SLJIT_DIV_SW:
+               SLJIT_COMPILE_ASSERT((SLJIT_DIVMOD_UW & 0x2) == 0 && SLJIT_DIV_UW - 0x2 == SLJIT_DIVMOD_UW, bad_div_opcode_assignments);
 #if !(defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1)
                FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS));
                FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS));
@@ -1065,28 +1065,28 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
 
 #if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
                if (int_op)
-                       FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_UDIVI ? DIVU : DIV) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
+                       FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? DIVU : DIV) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
                else
-                       FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_UDIVI ? DDIVU : DDIV) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
+                       FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? DDIVU : DDIV) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
 #else
-               FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_UDIVI ? DIVU : DIV) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
+               FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? DIVU : DIV) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
 #endif
 
                FAIL_IF(push_inst(compiler, MFLO | D(SLJIT_R0), DR(SLJIT_R0)));
-               return (op >= SLJIT_UDIVI) ? SLJIT_SUCCESS : push_inst(compiler, MFHI | D(SLJIT_R1), DR(SLJIT_R1));
+               return (op >= SLJIT_DIV_UW) ? SLJIT_SUCCESS : push_inst(compiler, MFHI | D(SLJIT_R1), DR(SLJIT_R1));
        }
 
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
 #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
 #      define flags 0
 #else
-       sljit_si flags = 0;
+       sljit_s32 flags = 0;
 #endif
 
        CHECK_ERROR();
@@ -1095,10 +1095,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
        ADJUST_LOCAL_OFFSET(src, srcw);
 
 #if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
-       if ((op & SLJIT_INT_OP) && GET_OPCODE(op) >= SLJIT_NOT) {
+       if ((op & SLJIT_I32_OP) && GET_OPCODE(op) >= SLJIT_NOT) {
                flags |= INT_DATA | SIGNED_DATA;
                if (src & SLJIT_IMM)
-                       srcw = (sljit_si)srcw;
+                       srcw = (sljit_s32)srcw;
        }
 #endif
 
@@ -1107,61 +1107,61 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
        case SLJIT_MOV_P:
                return emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
 
-       case SLJIT_MOV_UI:
+       case SLJIT_MOV_U32:
 #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
-               return emit_op(compiler, SLJIT_MOV_UI, INT_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
+               return emit_op(compiler, SLJIT_MOV_U32, INT_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
 #else
-               return emit_op(compiler, SLJIT_MOV_UI, INT_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_ui)srcw : srcw);
+               return emit_op(compiler, SLJIT_MOV_U32, INT_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u32)srcw : srcw);
 #endif
 
-       case SLJIT_MOV_SI:
+       case SLJIT_MOV_S32:
 #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
-               return emit_op(compiler, SLJIT_MOV_SI, INT_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
+               return emit_op(compiler, SLJIT_MOV_S32, INT_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
 #else
-               return emit_op(compiler, SLJIT_MOV_SI, INT_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_si)srcw : srcw);
+               return emit_op(compiler, SLJIT_MOV_S32, INT_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s32)srcw : srcw);
 #endif
 
-       case SLJIT_MOV_UB:
-               return emit_op(compiler, SLJIT_MOV_UB, BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_ub)srcw : srcw);
+       case SLJIT_MOV_U8:
+               return emit_op(compiler, SLJIT_MOV_U8, BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u8)srcw : srcw);
 
-       case SLJIT_MOV_SB:
-               return emit_op(compiler, SLJIT_MOV_SB, BYTE_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_sb)srcw : srcw);
+       case SLJIT_MOV_S8:
+               return emit_op(compiler, SLJIT_MOV_S8, BYTE_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s8)srcw : srcw);
 
-       case SLJIT_MOV_UH:
-               return emit_op(compiler, SLJIT_MOV_UH, HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_uh)srcw : srcw);
+       case SLJIT_MOV_U16:
+               return emit_op(compiler, SLJIT_MOV_U16, HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u16)srcw : srcw);
 
-       case SLJIT_MOV_SH:
-               return emit_op(compiler, SLJIT_MOV_SH, HALF_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_sh)srcw : srcw);
+       case SLJIT_MOV_S16:
+               return emit_op(compiler, SLJIT_MOV_S16, HALF_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s16)srcw : srcw);
 
        case SLJIT_MOVU:
        case SLJIT_MOVU_P:
                return emit_op(compiler, SLJIT_MOV, WORD_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
 
-       case SLJIT_MOVU_UI:
+       case SLJIT_MOVU_U32:
 #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
-               return emit_op(compiler, SLJIT_MOV_UI, INT_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
+               return emit_op(compiler, SLJIT_MOV_U32, INT_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
 #else
-               return emit_op(compiler, SLJIT_MOV_UI, INT_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_ui)srcw : srcw);
+               return emit_op(compiler, SLJIT_MOV_U32, INT_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u32)srcw : srcw);
 #endif
 
-       case SLJIT_MOVU_SI:
+       case SLJIT_MOVU_S32:
 #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
-               return emit_op(compiler, SLJIT_MOV_SI, INT_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
+               return emit_op(compiler, SLJIT_MOV_S32, INT_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
 #else
-               return emit_op(compiler, SLJIT_MOV_SI, INT_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_si)srcw : srcw);
+               return emit_op(compiler, SLJIT_MOV_S32, INT_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s32)srcw : srcw);
 #endif
 
-       case SLJIT_MOVU_UB:
-               return emit_op(compiler, SLJIT_MOV_UB, BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_ub)srcw : srcw);
+       case SLJIT_MOVU_U8:
+               return emit_op(compiler, SLJIT_MOV_U8, BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u8)srcw : srcw);
 
-       case SLJIT_MOVU_SB:
-               return emit_op(compiler, SLJIT_MOV_SB, BYTE_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_sb)srcw : srcw);
+       case SLJIT_MOVU_S8:
+               return emit_op(compiler, SLJIT_MOV_S8, BYTE_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s8)srcw : srcw);
 
-       case SLJIT_MOVU_UH:
-               return emit_op(compiler, SLJIT_MOV_UH, HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_uh)srcw : srcw);
+       case SLJIT_MOVU_U16:
+               return emit_op(compiler, SLJIT_MOV_U16, HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u16)srcw : srcw);
 
-       case SLJIT_MOVU_SH:
-               return emit_op(compiler, SLJIT_MOV_SH, HALF_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_sh)srcw : srcw);
+       case SLJIT_MOVU_S16:
+               return emit_op(compiler, SLJIT_MOV_S16, HALF_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s16)srcw : srcw);
 
        case SLJIT_NOT:
                return emit_op(compiler, op, flags, dst, dstw, TMP_REG1, 0, src, srcw);
@@ -1180,15 +1180,15 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
 #endif
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
 #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
 #      define flags 0
 #else
-       sljit_si flags = 0;
+       sljit_s32 flags = 0;
 #endif
 
        CHECK_ERROR();
@@ -1198,12 +1198,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
        ADJUST_LOCAL_OFFSET(src2, src2w);
 
 #if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
-       if (op & SLJIT_INT_OP) {
+       if (op & SLJIT_I32_OP) {
                flags |= INT_DATA | SIGNED_DATA;
                if (src1 & SLJIT_IMM)
-                       src1w = (sljit_si)src1w;
+                       src1w = (sljit_s32)src1w;
                if (src2 & SLJIT_IMM)
-                       src2w = (sljit_si)src2w;
+                       src2w = (sljit_s32)src2w;
        }
 #endif
 
@@ -1232,7 +1232,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
                        src2w &= 0x1f;
 #else
                if (src2 & SLJIT_IMM) {
-                       if (op & SLJIT_INT_OP)
+                       if (op & SLJIT_I32_OP)
                                src2w &= 0x1f;
                        else
                                src2w &= 0x3f;
@@ -1248,20 +1248,20 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
 #endif
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
 {
        CHECK_REG_INDEX(check_sljit_get_register_index(reg));
        return reg_map[reg];
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_float_register_index(sljit_si reg)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_float_register_index(sljit_s32 reg)
 {
        CHECK_REG_INDEX(check_sljit_get_float_register_index(reg));
        return reg << 1;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *compiler,
-       void *instruction, sljit_si size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
+       void *instruction, sljit_s32 size)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_op_custom(compiler, instruction, size));
@@ -1273,7 +1273,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *co
 /*  Floating point operators                                             */
 /* --------------------------------------------------------------------- */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
 {
 #ifdef SLJIT_IS_FPU_AVAILABLE
        return SLJIT_IS_FPU_AVAILABLE;
@@ -1286,17 +1286,17 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
 #endif
 }
 
-#define FLOAT_DATA(op) (DOUBLE_DATA | ((op & SLJIT_SINGLE_OP) >> 7))
-#define FMT(op) (((op & SLJIT_SINGLE_OP) ^ SLJIT_SINGLE_OP) << (21 - 8))
+#define FLOAT_DATA(op) (DOUBLE_DATA | ((op & SLJIT_F32_OP) >> 7))
+#define FMT(op) (((op & SLJIT_F32_OP) ^ SLJIT_F32_OP) << (21 - 8))
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_convw_fromd(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
 #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
 #      define flags 0
 #else
-       sljit_si flags = (GET_OPCODE(op) == SLJIT_CONVW_FROMD) << 21;
+       sljit_s32 flags = (GET_OPCODE(op) == SLJIT_CONV_SW_FROM_F64) << 21;
 #endif
 
        if (src & SLJIT_MEM) {
@@ -1322,17 +1322,17 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_convw_fromd(struct sljit_compiler *
 #endif
 }
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_convd_fromw(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
 #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
 #      define flags 0
 #else
-       sljit_si flags = (GET_OPCODE(op) == SLJIT_CONVD_FROMW) << 21;
+       sljit_s32 flags = (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_SW) << 21;
 #endif
 
-       sljit_si dst_r = FAST_IS_REG(dst) ? (dst << 1) : TMP_FREG1;
+       sljit_s32 dst_r = FAST_IS_REG(dst) ? (dst << 1) : TMP_FREG1;
 
        if (FAST_IS_REG(src))
                FAIL_IF(push_inst(compiler, MTC1 | flags | T(src) | FS(TMP_FREG1), MOVABLE_INS));
@@ -1342,14 +1342,14 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_convd_fromw(struct sljit_compiler *
        }
        else {
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-               if (GET_OPCODE(op) == SLJIT_CONVD_FROMI)
-                       srcw = (sljit_si)srcw;
+               if (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_S32)
+                       srcw = (sljit_s32)srcw;
 #endif
                FAIL_IF(load_immediate(compiler, DR(TMP_REG1), srcw));
                FAIL_IF(push_inst(compiler, MTC1 | flags | T(TMP_REG1) | FS(TMP_FREG1), MOVABLE_INS));
        }
 
-       FAIL_IF(push_inst(compiler, CVT_S_S | flags | (4 << 21) | (((op & SLJIT_SINGLE_OP) ^ SLJIT_SINGLE_OP) >> 8) | FS(TMP_FREG1) | FD(dst_r), MOVABLE_INS));
+       FAIL_IF(push_inst(compiler, CVT_S_S | flags | (4 << 21) | (((op & SLJIT_F32_OP) ^ SLJIT_F32_OP) >> 8) | FS(TMP_FREG1) | FD(dst_r), MOVABLE_INS));
 
        if (dst & SLJIT_MEM)
                return emit_op_mem2(compiler, FLOAT_DATA(op), TMP_FREG1, dst, dstw, 0, 0);
@@ -1360,9 +1360,9 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_convd_fromw(struct sljit_compiler *
 #endif
 }
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        if (src1 & SLJIT_MEM) {
                FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, src2, src2w));
@@ -1399,21 +1399,21 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_cmp(struct sljit_compiler *compiler
        return push_inst(compiler, C_UN_S | FMT(op) | FT(src2) | FS(src1), FCSR_FCC);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si dst_r;
+       sljit_s32 dst_r;
 
        CHECK_ERROR();
        compiler->cache_arg = 0;
        compiler->cache_argw = 0;
 
-       SLJIT_COMPILE_ASSERT((SLJIT_SINGLE_OP == 0x100) && !(DOUBLE_DATA & 0x2), float_transfer_bit_error);
+       SLJIT_COMPILE_ASSERT((SLJIT_F32_OP == 0x100) && !(DOUBLE_DATA & 0x2), float_transfer_bit_error);
        SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw);
 
-       if (GET_OPCODE(op) == SLJIT_CONVD_FROMS)
-               op ^= SLJIT_SINGLE_OP;
+       if (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_F32)
+               op ^= SLJIT_F32_OP;
 
        dst_r = FAST_IS_REG(dst) ? (dst << 1) : TMP_FREG1;
 
@@ -1425,7 +1425,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compile
                src <<= 1;
 
        switch (GET_OPCODE(op)) {
-       case SLJIT_DMOV:
+       case SLJIT_MOV_F64:
                if (src != dst_r) {
                        if (dst_r != TMP_FREG1)
                                FAIL_IF(push_inst(compiler, MOV_S | FMT(op) | FS(src) | FD(dst_r), MOVABLE_INS));
@@ -1433,15 +1433,15 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compile
                                dst_r = src;
                }
                break;
-       case SLJIT_DNEG:
+       case SLJIT_NEG_F64:
                FAIL_IF(push_inst(compiler, NEG_S | FMT(op) | FS(src) | FD(dst_r), MOVABLE_INS));
                break;
-       case SLJIT_DABS:
+       case SLJIT_ABS_F64:
                FAIL_IF(push_inst(compiler, ABS_S | FMT(op) | FS(src) | FD(dst_r), MOVABLE_INS));
                break;
-       case SLJIT_CONVD_FROMS:
-               FAIL_IF(push_inst(compiler, CVT_S_S | ((op & SLJIT_SINGLE_OP) ? 1 : (1 << 21)) | FS(src) | FD(dst_r), MOVABLE_INS));
-               op ^= SLJIT_SINGLE_OP;
+       case SLJIT_CONV_F64_FROM_F32:
+               FAIL_IF(push_inst(compiler, CVT_S_S | ((op & SLJIT_F32_OP) ? 1 : (1 << 21)) | FS(src) | FD(dst_r), MOVABLE_INS));
+               op ^= SLJIT_F32_OP;
                break;
        }
 
@@ -1450,12 +1450,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compile
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_si dst_r, flags = 0;
+       sljit_s32 dst_r, flags = 0;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_fop2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
@@ -1509,19 +1509,19 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compile
                src2 = TMP_FREG2;
 
        switch (GET_OPCODE(op)) {
-       case SLJIT_DADD:
+       case SLJIT_ADD_F64:
                FAIL_IF(push_inst(compiler, ADD_S | FMT(op) | FT(src2) | FS(src1) | FD(dst_r), MOVABLE_INS));
                break;
 
-       case SLJIT_DSUB:
+       case SLJIT_SUB_F64:
                FAIL_IF(push_inst(compiler, SUB_S | FMT(op) | FT(src2) | FS(src1) | FD(dst_r), MOVABLE_INS));
                break;
 
-       case SLJIT_DMUL:
+       case SLJIT_MUL_F64:
                FAIL_IF(push_inst(compiler, MUL_S | FMT(op) | FT(src2) | FS(src1) | FD(dst_r), MOVABLE_INS));
                break;
 
-       case SLJIT_DDIV:
+       case SLJIT_DIV_F64:
                FAIL_IF(push_inst(compiler, DIV_S | FMT(op) | FT(src2) | FS(src1) | FD(dst_r), MOVABLE_INS));
                break;
        }
@@ -1536,7 +1536,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compile
 /*  Other instructions                                                   */
 /* --------------------------------------------------------------------- */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw));
@@ -1553,7 +1553,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *c
        return emit_op_mem(compiler, WORD_DATA, RETURN_ADDR_REG, dst, dstw);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_fast_return(compiler, src, srcw));
@@ -1617,12 +1617,12 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compi
        flags = IS_BIT16_COND; \
        delay_check = FCSR_FCC;
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_si type)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_s32 type)
 {
        struct sljit_jump *jump;
        sljit_ins inst;
-       sljit_si flags = 0;
-       sljit_si delay_check = UNMOVABLE_INS;
+       sljit_s32 flags = 0;
+       sljit_s32 delay_check = UNMOVABLE_INS;
 
        CHECK_ERROR_PTR();
        CHECK_PTR(check_sljit_emit_jump(compiler, type));
@@ -1634,27 +1634,27 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
 
        switch (type) {
        case SLJIT_EQUAL:
-       case SLJIT_D_NOT_EQUAL:
+       case SLJIT_NOT_EQUAL_F64:
                BR_NZ(EQUAL_FLAG);
                break;
        case SLJIT_NOT_EQUAL:
-       case SLJIT_D_EQUAL:
+       case SLJIT_EQUAL_F64:
                BR_Z(EQUAL_FLAG);
                break;
        case SLJIT_LESS:
-       case SLJIT_D_LESS:
+       case SLJIT_LESS_F64:
                BR_Z(ULESS_FLAG);
                break;
        case SLJIT_GREATER_EQUAL:
-       case SLJIT_D_GREATER_EQUAL:
+       case SLJIT_GREATER_EQUAL_F64:
                BR_NZ(ULESS_FLAG);
                break;
        case SLJIT_GREATER:
-       case SLJIT_D_GREATER:
+       case SLJIT_GREATER_F64:
                BR_Z(UGREATER_FLAG);
                break;
        case SLJIT_LESS_EQUAL:
-       case SLJIT_D_LESS_EQUAL:
+       case SLJIT_LESS_EQUAL_F64:
                BR_NZ(UGREATER_FLAG);
                break;
        case SLJIT_SIG_LESS:
@@ -1677,10 +1677,10 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
        case SLJIT_MUL_NOT_OVERFLOW:
                BR_NZ(OVERFLOW_FLAG);
                break;
-       case SLJIT_D_UNORDERED:
+       case SLJIT_UNORDERED_F64:
                BR_F();
                break;
-       case SLJIT_D_ORDERED:
+       case SLJIT_ORDERED_F64:
                BR_T();
                break;
        default:
@@ -1733,12 +1733,12 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
                        src2 = 0; \
        }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_si type,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_s32 type,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        struct sljit_jump *jump;
-       sljit_si flags;
+       sljit_s32 flags;
        sljit_ins inst;
 
        CHECK_ERROR_PTR();
@@ -1748,7 +1748,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler
 
        compiler->cache_arg = 0;
        compiler->cache_argw = 0;
-       flags = ((type & SLJIT_INT_OP) ? INT_DATA : WORD_DATA) | LOAD_DATA;
+       flags = ((type & SLJIT_I32_OP) ? INT_DATA : WORD_DATA) | LOAD_DATA;
        if (src1 & SLJIT_MEM) {
                PTR_FAIL_IF(emit_op_mem2(compiler, flags, DR(TMP_REG1), src1, src1w, src2, src2w));
                src1 = TMP_REG1;
@@ -1854,13 +1854,13 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler
 #undef RESOLVE_IMM1
 #undef RESOLVE_IMM2
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_si type,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_s32 type,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        struct sljit_jump *jump;
        sljit_ins inst;
-       sljit_si if_true;
+       sljit_s32 if_true;
 
        CHECK_ERROR_PTR();
        CHECK_PTR(check_sljit_emit_fcmp(compiler, type, src1, src1w, src2, src2w));
@@ -1888,37 +1888,37 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compile
        jump->flags |= IS_BIT16_COND;
 
        switch (type & 0xff) {
-       case SLJIT_D_EQUAL:
+       case SLJIT_EQUAL_F64:
                inst = C_UEQ_S;
                if_true = 1;
                break;
-       case SLJIT_D_NOT_EQUAL:
+       case SLJIT_NOT_EQUAL_F64:
                inst = C_UEQ_S;
                if_true = 0;
                break;
-       case SLJIT_D_LESS:
+       case SLJIT_LESS_F64:
                inst = C_ULT_S;
                if_true = 1;
                break;
-       case SLJIT_D_GREATER_EQUAL:
+       case SLJIT_GREATER_EQUAL_F64:
                inst = C_ULT_S;
                if_true = 0;
                break;
-       case SLJIT_D_GREATER:
+       case SLJIT_GREATER_F64:
                inst = C_ULE_S;
                if_true = 0;
                break;
-       case SLJIT_D_LESS_EQUAL:
+       case SLJIT_LESS_EQUAL_F64:
                inst = C_ULE_S;
                if_true = 1;
                break;
-       case SLJIT_D_UNORDERED:
+       case SLJIT_UNORDERED_F64:
                inst = C_UN_S;
                if_true = 1;
                break;
        default: /* Make compilers happy. */
                SLJIT_ASSERT_STOP();
-       case SLJIT_D_ORDERED:
+       case SLJIT_ORDERED_F64:
                inst = C_UN_S;
                if_true = 0;
                break;
@@ -1943,9 +1943,9 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compile
 #undef FLOAT_DATA
 #undef FMT
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compiler, sljit_si type, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si src_r = TMP_REG2;
+       sljit_s32 src_r = TMP_REG2;
        struct sljit_jump *jump = NULL;
 
        CHECK_ERROR();
@@ -2001,17 +2001,17 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compil
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw,
-       sljit_si type)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw,
+       sljit_s32 type)
 {
-       sljit_si sugg_dst_ar, dst_ar;
-       sljit_si flags = GET_ALL_FLAGS(op);
+       sljit_s32 sugg_dst_ar, dst_ar;
+       sljit_s32 flags = GET_ALL_FLAGS(op);
 #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
 #      define mem_type WORD_DATA
 #else
-       sljit_si mem_type = (op & SLJIT_INT_OP) ? (INT_DATA | SIGNED_DATA) : WORD_DATA;
+       sljit_s32 mem_type = (op & SLJIT_I32_OP) ? (INT_DATA | SIGNED_DATA) : WORD_DATA;
 #endif
 
        CHECK_ERROR();
@@ -2023,7 +2023,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
 
        op = GET_OPCODE(op);
 #if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
-       if (op == SLJIT_MOV_SI || op == SLJIT_MOV_UI)
+       if (op == SLJIT_MOV_S32 || op == SLJIT_MOV_U32)
                mem_type = INT_DATA | SIGNED_DATA;
 #endif
        sugg_dst_ar = DR((op < SLJIT_ADD && FAST_IS_REG(dst)) ? dst : TMP_REG2);
@@ -2045,14 +2045,14 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
                break;
        case SLJIT_LESS:
        case SLJIT_GREATER_EQUAL:
-       case SLJIT_D_LESS:
-       case SLJIT_D_GREATER_EQUAL:
+       case SLJIT_LESS_F64:
+       case SLJIT_GREATER_EQUAL_F64:
                dst_ar = ULESS_FLAG;
                break;
        case SLJIT_GREATER:
        case SLJIT_LESS_EQUAL:
-       case SLJIT_D_GREATER:
-       case SLJIT_D_LESS_EQUAL:
+       case SLJIT_GREATER_F64:
+       case SLJIT_LESS_EQUAL_F64:
                dst_ar = UGREATER_FLAG;
                break;
        case SLJIT_SIG_LESS:
@@ -2073,13 +2073,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
                dst_ar = sugg_dst_ar;
                type ^= 0x1; /* Flip type bit for the XORI below. */
                break;
-       case SLJIT_D_EQUAL:
-       case SLJIT_D_NOT_EQUAL:
+       case SLJIT_EQUAL_F64:
+       case SLJIT_NOT_EQUAL_F64:
                dst_ar = EQUAL_FLAG;
                break;
 
-       case SLJIT_D_UNORDERED:
-       case SLJIT_D_ORDERED:
+       case SLJIT_UNORDERED_F64:
+       case SLJIT_ORDERED_F64:
                FAIL_IF(push_inst(compiler, CFC1 | TA(sugg_dst_ar) | DA(FCSR_REG), sugg_dst_ar));
                FAIL_IF(push_inst(compiler, SRL | TA(sugg_dst_ar) | DA(sugg_dst_ar) | SH_IMM(23), sugg_dst_ar));
                FAIL_IF(push_inst(compiler, ANDI | SA(sugg_dst_ar) | TA(sugg_dst_ar) | IMM(1), sugg_dst_ar));
@@ -2115,10 +2115,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
 #endif
 }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw init_value)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
 {
        struct sljit_const *const_;
-       sljit_si reg;
+       sljit_s32 reg;
 
        CHECK_ERROR_PTR();
        CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value));
index b14b75ceb51c50487f4855ea75b59e047dc9bbb6..0f23cf86ddc045807ecc1a5d968d78c8032d9ff3 100644 (file)
@@ -26,7 +26,7 @@
 
 /* ppc 32-bit arch dependent functions. */
 
-static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si reg, sljit_sw imm)
+static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 reg, sljit_sw imm)
 {
        if (imm <= SIMM_MAX && imm >= SIMM_MIN)
                return push_inst(compiler, ADDI | D(reg) | A(0) | IMM(imm));
@@ -41,39 +41,39 @@ static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si reg, sl
 #define INS_CLEAR_LEFT(dst, src, from) \
        (RLWINM | S(src) | A(dst) | ((from) << 6) | (31 << 1))
 
-static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, sljit_si op, sljit_si flags,
-       sljit_si dst, sljit_si src1, sljit_si src2)
+static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 flags,
+       sljit_s32 dst, sljit_s32 src1, sljit_s32 src2)
 {
        switch (op) {
        case SLJIT_MOV:
-       case SLJIT_MOV_UI:
-       case SLJIT_MOV_SI:
+       case SLJIT_MOV_U32:
+       case SLJIT_MOV_S32:
        case SLJIT_MOV_P:
                SLJIT_ASSERT(src1 == TMP_REG1);
                if (dst != src2)
                        return push_inst(compiler, OR | S(src2) | A(dst) | B(src2));
                return SLJIT_SUCCESS;
 
-       case SLJIT_MOV_UB:
-       case SLJIT_MOV_SB:
+       case SLJIT_MOV_U8:
+       case SLJIT_MOV_S8:
                SLJIT_ASSERT(src1 == TMP_REG1);
                if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) {
-                       if (op == SLJIT_MOV_SB)
+                       if (op == SLJIT_MOV_S8)
                                return push_inst(compiler, EXTSB | S(src2) | A(dst));
                        return push_inst(compiler, INS_CLEAR_LEFT(dst, src2, 24));
                }
-               else if ((flags & REG_DEST) && op == SLJIT_MOV_SB)
+               else if ((flags & REG_DEST) && op == SLJIT_MOV_S8)
                        return push_inst(compiler, EXTSB | S(src2) | A(dst));
                else {
                        SLJIT_ASSERT(dst == src2);
                }
                return SLJIT_SUCCESS;
 
-       case SLJIT_MOV_UH:
-       case SLJIT_MOV_SH:
+       case SLJIT_MOV_U16:
+       case SLJIT_MOV_S16:
                SLJIT_ASSERT(src1 == TMP_REG1);
                if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) {
-                       if (op == SLJIT_MOV_SH)
+                       if (op == SLJIT_MOV_S16)
                                return push_inst(compiler, EXTSH | S(src2) | A(dst));
                        return push_inst(compiler, INS_CLEAR_LEFT(dst, src2, 16));
                }
@@ -244,7 +244,7 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si emit_const(struct sljit_compiler *compiler, sljit_si reg, sljit_sw init_value)
+static SLJIT_INLINE sljit_s32 emit_const(struct sljit_compiler *compiler, sljit_s32 reg, sljit_sw init_value)
 {
        FAIL_IF(push_inst(compiler, ADDIS | D(reg) | A(0) | IMM(init_value >> 16)));
        return push_inst(compiler, ORI | S(reg) | A(reg) | IMM(init_value));
index 182ac7b3da55b825922b5aae5b50d880cbbedc97..8e3223f725198b2cb62de14416701f2c60a744d4 100644 (file)
@@ -41,7 +41,7 @@
 #define PUSH_RLDICR(reg, shift) \
        push_inst(compiler, RLDI(reg, reg, 63 - shift, shift, 1))
 
-static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si reg, sljit_sw imm)
+static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 reg, sljit_sw imm)
 {
        sljit_uw tmp;
        sljit_uw shift;
@@ -145,8 +145,8 @@ static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si reg, sl
                src1 = TMP_REG1; \
        }
 
-static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, sljit_si op, sljit_si flags,
-       sljit_si dst, sljit_si src1, sljit_si src2)
+static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 flags,
+       sljit_s32 dst, sljit_s32 src1, sljit_s32 src2)
 {
        switch (op) {
        case SLJIT_MOV:
@@ -156,11 +156,11 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
                        return push_inst(compiler, OR | S(src2) | A(dst) | B(src2));
                return SLJIT_SUCCESS;
 
-       case SLJIT_MOV_UI:
-       case SLJIT_MOV_SI:
+       case SLJIT_MOV_U32:
+       case SLJIT_MOV_S32:
                SLJIT_ASSERT(src1 == TMP_REG1);
                if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) {
-                       if (op == SLJIT_MOV_SI)
+                       if (op == SLJIT_MOV_S32)
                                return push_inst(compiler, EXTSW | S(src2) | A(dst));
                        return push_inst(compiler, INS_CLEAR_LEFT(dst, src2, 0));
                }
@@ -169,26 +169,26 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
                }
                return SLJIT_SUCCESS;
 
-       case SLJIT_MOV_UB:
-       case SLJIT_MOV_SB:
+       case SLJIT_MOV_U8:
+       case SLJIT_MOV_S8:
                SLJIT_ASSERT(src1 == TMP_REG1);
                if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) {
-                       if (op == SLJIT_MOV_SB)
+                       if (op == SLJIT_MOV_S8)
                                return push_inst(compiler, EXTSB | S(src2) | A(dst));
                        return push_inst(compiler, INS_CLEAR_LEFT(dst, src2, 24));
                }
-               else if ((flags & REG_DEST) && op == SLJIT_MOV_SB)
+               else if ((flags & REG_DEST) && op == SLJIT_MOV_S8)
                        return push_inst(compiler, EXTSB | S(src2) | A(dst));
                else {
                        SLJIT_ASSERT(dst == src2);
                }
                return SLJIT_SUCCESS;
 
-       case SLJIT_MOV_UH:
-       case SLJIT_MOV_SH:
+       case SLJIT_MOV_U16:
+       case SLJIT_MOV_S16:
                SLJIT_ASSERT(src1 == TMP_REG1);
                if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) {
-                       if (op == SLJIT_MOV_SH)
+                       if (op == SLJIT_MOV_S16)
                                return push_inst(compiler, EXTSH | S(src2) | A(dst));
                        return push_inst(compiler, INS_CLEAR_LEFT(dst, src2, 16));
                }
@@ -389,7 +389,7 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si emit_const(struct sljit_compiler *compiler, sljit_si reg, sljit_sw init_value)
+static SLJIT_INLINE sljit_s32 emit_const(struct sljit_compiler *compiler, sljit_s32 reg, sljit_sw init_value)
 {
        FAIL_IF(push_inst(compiler, ADDIS | D(reg) | A(0) | IMM(init_value >> 48)));
        FAIL_IF(push_inst(compiler, ORI | S(reg) | A(reg) | IMM(init_value >> 32)));
index b6a043f4e48f24edf8d2495e29fb760d4623e96b..a3647327bfed6f4c69057c4065135b13c190699d 100644 (file)
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void)
+SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void)
 {
        return "PowerPC" SLJIT_CPUINFO;
 }
 
 /* Length of an instruction word.
    Both for ppc-32 and ppc-64. */
-typedef sljit_ui sljit_ins;
+typedef sljit_u32 sljit_ins;
 
 #if ((defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) && (defined _AIX)) \
        || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
@@ -46,6 +46,8 @@ typedef sljit_ui sljit_ins;
 #define SLJIT_PASS_ENTRY_ADDR_TO_CALL 1
 #endif
 
+#if (defined SLJIT_CACHE_FLUSH_OWN_IMPL && SLJIT_CACHE_FLUSH_OWN_IMPL)
+
 static void ppc_cache_flush(sljit_ins *from, sljit_ins *to)
 {
 #ifdef _AIX
@@ -87,6 +89,8 @@ static void ppc_cache_flush(sljit_ins *from, sljit_ins *to)
 #endif /* _AIX */
 }
 
+#endif /* (defined SLJIT_CACHE_FLUSH_OWN_IMPL && SLJIT_CACHE_FLUSH_OWN_IMPL) */
+
 #define TMP_REG1       (SLJIT_NUMBER_OF_REGISTERS + 2)
 #define TMP_REG2       (SLJIT_NUMBER_OF_REGISTERS + 3)
 #define TMP_REG3       (SLJIT_NUMBER_OF_REGISTERS + 4)
@@ -101,7 +105,7 @@ static void ppc_cache_flush(sljit_ins *from, sljit_ins *to)
 #define TMP_FREG1      (0)
 #define TMP_FREG2      (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1)
 
-static SLJIT_CONST sljit_ub reg_map[SLJIT_NUMBER_OF_REGISTERS + 7] = {
+static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 7] = {
        0, 3, 4, 5, 6, 7, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 1, 8, 9, 10, 31, 12
 };
 
@@ -236,7 +240,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_function_context(void** func_ptr, struct
 }
 #endif
 
-static sljit_si push_inst(struct sljit_compiler *compiler, sljit_ins ins)
+static sljit_s32 push_inst(struct sljit_compiler *compiler, sljit_ins ins)
 {
        sljit_ins *ptr = (sljit_ins*)ensure_buf(compiler, sizeof(sljit_ins));
        FAIL_IF(!ptr);
@@ -245,7 +249,7 @@ static sljit_si push_inst(struct sljit_compiler *compiler, sljit_ins ins)
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si detect_jump_type(struct sljit_jump *jump, sljit_ins *code_ptr, sljit_ins *code)
+static SLJIT_INLINE sljit_s32 detect_jump_type(struct sljit_jump *jump, sljit_ins *code_ptr, sljit_ins *code)
 {
        sljit_sw diff;
        sljit_uw target_addr;
@@ -571,32 +575,32 @@ ALT_FORM6         0x200000 */
 #define STACK_LOAD     LD
 #endif
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
-       sljit_si i, tmp, offs;
+       sljit_s32 i, tmp, offs;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
        set_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
 
        FAIL_IF(push_inst(compiler, MFLR | D(0)));
-       offs = -(sljit_si)(sizeof(sljit_sw));
+       offs = -(sljit_s32)(sizeof(sljit_sw));
        FAIL_IF(push_inst(compiler, STACK_STORE | S(TMP_ZERO) | A(SLJIT_SP) | IMM(offs)));
 
        tmp = saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? (SLJIT_S0 + 1 - saveds) : SLJIT_FIRST_SAVED_REG;
        for (i = SLJIT_S0; i >= tmp; i--) {
-               offs -= (sljit_si)(sizeof(sljit_sw));
+               offs -= (sljit_s32)(sizeof(sljit_sw));
                FAIL_IF(push_inst(compiler, STACK_STORE | S(i) | A(SLJIT_SP) | IMM(offs)));
        }
 
        for (i = scratches; i >= SLJIT_FIRST_SAVED_REG; i--) {
-               offs -= (sljit_si)(sizeof(sljit_sw));
+               offs -= (sljit_s32)(sizeof(sljit_sw));
                FAIL_IF(push_inst(compiler, STACK_STORE | S(i) | A(SLJIT_SP) | IMM(offs)));
        }
 
-       SLJIT_ASSERT(offs == -(sljit_si)GET_SAVED_REGISTERS_SIZE(compiler->scratches, compiler->saveds, 1));
+       SLJIT_ASSERT(offs == -(sljit_s32)GET_SAVED_REGISTERS_SIZE(compiler->scratches, compiler->saveds, 1));
 
 #if (defined SLJIT_PPC_STACK_FRAME_V2 && SLJIT_PPC_STACK_FRAME_V2)
        FAIL_IF(push_inst(compiler, STACK_STORE | S(0) | A(SLJIT_SP) | IMM(2 * sizeof(sljit_sw))));
@@ -635,9 +639,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
        CHECK_ERROR();
        CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
@@ -648,9 +652,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compi
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si i, tmp, offs;
+       sljit_s32 i, tmp, offs;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_return(compiler, op, src, srcw));
@@ -670,18 +674,18 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
        FAIL_IF(push_inst(compiler, STACK_LOAD | D(0) | A(SLJIT_SP) | IMM(sizeof(sljit_sw))));
 #endif
 
-       offs = -(sljit_si)GET_SAVED_REGISTERS_SIZE(compiler->scratches, compiler->saveds, 1);
+       offs = -(sljit_s32)GET_SAVED_REGISTERS_SIZE(compiler->scratches, compiler->saveds, 1);
 
        tmp = compiler->scratches;
        for (i = SLJIT_FIRST_SAVED_REG; i <= tmp; i++) {
                FAIL_IF(push_inst(compiler, STACK_LOAD | D(i) | A(SLJIT_SP) | IMM(offs)));
-               offs += (sljit_si)(sizeof(sljit_sw));
+               offs += (sljit_s32)(sizeof(sljit_sw));
        }
 
        tmp = compiler->saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? (SLJIT_S0 + 1 - compiler->saveds) : SLJIT_FIRST_SAVED_REG;
        for (i = tmp; i <= SLJIT_S0; i++) {
                FAIL_IF(push_inst(compiler, STACK_LOAD | D(i) | A(SLJIT_SP) | IMM(offs)));
-               offs += (sljit_si)(sizeof(sljit_sw));
+               offs += (sljit_s32)(sizeof(sljit_sw));
        }
 
        FAIL_IF(push_inst(compiler, STACK_LOAD | D(TMP_ZERO) | A(SLJIT_SP) | IMM(offs)));
@@ -722,7 +726,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
        (((inst) & ~(INT_ALIGNED | UPDATE_REQ)) | (((flags) & MEM_MASK) <= GPR_REG ? D(reg) : FD(reg)))
 #endif
 
-static SLJIT_CONST sljit_ins data_transfer_insts[64 + 8] = {
+static const sljit_ins data_transfer_insts[64 + 8] = {
 
 /* -------- Unsigned -------- */
 
@@ -841,7 +845,7 @@ static SLJIT_CONST sljit_ins data_transfer_insts[64 + 8] = {
 #undef ARCH_32_64
 
 /* Simple cases, (no caching is required). */
-static sljit_si getput_arg_fast(struct sljit_compiler *compiler, sljit_si inp_flags, sljit_si reg, sljit_si arg, sljit_sw argw)
+static sljit_s32 getput_arg_fast(struct sljit_compiler *compiler, sljit_s32 inp_flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
 {
        sljit_ins inst;
 
@@ -891,7 +895,7 @@ static sljit_si getput_arg_fast(struct sljit_compiler *compiler, sljit_si inp_fl
 /* See getput_arg below.
    Note: can_cache is called only for binary operators. Those operator always
    uses word arguments without write back. */
-static sljit_si can_cache(sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_sw next_argw)
+static sljit_s32 can_cache(sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
 {
        sljit_sw high_short, next_high_short;
 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
@@ -940,9 +944,9 @@ static sljit_si can_cache(sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_
 #endif
 
 /* Emit the necessary instructions. See can_cache above. */
-static sljit_si getput_arg(struct sljit_compiler *compiler, sljit_si inp_flags, sljit_si reg, sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_sw next_argw)
+static sljit_s32 getput_arg(struct sljit_compiler *compiler, sljit_s32 inp_flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
 {
-       sljit_si tmp_r;
+       sljit_s32 tmp_r;
        sljit_ins inst;
        sljit_sw high_short, next_high_short;
 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
@@ -992,7 +996,7 @@ static sljit_si getput_arg(struct sljit_compiler *compiler, sljit_si inp_flags,
 #endif
 
                arg &= REG_MASK;
-               high_short = (sljit_si)(argw + ((argw & 0x8000) << 1)) & ~0xffff;
+               high_short = (sljit_s32)(argw + ((argw & 0x8000) << 1)) & ~0xffff;
                /* The getput_arg_fast should handle this otherwise. */
 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
                SLJIT_ASSERT(high_short && high_short <= 0x7fffffffl && high_short >= -0x80000000l);
@@ -1010,7 +1014,7 @@ static sljit_si getput_arg(struct sljit_compiler *compiler, sljit_si inp_flags,
                }
                else if (compiler->cache_arg != (SLJIT_MEM | arg) || high_short != compiler->cache_argw) {
                        if ((next_arg & SLJIT_MEM) && !(next_arg & OFFS_REG_MASK)) {
-                               next_high_short = (sljit_si)(next_argw + ((next_argw & 0x8000) << 1)) & ~0xffff;
+                               next_high_short = (sljit_s32)(next_argw + ((next_argw & 0x8000) << 1)) & ~0xffff;
                                if (high_short == next_high_short) {
                                        compiler->cache_arg = SLJIT_MEM | arg;
                                        compiler->cache_argw = high_short;
@@ -1107,27 +1111,27 @@ static sljit_si getput_arg(struct sljit_compiler *compiler, sljit_si inp_flags,
 #endif
 }
 
-static SLJIT_INLINE sljit_si emit_op_mem2(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg, sljit_si arg1, sljit_sw arg1w, sljit_si arg2, sljit_sw arg2w)
+static SLJIT_INLINE sljit_s32 emit_op_mem2(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg1, sljit_sw arg1w, sljit_s32 arg2, sljit_sw arg2w)
 {
        if (getput_arg_fast(compiler, flags, reg, arg1, arg1w))
                return compiler->error;
        return getput_arg(compiler, flags, reg, arg1, arg1w, arg2, arg2w);
 }
 
-static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si input_flags,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 input_flags,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        /* arg1 goes to TMP_REG1 or src reg
           arg2 goes to TMP_REG2, imm or src reg
           TMP_REG3 can be used for caching
           result goes to TMP_REG2, so put result can use TMP_REG1 and TMP_REG3. */
-       sljit_si dst_r;
-       sljit_si src1_r;
-       sljit_si src2_r;
-       sljit_si sugg_src2_r = TMP_REG2;
-       sljit_si flags = input_flags & (ALT_FORM1 | ALT_FORM2 | ALT_FORM3 | ALT_FORM4 | ALT_FORM5 | ALT_FORM6 | ALT_SIGN_EXT | ALT_SET_FLAGS);
+       sljit_s32 dst_r;
+       sljit_s32 src1_r;
+       sljit_s32 src2_r;
+       sljit_s32 sugg_src2_r = TMP_REG2;
+       sljit_s32 flags = input_flags & (ALT_FORM1 | ALT_FORM2 | ALT_FORM3 | ALT_FORM4 | ALT_FORM5 | ALT_FORM6 | ALT_SIGN_EXT | ALT_SET_FLAGS);
 
        if (!(input_flags & ALT_KEEP_CACHE)) {
                compiler->cache_arg = 0;
@@ -1136,14 +1140,14 @@ static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si i
 
        /* Destination check. */
        if (SLJIT_UNLIKELY(dst == SLJIT_UNUSED)) {
-               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_SI && !(src2 & SLJIT_MEM))
+               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_S32 && !(src2 & SLJIT_MEM))
                        return SLJIT_SUCCESS;
                dst_r = TMP_REG2;
        }
        else if (FAST_IS_REG(dst)) {
                dst_r = dst;
                flags |= REG_DEST;
-               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_SI)
+               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_S32)
                        sugg_src2_r = dst_r;
        }
        else {
@@ -1178,7 +1182,7 @@ static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si i
        if (FAST_IS_REG(src2)) {
                src2_r = src2;
                flags |= REG2_SOURCE;
-               if (!(flags & REG_DEST) && op >= SLJIT_MOV && op <= SLJIT_MOVU_SI)
+               if (!(flags & REG_DEST) && op >= SLJIT_MOV && op <= SLJIT_MOVU_S32)
                        dst_r = src2_r;
        }
        else if (src2 & SLJIT_IMM) {
@@ -1243,10 +1247,10 @@ static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si i
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler, sljit_si op)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op)
 {
 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
-       sljit_si int_op = op & SLJIT_INT_OP;
+       sljit_s32 int_op = op & SLJIT_I32_OP;
 #endif
 
        CHECK_ERROR();
@@ -1257,33 +1261,33 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
        case SLJIT_BREAKPOINT:
        case SLJIT_NOP:
                return push_inst(compiler, NOP);
-       case SLJIT_LUMUL:
-       case SLJIT_LSMUL:
+       case SLJIT_LMUL_UW:
+       case SLJIT_LMUL_SW:
                FAIL_IF(push_inst(compiler, OR | S(SLJIT_R0) | A(TMP_REG1) | B(SLJIT_R0)));
 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
                FAIL_IF(push_inst(compiler, MULLD | D(SLJIT_R0) | A(TMP_REG1) | B(SLJIT_R1)));
-               return push_inst(compiler, (op == SLJIT_LUMUL ? MULHDU : MULHD) | D(SLJIT_R1) | A(TMP_REG1) | B(SLJIT_R1));
+               return push_inst(compiler, (op == SLJIT_LMUL_UW ? MULHDU : MULHD) | D(SLJIT_R1) | A(TMP_REG1) | B(SLJIT_R1));
 #else
                FAIL_IF(push_inst(compiler, MULLW | D(SLJIT_R0) | A(TMP_REG1) | B(SLJIT_R1)));
-               return push_inst(compiler, (op == SLJIT_LUMUL ? MULHWU : MULHW) | D(SLJIT_R1) | A(TMP_REG1) | B(SLJIT_R1));
+               return push_inst(compiler, (op == SLJIT_LMUL_UW ? MULHWU : MULHW) | D(SLJIT_R1) | A(TMP_REG1) | B(SLJIT_R1));
 #endif
-       case SLJIT_UDIVMOD:
-       case SLJIT_SDIVMOD:
+       case SLJIT_DIVMOD_UW:
+       case SLJIT_DIVMOD_SW:
                FAIL_IF(push_inst(compiler, OR | S(SLJIT_R0) | A(TMP_REG1) | B(SLJIT_R0)));
 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
-               FAIL_IF(push_inst(compiler, (int_op ? (op == SLJIT_UDIVMOD ? DIVWU : DIVW) : (op == SLJIT_UDIVMOD ? DIVDU : DIVD)) | D(SLJIT_R0) | A(SLJIT_R0) | B(SLJIT_R1)));
+               FAIL_IF(push_inst(compiler, (int_op ? (op == SLJIT_DIVMOD_UW ? DIVWU : DIVW) : (op == SLJIT_DIVMOD_UW ? DIVDU : DIVD)) | D(SLJIT_R0) | A(SLJIT_R0) | B(SLJIT_R1)));
                FAIL_IF(push_inst(compiler, (int_op ? MULLW : MULLD) | D(SLJIT_R1) | A(SLJIT_R0) | B(SLJIT_R1)));
 #else
-               FAIL_IF(push_inst(compiler, (op == SLJIT_UDIVMOD ? DIVWU : DIVW) | D(SLJIT_R0) | A(SLJIT_R0) | B(SLJIT_R1)));
+               FAIL_IF(push_inst(compiler, (op == SLJIT_DIVMOD_UW ? DIVWU : DIVW) | D(SLJIT_R0) | A(SLJIT_R0) | B(SLJIT_R1)));
                FAIL_IF(push_inst(compiler, MULLW | D(SLJIT_R1) | A(SLJIT_R0) | B(SLJIT_R1)));
 #endif
                return push_inst(compiler, SUBF | D(SLJIT_R1) | A(SLJIT_R1) | B(TMP_REG1));
-       case SLJIT_UDIVI:
-       case SLJIT_SDIVI:
+       case SLJIT_DIV_UW:
+       case SLJIT_DIV_SW:
 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
-               return push_inst(compiler, (int_op ? (op == SLJIT_UDIVI ? DIVWU : DIVW) : (op == SLJIT_UDIVI ? DIVDU : DIVD)) | D(SLJIT_R0) | A(SLJIT_R0) | B(SLJIT_R1));
+               return push_inst(compiler, (int_op ? (op == SLJIT_DIV_UW ? DIVWU : DIVW) : (op == SLJIT_DIV_UW ? DIVDU : DIVD)) | D(SLJIT_R0) | A(SLJIT_R0) | B(SLJIT_R1));
 #else
-               return push_inst(compiler, (op == SLJIT_UDIVI ? DIVWU : DIVW) | D(SLJIT_R0) | A(SLJIT_R0) | B(SLJIT_R1));
+               return push_inst(compiler, (op == SLJIT_DIV_UW ? DIVWU : DIVW) | D(SLJIT_R0) | A(SLJIT_R0) | B(SLJIT_R1));
 #endif
        }
 
@@ -1293,12 +1297,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
 #define EMIT_MOV(type, type_flags, type_cast) \
        emit_op(compiler, (src & SLJIT_IMM) ? SLJIT_MOV : type, flags | (type_flags), dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? type_cast srcw : srcw)
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si flags = GET_FLAGS(op) ? ALT_SET_FLAGS : 0;
-       sljit_si op_flags = GET_ALL_FLAGS(op);
+       sljit_s32 flags = GET_FLAGS(op) ? ALT_SET_FLAGS : 0;
+       sljit_s32 op_flags = GET_ALL_FLAGS(op);
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_op1(compiler, op, dst, dstw, src, srcw));
@@ -1312,21 +1316,21 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
        if (op_flags & SLJIT_SET_O)
                FAIL_IF(push_inst(compiler, MTXER | S(TMP_ZERO)));
 
-       if (op_flags & SLJIT_INT_OP) {
+       if (op_flags & SLJIT_I32_OP) {
                if (op < SLJIT_NOT) {
                        if (FAST_IS_REG(src) && src == dst) {
                                if (!TYPE_CAST_NEEDED(op))
                                        return SLJIT_SUCCESS;
                        }
 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
-                       if (op == SLJIT_MOV_SI && (src & SLJIT_MEM))
-                               op = SLJIT_MOV_UI;
-                       if (op == SLJIT_MOVU_SI && (src & SLJIT_MEM))
-                               op = SLJIT_MOVU_UI;
-                       if (op == SLJIT_MOV_UI && (src & SLJIT_IMM))
-                               op = SLJIT_MOV_SI;
-                       if (op == SLJIT_MOVU_UI && (src & SLJIT_IMM))
-                               op = SLJIT_MOVU_SI;
+                       if (op == SLJIT_MOV_S32 && (src & SLJIT_MEM))
+                               op = SLJIT_MOV_U32;
+                       if (op == SLJIT_MOVU_S32 && (src & SLJIT_MEM))
+                               op = SLJIT_MOVU_U32;
+                       if (op == SLJIT_MOV_U32 && (src & SLJIT_IMM))
+                               op = SLJIT_MOV_S32;
+                       if (op == SLJIT_MOVU_U32 && (src & SLJIT_IMM))
+                               op = SLJIT_MOVU_S32;
 #endif
                }
 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
@@ -1334,7 +1338,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
                        /* Most operations expect sign extended arguments. */
                        flags |= INT_DATA | SIGNED_DATA;
                        if (src & SLJIT_IMM)
-                               srcw = (sljit_si)srcw;
+                               srcw = (sljit_s32)srcw;
                }
 #endif
        }
@@ -1343,58 +1347,58 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
        case SLJIT_MOV:
        case SLJIT_MOV_P:
 #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
-       case SLJIT_MOV_UI:
-       case SLJIT_MOV_SI:
+       case SLJIT_MOV_U32:
+       case SLJIT_MOV_S32:
 #endif
                return emit_op(compiler, SLJIT_MOV, flags | WORD_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
 
 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
-       case SLJIT_MOV_UI:
-               return EMIT_MOV(SLJIT_MOV_UI, INT_DATA, (sljit_ui));
+       case SLJIT_MOV_U32:
+               return EMIT_MOV(SLJIT_MOV_U32, INT_DATA, (sljit_u32));
 
-       case SLJIT_MOV_SI:
-               return EMIT_MOV(SLJIT_MOV_SI, INT_DATA | SIGNED_DATA, (sljit_si));
+       case SLJIT_MOV_S32:
+               return EMIT_MOV(SLJIT_MOV_S32, INT_DATA | SIGNED_DATA, (sljit_s32));
 #endif
 
-       case SLJIT_MOV_UB:
-               return EMIT_MOV(SLJIT_MOV_UB, BYTE_DATA, (sljit_ub));
+       case SLJIT_MOV_U8:
+               return EMIT_MOV(SLJIT_MOV_U8, BYTE_DATA, (sljit_u8));
 
-       case SLJIT_MOV_SB:
-               return EMIT_MOV(SLJIT_MOV_SB, BYTE_DATA | SIGNED_DATA, (sljit_sb));
+       case SLJIT_MOV_S8:
+               return EMIT_MOV(SLJIT_MOV_S8, BYTE_DATA | SIGNED_DATA, (sljit_s8));
 
-       case SLJIT_MOV_UH:
-               return EMIT_MOV(SLJIT_MOV_UH, HALF_DATA, (sljit_uh));
+       case SLJIT_MOV_U16:
+               return EMIT_MOV(SLJIT_MOV_U16, HALF_DATA, (sljit_u16));
 
-       case SLJIT_MOV_SH:
-               return EMIT_MOV(SLJIT_MOV_SH, HALF_DATA | SIGNED_DATA, (sljit_sh));
+       case SLJIT_MOV_S16:
+               return EMIT_MOV(SLJIT_MOV_S16, HALF_DATA | SIGNED_DATA, (sljit_s16));
 
        case SLJIT_MOVU:
        case SLJIT_MOVU_P:
 #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
-       case SLJIT_MOVU_UI:
-       case SLJIT_MOVU_SI:
+       case SLJIT_MOVU_U32:
+       case SLJIT_MOVU_S32:
 #endif
                return emit_op(compiler, SLJIT_MOV, flags | WORD_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
 
 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
-       case SLJIT_MOVU_UI:
-               return EMIT_MOV(SLJIT_MOV_UI, INT_DATA | WRITE_BACK, (sljit_ui));
+       case SLJIT_MOVU_U32:
+               return EMIT_MOV(SLJIT_MOV_U32, INT_DATA | WRITE_BACK, (sljit_u32));
 
-       case SLJIT_MOVU_SI:
-               return EMIT_MOV(SLJIT_MOV_SI, INT_DATA | SIGNED_DATA | WRITE_BACK, (sljit_si));
+       case SLJIT_MOVU_S32:
+               return EMIT_MOV(SLJIT_MOV_S32, INT_DATA | SIGNED_DATA | WRITE_BACK, (sljit_s32));
 #endif
 
-       case SLJIT_MOVU_UB:
-               return EMIT_MOV(SLJIT_MOV_UB, BYTE_DATA | WRITE_BACK, (sljit_ub));
+       case SLJIT_MOVU_U8:
+               return EMIT_MOV(SLJIT_MOV_U8, BYTE_DATA | WRITE_BACK, (sljit_u8));
 
-       case SLJIT_MOVU_SB:
-               return EMIT_MOV(SLJIT_MOV_SB, BYTE_DATA | SIGNED_DATA | WRITE_BACK, (sljit_sb));
+       case SLJIT_MOVU_S8:
+               return EMIT_MOV(SLJIT_MOV_S8, BYTE_DATA | SIGNED_DATA | WRITE_BACK, (sljit_s8));
 
-       case SLJIT_MOVU_UH:
-               return EMIT_MOV(SLJIT_MOV_UH, HALF_DATA | WRITE_BACK, (sljit_uh));
+       case SLJIT_MOVU_U16:
+               return EMIT_MOV(SLJIT_MOV_U16, HALF_DATA | WRITE_BACK, (sljit_u16));
 
-       case SLJIT_MOVU_SH:
-               return EMIT_MOV(SLJIT_MOV_SH, HALF_DATA | SIGNED_DATA | WRITE_BACK, (sljit_sh));
+       case SLJIT_MOVU_S16:
+               return EMIT_MOV(SLJIT_MOV_S16, HALF_DATA | SIGNED_DATA | WRITE_BACK, (sljit_s16));
 
        case SLJIT_NOT:
                return emit_op(compiler, SLJIT_NOT, flags, dst, dstw, TMP_REG1, 0, src, srcw);
@@ -1404,7 +1408,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
 
        case SLJIT_CLZ:
 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
-               return emit_op(compiler, SLJIT_CLZ, flags | (!(op_flags & SLJIT_INT_OP) ? 0 : ALT_FORM1), dst, dstw, TMP_REG1, 0, src, srcw);
+               return emit_op(compiler, SLJIT_CLZ, flags | (!(op_flags & SLJIT_I32_OP) ? 0 : ALT_FORM1), dst, dstw, TMP_REG1, 0, src, srcw);
 #else
                return emit_op(compiler, SLJIT_CLZ, flags, dst, dstw, TMP_REG1, 0, src, srcw);
 #endif
@@ -1448,12 +1452,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
        ((src) & SLJIT_IMM)
 #endif
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_si flags = GET_FLAGS(op) ? ALT_SET_FLAGS : 0;
+       sljit_s32 flags = GET_FLAGS(op) ? ALT_SET_FLAGS : 0;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_op2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
@@ -1467,13 +1471,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
                src2 = TMP_ZERO;
 
 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
-       if (op & SLJIT_INT_OP) {
+       if (op & SLJIT_I32_OP) {
                /* Most operations expect sign extended arguments. */
                flags |= INT_DATA | SIGNED_DATA;
                if (src1 & SLJIT_IMM)
-                       src1w = (sljit_si)(src1w);
+                       src1w = (sljit_s32)(src1w);
                if (src2 & SLJIT_IMM)
-                       src2w = (sljit_si)(src2w);
+                       src2w = (sljit_s32)(src2w);
                if (GET_FLAGS(op))
                        flags |= ALT_SIGN_EXT;
        }
@@ -1549,7 +1553,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
                }
                if (dst == SLJIT_UNUSED && (op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S)) && !(op & (SLJIT_SET_O | SLJIT_SET_C))) {
                        if (!(op & SLJIT_SET_U)) {
-                               /* We know ALT_SIGN_EXT is set if it is an SLJIT_INT_OP on 64 bit systems. */
+                               /* We know ALT_SIGN_EXT is set if it is an SLJIT_I32_OP on 64 bit systems. */
                                if (TEST_SL_IMM(src2, src2w)) {
                                        compiler->imm = src2w & 0xffff;
                                        return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM2, dst, dstw, src1, src1w, TMP_REG2, 0);
@@ -1560,7 +1564,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
                                }
                        }
                        if (!(op & (SLJIT_SET_E | SLJIT_SET_S))) {
-                               /* We know ALT_SIGN_EXT is set if it is an SLJIT_INT_OP on 64 bit systems. */
+                               /* We know ALT_SIGN_EXT is set if it is an SLJIT_I32_OP on 64 bit systems. */
                                if (TEST_UL_IMM(src2, src2w)) {
                                        compiler->imm = src2w & 0xffff;
                                        return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM3, dst, dstw, src1, src1w, TMP_REG2, 0);
@@ -1579,7 +1583,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
                                return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM3, dst, dstw, src1, src1w, TMP_REG2, 0);
                        }
                }
-               /* We know ALT_SIGN_EXT is set if it is an SLJIT_INT_OP on 64 bit systems. */
+               /* We know ALT_SIGN_EXT is set if it is an SLJIT_I32_OP on 64 bit systems. */
                return emit_op(compiler, SLJIT_SUB, flags | (!(op & SLJIT_SET_U) ? 0 : ALT_FORM6), dst, dstw, src1, src1w, src2, src2w);
 
        case SLJIT_SUBC:
@@ -1587,7 +1591,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
 
        case SLJIT_MUL:
 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
-               if (op & SLJIT_INT_OP)
+               if (op & SLJIT_I32_OP)
                        flags |= ALT_FORM2;
 #endif
                if (!GET_FLAGS(op)) {
@@ -1643,7 +1647,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
        case SLJIT_SHL:
        case SLJIT_LSHR:
 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
-               if (op & SLJIT_INT_OP)
+               if (op & SLJIT_I32_OP)
                        flags |= ALT_FORM2;
 #endif
                if (src2 & SLJIT_IMM) {
@@ -1656,20 +1660,20 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
 {
        CHECK_REG_INDEX(check_sljit_get_register_index(reg));
        return reg_map[reg];
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_float_register_index(sljit_si reg)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_float_register_index(sljit_s32 reg)
 {
        CHECK_REG_INDEX(check_sljit_get_float_register_index(reg));
        return reg;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *compiler,
-       void *instruction, sljit_si size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
+       void *instruction, sljit_s32 size)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_op_custom(compiler, instruction, size));
@@ -1681,7 +1685,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *co
 /*  Floating point operators                                             */
 /* --------------------------------------------------------------------- */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
 {
 #ifdef SLJIT_IS_FPU_AVAILABLE
        return SLJIT_IS_FPU_AVAILABLE;
@@ -1691,8 +1695,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
 #endif
 }
 
-#define FLOAT_DATA(op) (DOUBLE_DATA | ((op & SLJIT_SINGLE_OP) >> 6))
-#define SELECT_FOP(op, single, double) ((op & SLJIT_SINGLE_OP) ? single : double)
+#define FLOAT_DATA(op) (DOUBLE_DATA | ((op & SLJIT_F32_OP) >> 6))
+#define SELECT_FOP(op, single, double) ((op & SLJIT_F32_OP) ? single : double)
 
 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
 #define FLOAT_TMP_MEM_OFFSET (6 * sizeof(sljit_sw))
@@ -1709,9 +1713,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
 
 #endif /* SLJIT_CONFIG_PPC_64 */
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_convw_fromd(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
        if (src & SLJIT_MEM) {
                /* We can ignore the temporary data store on the stack from caching point of view. */
@@ -1721,12 +1725,12 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_convw_fromd(struct sljit_compiler *
 
 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
        op = GET_OPCODE(op);
-       FAIL_IF(push_inst(compiler, (op == SLJIT_CONVI_FROMD ? FCTIWZ : FCTIDZ) | FD(TMP_FREG1) | FB(src)));
+       FAIL_IF(push_inst(compiler, (op == SLJIT_CONV_S32_FROM_F64 ? FCTIWZ : FCTIDZ) | FD(TMP_FREG1) | FB(src)));
 
        if (dst == SLJIT_UNUSED)
                return SLJIT_SUCCESS;
 
-       if (op == SLJIT_CONVW_FROMD) {
+       if (op == SLJIT_CONV_SW_FROM_F64) {
                if (FAST_IS_REG(dst)) {
                        FAIL_IF(emit_op_mem2(compiler, DOUBLE_DATA, TMP_FREG1, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET, 0, 0));
                        return emit_op_mem2(compiler, WORD_DATA | LOAD_DATA, dst, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET, 0, 0);
@@ -1777,21 +1781,21 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_convw_fromd(struct sljit_compiler *
        return push_inst(compiler, STFIWX | FS(TMP_FREG1) | A(dst & REG_MASK) | B(dstw));
 }
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_convd_fromw(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
 
-       sljit_si dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
+       sljit_s32 dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
 
        if (src & SLJIT_IMM) {
-               if (GET_OPCODE(op) == SLJIT_CONVD_FROMI)
-                       srcw = (sljit_si)srcw;
+               if (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_S32)
+                       srcw = (sljit_s32)srcw;
                FAIL_IF(load_immediate(compiler, TMP_REG1, srcw));
                src = TMP_REG1;
        }
-       else if (GET_OPCODE(op) == SLJIT_CONVD_FROMI) {
+       else if (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_S32) {
                if (FAST_IS_REG(src))
                        FAIL_IF(push_inst(compiler, EXTSW | S(src) | A(TMP_REG1)));
                else
@@ -1810,14 +1814,14 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_convd_fromw(struct sljit_compiler *
 
        if (dst & SLJIT_MEM)
                return emit_op_mem2(compiler, FLOAT_DATA(op), TMP_FREG1, dst, dstw, 0, 0);
-       if (op & SLJIT_SINGLE_OP)
+       if (op & SLJIT_F32_OP)
                return push_inst(compiler, FRSP | FD(dst_r) | FB(dst_r));
        return SLJIT_SUCCESS;
 
 #else
 
-       sljit_si dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
-       sljit_si invert_sign = 1;
+       sljit_s32 dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
+       sljit_s32 invert_sign = 1;
 
        if (src & SLJIT_IMM) {
                FAIL_IF(load_immediate(compiler, TMP_REG1, srcw ^ 0x80000000));
@@ -1848,16 +1852,16 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_convd_fromw(struct sljit_compiler *
 
        if (dst & SLJIT_MEM)
                return emit_op_mem2(compiler, FLOAT_DATA(op), TMP_FREG1, dst, dstw, 0, 0);
-       if (op & SLJIT_SINGLE_OP)
+       if (op & SLJIT_F32_OP)
                return push_inst(compiler, FRSP | FD(dst_r) | FB(dst_r));
        return SLJIT_SUCCESS;
 
 #endif
 }
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        if (src1 & SLJIT_MEM) {
                FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, src2, src2w));
@@ -1872,21 +1876,21 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_cmp(struct sljit_compiler *compiler
        return push_inst(compiler, FCMPU | CRD(4) | FA(src1) | FB(src2));
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si dst_r;
+       sljit_s32 dst_r;
 
        CHECK_ERROR();
        compiler->cache_arg = 0;
        compiler->cache_argw = 0;
 
-       SLJIT_COMPILE_ASSERT((SLJIT_SINGLE_OP == 0x100) && !(DOUBLE_DATA & 0x4), float_transfer_bit_error);
+       SLJIT_COMPILE_ASSERT((SLJIT_F32_OP == 0x100) && !(DOUBLE_DATA & 0x4), float_transfer_bit_error);
        SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw);
 
-       if (GET_OPCODE(op) == SLJIT_CONVD_FROMS)
-               op ^= SLJIT_SINGLE_OP;
+       if (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_F32)
+               op ^= SLJIT_F32_OP;
 
        dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
 
@@ -1896,14 +1900,14 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compile
        }
 
        switch (GET_OPCODE(op)) {
-       case SLJIT_CONVD_FROMS:
-               op ^= SLJIT_SINGLE_OP;
-               if (op & SLJIT_SINGLE_OP) {
+       case SLJIT_CONV_F64_FROM_F32:
+               op ^= SLJIT_F32_OP;
+               if (op & SLJIT_F32_OP) {
                        FAIL_IF(push_inst(compiler, FRSP | FD(dst_r) | FB(src)));
                        break;
                }
                /* Fall through. */
-       case SLJIT_DMOV:
+       case SLJIT_MOV_F64:
                if (src != dst_r) {
                        if (dst_r != TMP_FREG1)
                                FAIL_IF(push_inst(compiler, FMR | FD(dst_r) | FB(src)));
@@ -1911,10 +1915,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compile
                                dst_r = src;
                }
                break;
-       case SLJIT_DNEG:
+       case SLJIT_NEG_F64:
                FAIL_IF(push_inst(compiler, FNEG | FD(dst_r) | FB(src)));
                break;
-       case SLJIT_DABS:
+       case SLJIT_ABS_F64:
                FAIL_IF(push_inst(compiler, FABS | FD(dst_r) | FB(src)));
                break;
        }
@@ -1924,12 +1928,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compile
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_si dst_r, flags = 0;
+       sljit_s32 dst_r, flags = 0;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_fop2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
@@ -1979,19 +1983,19 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compile
                src2 = TMP_FREG2;
 
        switch (GET_OPCODE(op)) {
-       case SLJIT_DADD:
+       case SLJIT_ADD_F64:
                FAIL_IF(push_inst(compiler, SELECT_FOP(op, FADDS, FADD) | FD(dst_r) | FA(src1) | FB(src2)));
                break;
 
-       case SLJIT_DSUB:
+       case SLJIT_SUB_F64:
                FAIL_IF(push_inst(compiler, SELECT_FOP(op, FSUBS, FSUB) | FD(dst_r) | FA(src1) | FB(src2)));
                break;
 
-       case SLJIT_DMUL:
+       case SLJIT_MUL_F64:
                FAIL_IF(push_inst(compiler, SELECT_FOP(op, FMULS, FMUL) | FD(dst_r) | FA(src1) | FC(src2) /* FMUL use FC as src2 */));
                break;
 
-       case SLJIT_DDIV:
+       case SLJIT_DIV_F64:
                FAIL_IF(push_inst(compiler, SELECT_FOP(op, FDIVS, FDIV) | FD(dst_r) | FA(src1) | FB(src2)));
                break;
        }
@@ -2009,7 +2013,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compile
 /*  Other instructions                                                   */
 /* --------------------------------------------------------------------- */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw));
@@ -2027,7 +2031,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *c
        return emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TMP_REG1, 0, TMP_REG2, 0);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_fast_return(compiler, src, srcw));
@@ -2065,7 +2069,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compi
        return label;
 }
 
-static sljit_ins get_bo_bi_flags(sljit_si type)
+static sljit_ins get_bo_bi_flags(sljit_s32 type)
 {
        switch (type) {
        case SLJIT_EQUAL:
@@ -2075,19 +2079,19 @@ static sljit_ins get_bo_bi_flags(sljit_si type)
                return (4 << 21) | (2 << 16);
 
        case SLJIT_LESS:
-       case SLJIT_D_LESS:
+       case SLJIT_LESS_F64:
                return (12 << 21) | ((4 + 0) << 16);
 
        case SLJIT_GREATER_EQUAL:
-       case SLJIT_D_GREATER_EQUAL:
+       case SLJIT_GREATER_EQUAL_F64:
                return (4 << 21) | ((4 + 0) << 16);
 
        case SLJIT_GREATER:
-       case SLJIT_D_GREATER:
+       case SLJIT_GREATER_F64:
                return (12 << 21) | ((4 + 1) << 16);
 
        case SLJIT_LESS_EQUAL:
-       case SLJIT_D_LESS_EQUAL:
+       case SLJIT_LESS_EQUAL_F64:
                return (4 << 21) | ((4 + 1) << 16);
 
        case SLJIT_SIG_LESS:
@@ -2110,16 +2114,16 @@ static sljit_ins get_bo_bi_flags(sljit_si type)
        case SLJIT_MUL_NOT_OVERFLOW:
                return (4 << 21) | (3 << 16);
 
-       case SLJIT_D_EQUAL:
+       case SLJIT_EQUAL_F64:
                return (12 << 21) | ((4 + 2) << 16);
 
-       case SLJIT_D_NOT_EQUAL:
+       case SLJIT_NOT_EQUAL_F64:
                return (4 << 21) | ((4 + 2) << 16);
 
-       case SLJIT_D_UNORDERED:
+       case SLJIT_UNORDERED_F64:
                return (12 << 21) | ((4 + 3) << 16);
 
-       case SLJIT_D_ORDERED:
+       case SLJIT_ORDERED_F64:
                return (4 << 21) | ((4 + 3) << 16);
 
        default:
@@ -2128,7 +2132,7 @@ static sljit_ins get_bo_bi_flags(sljit_si type)
        }
 }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_si type)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_s32 type)
 {
        struct sljit_jump *jump;
        sljit_ins bo_bi_flags;
@@ -2160,10 +2164,10 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
        return jump;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compiler, sljit_si type, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
 {
        struct sljit_jump *jump = NULL;
-       sljit_si src_r;
+       sljit_s32 src_r;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_ijump(compiler, type, src, srcw));
@@ -2211,13 +2215,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compil
 #define INVERT_BIT(dst) \
        FAIL_IF(push_inst(compiler, XORI | S(dst) | A(dst) | 0x1));
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw,
-       sljit_si type)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw,
+       sljit_s32 type)
 {
-       sljit_si reg, input_flags;
-       sljit_si flags = GET_ALL_FLAGS(op);
+       sljit_s32 reg, input_flags;
+       sljit_s32 flags = GET_ALL_FLAGS(op);
        sljit_sw original_dstw = dstw;
 
        CHECK_ERROR();
@@ -2235,7 +2239,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
        if (op >= SLJIT_ADD && (src & SLJIT_MEM)) {
                ADJUST_LOCAL_OFFSET(src, srcw);
 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
-               input_flags = (flags & SLJIT_INT_OP) ? INT_DATA : WORD_DATA;
+               input_flags = (flags & SLJIT_I32_OP) ? INT_DATA : WORD_DATA;
 #else
                input_flags = WORD_DATA;
 #endif
@@ -2255,23 +2259,23 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
                break;
 
        case SLJIT_LESS:
-       case SLJIT_D_LESS:
+       case SLJIT_LESS_F64:
                GET_CR_BIT(4 + 0, reg);
                break;
 
        case SLJIT_GREATER_EQUAL:
-       case SLJIT_D_GREATER_EQUAL:
+       case SLJIT_GREATER_EQUAL_F64:
                GET_CR_BIT(4 + 0, reg);
                INVERT_BIT(reg);
                break;
 
        case SLJIT_GREATER:
-       case SLJIT_D_GREATER:
+       case SLJIT_GREATER_F64:
                GET_CR_BIT(4 + 1, reg);
                break;
 
        case SLJIT_LESS_EQUAL:
-       case SLJIT_D_LESS_EQUAL:
+       case SLJIT_LESS_EQUAL_F64:
                GET_CR_BIT(4 + 1, reg);
                INVERT_BIT(reg);
                break;
@@ -2305,20 +2309,20 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
                INVERT_BIT(reg);
                break;
 
-       case SLJIT_D_EQUAL:
+       case SLJIT_EQUAL_F64:
                GET_CR_BIT(4 + 2, reg);
                break;
 
-       case SLJIT_D_NOT_EQUAL:
+       case SLJIT_NOT_EQUAL_F64:
                GET_CR_BIT(4 + 2, reg);
                INVERT_BIT(reg);
                break;
 
-       case SLJIT_D_UNORDERED:
+       case SLJIT_UNORDERED_F64:
                GET_CR_BIT(4 + 3, reg);
                break;
 
-       case SLJIT_D_ORDERED:
+       case SLJIT_ORDERED_F64:
                GET_CR_BIT(4 + 3, reg);
                INVERT_BIT(reg);
                break;
@@ -2333,7 +2337,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
                if (op == SLJIT_MOV)
                        input_flags = WORD_DATA;
                else {
-                       op = SLJIT_MOV_UI;
+                       op = SLJIT_MOV_U32;
                        input_flags = INT_DATA;
                }
 #else
@@ -2352,10 +2356,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
        return sljit_emit_op2(compiler, op | flags, dst, original_dstw, src, srcw, TMP_REG2, 0);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw init_value)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
 {
        struct sljit_const *const_;
-       sljit_si reg;
+       sljit_s32 reg;
 
        CHECK_ERROR_PTR();
        CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value));
index 4a2e6293de57989b15246861b3f2d1fa43eca0de..7e589a17c2553cd5f4be30b669e05cb993af8358 100644 (file)
@@ -24,7 +24,7 @@
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si dst, sljit_sw imm)
+static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw imm)
 {
        if (imm <= SIMM_MAX && imm >= SIMM_MIN)
                return push_inst(compiler, OR | D(dst) | S1(0) | IMM(imm), DR(dst));
@@ -35,26 +35,26 @@ static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si dst, sl
 
 #define ARG2(flags, src2) ((flags & SRC2_IMM) ? IMM(src2) : S2(src2))
 
-static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, sljit_si op, sljit_si flags,
-       sljit_si dst, sljit_si src1, sljit_sw src2)
+static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 flags,
+       sljit_s32 dst, sljit_s32 src1, sljit_sw src2)
 {
        SLJIT_COMPILE_ASSERT(ICC_IS_SET == SET_FLAGS, icc_is_set_and_set_flags_must_be_the_same);
 
        switch (op) {
        case SLJIT_MOV:
-       case SLJIT_MOV_UI:
-       case SLJIT_MOV_SI:
+       case SLJIT_MOV_U32:
+       case SLJIT_MOV_S32:
        case SLJIT_MOV_P:
                SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
                if (dst != src2)
                        return push_inst(compiler, OR | D(dst) | S1(0) | S2(src2), DR(dst));
                return SLJIT_SUCCESS;
 
-       case SLJIT_MOV_UB:
-       case SLJIT_MOV_SB:
+       case SLJIT_MOV_U8:
+       case SLJIT_MOV_S8:
                SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
                if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) {
-                       if (op == SLJIT_MOV_UB)
+                       if (op == SLJIT_MOV_U8)
                                return push_inst(compiler, AND | D(dst) | S1(src2) | IMM(0xff), DR(dst));
                        FAIL_IF(push_inst(compiler, SLL | D(dst) | S1(src2) | IMM(24), DR(dst)));
                        return push_inst(compiler, SRA | D(dst) | S1(dst) | IMM(24), DR(dst));
@@ -63,12 +63,12 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
                        SLJIT_ASSERT_STOP();
                return SLJIT_SUCCESS;
 
-       case SLJIT_MOV_UH:
-       case SLJIT_MOV_SH:
+       case SLJIT_MOV_U16:
+       case SLJIT_MOV_S16:
                SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
                if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) {
                        FAIL_IF(push_inst(compiler, SLL | D(dst) | S1(src2) | IMM(16), DR(dst)));
-                       return push_inst(compiler, (op == SLJIT_MOV_SH ? SRA : SRL) | D(dst) | S1(dst) | IMM(16), DR(dst));
+                       return push_inst(compiler, (op == SLJIT_MOV_S16 ? SRA : SRL) | D(dst) | S1(dst) | IMM(16), DR(dst));
                }
                else if (dst != src2)
                        SLJIT_ASSERT_STOP();
@@ -139,7 +139,7 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw init_value)
+static SLJIT_INLINE sljit_s32 emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw init_value)
 {
        FAIL_IF(push_inst(compiler, SETHI | D(dst) | ((init_value >> 10) & 0x3fffff), DR(dst)));
        return push_inst(compiler, OR | D(dst) | S1(dst) | IMM_ARG | (init_value & 0x3ff), DR(dst));
index 327c4267be439bcb7567567813df14605c45ce89..f3a33a1097edfec024753de904a0d22454756264 100644 (file)
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void)
+SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void)
 {
        return "SPARC" SLJIT_CPUINFO;
 }
 
 /* Length of an instruction word
    Both for sparc-32 and sparc-64 */
-typedef sljit_ui sljit_ins;
+typedef sljit_u32 sljit_ins;
+
+#if (defined SLJIT_CACHE_FLUSH_OWN_IMPL && SLJIT_CACHE_FLUSH_OWN_IMPL)
 
 static void sparc_cache_flush(sljit_ins *from, sljit_ins *to)
 {
@@ -82,6 +84,8 @@ static void sparc_cache_flush(sljit_ins *from, sljit_ins *to)
 #endif
 }
 
+#endif /* (defined SLJIT_CACHE_FLUSH_OWN_IMPL && SLJIT_CACHE_FLUSH_OWN_IMPL) */
+
 /* TMP_REG2 is not used by getput_arg */
 #define TMP_REG1       (SLJIT_NUMBER_OF_REGISTERS + 2)
 #define TMP_REG2       (SLJIT_NUMBER_OF_REGISTERS + 3)
@@ -91,7 +95,7 @@ static void sparc_cache_flush(sljit_ins *from, sljit_ins *to)
 #define TMP_FREG1      (0)
 #define TMP_FREG2      ((SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1) << 1)
 
-static SLJIT_CONST sljit_ub reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
+static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
        0, 8, 9, 10, 13, 29, 28, 27, 23, 22, 21, 20, 19, 18, 17, 16, 26, 25, 24, 14, 1, 11, 12, 15
 };
 
@@ -181,7 +185,7 @@ static SLJIT_CONST sljit_ub reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
 
 /* dest_reg is the absolute name of the register
    Useful for reordering instructions in the delay slot. */
-static sljit_si push_inst(struct sljit_compiler *compiler, sljit_ins ins, sljit_si delay_slot)
+static sljit_s32 push_inst(struct sljit_compiler *compiler, sljit_ins ins, sljit_s32 delay_slot)
 {
        sljit_ins *ptr;
        SLJIT_ASSERT((delay_slot & DST_INS_MASK) == UNMOVABLE_INS
@@ -340,7 +344,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
        SLJIT_ASSERT(!label);
        SLJIT_ASSERT(!jump);
        SLJIT_ASSERT(!const_);
-       SLJIT_ASSERT(code_ptr - code <= (sljit_si)compiler->size);
+       SLJIT_ASSERT(code_ptr - code <= (sljit_s32)compiler->size);
 
        jump = compiler->jumps;
        while (jump) {
@@ -418,9 +422,9 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
 #include "sljitNativeSPARC_64.c"
 #endif
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
@@ -442,9 +446,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
        CHECK_ERROR();
        CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
@@ -454,7 +458,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compi
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_return(compiler, op, src, srcw));
@@ -478,7 +482,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
 #define ARCH_32_64(a, b)       b
 #endif
 
-static SLJIT_CONST sljit_ins data_transfer_insts[16 + 4] = {
+static const sljit_ins data_transfer_insts[16 + 4] = {
 /* u w s */ ARCH_32_64(OPC1(3) | OPC3(0x04) /* stw */, OPC1(3) | OPC3(0x0e) /* stx */),
 /* u w l */ ARCH_32_64(OPC1(3) | OPC3(0x00) /* lduw */, OPC1(3) | OPC3(0x0b) /* ldx */),
 /* u b s */ OPC1(3) | OPC3(0x05) /* stb */,
@@ -506,7 +510,7 @@ static SLJIT_CONST sljit_ins data_transfer_insts[16 + 4] = {
 #undef ARCH_32_64
 
 /* Can perform an operation using at most 1 instruction. */
-static sljit_si getput_arg_fast(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg, sljit_si arg, sljit_sw argw)
+static sljit_s32 getput_arg_fast(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
 {
        SLJIT_ASSERT(arg & SLJIT_MEM);
 
@@ -529,7 +533,7 @@ static sljit_si getput_arg_fast(struct sljit_compiler *compiler, sljit_si flags,
 /* See getput_arg below.
    Note: can_cache is called only for binary operators. Those
    operators always uses word arguments without write back. */
-static sljit_si can_cache(sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_sw next_argw)
+static sljit_s32 can_cache(sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
 {
        SLJIT_ASSERT((arg & SLJIT_MEM) && (next_arg & SLJIT_MEM));
 
@@ -549,9 +553,9 @@ static sljit_si can_cache(sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_
 }
 
 /* Emit the necessary instructions. See can_cache above. */
-static sljit_si getput_arg(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg, sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_sw next_argw)
+static sljit_s32 getput_arg(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
 {
-       sljit_si base, arg2, delay_slot;
+       sljit_s32 base, arg2, delay_slot;
        sljit_ins dest;
 
        SLJIT_ASSERT(arg & SLJIT_MEM);
@@ -613,7 +617,7 @@ static sljit_si getput_arg(struct sljit_compiler *compiler, sljit_si flags, slji
        return push_inst(compiler, ADD | D(base) | S1(base) | S2(arg2), DR(base));
 }
 
-static SLJIT_INLINE sljit_si emit_op_mem(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg, sljit_si arg, sljit_sw argw)
+static SLJIT_INLINE sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
 {
        if (getput_arg_fast(compiler, flags, reg, arg, argw))
                return compiler->error;
@@ -622,26 +626,26 @@ static SLJIT_INLINE sljit_si emit_op_mem(struct sljit_compiler *compiler, sljit_
        return getput_arg(compiler, flags, reg, arg, argw, 0, 0);
 }
 
-static SLJIT_INLINE sljit_si emit_op_mem2(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg, sljit_si arg1, sljit_sw arg1w, sljit_si arg2, sljit_sw arg2w)
+static SLJIT_INLINE sljit_s32 emit_op_mem2(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg1, sljit_sw arg1w, sljit_s32 arg2, sljit_sw arg2w)
 {
        if (getput_arg_fast(compiler, flags, reg, arg1, arg1w))
                return compiler->error;
        return getput_arg(compiler, flags, reg, arg1, arg1w, arg2, arg2w);
 }
 
-static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si flags,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 flags,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        /* arg1 goes to TMP_REG1 or src reg
           arg2 goes to TMP_REG2, imm or src reg
           TMP_REG3 can be used for caching
           result goes to TMP_REG2, so put result can use TMP_REG1 and TMP_REG3. */
-       sljit_si dst_r = TMP_REG2;
-       sljit_si src1_r;
+       sljit_s32 dst_r = TMP_REG2;
+       sljit_s32 src1_r;
        sljit_sw src2_r = 0;
-       sljit_si sugg_src2_r = TMP_REG2;
+       sljit_s32 sugg_src2_r = TMP_REG2;
 
        if (!(flags & ALT_KEEP_CACHE)) {
                compiler->cache_arg = 0;
@@ -649,13 +653,13 @@ static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si f
        }
 
        if (SLJIT_UNLIKELY(dst == SLJIT_UNUSED)) {
-               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_SI && !(src2 & SLJIT_MEM))
+               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_S32 && !(src2 & SLJIT_MEM))
                        return SLJIT_SUCCESS;
        }
        else if (FAST_IS_REG(dst)) {
                dst_r = dst;
                flags |= REG_DEST;
-               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_SI)
+               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_S32)
                        sugg_src2_r = dst_r;
        }
        else if ((dst & SLJIT_MEM) && !getput_arg_fast(compiler, flags | ARG_TEST, TMP_REG1, dst, dstw))
@@ -705,7 +709,7 @@ static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si f
        if (FAST_IS_REG(src2)) {
                src2_r = src2;
                flags |= REG2_SOURCE;
-               if (!(flags & REG_DEST) && op >= SLJIT_MOV && op <= SLJIT_MOVU_SI)
+               if (!(flags & REG_DEST) && op >= SLJIT_MOV && op <= SLJIT_MOVU_S32)
                        dst_r = src2_r;
        }
        else if (src2 & SLJIT_IMM) {
@@ -716,7 +720,7 @@ static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si f
                        }
                        else {
                                src2_r = 0;
-                               if ((op >= SLJIT_MOV && op <= SLJIT_MOVU_SI) && (dst & SLJIT_MEM))
+                               if ((op >= SLJIT_MOV && op <= SLJIT_MOVU_S32) && (dst & SLJIT_MEM))
                                        dst_r = 0;
                        }
                }
@@ -758,7 +762,7 @@ static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si f
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler, sljit_si op)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_op0(compiler, op));
@@ -769,30 +773,30 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
                return push_inst(compiler, TA, UNMOVABLE_INS);
        case SLJIT_NOP:
                return push_inst(compiler, NOP, UNMOVABLE_INS);
-       case SLJIT_LUMUL:
-       case SLJIT_LSMUL:
+       case SLJIT_LMUL_UW:
+       case SLJIT_LMUL_SW:
 #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
-               FAIL_IF(push_inst(compiler, (op == SLJIT_LUMUL ? UMUL : SMUL) | D(SLJIT_R0) | S1(SLJIT_R0) | S2(SLJIT_R1), DR(SLJIT_R0)));
+               FAIL_IF(push_inst(compiler, (op == SLJIT_LMUL_UW ? UMUL : SMUL) | D(SLJIT_R0) | S1(SLJIT_R0) | S2(SLJIT_R1), DR(SLJIT_R0)));
                return push_inst(compiler, RDY | D(SLJIT_R1), DR(SLJIT_R1));
 #else
 #error "Implementation required"
 #endif
-       case SLJIT_UDIVMOD:
-       case SLJIT_SDIVMOD:
-       case SLJIT_UDIVI:
-       case SLJIT_SDIVI:
-               SLJIT_COMPILE_ASSERT((SLJIT_UDIVMOD & 0x2) == 0 && SLJIT_UDIVI - 0x2 == SLJIT_UDIVMOD, bad_div_opcode_assignments);
+       case SLJIT_DIVMOD_UW:
+       case SLJIT_DIVMOD_SW:
+       case SLJIT_DIV_UW:
+       case SLJIT_DIV_SW:
+               SLJIT_COMPILE_ASSERT((SLJIT_DIVMOD_UW & 0x2) == 0 && SLJIT_DIV_UW - 0x2 == SLJIT_DIVMOD_UW, bad_div_opcode_assignments);
 #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
-               if ((op | 0x2) == SLJIT_UDIVI)
+               if ((op | 0x2) == SLJIT_DIV_UW)
                        FAIL_IF(push_inst(compiler, WRY | S1(0), MOVABLE_INS));
                else {
                        FAIL_IF(push_inst(compiler, SRA | D(TMP_REG1) | S1(SLJIT_R0) | IMM(31), DR(TMP_REG1)));
                        FAIL_IF(push_inst(compiler, WRY | S1(TMP_REG1), MOVABLE_INS));
                }
-               if (op <= SLJIT_SDIVMOD)
+               if (op <= SLJIT_DIVMOD_SW)
                        FAIL_IF(push_inst(compiler, OR | D(TMP_REG2) | S1(0) | S2(SLJIT_R0), DR(TMP_REG2)));
-               FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_UDIVI ? UDIV : SDIV) | D(SLJIT_R0) | S1(SLJIT_R0) | S2(SLJIT_R1), DR(SLJIT_R0)));
-               if (op >= SLJIT_UDIVI)
+               FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? UDIV : SDIV) | D(SLJIT_R0) | S1(SLJIT_R0) | S2(SLJIT_R1), DR(SLJIT_R0)));
+               if (op >= SLJIT_DIV_UW)
                        return SLJIT_SUCCESS;
                FAIL_IF(push_inst(compiler, SMUL | D(SLJIT_R1) | S1(SLJIT_R0) | S2(SLJIT_R1), DR(SLJIT_R1)));
                return push_inst(compiler, SUB | D(SLJIT_R1) | S1(TMP_REG2) | S2(SLJIT_R1), DR(SLJIT_R1));
@@ -804,11 +808,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si flags = GET_FLAGS(op) ? SET_FLAGS : 0;
+       sljit_s32 flags = GET_FLAGS(op) ? SET_FLAGS : 0;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_op1(compiler, op, dst, dstw, src, srcw));
@@ -821,45 +825,45 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
        case SLJIT_MOV_P:
                return emit_op(compiler, SLJIT_MOV, flags | WORD_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
 
-       case SLJIT_MOV_UI:
-               return emit_op(compiler, SLJIT_MOV_UI, flags | INT_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
+       case SLJIT_MOV_U32:
+               return emit_op(compiler, SLJIT_MOV_U32, flags | INT_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
 
-       case SLJIT_MOV_SI:
-               return emit_op(compiler, SLJIT_MOV_SI, flags | INT_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
+       case SLJIT_MOV_S32:
+               return emit_op(compiler, SLJIT_MOV_S32, flags | INT_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
 
-       case SLJIT_MOV_UB:
-               return emit_op(compiler, SLJIT_MOV_UB, flags | BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_ub)srcw : srcw);
+       case SLJIT_MOV_U8:
+               return emit_op(compiler, SLJIT_MOV_U8, flags | BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u8)srcw : srcw);
 
-       case SLJIT_MOV_SB:
-               return emit_op(compiler, SLJIT_MOV_SB, flags | BYTE_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_sb)srcw : srcw);
+       case SLJIT_MOV_S8:
+               return emit_op(compiler, SLJIT_MOV_S8, flags | BYTE_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s8)srcw : srcw);
 
-       case SLJIT_MOV_UH:
-               return emit_op(compiler, SLJIT_MOV_UH, flags | HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_uh)srcw : srcw);
+       case SLJIT_MOV_U16:
+               return emit_op(compiler, SLJIT_MOV_U16, flags | HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u16)srcw : srcw);
 
-       case SLJIT_MOV_SH:
-               return emit_op(compiler, SLJIT_MOV_SH, flags | HALF_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_sh)srcw : srcw);
+       case SLJIT_MOV_S16:
+               return emit_op(compiler, SLJIT_MOV_S16, flags | HALF_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s16)srcw : srcw);
 
        case SLJIT_MOVU:
        case SLJIT_MOVU_P:
                return emit_op(compiler, SLJIT_MOV, flags | WORD_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
 
-       case SLJIT_MOVU_UI:
-               return emit_op(compiler, SLJIT_MOV_UI, flags | INT_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
+       case SLJIT_MOVU_U32:
+               return emit_op(compiler, SLJIT_MOV_U32, flags | INT_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
 
-       case SLJIT_MOVU_SI:
-               return emit_op(compiler, SLJIT_MOV_SI, flags | INT_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
+       case SLJIT_MOVU_S32:
+               return emit_op(compiler, SLJIT_MOV_S32, flags | INT_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
 
-       case SLJIT_MOVU_UB:
-               return emit_op(compiler, SLJIT_MOV_UB, flags | BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_ub)srcw : srcw);
+       case SLJIT_MOVU_U8:
+               return emit_op(compiler, SLJIT_MOV_U8, flags | BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u8)srcw : srcw);
 
-       case SLJIT_MOVU_SB:
-               return emit_op(compiler, SLJIT_MOV_SB, flags | BYTE_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_sb)srcw : srcw);
+       case SLJIT_MOVU_S8:
+               return emit_op(compiler, SLJIT_MOV_S8, flags | BYTE_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s8)srcw : srcw);
 
-       case SLJIT_MOVU_UH:
-               return emit_op(compiler, SLJIT_MOV_UH, flags | HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_uh)srcw : srcw);
+       case SLJIT_MOVU_U16:
+               return emit_op(compiler, SLJIT_MOV_U16, flags | HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u16)srcw : srcw);
 
-       case SLJIT_MOVU_SH:
-               return emit_op(compiler, SLJIT_MOV_SH, flags | HALF_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_sh)srcw : srcw);
+       case SLJIT_MOVU_S16:
+               return emit_op(compiler, SLJIT_MOV_S16, flags | HALF_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s16)srcw : srcw);
 
        case SLJIT_NOT:
        case SLJIT_CLZ:
@@ -872,12 +876,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_si flags = GET_FLAGS(op) ? SET_FLAGS : 0;
+       sljit_s32 flags = GET_FLAGS(op) ? SET_FLAGS : 0;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_op2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
@@ -914,20 +918,20 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
 {
        CHECK_REG_INDEX(check_sljit_get_register_index(reg));
        return reg_map[reg];
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_float_register_index(sljit_si reg)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_float_register_index(sljit_s32 reg)
 {
        CHECK_REG_INDEX(check_sljit_get_float_register_index(reg));
        return reg << 1;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *compiler,
-       void *instruction, sljit_si size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
+       void *instruction, sljit_s32 size)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_op_custom(compiler, instruction, size));
@@ -939,7 +943,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *co
 /*  Floating point operators                                             */
 /* --------------------------------------------------------------------- */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
 {
 #ifdef SLJIT_IS_FPU_AVAILABLE
        return SLJIT_IS_FPU_AVAILABLE;
@@ -949,13 +953,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
 #endif
 }
 
-#define FLOAT_DATA(op) (DOUBLE_DATA | ((op & SLJIT_SINGLE_OP) >> 7))
-#define SELECT_FOP(op, single, double) ((op & SLJIT_SINGLE_OP) ? single : double)
+#define FLOAT_DATA(op) (DOUBLE_DATA | ((op & SLJIT_F32_OP) >> 7))
+#define SELECT_FOP(op, single, double) ((op & SLJIT_F32_OP) ? single : double)
 #define FLOAT_TMP_MEM_OFFSET (22 * sizeof(sljit_sw))
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_convw_fromd(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
        if (src & SLJIT_MEM) {
                FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src, srcw, dst, dstw));
@@ -978,16 +982,16 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_convw_fromd(struct sljit_compiler *
        return emit_op_mem2(compiler, SINGLE_DATA, TMP_FREG1, dst, dstw, 0, 0);
 }
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_convd_fromw(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si dst_r = FAST_IS_REG(dst) ? (dst << 1) : TMP_FREG1;
+       sljit_s32 dst_r = FAST_IS_REG(dst) ? (dst << 1) : TMP_FREG1;
 
        if (src & SLJIT_IMM) {
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-               if (GET_OPCODE(op) == SLJIT_CONVD_FROMI)
-                       srcw = (sljit_si)srcw;
+               if (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_S32)
+                       srcw = (sljit_s32)srcw;
 #endif
                FAIL_IF(load_immediate(compiler, TMP_REG1, srcw));
                src = TMP_REG1;
@@ -1008,9 +1012,9 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_convd_fromw(struct sljit_compiler *
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        if (src1 & SLJIT_MEM) {
                FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, src2, src2w));
@@ -1029,21 +1033,21 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_cmp(struct sljit_compiler *compiler
        return push_inst(compiler, SELECT_FOP(op, FCMPS, FCMPD) | S1A(src1) | S2A(src2), FCC_IS_SET | MOVABLE_INS);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si dst_r;
+       sljit_s32 dst_r;
 
        CHECK_ERROR();
        compiler->cache_arg = 0;
        compiler->cache_argw = 0;
 
-       SLJIT_COMPILE_ASSERT((SLJIT_SINGLE_OP == 0x100) && !(DOUBLE_DATA & 0x2), float_transfer_bit_error);
+       SLJIT_COMPILE_ASSERT((SLJIT_F32_OP == 0x100) && !(DOUBLE_DATA & 0x2), float_transfer_bit_error);
        SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw);
 
-       if (GET_OPCODE(op) == SLJIT_CONVD_FROMS)
-               op ^= SLJIT_SINGLE_OP;
+       if (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_F32)
+               op ^= SLJIT_F32_OP;
 
        dst_r = FAST_IS_REG(dst) ? (dst << 1) : TMP_FREG1;
 
@@ -1055,30 +1059,30 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compile
                src <<= 1;
 
        switch (GET_OPCODE(op)) {
-       case SLJIT_DMOV:
+       case SLJIT_MOV_F64:
                if (src != dst_r) {
                        if (dst_r != TMP_FREG1) {
                                FAIL_IF(push_inst(compiler, FMOVS | DA(dst_r) | S2A(src), MOVABLE_INS));
-                               if (!(op & SLJIT_SINGLE_OP))
+                               if (!(op & SLJIT_F32_OP))
                                        FAIL_IF(push_inst(compiler, FMOVS | DA(dst_r | 1) | S2A(src | 1), MOVABLE_INS));
                        }
                        else
                                dst_r = src;
                }
                break;
-       case SLJIT_DNEG:
+       case SLJIT_NEG_F64:
                FAIL_IF(push_inst(compiler, FNEGS | DA(dst_r) | S2A(src), MOVABLE_INS));
-               if (dst_r != src && !(op & SLJIT_SINGLE_OP))
+               if (dst_r != src && !(op & SLJIT_F32_OP))
                        FAIL_IF(push_inst(compiler, FMOVS | DA(dst_r | 1) | S2A(src | 1), MOVABLE_INS));
                break;
-       case SLJIT_DABS:
+       case SLJIT_ABS_F64:
                FAIL_IF(push_inst(compiler, FABSS | DA(dst_r) | S2A(src), MOVABLE_INS));
-               if (dst_r != src && !(op & SLJIT_SINGLE_OP))
+               if (dst_r != src && !(op & SLJIT_F32_OP))
                        FAIL_IF(push_inst(compiler, FMOVS | DA(dst_r | 1) | S2A(src | 1), MOVABLE_INS));
                break;
-       case SLJIT_CONVD_FROMS:
+       case SLJIT_CONV_F64_FROM_F32:
                FAIL_IF(push_inst(compiler, SELECT_FOP(op, FSTOD, FDTOS) | DA(dst_r) | S2A(src), MOVABLE_INS));
-               op ^= SLJIT_SINGLE_OP;
+               op ^= SLJIT_F32_OP;
                break;
        }
 
@@ -1087,12 +1091,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compile
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_si dst_r, flags = 0;
+       sljit_s32 dst_r, flags = 0;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_fop2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
@@ -1146,19 +1150,19 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compile
                src2 = TMP_FREG2;
 
        switch (GET_OPCODE(op)) {
-       case SLJIT_DADD:
+       case SLJIT_ADD_F64:
                FAIL_IF(push_inst(compiler, SELECT_FOP(op, FADDS, FADDD) | DA(dst_r) | S1A(src1) | S2A(src2), MOVABLE_INS));
                break;
 
-       case SLJIT_DSUB:
+       case SLJIT_SUB_F64:
                FAIL_IF(push_inst(compiler, SELECT_FOP(op, FSUBS, FSUBD) | DA(dst_r) | S1A(src1) | S2A(src2), MOVABLE_INS));
                break;
 
-       case SLJIT_DMUL:
+       case SLJIT_MUL_F64:
                FAIL_IF(push_inst(compiler, SELECT_FOP(op, FMULS, FMULD) | DA(dst_r) | S1A(src1) | S2A(src2), MOVABLE_INS));
                break;
 
-       case SLJIT_DDIV:
+       case SLJIT_DIV_F64:
                FAIL_IF(push_inst(compiler, SELECT_FOP(op, FDIVS, FDIVD) | DA(dst_r) | S1A(src1) | S2A(src2), MOVABLE_INS));
                break;
        }
@@ -1176,7 +1180,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compile
 /*  Other instructions                                                   */
 /* --------------------------------------------------------------------- */
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw));
@@ -1193,7 +1197,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *c
        return emit_op_mem(compiler, WORD_DATA, TMP_LINK, dst, dstw);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_fast_return(compiler, src, srcw));
@@ -1231,33 +1235,33 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compi
        return label;
 }
 
-static sljit_ins get_cc(sljit_si type)
+static sljit_ins get_cc(sljit_s32 type)
 {
        switch (type) {
        case SLJIT_EQUAL:
        case SLJIT_MUL_NOT_OVERFLOW:
-       case SLJIT_D_NOT_EQUAL: /* Unordered. */
+       case SLJIT_NOT_EQUAL_F64: /* Unordered. */
                return DA(0x1);
 
        case SLJIT_NOT_EQUAL:
        case SLJIT_MUL_OVERFLOW:
-       case SLJIT_D_EQUAL:
+       case SLJIT_EQUAL_F64:
                return DA(0x9);
 
        case SLJIT_LESS:
-       case SLJIT_D_GREATER: /* Unordered. */
+       case SLJIT_GREATER_F64: /* Unordered. */
                return DA(0x5);
 
        case SLJIT_GREATER_EQUAL:
-       case SLJIT_D_LESS_EQUAL:
+       case SLJIT_LESS_EQUAL_F64:
                return DA(0xd);
 
        case SLJIT_GREATER:
-       case SLJIT_D_GREATER_EQUAL: /* Unordered. */
+       case SLJIT_GREATER_EQUAL_F64: /* Unordered. */
                return DA(0xc);
 
        case SLJIT_LESS_EQUAL:
-       case SLJIT_D_LESS:
+       case SLJIT_LESS_F64:
                return DA(0x4);
 
        case SLJIT_SIG_LESS:
@@ -1273,11 +1277,11 @@ static sljit_ins get_cc(sljit_si type)
                return DA(0x2);
 
        case SLJIT_OVERFLOW:
-       case SLJIT_D_UNORDERED:
+       case SLJIT_UNORDERED_F64:
                return DA(0x7);
 
        case SLJIT_NOT_OVERFLOW:
-       case SLJIT_D_ORDERED:
+       case SLJIT_ORDERED_F64:
                return DA(0xf);
 
        default:
@@ -1286,7 +1290,7 @@ static sljit_ins get_cc(sljit_si type)
        }
 }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_si type)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_s32 type)
 {
        struct sljit_jump *jump;
 
@@ -1298,7 +1302,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
        set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP);
        type &= 0xff;
 
-       if (type < SLJIT_D_EQUAL) {
+       if (type < SLJIT_EQUAL_F64) {
                jump->flags |= IS_COND;
                if (((compiler->delay_slot & DST_INS_MASK) != UNMOVABLE_INS) && !(compiler->delay_slot & ICC_IS_SET))
                        jump->flags |= IS_MOVABLE;
@@ -1332,10 +1336,10 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
        return jump;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compiler, sljit_si type, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
 {
        struct sljit_jump *jump = NULL;
-       sljit_si src_r;
+       sljit_s32 src_r;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_ijump(compiler, type, src, srcw));
@@ -1367,12 +1371,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compil
        return push_inst(compiler, NOP, UNMOVABLE_INS);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw,
-       sljit_si type)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw,
+       sljit_s32 type)
 {
-       sljit_si reg, flags = (GET_FLAGS(op) ? SET_FLAGS : 0);
+       sljit_s32 reg, flags = (GET_FLAGS(op) ? SET_FLAGS : 0);
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, src, srcw, type));
@@ -1395,7 +1399,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
        }
 
        type &= 0xff;
-       if (type < SLJIT_D_EQUAL)
+       if (type < SLJIT_EQUAL_F64)
                FAIL_IF(push_inst(compiler, BICC | get_cc(type) | 3, UNMOVABLE_INS));
        else
                FAIL_IF(push_inst(compiler, FBFCC | get_cc(type) | 3, UNMOVABLE_INS));
@@ -1412,9 +1416,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
 #endif
 }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw init_value)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
 {
-       sljit_si reg;
+       sljit_s32 reg;
        struct sljit_const *const_;
 
        CHECK_ERROR_PTR();
index 4d40392fa82f005eed63ba3fb3fb5e73bb3484e3..462a8b9cd953fe00e1b962b57d5736a59f968843 100644 (file)
@@ -49,7 +49,7 @@
 #define ADDR_TMP (SLJIT_NUMBER_OF_REGISTERS + 5)
 #define PIC_ADDR_REG TMP_REG2
 
-static SLJIT_CONST sljit_ub reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
+static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
        63, 0, 1, 2, 3, 4, 30, 31, 32, 33, 34, 54, 5, 16, 6, 7
 };
 
@@ -106,7 +106,7 @@ static SLJIT_CONST sljit_ub reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
  */
 #define CHECK_FLAGS(list) (!(flags & UNUSED_DEST) || (op & GET_FLAGS(~(list))))
 
-SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char *sljit_get_platform_name(void)
+SLJIT_API_FUNC_ATTRIBUTE const char *sljit_get_platform_name(void)
 {
        return "TileGX" SLJIT_CPUINFO;
 }
@@ -307,7 +307,7 @@ struct jit_instr {
 #define JOFF_X1(x) create_JumpOff_X1(x)
 #define BOFF_X1(x) create_BrOff_X1(x)
 
-static SLJIT_CONST tilegx_mnemonic data_transfer_insts[16] = {
+static const tilegx_mnemonic data_transfer_insts[16] = {
        /* u w s */ TILEGX_OPC_ST   /* st */,
        /* u w l */ TILEGX_OPC_LD   /* ld */,
        /* u b s */ TILEGX_OPC_ST1  /* st1 */,
@@ -327,7 +327,7 @@ static SLJIT_CONST tilegx_mnemonic data_transfer_insts[16] = {
 };
 
 #ifdef TILEGX_JIT_DEBUG
-static sljit_si push_inst_debug(struct sljit_compiler *compiler, sljit_ins ins, int line)
+static sljit_s32 push_inst_debug(struct sljit_compiler *compiler, sljit_ins ins, int line)
 {
        sljit_ins *ptr = (sljit_ins *)ensure_buf(compiler, sizeof(sljit_ins));
        FAIL_IF(!ptr);
@@ -338,7 +338,7 @@ static sljit_si push_inst_debug(struct sljit_compiler *compiler, sljit_ins ins,
        return SLJIT_SUCCESS;
 }
 
-static sljit_si push_inst_nodebug(struct sljit_compiler *compiler, sljit_ins ins)
+static sljit_s32 push_inst_nodebug(struct sljit_compiler *compiler, sljit_ins ins)
 {
        sljit_ins *ptr = (sljit_ins *)ensure_buf(compiler, sizeof(sljit_ins));
        FAIL_IF(!ptr);
@@ -349,7 +349,7 @@ static sljit_si push_inst_nodebug(struct sljit_compiler *compiler, sljit_ins ins
 
 #define push_inst(a, b) push_inst_debug(a, b, __LINE__)
 #else
-static sljit_si push_inst(struct sljit_compiler *compiler, sljit_ins ins)
+static sljit_s32 push_inst(struct sljit_compiler *compiler, sljit_ins ins)
 {
        sljit_ins *ptr = (sljit_ins *)ensure_buf(compiler, sizeof(sljit_ins));
        FAIL_IF(!ptr);
@@ -557,7 +557,7 @@ const struct Format* compute_format()
        return match;
 }
 
-sljit_si assign_pipes()
+sljit_s32 assign_pipes()
 {
        unsigned long output_registers = 0;
        unsigned int i = 0;
@@ -621,7 +621,7 @@ tilegx_bundle_bits get_bundle_bit(struct jit_instr *inst)
        return bits;
 }
 
-static sljit_si update_buffer(struct sljit_compiler *compiler)
+static sljit_s32 update_buffer(struct sljit_compiler *compiler)
 {
        int i;
        int orig_index = inst_buf_index;
@@ -733,7 +733,7 @@ static sljit_si update_buffer(struct sljit_compiler *compiler)
        SLJIT_ASSERT_STOP();
 }
 
-static sljit_si flush_buffer(struct sljit_compiler *compiler)
+static sljit_s32 flush_buffer(struct sljit_compiler *compiler)
 {
        while (inst_buf_index != 0) {
                FAIL_IF(update_buffer(compiler));
@@ -741,7 +741,7 @@ static sljit_si flush_buffer(struct sljit_compiler *compiler)
        return SLJIT_SUCCESS;
 }
 
-static sljit_si push_4_buffer(struct sljit_compiler *compiler, tilegx_mnemonic opc, int op0, int op1, int op2, int op3, int line)
+static sljit_s32 push_4_buffer(struct sljit_compiler *compiler, tilegx_mnemonic opc, int op0, int op1, int op2, int op3, int line)
 {
        if (inst_buf_index == TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE)
                FAIL_IF(update_buffer(compiler));
@@ -761,7 +761,7 @@ static sljit_si push_4_buffer(struct sljit_compiler *compiler, tilegx_mnemonic o
        return SLJIT_SUCCESS;
 }
 
-static sljit_si push_3_buffer(struct sljit_compiler *compiler, tilegx_mnemonic opc, int op0, int op1, int op2, int line)
+static sljit_s32 push_3_buffer(struct sljit_compiler *compiler, tilegx_mnemonic opc, int op0, int op1, int op2, int line)
 {
        if (inst_buf_index == TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE)
                FAIL_IF(update_buffer(compiler));
@@ -822,7 +822,7 @@ static sljit_si push_3_buffer(struct sljit_compiler *compiler, tilegx_mnemonic o
        return SLJIT_SUCCESS;
 }
 
-static sljit_si push_2_buffer(struct sljit_compiler *compiler, tilegx_mnemonic opc, int op0, int op1, int line)
+static sljit_s32 push_2_buffer(struct sljit_compiler *compiler, tilegx_mnemonic opc, int op0, int op1, int line)
 {
        if (inst_buf_index == TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE)
                FAIL_IF(update_buffer(compiler));
@@ -867,7 +867,7 @@ static sljit_si push_2_buffer(struct sljit_compiler *compiler, tilegx_mnemonic o
        return SLJIT_SUCCESS;
 }
 
-static sljit_si push_0_buffer(struct sljit_compiler *compiler, tilegx_mnemonic opc, int line)
+static sljit_s32 push_0_buffer(struct sljit_compiler *compiler, tilegx_mnemonic opc, int line)
 {
        if (inst_buf_index == TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE)
                FAIL_IF(update_buffer(compiler));
@@ -883,7 +883,7 @@ static sljit_si push_0_buffer(struct sljit_compiler *compiler, tilegx_mnemonic o
        return SLJIT_SUCCESS;
 }
 
-static sljit_si push_jr_buffer(struct sljit_compiler *compiler, tilegx_mnemonic opc, int op0, int line)
+static sljit_s32 push_jr_buffer(struct sljit_compiler *compiler, tilegx_mnemonic opc, int op0, int line)
 {
        if (inst_buf_index == TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE)
                FAIL_IF(update_buffer(compiler));
@@ -1117,7 +1117,7 @@ SLJIT_API_FUNC_ATTRIBUTE void * sljit_generate_code(struct sljit_compiler *compi
        return code;
 }
 
-static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si dst_ar, sljit_sw imm)
+static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 dst_ar, sljit_sw imm)
 {
 
        if (imm <= SIMM_16BIT_MAX && imm >= SIMM_16BIT_MIN)
@@ -1140,7 +1140,7 @@ static sljit_si load_immediate(struct sljit_compiler *compiler, sljit_si dst_ar,
        return SHL16INSLI(dst_ar, dst_ar, imm);
 }
 
-static sljit_si emit_const(struct sljit_compiler *compiler, sljit_si dst_ar, sljit_sw imm, int flush)
+static sljit_s32 emit_const(struct sljit_compiler *compiler, sljit_s32 dst_ar, sljit_sw imm, int flush)
 {
        /* Should *not* be optimized as load_immediate, as pcre relocation
           mechanism will match this fixed 4-instruction pattern. */
@@ -1155,7 +1155,7 @@ static sljit_si emit_const(struct sljit_compiler *compiler, sljit_si dst_ar, slj
        return SHL16INSLI(dst_ar, dst_ar, imm);
 }
 
-static sljit_si emit_const_64(struct sljit_compiler *compiler, sljit_si dst_ar, sljit_sw imm, int flush)
+static sljit_s32 emit_const_64(struct sljit_compiler *compiler, sljit_s32 dst_ar, sljit_sw imm, int flush)
 {
        /* Should *not* be optimized as load_immediate, as pcre relocation
           mechanism will match this fixed 4-instruction pattern. */
@@ -1172,12 +1172,12 @@ static sljit_si emit_const_64(struct sljit_compiler *compiler, sljit_si dst_ar,
        return SHL16INSLI(reg_map[dst_ar], reg_map[dst_ar], imm);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
        sljit_ins base;
-       sljit_si i, tmp;
+       sljit_s32 i, tmp;
  
        CHECK_ERROR();
        CHECK(check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
@@ -1222,9 +1222,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
        CHECK_ERROR();
        CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
@@ -1236,12 +1236,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compi
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si local_size;
+       sljit_s32 local_size;
        sljit_ins base;
-       sljit_si i, tmp;
-       sljit_si saveds;
+       sljit_s32 i, tmp;
+       sljit_s32 saveds;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_return(compiler, op, src, srcw));
@@ -1285,7 +1285,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
 /* reg_ar is an absoulute register! */
 
 /* Can perform an operation using at most 1 instruction. */
-static sljit_si getput_arg_fast(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg_ar, sljit_si arg, sljit_sw argw)
+static sljit_s32 getput_arg_fast(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg_ar, sljit_s32 arg, sljit_sw argw)
 {
        SLJIT_ASSERT(arg & SLJIT_MEM);
 
@@ -1311,7 +1311,7 @@ static sljit_si getput_arg_fast(struct sljit_compiler *compiler, sljit_si flags,
 /* See getput_arg below.
    Note: can_cache is called only for binary operators. Those
    operators always uses word arguments without write back. */
-static sljit_si can_cache(sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_sw next_argw)
+static sljit_s32 can_cache(sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
 {
        SLJIT_ASSERT((arg & SLJIT_MEM) && (next_arg & SLJIT_MEM));
 
@@ -1337,9 +1337,9 @@ static sljit_si can_cache(sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_
 }
 
 /* Emit the necessary instructions. See can_cache above. */
-static sljit_si getput_arg(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg_ar, sljit_si arg, sljit_sw argw, sljit_si next_arg, sljit_sw next_argw)
+static sljit_s32 getput_arg(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg_ar, sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
 {
-       sljit_si tmp_ar, base;
+       sljit_s32 tmp_ar, base;
 
        SLJIT_ASSERT(arg & SLJIT_MEM);
        if (!(next_arg & SLJIT_MEM)) {
@@ -1530,7 +1530,7 @@ static sljit_si getput_arg(struct sljit_compiler *compiler, sljit_si flags, slji
                return PB2(data_transfer_insts[flags & MEM_MASK], tmp_ar, reg_ar);
 }
 
-static SLJIT_INLINE sljit_si emit_op_mem(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg_ar, sljit_si arg, sljit_sw argw)
+static SLJIT_INLINE sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg_ar, sljit_s32 arg, sljit_sw argw)
 {
        if (getput_arg_fast(compiler, flags, reg_ar, arg, argw))
                return compiler->error;
@@ -1540,14 +1540,14 @@ static SLJIT_INLINE sljit_si emit_op_mem(struct sljit_compiler *compiler, sljit_
        return getput_arg(compiler, flags, reg_ar, arg, argw, 0, 0);
 }
 
-static SLJIT_INLINE sljit_si emit_op_mem2(struct sljit_compiler *compiler, sljit_si flags, sljit_si reg, sljit_si arg1, sljit_sw arg1w, sljit_si arg2, sljit_sw arg2w)
+static SLJIT_INLINE sljit_s32 emit_op_mem2(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg1, sljit_sw arg1w, sljit_s32 arg2, sljit_sw arg2w)
 {
        if (getput_arg_fast(compiler, flags, reg, arg1, arg1w))
                return compiler->error;
        return getput_arg(compiler, flags, reg, arg1, arg1w, arg2, arg2w);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw));
@@ -1564,7 +1564,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *c
        return emit_op_mem(compiler, WORD_DATA, RA, dst, dstw);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_fast_return(compiler, src, srcw));
@@ -1582,9 +1582,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *
        return JR(RA);
 }
 
-static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, sljit_si op, sljit_si flags, sljit_si dst, sljit_si src1, sljit_sw src2)
+static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 flags, sljit_s32 dst, sljit_s32 src1, sljit_sw src2)
 {
-       sljit_si overflow_ra = 0;
+       sljit_s32 overflow_ra = 0;
 
        switch (GET_OPCODE(op)) {
        case SLJIT_MOV:
@@ -1594,11 +1594,11 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
                        return ADD(reg_map[dst], reg_map[src2], ZERO);
                return SLJIT_SUCCESS;
 
-       case SLJIT_MOV_UI:
-       case SLJIT_MOV_SI:
+       case SLJIT_MOV_U32:
+       case SLJIT_MOV_S32:
                SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
                if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) {
-                       if (op == SLJIT_MOV_SI)
+                       if (op == SLJIT_MOV_S32)
                                return BFEXTS(reg_map[dst], reg_map[src2], 0, 31);
 
                        return BFEXTU(reg_map[dst], reg_map[src2], 0, 31);
@@ -1609,11 +1609,11 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
 
                return SLJIT_SUCCESS;
 
-       case SLJIT_MOV_UB:
-       case SLJIT_MOV_SB:
+       case SLJIT_MOV_U8:
+       case SLJIT_MOV_S8:
                SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
                if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) {
-                       if (op == SLJIT_MOV_SB)
+                       if (op == SLJIT_MOV_S8)
                                return BFEXTS(reg_map[dst], reg_map[src2], 0, 7);
 
                        return BFEXTU(reg_map[dst], reg_map[src2], 0, 7);
@@ -1624,11 +1624,11 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
 
                return SLJIT_SUCCESS;
 
-       case SLJIT_MOV_UH:
-       case SLJIT_MOV_SH:
+       case SLJIT_MOV_U16:
+       case SLJIT_MOV_S16:
                SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
                if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) {
-                       if (op == SLJIT_MOV_SH)
+                       if (op == SLJIT_MOV_S16)
                                return BFEXTS(reg_map[dst], reg_map[src2], 0, 15);
 
                        return BFEXTU(reg_map[dst], reg_map[src2], 0, 15);
@@ -1956,16 +1956,16 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
        return SLJIT_SUCCESS;
 }
 
-static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si flags, sljit_si dst, sljit_sw dstw, sljit_si src1, sljit_sw src1w, sljit_si src2, sljit_sw src2w)
+static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 flags, sljit_s32 dst, sljit_sw dstw, sljit_s32 src1, sljit_sw src1w, sljit_s32 src2, sljit_sw src2w)
 {
        /* arg1 goes to TMP_REG1 or src reg.
           arg2 goes to TMP_REG2, imm or src reg.
           TMP_REG3 can be used for caching.
           result goes to TMP_REG2, so put result can use TMP_REG1 and TMP_REG3. */
-       sljit_si dst_r = TMP_REG2;
-       sljit_si src1_r;
+       sljit_s32 dst_r = TMP_REG2;
+       sljit_s32 src1_r;
        sljit_sw src2_r = 0;
-       sljit_si sugg_src2_r = TMP_REG2;
+       sljit_s32 sugg_src2_r = TMP_REG2;
 
        if (!(flags & ALT_KEEP_CACHE)) {
                compiler->cache_arg = 0;
@@ -1973,14 +1973,14 @@ static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si f
        }
 
        if (SLJIT_UNLIKELY(dst == SLJIT_UNUSED)) {
-               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_SI && !(src2 & SLJIT_MEM))
+               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_S32 && !(src2 & SLJIT_MEM))
                        return SLJIT_SUCCESS;
                if (GET_FLAGS(op))
                        flags |= UNUSED_DEST;
        } else if (FAST_IS_REG(dst)) {
                dst_r = dst;
                flags |= REG_DEST;
-               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_SI)
+               if (op >= SLJIT_MOV && op <= SLJIT_MOVU_S32)
                        sugg_src2_r = dst_r;
        } else if ((dst & SLJIT_MEM) && !getput_arg_fast(compiler, flags | ARG_TEST, TMP_REG1_mapped, dst, dstw))
                flags |= SLOW_DEST;
@@ -2033,7 +2033,7 @@ static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si f
        if (FAST_IS_REG(src2)) {
                src2_r = src2;
                flags |= REG2_SOURCE;
-               if (!(flags & REG_DEST) && op >= SLJIT_MOV && op <= SLJIT_MOVU_SI)
+               if (!(flags & REG_DEST) && op >= SLJIT_MOV && op <= SLJIT_MOVU_S32)
                        dst_r = src2_r;
        } else if (src2 & SLJIT_IMM) {
                if (!(flags & SRC2_IMM)) {
@@ -2042,7 +2042,7 @@ static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si f
                                src2_r = sugg_src2_r;
                        } else {
                                src2_r = 0;
-                               if ((op >= SLJIT_MOV && op <= SLJIT_MOVU_SI) && (dst & SLJIT_MEM))
+                               if ((op >= SLJIT_MOV && op <= SLJIT_MOVU_S32) && (dst & SLJIT_MEM))
                                        dst_r = 0;
                        }
                }
@@ -2082,11 +2082,11 @@ static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si f
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_si op, sljit_si dst, sljit_sw dstw, sljit_si src, sljit_sw srcw, sljit_si type)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 dst, sljit_sw dstw, sljit_s32 src, sljit_sw srcw, sljit_s32 type)
 {
-       sljit_si sugg_dst_ar, dst_ar;
-       sljit_si flags = GET_ALL_FLAGS(op);
-       sljit_si mem_type = (op & SLJIT_INT_OP) ? (INT_DATA | SIGNED_DATA) : WORD_DATA;
+       sljit_s32 sugg_dst_ar, dst_ar;
+       sljit_s32 flags = GET_ALL_FLAGS(op);
+       sljit_s32 mem_type = (op & SLJIT_I32_OP) ? (INT_DATA | SIGNED_DATA) : WORD_DATA;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, src, srcw, type));
@@ -2096,7 +2096,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
                return SLJIT_SUCCESS;
 
        op = GET_OPCODE(op);
-       if (op == SLJIT_MOV_SI || op == SLJIT_MOV_UI)
+       if (op == SLJIT_MOV_S32 || op == SLJIT_MOV_U32)
                mem_type = INT_DATA | SIGNED_DATA;
        sugg_dst_ar = reg_map[(op < SLJIT_ADD && FAST_IS_REG(dst)) ? dst : TMP_REG2];
 
@@ -2168,7 +2168,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler, sljit_si op) {
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op) {
        CHECK_ERROR();
        CHECK(check_sljit_emit_op0(compiler, op));
 
@@ -2180,17 +2180,19 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
        case SLJIT_BREAKPOINT:
                return PI(BPT);
 
-       case SLJIT_LUMUL:
-       case SLJIT_LSMUL:
-       case SLJIT_UDIVI:
-       case SLJIT_SDIVI:
+       case SLJIT_LMUL_UW:
+       case SLJIT_LMUL_SW:
+       case SLJIT_DIVMOD_UW:
+       case SLJIT_DIVMOD_SW:
+       case SLJIT_DIV_UW:
+       case SLJIT_DIV_SW:
                SLJIT_ASSERT_STOP();
        }
 
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler, sljit_si op, sljit_si dst, sljit_sw dstw, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 dst, sljit_sw dstw, sljit_s32 src, sljit_sw srcw)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_op1(compiler, op, dst, dstw, src, srcw));
@@ -2202,45 +2204,45 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
        case SLJIT_MOV_P:
                return emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
 
-       case SLJIT_MOV_UI:
-               return emit_op(compiler, SLJIT_MOV_UI, INT_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
+       case SLJIT_MOV_U32:
+               return emit_op(compiler, SLJIT_MOV_U32, INT_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
 
-       case SLJIT_MOV_SI:
-               return emit_op(compiler, SLJIT_MOV_SI, INT_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
+       case SLJIT_MOV_S32:
+               return emit_op(compiler, SLJIT_MOV_S32, INT_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
 
-       case SLJIT_MOV_UB:
-               return emit_op(compiler, SLJIT_MOV_UB, BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_ub) srcw : srcw);
+       case SLJIT_MOV_U8:
+               return emit_op(compiler, SLJIT_MOV_U8, BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u8) srcw : srcw);
 
-       case SLJIT_MOV_SB:
-               return emit_op(compiler, SLJIT_MOV_SB, BYTE_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_sb) srcw : srcw);
+       case SLJIT_MOV_S8:
+               return emit_op(compiler, SLJIT_MOV_S8, BYTE_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s8) srcw : srcw);
 
-       case SLJIT_MOV_UH:
-               return emit_op(compiler, SLJIT_MOV_UH, HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_uh) srcw : srcw);
+       case SLJIT_MOV_U16:
+               return emit_op(compiler, SLJIT_MOV_U16, HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u16) srcw : srcw);
 
-       case SLJIT_MOV_SH:
-               return emit_op(compiler, SLJIT_MOV_SH, HALF_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_sh) srcw : srcw);
+       case SLJIT_MOV_S16:
+               return emit_op(compiler, SLJIT_MOV_S16, HALF_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s16) srcw : srcw);
 
        case SLJIT_MOVU:
        case SLJIT_MOVU_P:
                return emit_op(compiler, SLJIT_MOV, WORD_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
 
-       case SLJIT_MOVU_UI:
-               return emit_op(compiler, SLJIT_MOV_UI, INT_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
+       case SLJIT_MOVU_U32:
+               return emit_op(compiler, SLJIT_MOV_U32, INT_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
 
-       case SLJIT_MOVU_SI:
-               return emit_op(compiler, SLJIT_MOV_SI, INT_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
+       case SLJIT_MOVU_S32:
+               return emit_op(compiler, SLJIT_MOV_S32, INT_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
 
-       case SLJIT_MOVU_UB:
-               return emit_op(compiler, SLJIT_MOV_UB, BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_ub) srcw : srcw);
+       case SLJIT_MOVU_U8:
+               return emit_op(compiler, SLJIT_MOV_U8, BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u8) srcw : srcw);
 
-       case SLJIT_MOVU_SB:
-               return emit_op(compiler, SLJIT_MOV_SB, BYTE_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_sb) srcw : srcw);
+       case SLJIT_MOVU_S8:
+               return emit_op(compiler, SLJIT_MOV_S8, BYTE_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s8) srcw : srcw);
 
-       case SLJIT_MOVU_UH:
-               return emit_op(compiler, SLJIT_MOV_UH, HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_uh) srcw : srcw);
+       case SLJIT_MOVU_U16:
+               return emit_op(compiler, SLJIT_MOV_U16, HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u16) srcw : srcw);
 
-       case SLJIT_MOVU_SH:
-               return emit_op(compiler, SLJIT_MOV_SH, HALF_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_sh) srcw : srcw);
+       case SLJIT_MOVU_S16:
+               return emit_op(compiler, SLJIT_MOV_S16, HALF_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s16) srcw : srcw);
 
        case SLJIT_NOT:
                return emit_op(compiler, op, 0, dst, dstw, TMP_REG1, 0, src, srcw);
@@ -2249,13 +2251,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
                return emit_op(compiler, SLJIT_SUB | GET_ALL_FLAGS(op), IMM_OP, dst, dstw, SLJIT_IMM, 0, src, srcw);
 
        case SLJIT_CLZ:
-               return emit_op(compiler, op, (op & SLJIT_INT_OP) ? INT_DATA : WORD_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
+               return emit_op(compiler, op, (op & SLJIT_I32_OP) ? INT_DATA : WORD_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
        }
 
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler, sljit_si op, sljit_si dst, sljit_sw dstw, sljit_si src1, sljit_sw src1w, sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 dst, sljit_sw dstw, sljit_s32 src1, sljit_sw src1w, sljit_s32 src2, sljit_sw src2w)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_op2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
@@ -2285,7 +2287,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
        case SLJIT_ASHR:
                if (src2 & SLJIT_IMM)
                        src2w &= 0x3f;
-               if (op & SLJIT_INT_OP)
+               if (op & SLJIT_I32_OP)
                        src2w &= 0x1f;
 
                return emit_op(compiler, op, IMM_OP, dst, dstw, src1, src1w, src2, src2w);
@@ -2312,9 +2314,9 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_label * sljit_emit_label(struct sljit_comp
        return label;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compiler, sljit_si type, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si src_r = TMP_REG2;
+       sljit_s32 src_r = TMP_REG2;
        struct sljit_jump *jump = NULL;
 
        flush_buffer(compiler);
@@ -2401,11 +2403,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compil
        inst = BNEZ_X1 | SRCA_X1(src); \
        flags = IS_COND;
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump * sljit_emit_jump(struct sljit_compiler *compiler, sljit_si type)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump * sljit_emit_jump(struct sljit_compiler *compiler, sljit_s32 type)
 {
        struct sljit_jump *jump;
        sljit_ins inst;
-       sljit_si flags = 0;
+       sljit_s32 flags = 0;
 
        flush_buffer(compiler);
 
@@ -2485,25 +2487,25 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump * sljit_emit_jump(struct sljit_compil
        return jump;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
 {
        return 0;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compiler, sljit_si op, sljit_si dst, sljit_sw dstw, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 dst, sljit_sw dstw, sljit_s32 src, sljit_sw srcw)
 {
        SLJIT_ASSERT_STOP();
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compiler, sljit_si op, sljit_si dst, sljit_sw dstw, sljit_si src1, sljit_sw src1w, sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 dst, sljit_sw dstw, sljit_s32 src1, sljit_sw src1w, sljit_s32 src2, sljit_sw src2w)
 {
        SLJIT_ASSERT_STOP();
 }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_const * sljit_emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw init_value)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_const * sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
 {
        struct sljit_const *const_;
-       sljit_si reg;
+       sljit_s32 reg;
 
        flush_buffer(compiler);
 
@@ -2545,14 +2547,14 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_consta
        SLJIT_CACHE_FLUSH(inst, inst + 4);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
 {
        CHECK_REG_INDEX(check_sljit_get_register_index(reg));
        return reg_map[reg];
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *compiler,
-       void *instruction, sljit_si size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
+       void *instruction, sljit_s32 size)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_op_custom(compiler, instruction, size));
index d7129c8e26dfcdd853f0c2280f4e6fdaf3c69041..78f3dcb06f9f30a10f16c9aeadc168a665b456a2 100644 (file)
 
 /* x86 32-bit arch dependent functions. */
 
-static sljit_si emit_do_imm(struct sljit_compiler *compiler, sljit_ub opcode, sljit_sw imm)
+static sljit_s32 emit_do_imm(struct sljit_compiler *compiler, sljit_u8 opcode, sljit_sw imm)
 {
-       sljit_ub *inst;
+       sljit_u8 *inst;
 
-       inst = (sljit_ub*)ensure_buf(compiler, 1 + 1 + sizeof(sljit_sw));
+       inst = (sljit_u8*)ensure_buf(compiler, 1 + 1 + sizeof(sljit_sw));
        FAIL_IF(!inst);
        INC_SIZE(1 + sizeof(sljit_sw));
        *inst++ = opcode;
-       *(sljit_sw*)inst = imm;
+       sljit_unaligned_store_sw(inst, imm);
        return SLJIT_SUCCESS;
 }
 
-static sljit_ub* generate_far_jump_code(struct sljit_jump *jump, sljit_ub *code_ptr, sljit_si type)
+static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_s32 type)
 {
        if (type == SLJIT_JUMP) {
                *code_ptr++ = JMP_i32;
@@ -57,18 +57,18 @@ static sljit_ub* generate_far_jump_code(struct sljit_jump *jump, sljit_ub *code_
        if (jump->flags & JUMP_LABEL)
                jump->flags |= PATCH_MW;
        else
-               *(sljit_sw*)code_ptr = jump->u.target - (jump->addr + 4);
+               sljit_unaligned_store_sw(code_ptr, jump->u.target - (jump->addr + 4));
        code_ptr += 4;
 
        return code_ptr;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
-       sljit_si size;
-       sljit_ub *inst;
+       sljit_s32 size;
+       sljit_u8 *inst;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
@@ -83,7 +83,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
 #else
        size += (args > 0 ? (2 + args * 3) : 0);
 #endif
-       inst = (sljit_ub*)ensure_buf(compiler, 1 + size);
+       inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
        FAIL_IF(!inst);
 
        INC_SIZE(size);
@@ -143,7 +143,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
        if (options & SLJIT_DOUBLE_ALIGNMENT) {
                local_size = SLJIT_LOCALS_OFFSET + ((local_size + 7) & ~7);
 
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 17);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 17);
                FAIL_IF(!inst);
 
                INC_SIZE(17);
@@ -151,12 +151,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
                inst[1] = MOD_REG | (reg_map[TMP_REG1] << 3) | reg_map[SLJIT_SP];
                inst[2] = GROUP_F7;
                inst[3] = MOD_REG | (0 << 3) | reg_map[SLJIT_SP];
-               *(sljit_sw*)(inst + 4) = 0x4;
+               sljit_unaligned_store_sw(inst + 4, 0x4);
                inst[8] = JNE_i8;
                inst[9] = 6;
                inst[10] = GROUP_BINARY_81;
                inst[11] = MOD_REG | (5 << 3) | reg_map[SLJIT_SP];
-               *(sljit_sw*)(inst + 12) = 0x4;
+               sljit_unaligned_store_sw(inst + 12, 0x4);
                inst[16] = PUSH_r + reg_map[TMP_REG1];
        }
        else
@@ -183,9 +183,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
                SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_IMM, local_size);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
        CHECK_ERROR();
        CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
@@ -205,10 +205,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compi
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si size;
-       sljit_ub *inst;
+       sljit_s32 size;
+       sljit_u8 *inst;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_return(compiler, op, src, srcw));
@@ -223,7 +223,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
 
 #if !defined(__APPLE__)
        if (compiler->options & SLJIT_DOUBLE_ALIGNMENT) {
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 3);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 3);
                FAIL_IF(!inst);
 
                INC_SIZE(3);
@@ -242,7 +242,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
        if (compiler->args > 0)
                size += 2;
 #endif
-       inst = (sljit_ub*)ensure_buf(compiler, 1 + size);
+       inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
        FAIL_IF(!inst);
 
        INC_SIZE(size);
@@ -271,16 +271,16 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
 /* --------------------------------------------------------------------- */
 
 /* Size contains the flags as well. */
-static sljit_ub* emit_x86_instruction(struct sljit_compiler *compiler, sljit_si size,
+static sljit_u8* emit_x86_instruction(struct sljit_compiler *compiler, sljit_s32 size,
        /* The register or immediate operand. */
-       sljit_si a, sljit_sw imma,
+       sljit_s32 a, sljit_sw imma,
        /* The general operand (not immediate). */
-       sljit_si b, sljit_sw immb)
+       sljit_s32 b, sljit_sw immb)
 {
-       sljit_ub *inst;
-       sljit_ub *buf_ptr;
-       sljit_si flags = size & ~0xf;
-       sljit_si inst_size;
+       sljit_u8 *inst;
+       sljit_u8 *buf_ptr;
+       sljit_s32 flags = size & ~0xf;
+       sljit_s32 inst_size;
 
        /* Both cannot be switched on. */
        SLJIT_ASSERT((flags & (EX86_BIN_INS | EX86_SHIFT_INS)) != (EX86_BIN_INS | EX86_SHIFT_INS));
@@ -310,7 +310,7 @@ static sljit_ub* emit_x86_instruction(struct sljit_compiler *compiler, sljit_si
                else if (immb != 0 && !(b & OFFS_REG_MASK)) {
                        /* Immediate operand. */
                        if (immb <= 127 && immb >= -128)
-                               inst_size += sizeof(sljit_sb);
+                               inst_size += sizeof(sljit_s8);
                        else
                                inst_size += sizeof(sljit_sw);
                }
@@ -347,7 +347,7 @@ static sljit_ub* emit_x86_instruction(struct sljit_compiler *compiler, sljit_si
        else
                SLJIT_ASSERT(!(flags & EX86_SHIFT_INS) || a == SLJIT_PREF_SHIFT_REG);
 
-       inst = (sljit_ub*)ensure_buf(compiler, 1 + inst_size);
+       inst = (sljit_u8*)ensure_buf(compiler, 1 + inst_size);
        PTR_FAIL_IF(!inst);
 
        /* Encoding the byte. */
@@ -406,7 +406,7 @@ static sljit_ub* emit_x86_instruction(struct sljit_compiler *compiler, sljit_si
                                if (immb <= 127 && immb >= -128)
                                        *buf_ptr++ = immb; /* 8 bit displacement. */
                                else {
-                                       *(sljit_sw*)buf_ptr = immb; /* 32 bit displacement. */
+                                       sljit_unaligned_store_sw(buf_ptr, immb); /* 32 bit displacement. */
                                        buf_ptr += sizeof(sljit_sw);
                                }
                        }
@@ -418,7 +418,7 @@ static sljit_ub* emit_x86_instruction(struct sljit_compiler *compiler, sljit_si
        }
        else {
                *buf_ptr++ |= 0x05;
-               *(sljit_sw*)buf_ptr = immb; /* 32 bit displacement. */
+               sljit_unaligned_store_sw(buf_ptr, immb); /* 32 bit displacement. */
                buf_ptr += sizeof(sljit_sw);
        }
 
@@ -426,9 +426,9 @@ static sljit_ub* emit_x86_instruction(struct sljit_compiler *compiler, sljit_si
                if (flags & EX86_BYTE_ARG)
                        *buf_ptr = imma;
                else if (flags & EX86_HALF_ARG)
-                       *(short*)buf_ptr = imma;
+                       sljit_unaligned_store_s16(buf_ptr, imma);
                else if (!(flags & EX86_SHIFT_INS))
-                       *(sljit_sw*)buf_ptr = imma;
+                       sljit_unaligned_store_sw(buf_ptr, imma);
        }
 
        return !(flags & EX86_SHIFT_INS) ? inst : (inst + 1);
@@ -438,12 +438,12 @@ static sljit_ub* emit_x86_instruction(struct sljit_compiler *compiler, sljit_si
 /*  Call / return instructions                                           */
 /* --------------------------------------------------------------------- */
 
-static SLJIT_INLINE sljit_si call_with_args(struct sljit_compiler *compiler, sljit_si type)
+static SLJIT_INLINE sljit_s32 call_with_args(struct sljit_compiler *compiler, sljit_s32 type)
 {
-       sljit_ub *inst;
+       sljit_u8 *inst;
 
 #if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
-       inst = (sljit_ub*)ensure_buf(compiler, type >= SLJIT_CALL3 ? 1 + 2 + 1 : 1 + 2);
+       inst = (sljit_u8*)ensure_buf(compiler, type >= SLJIT_CALL3 ? 1 + 2 + 1 : 1 + 2);
        FAIL_IF(!inst);
        INC_SIZE(type >= SLJIT_CALL3 ? 2 + 1 : 2);
 
@@ -452,7 +452,7 @@ static SLJIT_INLINE sljit_si call_with_args(struct sljit_compiler *compiler, slj
        *inst++ = MOV_r_rm;
        *inst++ = MOD_REG | (reg_map[SLJIT_R2] << 3) | reg_map[SLJIT_R0];
 #else
-       inst = (sljit_ub*)ensure_buf(compiler, 1 + 4 * (type - SLJIT_CALL0));
+       inst = (sljit_u8*)ensure_buf(compiler, 1 + 4 * (type - SLJIT_CALL0));
        FAIL_IF(!inst);
        INC_SIZE(4 * (type - SLJIT_CALL0));
 
@@ -476,9 +476,9 @@ static SLJIT_INLINE sljit_si call_with_args(struct sljit_compiler *compiler, slj
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
 {
-       sljit_ub *inst;
+       sljit_u8 *inst;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw));
@@ -492,7 +492,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *c
 
        if (FAST_IS_REG(dst)) {
                /* Unused dest is possible here. */
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 1);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 1);
                FAIL_IF(!inst);
 
                INC_SIZE(1);
@@ -507,9 +507,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *c
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw)
 {
-       sljit_ub *inst;
+       sljit_u8 *inst;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_fast_return(compiler, src, srcw));
@@ -518,7 +518,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *
        CHECK_EXTRA_REGS(src, srcw, (void)0);
 
        if (FAST_IS_REG(src)) {
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 1 + 1);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 1 + 1);
                FAIL_IF(!inst);
 
                INC_SIZE(1 + 1);
@@ -530,18 +530,18 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *
                *inst++ = GROUP_FF;
                *inst |= PUSH_rm;
 
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 1);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 1);
                FAIL_IF(!inst);
                INC_SIZE(1);
        }
        else {
                /* SLJIT_IMM. */
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 5 + 1);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 5 + 1);
                FAIL_IF(!inst);
 
                INC_SIZE(5 + 1);
                *inst++ = PUSH_i32;
-               *(sljit_sw*)inst = srcw;
+               sljit_unaligned_store_sw(inst, srcw);
                inst += sizeof(sljit_sw);
        }
 
index 1790d8a4d0a606639302d0d5f8c65da29f6d9bce..e88ddedcd1ca2fccf782df1be5c83c12c38e9dab 100644 (file)
 
 /* x86 64-bit arch dependent functions. */
 
-static sljit_si emit_load_imm64(struct sljit_compiler *compiler, sljit_si reg, sljit_sw imm)
+static sljit_s32 emit_load_imm64(struct sljit_compiler *compiler, sljit_s32 reg, sljit_sw imm)
 {
-       sljit_ub *inst;
+       sljit_u8 *inst;
 
-       inst = (sljit_ub*)ensure_buf(compiler, 1 + 2 + sizeof(sljit_sw));
+       inst = (sljit_u8*)ensure_buf(compiler, 1 + 2 + sizeof(sljit_sw));
        FAIL_IF(!inst);
        INC_SIZE(2 + sizeof(sljit_sw));
        *inst++ = REX_W | ((reg_map[reg] <= 7) ? 0 : REX_B);
        *inst++ = MOV_r_i32 + (reg_map[reg] & 0x7);
-       *(sljit_sw*)inst = imm;
+       sljit_unaligned_store_sw(inst, imm);
        return SLJIT_SUCCESS;
 }
 
-static sljit_ub* generate_far_jump_code(struct sljit_jump *jump, sljit_ub *code_ptr, sljit_si type)
+static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_s32 type)
 {
        if (type < SLJIT_JUMP) {
                /* Invert type. */
@@ -55,7 +55,7 @@ static sljit_ub* generate_far_jump_code(struct sljit_jump *jump, sljit_ub *code_
        if (jump->flags & JUMP_LABEL)
                jump->flags |= PATCH_MD;
        else
-               *(sljit_sw*)code_ptr = jump->u.target;
+               sljit_unaligned_store_sw(code_ptr, jump->u.target);
 
        code_ptr += sizeof(sljit_sw);
        *code_ptr++ = REX_B;
@@ -65,19 +65,19 @@ static sljit_ub* generate_far_jump_code(struct sljit_jump *jump, sljit_ub *code_
        return code_ptr;
 }
 
-static sljit_ub* generate_fixed_jump(sljit_ub *code_ptr, sljit_sw addr, sljit_si type)
+static sljit_u8* generate_fixed_jump(sljit_u8 *code_ptr, sljit_sw addr, sljit_s32 type)
 {
-       sljit_sw delta = addr - ((sljit_sw)code_ptr + 1 + sizeof(sljit_si));
+       sljit_sw delta = addr - ((sljit_sw)code_ptr + 1 + sizeof(sljit_s32));
 
        if (delta <= HALFWORD_MAX && delta >= HALFWORD_MIN) {
                *code_ptr++ = (type == 2) ? CALL_i32 : JMP_i32;
-               *(sljit_sw*)code_ptr = delta;
+               sljit_unaligned_store_sw(code_ptr, delta);
        }
        else {
                SLJIT_COMPILE_ASSERT(reg_map[TMP_REG3] == 9, tmp3_is_9_second);
                *code_ptr++ = REX_W | REX_B;
                *code_ptr++ = MOV_r_i32 + 1;
-               *(sljit_sw*)code_ptr = addr;
+               sljit_unaligned_store_sw(code_ptr, addr);
                code_ptr += sizeof(sljit_sw);
                *code_ptr++ = REX_B;
                *code_ptr++ = GROUP_FF;
@@ -87,12 +87,12 @@ static sljit_ub* generate_fixed_jump(sljit_ub *code_ptr, sljit_sw addr, sljit_si
        return code_ptr;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
-       sljit_si i, tmp, size, saved_register_size;
-       sljit_ub *inst;
+       sljit_s32 i, tmp, size, saved_register_size;
+       sljit_u8 *inst;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
@@ -106,7 +106,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
        tmp = saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? (SLJIT_S0 + 1 - saveds) : SLJIT_FIRST_SAVED_REG;
        for (i = SLJIT_S0; i >= tmp; i--) {
                size = reg_map[i] >= 8 ? 2 : 1;
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + size);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
                FAIL_IF(!inst);
                INC_SIZE(size);
                if (reg_map[i] >= 8)
@@ -116,7 +116,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
 
        for (i = scratches; i >= SLJIT_FIRST_SAVED_REG; i--) {
                size = reg_map[i] >= 8 ? 2 : 1;
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + size);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
                FAIL_IF(!inst);
                INC_SIZE(size);
                if (reg_map[i] >= 8)
@@ -126,7 +126,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
 
        if (args > 0) {
                size = args * 3;
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + size);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
                FAIL_IF(!inst);
 
                INC_SIZE(size);
@@ -172,9 +172,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
 #ifdef _WIN64
        if (local_size > 1024) {
                /* Allocate stack for the callback, which grows the stack. */
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 4 + (3 + sizeof(sljit_si)));
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 4 + (3 + sizeof(sljit_s32)));
                FAIL_IF(!inst);
-               INC_SIZE(4 + (3 + sizeof(sljit_si)));
+               INC_SIZE(4 + (3 + sizeof(sljit_s32)));
                *inst++ = REX_W;
                *inst++ = GROUP_BINARY_83;
                *inst++ = MOD_REG | SUB | 4;
@@ -193,7 +193,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
                *inst++ = REX_W;
                *inst++ = MOV_rm_i32;
                *inst++ = MOD_REG | reg_lmap[SLJIT_R0];
-               *(sljit_si*)inst = local_size;
+               sljit_unaligned_store_s32(inst, local_size);
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
                        || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
                compiler->skip_checks = 1;
@@ -204,7 +204,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
 
        SLJIT_ASSERT(local_size > 0);
        if (local_size <= 127) {
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 4);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 4);
                FAIL_IF(!inst);
                INC_SIZE(4);
                *inst++ = REX_W;
@@ -213,35 +213,35 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
                *inst++ = local_size;
        }
        else {
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 7);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 7);
                FAIL_IF(!inst);
                INC_SIZE(7);
                *inst++ = REX_W;
                *inst++ = GROUP_BINARY_81;
                *inst++ = MOD_REG | SUB | 4;
-               *(sljit_si*)inst = local_size;
-               inst += sizeof(sljit_si);
+               sljit_unaligned_store_s32(inst, local_size);
+               inst += sizeof(sljit_s32);
        }
 
 #ifdef _WIN64
        /* Save xmm6 register: movaps [rsp + 0x20], xmm6 */
        if (fscratches >= 6 || fsaveds >= 1) {
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 5);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 5);
                FAIL_IF(!inst);
                INC_SIZE(5);
                *inst++ = GROUP_0F;
-               *(sljit_si*)inst = 0x20247429;
+               sljit_unaligned_store_s32(inst, 0x20247429);
        }
 #endif
 
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compiler,
-       sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
-       sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
+       sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+       sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 {
-       sljit_si saved_register_size;
+       sljit_s32 saved_register_size;
 
        CHECK_ERROR();
        CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
@@ -253,10 +253,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compi
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si i, tmp, size;
-       sljit_ub *inst;
+       sljit_s32 i, tmp, size;
+       sljit_u8 *inst;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_return(compiler, op, src, srcw));
@@ -267,17 +267,17 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
 #ifdef _WIN64
        /* Restore xmm6 register: movaps xmm6, [rsp + 0x20] */
        if (compiler->fscratches >= 6 || compiler->fsaveds >= 1) {
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 5);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 5);
                FAIL_IF(!inst);
                INC_SIZE(5);
                *inst++ = GROUP_0F;
-               *(sljit_si*)inst = 0x20247428;
+               sljit_unaligned_store_s32(inst, 0x20247428);
        }
 #endif
 
        SLJIT_ASSERT(compiler->local_size > 0);
        if (compiler->local_size <= 127) {
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 4);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 4);
                FAIL_IF(!inst);
                INC_SIZE(4);
                *inst++ = REX_W;
@@ -286,19 +286,19 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
                *inst = compiler->local_size;
        }
        else {
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 7);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 7);
                FAIL_IF(!inst);
                INC_SIZE(7);
                *inst++ = REX_W;
                *inst++ = GROUP_BINARY_81;
                *inst++ = MOD_REG | ADD | 4;
-               *(sljit_si*)inst = compiler->local_size;
+               sljit_unaligned_store_s32(inst, compiler->local_size);
        }
 
        tmp = compiler->scratches;
        for (i = SLJIT_FIRST_SAVED_REG; i <= tmp; i++) {
                size = reg_map[i] >= 8 ? 2 : 1;
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + size);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
                FAIL_IF(!inst);
                INC_SIZE(size);
                if (reg_map[i] >= 8)
@@ -309,7 +309,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
        tmp = compiler->saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? (SLJIT_S0 + 1 - compiler->saveds) : SLJIT_FIRST_SAVED_REG;
        for (i = tmp; i <= SLJIT_S0; i++) {
                size = reg_map[i] >= 8 ? 2 : 1;
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + size);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
                FAIL_IF(!inst);
                INC_SIZE(size);
                if (reg_map[i] >= 8)
@@ -317,7 +317,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
                POP_REG(reg_lmap[i]);
        }
 
-       inst = (sljit_ub*)ensure_buf(compiler, 1 + 1);
+       inst = (sljit_u8*)ensure_buf(compiler, 1 + 1);
        FAIL_IF(!inst);
        INC_SIZE(1);
        RET();
@@ -328,32 +328,32 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
 /*  Operators                                                            */
 /* --------------------------------------------------------------------- */
 
-static sljit_si emit_do_imm32(struct sljit_compiler *compiler, sljit_ub rex, sljit_ub opcode, sljit_sw imm)
+static sljit_s32 emit_do_imm32(struct sljit_compiler *compiler, sljit_u8 rex, sljit_u8 opcode, sljit_sw imm)
 {
-       sljit_ub *inst;
-       sljit_si length = 1 + (rex ? 1 : 0) + sizeof(sljit_si);
+       sljit_u8 *inst;
+       sljit_s32 length = 1 + (rex ? 1 : 0) + sizeof(sljit_s32);
 
-       inst = (sljit_ub*)ensure_buf(compiler, 1 + length);
+       inst = (sljit_u8*)ensure_buf(compiler, 1 + length);
        FAIL_IF(!inst);
        INC_SIZE(length);
        if (rex)
                *inst++ = rex;
        *inst++ = opcode;
-       *(sljit_si*)inst = imm;
+       sljit_unaligned_store_s32(inst, imm);
        return SLJIT_SUCCESS;
 }
 
-static sljit_ub* emit_x86_instruction(struct sljit_compiler *compiler, sljit_si size,
+static sljit_u8* emit_x86_instruction(struct sljit_compiler *compiler, sljit_s32 size,
        /* The register or immediate operand. */
-       sljit_si a, sljit_sw imma,
+       sljit_s32 a, sljit_sw imma,
        /* The general operand (not immediate). */
-       sljit_si b, sljit_sw immb)
+       sljit_s32 b, sljit_sw immb)
 {
-       sljit_ub *inst;
-       sljit_ub *buf_ptr;
-       sljit_ub rex = 0;
-       sljit_si flags = size & ~0xf;
-       sljit_si inst_size;
+       sljit_u8 *inst;
+       sljit_u8 *buf_ptr;
+       sljit_u8 rex = 0;
+       sljit_s32 flags = size & ~0xf;
+       sljit_s32 inst_size;
 
        /* The immediate operand must be 32 bit. */
        SLJIT_ASSERT(!(a & SLJIT_IMM) || compiler->mode32 || IS_HALFWORD(imma));
@@ -400,7 +400,7 @@ static sljit_ub* emit_x86_instruction(struct sljit_compiler *compiler, sljit_si
                }
 
                if ((b & REG_MASK) == SLJIT_UNUSED)
-                       inst_size += 1 + sizeof(sljit_si); /* SIB byte required to avoid RIP based addressing. */
+                       inst_size += 1 + sizeof(sljit_s32); /* SIB byte required to avoid RIP based addressing. */
                else {
                        if (reg_map[b & REG_MASK] >= 8)
                                rex |= REX_B;
@@ -408,12 +408,12 @@ static sljit_ub* emit_x86_instruction(struct sljit_compiler *compiler, sljit_si
                        if (immb != 0 && (!(b & OFFS_REG_MASK) || (b & OFFS_REG_MASK) == TO_OFFS_REG(SLJIT_SP))) {
                                /* Immediate operand. */
                                if (immb <= 127 && immb >= -128)
-                                       inst_size += sizeof(sljit_sb);
+                                       inst_size += sizeof(sljit_s8);
                                else
-                                       inst_size += sizeof(sljit_si);
+                                       inst_size += sizeof(sljit_s32);
                        }
                        else if (reg_lmap[b & REG_MASK] == 5)
-                               inst_size += sizeof(sljit_sb);
+                               inst_size += sizeof(sljit_s8);
 
                        if ((b & OFFS_REG_MASK) != SLJIT_UNUSED) {
                                inst_size += 1; /* SIB byte. */
@@ -444,7 +444,7 @@ static sljit_ub* emit_x86_instruction(struct sljit_compiler *compiler, sljit_si
                else if (flags & EX86_HALF_ARG)
                        inst_size += sizeof(short);
                else
-                       inst_size += sizeof(sljit_si);
+                       inst_size += sizeof(sljit_s32);
        }
        else {
                SLJIT_ASSERT(!(flags & EX86_SHIFT_INS) || a == SLJIT_PREF_SHIFT_REG);
@@ -456,7 +456,7 @@ static sljit_ub* emit_x86_instruction(struct sljit_compiler *compiler, sljit_si
        if (rex)
                inst_size++;
 
-       inst = (sljit_ub*)ensure_buf(compiler, 1 + inst_size);
+       inst = (sljit_u8*)ensure_buf(compiler, 1 + inst_size);
        PTR_FAIL_IF(!inst);
 
        /* Encoding the byte. */
@@ -516,8 +516,8 @@ static sljit_ub* emit_x86_instruction(struct sljit_compiler *compiler, sljit_si
                                if (immb <= 127 && immb >= -128)
                                        *buf_ptr++ = immb; /* 8 bit displacement. */
                                else {
-                                       *(sljit_si*)buf_ptr = immb; /* 32 bit displacement. */
-                                       buf_ptr += sizeof(sljit_si);
+                                       sljit_unaligned_store_s32(buf_ptr, immb); /* 32 bit displacement. */
+                                       buf_ptr += sizeof(sljit_s32);
                                }
                        }
                }
@@ -533,17 +533,17 @@ static sljit_ub* emit_x86_instruction(struct sljit_compiler *compiler, sljit_si
        else {
                *buf_ptr++ |= 0x04;
                *buf_ptr++ = 0x25;
-               *(sljit_si*)buf_ptr = immb; /* 32 bit displacement. */
-               buf_ptr += sizeof(sljit_si);
+               sljit_unaligned_store_s32(buf_ptr, immb); /* 32 bit displacement. */
+               buf_ptr += sizeof(sljit_s32);
        }
 
        if (a & SLJIT_IMM) {
                if (flags & EX86_BYTE_ARG)
                        *buf_ptr = imma;
                else if (flags & EX86_HALF_ARG)
-                       *(short*)buf_ptr = imma;
+                       sljit_unaligned_store_s16(buf_ptr, imma);
                else if (!(flags & EX86_SHIFT_INS))
-                       *(sljit_si*)buf_ptr = imma;
+                       sljit_unaligned_store_s32(buf_ptr, imma);
        }
 
        return !(flags & EX86_SHIFT_INS) ? inst : (inst + 1);
@@ -553,14 +553,14 @@ static sljit_ub* emit_x86_instruction(struct sljit_compiler *compiler, sljit_si
 /*  Call / return instructions                                           */
 /* --------------------------------------------------------------------- */
 
-static SLJIT_INLINE sljit_si call_with_args(struct sljit_compiler *compiler, sljit_si type)
+static SLJIT_INLINE sljit_s32 call_with_args(struct sljit_compiler *compiler, sljit_s32 type)
 {
-       sljit_ub *inst;
+       sljit_u8 *inst;
 
 #ifndef _WIN64
        SLJIT_COMPILE_ASSERT(reg_map[SLJIT_R1] == 6 && reg_map[SLJIT_R0] < 8 && reg_map[SLJIT_R2] < 8, args_registers);
 
-       inst = (sljit_ub*)ensure_buf(compiler, 1 + ((type < SLJIT_CALL3) ? 3 : 6));
+       inst = (sljit_u8*)ensure_buf(compiler, 1 + ((type < SLJIT_CALL3) ? 3 : 6));
        FAIL_IF(!inst);
        INC_SIZE((type < SLJIT_CALL3) ? 3 : 6);
        if (type >= SLJIT_CALL3) {
@@ -574,7 +574,7 @@ static SLJIT_INLINE sljit_si call_with_args(struct sljit_compiler *compiler, slj
 #else
        SLJIT_COMPILE_ASSERT(reg_map[SLJIT_R1] == 2 && reg_map[SLJIT_R0] < 8 && reg_map[SLJIT_R2] < 8, args_registers);
 
-       inst = (sljit_ub*)ensure_buf(compiler, 1 + ((type < SLJIT_CALL3) ? 3 : 6));
+       inst = (sljit_u8*)ensure_buf(compiler, 1 + ((type < SLJIT_CALL3) ? 3 : 6));
        FAIL_IF(!inst);
        INC_SIZE((type < SLJIT_CALL3) ? 3 : 6);
        if (type >= SLJIT_CALL3) {
@@ -589,9 +589,9 @@ static SLJIT_INLINE sljit_si call_with_args(struct sljit_compiler *compiler, slj
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
 {
-       sljit_ub *inst;
+       sljit_u8 *inst;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw));
@@ -603,14 +603,14 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *c
 
        if (FAST_IS_REG(dst)) {
                if (reg_map[dst] < 8) {
-                       inst = (sljit_ub*)ensure_buf(compiler, 1 + 1);
+                       inst = (sljit_u8*)ensure_buf(compiler, 1 + 1);
                        FAIL_IF(!inst);
                        INC_SIZE(1);
                        POP_REG(reg_lmap[dst]);
                        return SLJIT_SUCCESS;
                }
 
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 2);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 2);
                FAIL_IF(!inst);
                INC_SIZE(2);
                *inst++ = REX_B;
@@ -626,9 +626,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *c
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw)
 {
-       sljit_ub *inst;
+       sljit_u8 *inst;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_fast_return(compiler, src, srcw));
@@ -641,14 +641,14 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *
 
        if (FAST_IS_REG(src)) {
                if (reg_map[src] < 8) {
-                       inst = (sljit_ub*)ensure_buf(compiler, 1 + 1 + 1);
+                       inst = (sljit_u8*)ensure_buf(compiler, 1 + 1 + 1);
                        FAIL_IF(!inst);
 
                        INC_SIZE(1 + 1);
                        PUSH_REG(reg_lmap[src]);
                }
                else {
-                       inst = (sljit_ub*)ensure_buf(compiler, 1 + 2 + 1);
+                       inst = (sljit_u8*)ensure_buf(compiler, 1 + 2 + 1);
                        FAIL_IF(!inst);
 
                        INC_SIZE(2 + 1);
@@ -664,20 +664,20 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *
                *inst++ = GROUP_FF;
                *inst |= PUSH_rm;
 
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 1);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 1);
                FAIL_IF(!inst);
                INC_SIZE(1);
        }
        else {
                SLJIT_ASSERT(IS_HALFWORD(srcw));
                /* SLJIT_IMM. */
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 5 + 1);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 5 + 1);
                FAIL_IF(!inst);
 
                INC_SIZE(5 + 1);
                *inst++ = PUSH_i32;
-               *(sljit_si*)inst = srcw;
-               inst += sizeof(sljit_si);
+               sljit_unaligned_store_s32(inst, srcw);
+               inst += sizeof(sljit_s32);
        }
 
        RET();
@@ -689,12 +689,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *
 /*  Extend input                                                         */
 /* --------------------------------------------------------------------- */
 
-static sljit_si emit_mov_int(struct sljit_compiler *compiler, sljit_si sign,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static sljit_s32 emit_mov_int(struct sljit_compiler *compiler, sljit_s32 sign,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_ub* inst;
-       sljit_si dst_r;
+       sljit_u8* inst;
+       sljit_s32 dst_r;
 
        compiler->mode32 = 0;
 
@@ -704,7 +704,7 @@ static sljit_si emit_mov_int(struct sljit_compiler *compiler, sljit_si sign,
        if (src & SLJIT_IMM) {
                if (FAST_IS_REG(dst)) {
                        if (sign || ((sljit_uw)srcw <= 0x7fffffff)) {
-                               inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, (sljit_sw)(sljit_si)srcw, dst, dstw);
+                               inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, (sljit_sw)(sljit_s32)srcw, dst, dstw);
                                FAIL_IF(!inst);
                                *inst = MOV_rm_i32;
                                return SLJIT_SUCCESS;
@@ -712,7 +712,7 @@ static sljit_si emit_mov_int(struct sljit_compiler *compiler, sljit_si sign,
                        return emit_load_imm64(compiler, dst, srcw);
                }
                compiler->mode32 = 1;
-               inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, (sljit_sw)(sljit_si)srcw, dst, dstw);
+               inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, (sljit_sw)(sljit_s32)srcw, dst, dstw);
                FAIL_IF(!inst);
                *inst = MOV_rm_i32;
                compiler->mode32 = 0;
index 416c15afafa6a6180a1fc51296c3208d9fcb477b..aa5ba089d2a0873bef0ae972846183ba54d514ea 100644 (file)
@@ -24,7 +24,7 @@
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void)
+SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void)
 {
        return "x86" SLJIT_CPUINFO;
 }
@@ -66,7 +66,7 @@ SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void)
 /* Last register + 1. */
 #define TMP_REG1       (SLJIT_NUMBER_OF_REGISTERS + 2)
 
-static SLJIT_CONST sljit_ub reg_map[SLJIT_NUMBER_OF_REGISTERS + 3] = {
+static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 3] = {
        0, 0, 2, 1, 0, 0, 0, 0, 7, 6, 3, 4, 5
 };
 
@@ -89,20 +89,20 @@ static SLJIT_CONST sljit_ub reg_map[SLJIT_NUMBER_OF_REGISTERS + 3] = {
    therefore r12 is better for SAVED_EREG than SAVED_REG. */
 #ifndef _WIN64
 /* 1st passed in rdi, 2nd argument passed in rsi, 3rd in rdx. */
-static SLJIT_CONST sljit_ub reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = {
+static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = {
        0, 0, 6, 1, 8, 11, 10, 12, 5, 13, 14, 15, 3, 4, 2, 7, 9
 };
 /* low-map. reg_map & 0x7. */
-static SLJIT_CONST sljit_ub reg_lmap[SLJIT_NUMBER_OF_REGISTERS + 5] = {
+static const sljit_u8 reg_lmap[SLJIT_NUMBER_OF_REGISTERS + 5] = {
        0, 0, 6, 1, 0, 3,  2,  4,  5,  5,  6,  7, 3, 4, 2, 7, 1
 };
 #else
 /* 1st passed in rcx, 2nd argument passed in rdx, 3rd in r8. */
-static SLJIT_CONST sljit_ub reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = {
+static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = {
        0, 0, 2, 1, 11, 12, 5, 13, 14, 15, 7, 6, 3, 4, 10, 8, 9
 };
 /* low-map. reg_map & 0x7. */
-static SLJIT_CONST sljit_ub reg_lmap[SLJIT_NUMBER_OF_REGISTERS + 5] = {
+static const sljit_u8 reg_lmap[SLJIT_NUMBER_OF_REGISTERS + 5] = {
        0, 0, 2, 1, 3,  4,  5,  5, 6,  7,  7, 6, 3, 4, 2,  0, 1
 };
 #endif
@@ -269,9 +269,9 @@ static SLJIT_CONST sljit_ub reg_lmap[SLJIT_NUMBER_OF_REGISTERS + 5] = {
    built-in CPU features. Therefore they can be overwritten by different threads
    if they detect the CPU features in the same time. */
 #if (defined SLJIT_DETECT_SSE2 && SLJIT_DETECT_SSE2)
-static sljit_si cpu_has_sse2 = -1;
+static sljit_s32 cpu_has_sse2 = -1;
 #endif
-static sljit_si cpu_has_cmov = -1;
+static sljit_s32 cpu_has_cmov = -1;
 
 #ifdef _WIN32_WCE
 #include <cmnintrin.h>
@@ -279,15 +279,38 @@ static sljit_si cpu_has_cmov = -1;
 #include <intrin.h>
 #endif
 
+/******************************************************/
+/*    Unaligned-store functions                       */
+/******************************************************/
+
+static SLJIT_INLINE void sljit_unaligned_store_s16(void *addr, sljit_s16 value)
+{
+       SLJIT_MEMCPY(addr, &value, sizeof(value));
+}
+
+static SLJIT_INLINE void sljit_unaligned_store_s32(void *addr, sljit_s32 value)
+{
+       SLJIT_MEMCPY(addr, &value, sizeof(value));
+}
+
+static SLJIT_INLINE void sljit_unaligned_store_sw(void *addr, sljit_sw value)
+{
+       SLJIT_MEMCPY(addr, &value, sizeof(value));
+}
+
+/******************************************************/
+/*    Utility functions                               */
+/******************************************************/
+
 static void get_cpu_features(void)
 {
-       sljit_ui features;
+       sljit_u32 features;
 
 #if defined(_MSC_VER) && _MSC_VER >= 1400
 
        int CPUInfo[4];
        __cpuid(CPUInfo, 1);
-       features = (sljit_ui)CPUInfo[3];
+       features = (sljit_u32)CPUInfo[3];
 
 #elif defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__SUNPRO_C)
 
@@ -330,31 +353,31 @@ static void get_cpu_features(void)
        cpu_has_cmov = (features >> 15) & 0x1;
 }
 
-static sljit_ub get_jump_code(sljit_si type)
+static sljit_u8 get_jump_code(sljit_s32 type)
 {
        switch (type) {
        case SLJIT_EQUAL:
-       case SLJIT_D_EQUAL:
+       case SLJIT_EQUAL_F64:
                return 0x84 /* je */;
 
        case SLJIT_NOT_EQUAL:
-       case SLJIT_D_NOT_EQUAL:
+       case SLJIT_NOT_EQUAL_F64:
                return 0x85 /* jne */;
 
        case SLJIT_LESS:
-       case SLJIT_D_LESS:
+       case SLJIT_LESS_F64:
                return 0x82 /* jc */;
 
        case SLJIT_GREATER_EQUAL:
-       case SLJIT_D_GREATER_EQUAL:
+       case SLJIT_GREATER_EQUAL_F64:
                return 0x83 /* jae */;
 
        case SLJIT_GREATER:
-       case SLJIT_D_GREATER:
+       case SLJIT_GREATER_F64:
                return 0x87 /* jnbe */;
 
        case SLJIT_LESS_EQUAL:
-       case SLJIT_D_LESS_EQUAL:
+       case SLJIT_LESS_EQUAL_F64:
                return 0x86 /* jbe */;
 
        case SLJIT_SIG_LESS:
@@ -377,24 +400,24 @@ static sljit_ub get_jump_code(sljit_si type)
        case SLJIT_MUL_NOT_OVERFLOW:
                return 0x81 /* jno */;
 
-       case SLJIT_D_UNORDERED:
+       case SLJIT_UNORDERED_F64:
                return 0x8a /* jp */;
 
-       case SLJIT_D_ORDERED:
+       case SLJIT_ORDERED_F64:
                return 0x8b /* jpo */;
        }
        return 0;
 }
 
-static sljit_ub* generate_far_jump_code(struct sljit_jump *jump, sljit_ub *code_ptr, sljit_si type);
+static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_s32 type);
 
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-static sljit_ub* generate_fixed_jump(sljit_ub *code_ptr, sljit_sw addr, sljit_si type);
+static sljit_u8* generate_fixed_jump(sljit_u8 *code_ptr, sljit_sw addr, sljit_s32 type);
 #endif
 
-static sljit_ub* generate_near_jump_code(struct sljit_jump *jump, sljit_ub *code_ptr, sljit_ub *code, sljit_si type)
+static sljit_u8* generate_near_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_u8 *code, sljit_s32 type)
 {
-       sljit_si short_jump;
+       sljit_s32 short_jump;
        sljit_uw label_addr;
 
        if (jump->flags & JUMP_LABEL)
@@ -432,13 +455,13 @@ static sljit_ub* generate_near_jump_code(struct sljit_jump *jump, sljit_ub *code
 
        if (short_jump) {
                jump->flags |= PATCH_MB;
-               code_ptr += sizeof(sljit_sb);
+               code_ptr += sizeof(sljit_s8);
        } else {
                jump->flags |= PATCH_MW;
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
                code_ptr += sizeof(sljit_sw);
 #else
-               code_ptr += sizeof(sljit_si);
+               code_ptr += sizeof(sljit_s32);
 #endif
        }
 
@@ -448,11 +471,11 @@ static sljit_ub* generate_near_jump_code(struct sljit_jump *jump, sljit_ub *code
 SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler)
 {
        struct sljit_memory_fragment *buf;
-       sljit_ub *code;
-       sljit_ub *code_ptr;
-       sljit_ub *buf_ptr;
-       sljit_ub *buf_end;
-       sljit_ub len;
+       sljit_u8 *code;
+       sljit_u8 *code_ptr;
+       sljit_u8 *buf_ptr;
+       sljit_u8 *buf_end;
+       sljit_u8 len;
 
        struct sljit_label *label;
        struct sljit_jump *jump;
@@ -463,7 +486,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
        reverse_buf(compiler);
 
        /* Second code generation pass. */
-       code = (sljit_ub*)SLJIT_MALLOC_EXEC(compiler->size);
+       code = (sljit_u8*)SLJIT_MALLOC_EXEC(compiler->size);
        PTR_FAIL_WITH_EXEC_IF(code);
        buf = compiler->buf;
 
@@ -478,7 +501,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
                        len = *buf_ptr++;
                        if (len > 0) {
                                /* The code is already generated. */
-                               SLJIT_MEMMOVE(code_ptr, buf_ptr, len);
+                               SLJIT_MEMCPY(code_ptr, buf_ptr, len);
                                code_ptr += len;
                                buf_ptr += len;
                        }
@@ -504,7 +527,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
                                        *code_ptr++ = (*buf_ptr == 2) ? CALL_i32 : JMP_i32;
                                        buf_ptr++;
-                                       *(sljit_sw*)code_ptr = *(sljit_sw*)buf_ptr - ((sljit_sw)code_ptr + sizeof(sljit_sw));
+                                       sljit_unaligned_store_sw(code_ptr, *(sljit_sw*)buf_ptr - ((sljit_sw)code_ptr + sizeof(sljit_sw)));
                                        code_ptr += sizeof(sljit_sw);
                                        buf_ptr += sizeof(sljit_sw) - 1;
 #else
@@ -526,29 +549,29 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
        jump = compiler->jumps;
        while (jump) {
                if (jump->flags & PATCH_MB) {
-                       SLJIT_ASSERT((sljit_sw)(jump->u.label->addr - (jump->addr + sizeof(sljit_sb))) >= -128 && (sljit_sw)(jump->u.label->addr - (jump->addr + sizeof(sljit_sb))) <= 127);
-                       *(sljit_ub*)jump->addr = (sljit_ub)(jump->u.label->addr - (jump->addr + sizeof(sljit_sb)));
+                       SLJIT_ASSERT((sljit_sw)(jump->u.label->addr - (jump->addr + sizeof(sljit_s8))) >= -128 && (sljit_sw)(jump->u.label->addr - (jump->addr + sizeof(sljit_s8))) <= 127);
+                       *(sljit_u8*)jump->addr = (sljit_u8)(jump->u.label->addr - (jump->addr + sizeof(sljit_s8)));
                } else if (jump->flags & PATCH_MW) {
                        if (jump->flags & JUMP_LABEL) {
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-                               *(sljit_sw*)jump->addr = (sljit_sw)(jump->u.label->addr - (jump->addr + sizeof(sljit_sw)));
+                               sljit_unaligned_store_sw((void*)jump->addr, (sljit_sw)(jump->u.label->addr - (jump->addr + sizeof(sljit_sw))));
 #else
-                               SLJIT_ASSERT((sljit_sw)(jump->u.label->addr - (jump->addr + sizeof(sljit_si))) >= HALFWORD_MIN && (sljit_sw)(jump->u.label->addr - (jump->addr + sizeof(sljit_si))) <= HALFWORD_MAX);
-                               *(sljit_si*)jump->addr = (sljit_si)(jump->u.label->addr - (jump->addr + sizeof(sljit_si)));
+                               SLJIT_ASSERT((sljit_sw)(jump->u.label->addr - (jump->addr + sizeof(sljit_s32))) >= HALFWORD_MIN && (sljit_sw)(jump->u.label->addr - (jump->addr + sizeof(sljit_s32))) <= HALFWORD_MAX);
+                               sljit_unaligned_store_s32((void*)jump->addr, (sljit_s32)(jump->u.label->addr - (jump->addr + sizeof(sljit_s32))));
 #endif
                        }
                        else {
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-                               *(sljit_sw*)jump->addr = (sljit_sw)(jump->u.target - (jump->addr + sizeof(sljit_sw)));
+                               sljit_unaligned_store_sw((void*)jump->addr, (sljit_sw)(jump->u.target - (jump->addr + sizeof(sljit_sw))));
 #else
-                               SLJIT_ASSERT((sljit_sw)(jump->u.target - (jump->addr + sizeof(sljit_si))) >= HALFWORD_MIN && (sljit_sw)(jump->u.target - (jump->addr + sizeof(sljit_si))) <= HALFWORD_MAX);
-                               *(sljit_si*)jump->addr = (sljit_si)(jump->u.target - (jump->addr + sizeof(sljit_si)));
+                               SLJIT_ASSERT((sljit_sw)(jump->u.target - (jump->addr + sizeof(sljit_s32))) >= HALFWORD_MIN && (sljit_sw)(jump->u.target - (jump->addr + sizeof(sljit_s32))) <= HALFWORD_MAX);
+                               sljit_unaligned_store_s32((void*)jump->addr, (sljit_s32)(jump->u.target - (jump->addr + sizeof(sljit_s32))));
 #endif
                        }
                }
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
                else if (jump->flags & PATCH_MD)
-                       *(sljit_sw*)jump->addr = jump->u.label->addr;
+                       sljit_unaligned_store_sw((void*)jump->addr, jump->u.label->addr);
 #endif
 
                jump = jump->next;
@@ -565,32 +588,32 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
 /*  Operators                                                            */
 /* --------------------------------------------------------------------- */
 
-static sljit_si emit_cum_binary(struct sljit_compiler *compiler,
-       sljit_ub op_rm, sljit_ub op_mr, sljit_ub op_imm, sljit_ub op_eax_imm,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w);
+static sljit_s32 emit_cum_binary(struct sljit_compiler *compiler,
+       sljit_u8 op_rm, sljit_u8 op_mr, sljit_u8 op_imm, sljit_u8 op_eax_imm,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w);
 
-static sljit_si emit_non_cum_binary(struct sljit_compiler *compiler,
-       sljit_ub op_rm, sljit_ub op_mr, sljit_ub op_imm, sljit_ub op_eax_imm,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w);
+static sljit_s32 emit_non_cum_binary(struct sljit_compiler *compiler,
+       sljit_u8 op_rm, sljit_u8 op_mr, sljit_u8 op_imm, sljit_u8 op_eax_imm,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w);
 
-static sljit_si emit_mov(struct sljit_compiler *compiler,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw);
+static sljit_s32 emit_mov(struct sljit_compiler *compiler,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw);
 
-static SLJIT_INLINE sljit_si emit_save_flags(struct sljit_compiler *compiler)
+static SLJIT_INLINE sljit_s32 emit_save_flags(struct sljit_compiler *compiler)
 {
-       sljit_ub *inst;
+       sljit_u8 *inst;
 
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-       inst = (sljit_ub*)ensure_buf(compiler, 1 + 5);
+       inst = (sljit_u8*)ensure_buf(compiler, 1 + 5);
        FAIL_IF(!inst);
        INC_SIZE(5);
 #else
-       inst = (sljit_ub*)ensure_buf(compiler, 1 + 6);
+       inst = (sljit_u8*)ensure_buf(compiler, 1 + 6);
        FAIL_IF(!inst);
        INC_SIZE(6);
        *inst++ = REX_W;
@@ -598,23 +621,23 @@ static SLJIT_INLINE sljit_si emit_save_flags(struct sljit_compiler *compiler)
        *inst++ = LEA_r_m; /* lea esp/rsp, [esp/rsp + sizeof(sljit_sw)] */
        *inst++ = 0x64;
        *inst++ = 0x24;
-       *inst++ = (sljit_ub)sizeof(sljit_sw);
+       *inst++ = (sljit_u8)sizeof(sljit_sw);
        *inst++ = PUSHF;
        compiler->flags_saved = 1;
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si emit_restore_flags(struct sljit_compiler *compiler, sljit_si keep_flags)
+static SLJIT_INLINE sljit_s32 emit_restore_flags(struct sljit_compiler *compiler, sljit_s32 keep_flags)
 {
-       sljit_ub *inst;
+       sljit_u8 *inst;
 
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-       inst = (sljit_ub*)ensure_buf(compiler, 1 + 5);
+       inst = (sljit_u8*)ensure_buf(compiler, 1 + 5);
        FAIL_IF(!inst);
        INC_SIZE(5);
        *inst++ = POPF;
 #else
-       inst = (sljit_ub*)ensure_buf(compiler, 1 + 6);
+       inst = (sljit_u8*)ensure_buf(compiler, 1 + 6);
        FAIL_IF(!inst);
        INC_SIZE(6);
        *inst++ = POPF;
@@ -623,7 +646,7 @@ static SLJIT_INLINE sljit_si emit_restore_flags(struct sljit_compiler *compiler,
        *inst++ = LEA_r_m; /* lea esp/rsp, [esp/rsp - sizeof(sljit_sw)] */
        *inst++ = 0x64;
        *inst++ = 0x24;
-       *inst++ = (sljit_ub)-(sljit_sb)sizeof(sljit_sw);
+       *inst++ = (sljit_u8)(-(sljit_s8)sizeof(sljit_sw));
        compiler->flags_saved = keep_flags;
        return SLJIT_SUCCESS;
 }
@@ -640,7 +663,7 @@ static void SLJIT_CALL sljit_grow_stack(sljit_sw local_size)
        CPU cycles if the stack is large enough. However, you don't know it in
        advance, so it must always be called. I think this is a bad design in
        general even if it has some reasons. */
-       *(volatile sljit_si*)alloca(local_size) = 0;
+       *(volatile sljit_s32*)alloca(local_size) = 0;
 }
 
 #endif
@@ -651,11 +674,11 @@ static void SLJIT_CALL sljit_grow_stack(sljit_sw local_size)
 #include "sljitNativeX86_64.c"
 #endif
 
-static sljit_si emit_mov(struct sljit_compiler *compiler,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static sljit_s32 emit_mov(struct sljit_compiler *compiler,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_ub* inst;
+       sljit_u8* inst;
 
        if (dst == SLJIT_UNUSED) {
                /* No destination, doesn't need to setup flags. */
@@ -719,11 +742,11 @@ static sljit_si emit_mov(struct sljit_compiler *compiler,
 #define EMIT_MOV(compiler, dst, dstw, src, srcw) \
        FAIL_IF(emit_mov(compiler, dst, dstw, src, srcw));
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler, sljit_si op)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op)
 {
-       sljit_ub *inst;
+       sljit_u8 *inst;
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-       sljit_si size;
+       sljit_s32 size;
 #endif
 
        CHECK_ERROR();
@@ -731,23 +754,23 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
 
        switch (GET_OPCODE(op)) {
        case SLJIT_BREAKPOINT:
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 1);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 1);
                FAIL_IF(!inst);
                INC_SIZE(1);
                *inst = INT3;
                break;
        case SLJIT_NOP:
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 1);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 1);
                FAIL_IF(!inst);
                INC_SIZE(1);
                *inst = NOP;
                break;
-       case SLJIT_LUMUL:
-       case SLJIT_LSMUL:
-       case SLJIT_UDIVMOD:
-       case SLJIT_SDIVMOD:
-       case SLJIT_UDIVI:
-       case SLJIT_SDIVI:
+       case SLJIT_LMUL_UW:
+       case SLJIT_LMUL_SW:
+       case SLJIT_DIVMOD_UW:
+       case SLJIT_DIVMOD_SW:
+       case SLJIT_DIV_UW:
+       case SLJIT_DIV_SW:
                compiler->flags_saved = 0;
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
 #ifdef _WIN64
@@ -763,12 +786,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
                        && reg_map[TMP_REG1] == 2,
                        invalid_register_assignment_for_div_mul);
 #endif
-               compiler->mode32 = op & SLJIT_INT_OP;
+               compiler->mode32 = op & SLJIT_I32_OP;
 #endif
-               SLJIT_COMPILE_ASSERT((SLJIT_UDIVMOD & 0x2) == 0 && SLJIT_UDIVI - 0x2 == SLJIT_UDIVMOD, bad_div_opcode_assignments);
+               SLJIT_COMPILE_ASSERT((SLJIT_DIVMOD_UW & 0x2) == 0 && SLJIT_DIV_UW - 0x2 == SLJIT_DIVMOD_UW, bad_div_opcode_assignments);
 
                op = GET_OPCODE(op);
-               if ((op | 0x2) == SLJIT_UDIVI) {
+               if ((op | 0x2) == SLJIT_DIV_UW) {
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || defined(_WIN64)
                        EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_R1, 0);
                        inst = emit_x86_instruction(compiler, 1, SLJIT_R1, 0, SLJIT_R1, 0);
@@ -779,24 +802,24 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
                        *inst = XOR_r_rm;
                }
 
-               if ((op | 0x2) == SLJIT_SDIVI) {
+               if ((op | 0x2) == SLJIT_DIV_SW) {
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || defined(_WIN64)
                        EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_R1, 0);
 #endif
 
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-                       inst = (sljit_ub*)ensure_buf(compiler, 1 + 1);
+                       inst = (sljit_u8*)ensure_buf(compiler, 1 + 1);
                        FAIL_IF(!inst);
                        INC_SIZE(1);
                        *inst = CDQ;
 #else
                        if (compiler->mode32) {
-                               inst = (sljit_ub*)ensure_buf(compiler, 1 + 1);
+                               inst = (sljit_u8*)ensure_buf(compiler, 1 + 1);
                                FAIL_IF(!inst);
                                INC_SIZE(1);
                                *inst = CDQ;
                        } else {
-                               inst = (sljit_ub*)ensure_buf(compiler, 1 + 2);
+                               inst = (sljit_u8*)ensure_buf(compiler, 1 + 2);
                                FAIL_IF(!inst);
                                INC_SIZE(2);
                                *inst++ = REX_W;
@@ -806,27 +829,27 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
                }
 
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 2);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 2);
                FAIL_IF(!inst);
                INC_SIZE(2);
                *inst++ = GROUP_F7;
-               *inst = MOD_REG | ((op >= SLJIT_UDIVMOD) ? reg_map[TMP_REG1] : reg_map[SLJIT_R1]);
+               *inst = MOD_REG | ((op >= SLJIT_DIVMOD_UW) ? reg_map[TMP_REG1] : reg_map[SLJIT_R1]);
 #else
 #ifdef _WIN64
-               size = (!compiler->mode32 || op >= SLJIT_UDIVMOD) ? 3 : 2;
+               size = (!compiler->mode32 || op >= SLJIT_DIVMOD_UW) ? 3 : 2;
 #else
                size = (!compiler->mode32) ? 3 : 2;
 #endif
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + size);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
                FAIL_IF(!inst);
                INC_SIZE(size);
 #ifdef _WIN64
                if (!compiler->mode32)
-                       *inst++ = REX_W | ((op >= SLJIT_UDIVMOD) ? REX_B : 0);
-               else if (op >= SLJIT_UDIVMOD)
+                       *inst++ = REX_W | ((op >= SLJIT_DIVMOD_UW) ? REX_B : 0);
+               else if (op >= SLJIT_DIVMOD_UW)
                        *inst++ = REX_B;
                *inst++ = GROUP_F7;
-               *inst = MOD_REG | ((op >= SLJIT_UDIVMOD) ? reg_lmap[TMP_REG1] : reg_lmap[SLJIT_R1]);
+               *inst = MOD_REG | ((op >= SLJIT_DIVMOD_UW) ? reg_lmap[TMP_REG1] : reg_lmap[SLJIT_R1]);
 #else
                if (!compiler->mode32)
                        *inst++ = REX_W;
@@ -835,26 +858,26 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
 #endif
 #endif
                switch (op) {
-               case SLJIT_LUMUL:
+               case SLJIT_LMUL_UW:
                        *inst |= MUL;
                        break;
-               case SLJIT_LSMUL:
+               case SLJIT_LMUL_SW:
                        *inst |= IMUL;
                        break;
-               case SLJIT_UDIVMOD:
-               case SLJIT_UDIVI:
+               case SLJIT_DIVMOD_UW:
+               case SLJIT_DIV_UW:
                        *inst |= DIV;
                        break;
-               case SLJIT_SDIVMOD:
-               case SLJIT_SDIVI:
+               case SLJIT_DIVMOD_SW:
+               case SLJIT_DIV_SW:
                        *inst |= IDIV;
                        break;
                }
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && !defined(_WIN64)
-               if (op <= SLJIT_SDIVMOD)
+               if (op <= SLJIT_DIVMOD_SW)
                        EMIT_MOV(compiler, SLJIT_R1, 0, TMP_REG1, 0);
 #else
-               if (op >= SLJIT_UDIVI)
+               if (op >= SLJIT_DIV_UW)
                        EMIT_MOV(compiler, SLJIT_R1, 0, TMP_REG1, 0);
 #endif
                break;
@@ -865,20 +888,20 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
 
 #define ENCODE_PREFIX(prefix) \
        do { \
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 1); \
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 1); \
                FAIL_IF(!inst); \
                INC_SIZE(1); \
                *inst = (prefix); \
        } while (0)
 
-static sljit_si emit_mov_byte(struct sljit_compiler *compiler, sljit_si sign,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static sljit_s32 emit_mov_byte(struct sljit_compiler *compiler, sljit_s32 sign,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_ub* inst;
-       sljit_si dst_r;
+       sljit_u8* inst;
+       sljit_s32 dst_r;
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-       sljit_si work_r;
+       sljit_s32 work_r;
 #endif
 
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
@@ -1016,12 +1039,12 @@ static sljit_si emit_mov_byte(struct sljit_compiler *compiler, sljit_si sign,
        return SLJIT_SUCCESS;
 }
 
-static sljit_si emit_mov_half(struct sljit_compiler *compiler, sljit_si sign,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static sljit_s32 emit_mov_half(struct sljit_compiler *compiler, sljit_s32 sign,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_ub* inst;
-       sljit_si dst_r;
+       sljit_u8* inst;
+       sljit_s32 dst_r;
 
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
        compiler->mode32 = 0;
@@ -1067,11 +1090,11 @@ static sljit_si emit_mov_half(struct sljit_compiler *compiler, sljit_si sign,
        return SLJIT_SUCCESS;
 }
 
-static sljit_si emit_unary(struct sljit_compiler *compiler, sljit_ub opcode,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static sljit_s32 emit_unary(struct sljit_compiler *compiler, sljit_u8 opcode,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_ub* inst;
+       sljit_u8* inst;
 
        if (dst == SLJIT_UNUSED) {
                EMIT_MOV(compiler, TMP_REG1, 0, src, srcw);
@@ -1106,11 +1129,11 @@ static sljit_si emit_unary(struct sljit_compiler *compiler, sljit_ub opcode,
        return SLJIT_SUCCESS;
 }
 
-static sljit_si emit_not_with_flags(struct sljit_compiler *compiler,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static sljit_s32 emit_not_with_flags(struct sljit_compiler *compiler,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_ub* inst;
+       sljit_u8* inst;
 
        if (dst == SLJIT_UNUSED) {
                EMIT_MOV(compiler, TMP_REG1, 0, src, srcw);
@@ -1146,12 +1169,12 @@ static sljit_si emit_not_with_flags(struct sljit_compiler *compiler,
        return SLJIT_SUCCESS;
 }
 
-static sljit_si emit_clz(struct sljit_compiler *compiler, sljit_si op_flags,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static sljit_s32 emit_clz(struct sljit_compiler *compiler, sljit_s32 op_flags,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_ub* inst;
-       sljit_si dst_r;
+       sljit_u8* inst;
+       sljit_s32 dst_r;
 
        SLJIT_UNUSED_ARG(op_flags);
        if (SLJIT_UNLIKELY(dst == SLJIT_UNUSED)) {
@@ -1164,7 +1187,7 @@ static sljit_si emit_clz(struct sljit_compiler *compiler, sljit_si op_flags,
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
                inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, SLJIT_IMM, 31, TMP_REG1, 0);
 #else
-               inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, SLJIT_IMM, !(op_flags & SLJIT_INT_OP) ? 63 : 31, TMP_REG1, 0);
+               inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, SLJIT_IMM, !(op_flags & SLJIT_I32_OP) ? 63 : 31, TMP_REG1, 0);
 #endif
                FAIL_IF(!inst);
                *inst |= SHR;
@@ -1199,8 +1222,8 @@ static sljit_si emit_clz(struct sljit_compiler *compiler, sljit_si op_flags,
 #else
        dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2;
        compiler->mode32 = 0;
-       EMIT_MOV(compiler, dst_r, 0, SLJIT_IMM, !(op_flags & SLJIT_INT_OP) ? 64 + 63 : 32 + 31);
-       compiler->mode32 = op_flags & SLJIT_INT_OP;
+       EMIT_MOV(compiler, dst_r, 0, SLJIT_IMM, !(op_flags & SLJIT_I32_OP) ? 64 + 63 : 32 + 31);
+       compiler->mode32 = op_flags & SLJIT_I32_OP;
 #endif
 
        if (cpu_has_cmov == -1)
@@ -1213,7 +1236,7 @@ static sljit_si emit_clz(struct sljit_compiler *compiler, sljit_si op_flags,
                *inst = CMOVNE_r_rm;
        } else {
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 4);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 4);
                FAIL_IF(!inst);
                INC_SIZE(4);
 
@@ -1222,7 +1245,7 @@ static sljit_si emit_clz(struct sljit_compiler *compiler, sljit_si op_flags,
                *inst++ = MOV_r_rm;
                *inst++ = MOD_REG | (reg_map[dst_r] << 3) | reg_map[TMP_REG1];
 #else
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 5);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 5);
                FAIL_IF(!inst);
                INC_SIZE(5);
 
@@ -1237,7 +1260,7 @@ static sljit_si emit_clz(struct sljit_compiler *compiler, sljit_si op_flags,
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
        inst = emit_x86_instruction(compiler, 1 | EX86_BIN_INS, SLJIT_IMM, 31, dst_r, 0);
 #else
-       inst = emit_x86_instruction(compiler, 1 | EX86_BIN_INS, SLJIT_IMM, !(op_flags & SLJIT_INT_OP) ? 63 : 31, dst_r, 0);
+       inst = emit_x86_instruction(compiler, 1 | EX86_BIN_INS, SLJIT_IMM, !(op_flags & SLJIT_I32_OP) ? 63 : 31, dst_r, 0);
 #endif
        FAIL_IF(!inst);
        *(inst + 1) |= XOR;
@@ -1255,16 +1278,16 @@ static sljit_si emit_clz(struct sljit_compiler *compiler, sljit_si op_flags,
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_ub* inst;
-       sljit_si update = 0;
-       sljit_si op_flags = GET_ALL_FLAGS(op);
+       sljit_u8* inst;
+       sljit_s32 update = 0;
+       sljit_s32 op_flags = GET_ALL_FLAGS(op);
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-       sljit_si dst_is_ereg = 0;
-       sljit_si src_is_ereg = 0;
+       sljit_s32 dst_is_ereg = 0;
+       sljit_s32 src_is_ereg = 0;
 #else
 #      define src_is_ereg 0
 #endif
@@ -1277,7 +1300,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
        CHECK_EXTRA_REGS(dst, dstw, dst_is_ereg = 1);
        CHECK_EXTRA_REGS(src, srcw, src_is_ereg = 1);
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-       compiler->mode32 = op_flags & SLJIT_INT_OP;
+       compiler->mode32 = op_flags & SLJIT_I32_OP;
 #endif
 
        op = GET_OPCODE(op);
@@ -1286,20 +1309,20 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
                compiler->mode32 = 0;
 #endif
 
-               if (op_flags & SLJIT_INT_OP) {
+               if (op_flags & SLJIT_I32_OP) {
                        if (FAST_IS_REG(src) && src == dst) {
                                if (!TYPE_CAST_NEEDED(op))
                                        return SLJIT_SUCCESS;
                        }
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-                       if (op == SLJIT_MOV_SI && (src & SLJIT_MEM))
-                               op = SLJIT_MOV_UI;
-                       if (op == SLJIT_MOVU_SI && (src & SLJIT_MEM))
-                               op = SLJIT_MOVU_UI;
-                       if (op == SLJIT_MOV_UI && (src & SLJIT_IMM))
-                               op = SLJIT_MOV_SI;
-                       if (op == SLJIT_MOVU_UI && (src & SLJIT_IMM))
-                               op = SLJIT_MOVU_SI;
+                       if (op == SLJIT_MOV_S32 && (src & SLJIT_MEM))
+                               op = SLJIT_MOV_U32;
+                       if (op == SLJIT_MOVU_S32 && (src & SLJIT_MEM))
+                               op = SLJIT_MOVU_U32;
+                       if (op == SLJIT_MOV_U32 && (src & SLJIT_IMM))
+                               op = SLJIT_MOV_S32;
+                       if (op == SLJIT_MOVU_U32 && (src & SLJIT_IMM))
+                               op = SLJIT_MOVU_S32;
 #endif
                }
 
@@ -1311,24 +1334,24 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
 
                if (src & SLJIT_IMM) {
                        switch (op) {
-                       case SLJIT_MOV_UB:
-                               srcw = (sljit_ub)srcw;
+                       case SLJIT_MOV_U8:
+                               srcw = (sljit_u8)srcw;
                                break;
-                       case SLJIT_MOV_SB:
-                               srcw = (sljit_sb)srcw;
+                       case SLJIT_MOV_S8:
+                               srcw = (sljit_s8)srcw;
                                break;
-                       case SLJIT_MOV_UH:
-                               srcw = (sljit_uh)srcw;
+                       case SLJIT_MOV_U16:
+                               srcw = (sljit_u16)srcw;
                                break;
-                       case SLJIT_MOV_SH:
-                               srcw = (sljit_sh)srcw;
+                       case SLJIT_MOV_S16:
+                               srcw = (sljit_s16)srcw;
                                break;
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-                       case SLJIT_MOV_UI:
-                               srcw = (sljit_ui)srcw;
+                       case SLJIT_MOV_U32:
+                               srcw = (sljit_u32)srcw;
                                break;
-                       case SLJIT_MOV_SI:
-                               srcw = (sljit_si)srcw;
+                       case SLJIT_MOV_S32:
+                               srcw = (sljit_s32)srcw;
                                break;
 #endif
                        }
@@ -1347,7 +1370,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
                }
 
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-               if (SLJIT_UNLIKELY(dst_is_ereg) && (!(op == SLJIT_MOV || op == SLJIT_MOV_UI || op == SLJIT_MOV_SI || op == SLJIT_MOV_P) || (src & SLJIT_MEM))) {
+               if (SLJIT_UNLIKELY(dst_is_ereg) && (!(op == SLJIT_MOV || op == SLJIT_MOV_U32 || op == SLJIT_MOV_S32 || op == SLJIT_MOV_P) || (src & SLJIT_MEM))) {
                        SLJIT_ASSERT(dst == SLJIT_MEM1(SLJIT_SP));
                        dst = TMP_REG1;
                }
@@ -1357,28 +1380,28 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
                case SLJIT_MOV:
                case SLJIT_MOV_P:
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-               case SLJIT_MOV_UI:
-               case SLJIT_MOV_SI:
+               case SLJIT_MOV_U32:
+               case SLJIT_MOV_S32:
 #endif
                        FAIL_IF(emit_mov(compiler, dst, dstw, src, srcw));
                        break;
-               case SLJIT_MOV_UB:
+               case SLJIT_MOV_U8:
                        FAIL_IF(emit_mov_byte(compiler, 0, dst, dstw, src, srcw));
                        break;
-               case SLJIT_MOV_SB:
+               case SLJIT_MOV_S8:
                        FAIL_IF(emit_mov_byte(compiler, 1, dst, dstw, src, srcw));
                        break;
-               case SLJIT_MOV_UH:
+               case SLJIT_MOV_U16:
                        FAIL_IF(emit_mov_half(compiler, 0, dst, dstw, src, srcw));
                        break;
-               case SLJIT_MOV_SH:
+               case SLJIT_MOV_S16:
                        FAIL_IF(emit_mov_half(compiler, 1, dst, dstw, src, srcw));
                        break;
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-               case SLJIT_MOV_UI:
+               case SLJIT_MOV_U32:
                        FAIL_IF(emit_mov_int(compiler, 0, dst, dstw, src, srcw));
                        break;
-               case SLJIT_MOV_SI:
+               case SLJIT_MOV_S32:
                        FAIL_IF(emit_mov_int(compiler, 1, dst, dstw, src, srcw));
                        break;
 #endif
@@ -1454,13 +1477,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
 
 #endif
 
-static sljit_si emit_cum_binary(struct sljit_compiler *compiler,
-       sljit_ub op_rm, sljit_ub op_mr, sljit_ub op_imm, sljit_ub op_eax_imm,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static sljit_s32 emit_cum_binary(struct sljit_compiler *compiler,
+       sljit_u8 op_rm, sljit_u8 op_mr, sljit_u8 op_imm, sljit_u8 op_eax_imm,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_ub* inst;
+       sljit_u8* inst;
 
        if (dst == SLJIT_UNUSED) {
                EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
@@ -1570,13 +1593,13 @@ static sljit_si emit_cum_binary(struct sljit_compiler *compiler,
        return SLJIT_SUCCESS;
 }
 
-static sljit_si emit_non_cum_binary(struct sljit_compiler *compiler,
-       sljit_ub op_rm, sljit_ub op_mr, sljit_ub op_imm, sljit_ub op_eax_imm,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static sljit_s32 emit_non_cum_binary(struct sljit_compiler *compiler,
+       sljit_u8 op_rm, sljit_u8 op_mr, sljit_u8 op_imm, sljit_u8 op_eax_imm,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_ub* inst;
+       sljit_u8* inst;
 
        if (dst == SLJIT_UNUSED) {
                EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
@@ -1652,13 +1675,13 @@ static sljit_si emit_non_cum_binary(struct sljit_compiler *compiler,
        return SLJIT_SUCCESS;
 }
 
-static sljit_si emit_mul(struct sljit_compiler *compiler,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static sljit_s32 emit_mul(struct sljit_compiler *compiler,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_ub* inst;
-       sljit_si dst_r;
+       sljit_u8* inst;
+       sljit_s32 dst_r;
 
        dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;
 
@@ -1686,30 +1709,30 @@ static sljit_si emit_mul(struct sljit_compiler *compiler,
                        inst = emit_x86_instruction(compiler, 1, dst_r, 0, src2, src2w);
                        FAIL_IF(!inst);
                        *inst = IMUL_r_rm_i8;
-                       inst = (sljit_ub*)ensure_buf(compiler, 1 + 1);
+                       inst = (sljit_u8*)ensure_buf(compiler, 1 + 1);
                        FAIL_IF(!inst);
                        INC_SIZE(1);
-                       *inst = (sljit_sb)src1w;
+                       *inst = (sljit_s8)src1w;
                }
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
                else {
                        inst = emit_x86_instruction(compiler, 1, dst_r, 0, src2, src2w);
                        FAIL_IF(!inst);
                        *inst = IMUL_r_rm_i32;
-                       inst = (sljit_ub*)ensure_buf(compiler, 1 + 4);
+                       inst = (sljit_u8*)ensure_buf(compiler, 1 + 4);
                        FAIL_IF(!inst);
                        INC_SIZE(4);
-                       *(sljit_sw*)inst = src1w;
+                       sljit_unaligned_store_sw(inst, src1w);
                }
 #else
                else if (IS_HALFWORD(src1w)) {
                        inst = emit_x86_instruction(compiler, 1, dst_r, 0, src2, src2w);
                        FAIL_IF(!inst);
                        *inst = IMUL_r_rm_i32;
-                       inst = (sljit_ub*)ensure_buf(compiler, 1 + 4);
+                       inst = (sljit_u8*)ensure_buf(compiler, 1 + 4);
                        FAIL_IF(!inst);
                        INC_SIZE(4);
-                       *(sljit_si*)inst = (sljit_si)src1w;
+                       sljit_unaligned_store_s32(inst, (sljit_s32)src1w);
                }
                else {
                        EMIT_MOV(compiler, TMP_REG2, 0, SLJIT_IMM, src1w);
@@ -1729,30 +1752,30 @@ static sljit_si emit_mul(struct sljit_compiler *compiler,
                        inst = emit_x86_instruction(compiler, 1, dst_r, 0, src1, src1w);
                        FAIL_IF(!inst);
                        *inst = IMUL_r_rm_i8;
-                       inst = (sljit_ub*)ensure_buf(compiler, 1 + 1);
+                       inst = (sljit_u8*)ensure_buf(compiler, 1 + 1);
                        FAIL_IF(!inst);
                        INC_SIZE(1);
-                       *inst = (sljit_sb)src2w;
+                       *inst = (sljit_s8)src2w;
                }
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
                else {
                        inst = emit_x86_instruction(compiler, 1, dst_r, 0, src1, src1w);
                        FAIL_IF(!inst);
                        *inst = IMUL_r_rm_i32;
-                       inst = (sljit_ub*)ensure_buf(compiler, 1 + 4);
+                       inst = (sljit_u8*)ensure_buf(compiler, 1 + 4);
                        FAIL_IF(!inst);
                        INC_SIZE(4);
-                       *(sljit_sw*)inst = src2w;
+                       sljit_unaligned_store_sw(inst, src2w);
                }
 #else
                else if (IS_HALFWORD(src2w)) {
                        inst = emit_x86_instruction(compiler, 1, dst_r, 0, src1, src1w);
                        FAIL_IF(!inst);
                        *inst = IMUL_r_rm_i32;
-                       inst = (sljit_ub*)ensure_buf(compiler, 1 + 4);
+                       inst = (sljit_u8*)ensure_buf(compiler, 1 + 4);
                        FAIL_IF(!inst);
                        INC_SIZE(4);
-                       *(sljit_si*)inst = (sljit_si)src2w;
+                       sljit_unaligned_store_s32(inst, (sljit_s32)src2w);
                }
                else {
                        EMIT_MOV(compiler, TMP_REG2, 0, SLJIT_IMM, src2w);
@@ -1782,13 +1805,13 @@ static sljit_si emit_mul(struct sljit_compiler *compiler,
        return SLJIT_SUCCESS;
 }
 
-static sljit_si emit_lea_binary(struct sljit_compiler *compiler, sljit_si keep_flags,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static sljit_s32 emit_lea_binary(struct sljit_compiler *compiler, sljit_s32 keep_flags,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_ub* inst;
-       sljit_si dst_r, done = 0;
+       sljit_u8* inst;
+       sljit_s32 dst_r, done = 0;
 
        /* These cases better be left to handled by normal way. */
        if (!keep_flags) {
@@ -1809,7 +1832,7 @@ static sljit_si emit_lea_binary(struct sljit_compiler *compiler, sljit_si keep_f
                }
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
                if ((src2 & SLJIT_IMM) && (compiler->mode32 || IS_HALFWORD(src2w))) {
-                       inst = emit_x86_instruction(compiler, 1, dst_r, 0, SLJIT_MEM1(src1), (sljit_si)src2w);
+                       inst = emit_x86_instruction(compiler, 1, dst_r, 0, SLJIT_MEM1(src1), (sljit_s32)src2w);
 #else
                if (src2 & SLJIT_IMM) {
                        inst = emit_x86_instruction(compiler, 1, dst_r, 0, SLJIT_MEM1(src1), src2w);
@@ -1822,7 +1845,7 @@ static sljit_si emit_lea_binary(struct sljit_compiler *compiler, sljit_si keep_f
        else if (FAST_IS_REG(src2)) {
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
                if ((src1 & SLJIT_IMM) && (compiler->mode32 || IS_HALFWORD(src1w))) {
-                       inst = emit_x86_instruction(compiler, 1, dst_r, 0, SLJIT_MEM1(src2), (sljit_si)src1w);
+                       inst = emit_x86_instruction(compiler, 1, dst_r, 0, SLJIT_MEM1(src2), (sljit_s32)src1w);
 #else
                if (src1 & SLJIT_IMM) {
                        inst = emit_x86_instruction(compiler, 1, dst_r, 0, SLJIT_MEM1(src2), src1w);
@@ -1841,11 +1864,11 @@ static sljit_si emit_lea_binary(struct sljit_compiler *compiler, sljit_si keep_f
        return SLJIT_ERR_UNSUPPORTED;
 }
 
-static sljit_si emit_cmp_binary(struct sljit_compiler *compiler,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static sljit_s32 emit_cmp_binary(struct sljit_compiler *compiler,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_ub* inst;
+       sljit_u8* inst;
 
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
        if (src1 == SLJIT_R0 && (src2 & SLJIT_IMM) && (src2w > 127 || src2w < -128) && (compiler->mode32 || IS_HALFWORD(src2w))) {
@@ -1892,11 +1915,11 @@ static sljit_si emit_cmp_binary(struct sljit_compiler *compiler,
        return SLJIT_SUCCESS;
 }
 
-static sljit_si emit_test_binary(struct sljit_compiler *compiler,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static sljit_s32 emit_test_binary(struct sljit_compiler *compiler,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_ub* inst;
+       sljit_u8* inst;
 
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
        if (src1 == SLJIT_R0 && (src2 & SLJIT_IMM) && (src2w > 127 || src2w < -128) && (compiler->mode32 || IS_HALFWORD(src2w))) {
@@ -2002,13 +2025,13 @@ static sljit_si emit_test_binary(struct sljit_compiler *compiler,
        return SLJIT_SUCCESS;
 }
 
-static sljit_si emit_shift(struct sljit_compiler *compiler,
-       sljit_ub mode,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static sljit_s32 emit_shift(struct sljit_compiler *compiler,
+       sljit_u8 mode,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_ub* inst;
+       sljit_u8* inst;
 
        if ((src2 & SLJIT_IMM) || (src2 == SLJIT_PREF_SHIFT_REG)) {
                if (dst == src1 && dstw == src1w) {
@@ -2091,11 +2114,11 @@ static sljit_si emit_shift(struct sljit_compiler *compiler,
        return SLJIT_SUCCESS;
 }
 
-static sljit_si emit_shift_with_flags(struct sljit_compiler *compiler,
-       sljit_ub mode, sljit_si set_flags,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static sljit_s32 emit_shift_with_flags(struct sljit_compiler *compiler,
+       sljit_u8 mode, sljit_s32 set_flags,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        /* The CPU does not set flags if the shift count is 0. */
        if (src2 & SLJIT_IMM) {
@@ -2126,10 +2149,10 @@ static sljit_si emit_shift_with_flags(struct sljit_compiler *compiler,
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        CHECK_ERROR();
        CHECK(check_sljit_emit_op2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
@@ -2141,7 +2164,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
        CHECK_EXTRA_REGS(src1, src1w, (void)0);
        CHECK_EXTRA_REGS(src2, src2w, (void)0);
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-       compiler->mode32 = op & SLJIT_INT_OP;
+       compiler->mode32 = op & SLJIT_I32_OP;
 #endif
 
        if (GET_OPCODE(op) >= SLJIT_MUL) {
@@ -2221,7 +2244,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
 {
        CHECK_REG_INDEX(check_sljit_get_register_index(reg));
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
@@ -2231,24 +2254,24 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg)
        return reg_map[reg];
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_float_register_index(sljit_si reg)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_float_register_index(sljit_s32 reg)
 {
        CHECK_REG_INDEX(check_sljit_get_float_register_index(reg));
        return reg;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *compiler,
-       void *instruction, sljit_si size)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
+       void *instruction, sljit_s32 size)
 {
-       sljit_ub *inst;
+       sljit_u8 *inst;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_op_custom(compiler, instruction, size));
 
-       inst = (sljit_ub*)ensure_buf(compiler, 1 + size);
+       inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
        FAIL_IF(!inst);
        INC_SIZE(size);
-       SLJIT_MEMMOVE(inst, instruction, size);
+       SLJIT_MEMCPY(inst, instruction, size);
        return SLJIT_SUCCESS;
 }
 
@@ -2257,12 +2280,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *co
 /* --------------------------------------------------------------------- */
 
 /* Alignment + 2 * 16 bytes. */
-static sljit_si sse2_data[3 + (4 + 4) * 2];
-static sljit_si *sse2_buffer;
+static sljit_s32 sse2_data[3 + (4 + 4) * 2];
+static sljit_s32 *sse2_buffer;
 
 static void init_compiler(void)
 {
-       sse2_buffer = (sljit_si*)(((sljit_uw)sse2_data + 15) & ~0xf);
+       sse2_buffer = (sljit_s32*)(((sljit_uw)sse2_data + 15) & ~0xf);
        /* Single precision constants. */
        sse2_buffer[0] = 0x80000000;
        sse2_buffer[4] = 0x7fffffff;
@@ -2273,7 +2296,7 @@ static void init_compiler(void)
        sse2_buffer[13] = 0x7fffffff;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
 {
 #ifdef SLJIT_IS_FPU_AVAILABLE
        return SLJIT_IS_FPU_AVAILABLE;
@@ -2286,10 +2309,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
 #endif /* SLJIT_DETECT_SSE2 */
 }
 
-static sljit_si emit_sse2(struct sljit_compiler *compiler, sljit_ub opcode,
-       sljit_si single, sljit_si xmm1, sljit_si xmm2, sljit_sw xmm2w)
+static sljit_s32 emit_sse2(struct sljit_compiler *compiler, sljit_u8 opcode,
+       sljit_s32 single, sljit_s32 xmm1, sljit_s32 xmm2, sljit_sw xmm2w)
 {
-       sljit_ub *inst;
+       sljit_u8 *inst;
 
        inst = emit_x86_instruction(compiler, 2 | (single ? EX86_PREF_F3 : EX86_PREF_F2) | EX86_SSE2, xmm1, 0, xmm2, xmm2w);
        FAIL_IF(!inst);
@@ -2298,10 +2321,10 @@ static sljit_si emit_sse2(struct sljit_compiler *compiler, sljit_ub opcode,
        return SLJIT_SUCCESS;
 }
 
-static sljit_si emit_sse2_logic(struct sljit_compiler *compiler, sljit_ub opcode,
-       sljit_si pref66, sljit_si xmm1, sljit_si xmm2, sljit_sw xmm2w)
+static sljit_s32 emit_sse2_logic(struct sljit_compiler *compiler, sljit_u8 opcode,
+       sljit_s32 pref66, sljit_s32 xmm1, sljit_s32 xmm2, sljit_sw xmm2w)
 {
-       sljit_ub *inst;
+       sljit_u8 *inst;
 
        inst = emit_x86_instruction(compiler, 2 | (pref66 ? EX86_PREF_66 : 0) | EX86_SSE2, xmm1, 0, xmm2, xmm2w);
        FAIL_IF(!inst);
@@ -2310,31 +2333,31 @@ static sljit_si emit_sse2_logic(struct sljit_compiler *compiler, sljit_ub opcode
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si emit_sse2_load(struct sljit_compiler *compiler,
-       sljit_si single, sljit_si dst, sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE sljit_s32 emit_sse2_load(struct sljit_compiler *compiler,
+       sljit_s32 single, sljit_s32 dst, sljit_s32 src, sljit_sw srcw)
 {
        return emit_sse2(compiler, MOVSD_x_xm, single, dst, src, srcw);
 }
 
-static SLJIT_INLINE sljit_si emit_sse2_store(struct sljit_compiler *compiler,
-       sljit_si single, sljit_si dst, sljit_sw dstw, sljit_si src)
+static SLJIT_INLINE sljit_s32 emit_sse2_store(struct sljit_compiler *compiler,
+       sljit_s32 single, sljit_s32 dst, sljit_sw dstw, sljit_s32 src)
 {
        return emit_sse2(compiler, MOVSD_xm_x, single, src, dst, dstw);
 }
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_convw_fromd(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG1;
-       sljit_ub *inst;
+       sljit_s32 dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG1;
+       sljit_u8 *inst;
 
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-       if (GET_OPCODE(op) == SLJIT_CONVW_FROMD)
+       if (GET_OPCODE(op) == SLJIT_CONV_SW_FROM_F64)
                compiler->mode32 = 0;
 #endif
 
-       inst = emit_x86_instruction(compiler, 2 | ((op & SLJIT_SINGLE_OP) ? EX86_PREF_F3 : EX86_PREF_F2) | EX86_SSE2_OP2, dst_r, 0, src, srcw);
+       inst = emit_x86_instruction(compiler, 2 | ((op & SLJIT_F32_OP) ? EX86_PREF_F3 : EX86_PREF_F2) | EX86_SSE2_OP2, dst_r, 0, src, srcw);
        FAIL_IF(!inst);
        *inst++ = GROUP_0F;
        *inst = CVTTSD2SI_r_xm;
@@ -2344,29 +2367,29 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_convw_fromd(struct sljit_compiler *
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_convd_fromw(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG;
-       sljit_ub *inst;
+       sljit_s32 dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG;
+       sljit_u8 *inst;
 
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-       if (GET_OPCODE(op) == SLJIT_CONVD_FROMW)
+       if (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_SW)
                compiler->mode32 = 0;
 #endif
 
        if (src & SLJIT_IMM) {
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-               if (GET_OPCODE(op) == SLJIT_CONVD_FROMI)
-                       srcw = (sljit_si)srcw;
+               if (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_S32)
+                       srcw = (sljit_s32)srcw;
 #endif
                EMIT_MOV(compiler, TMP_REG1, 0, src, srcw);
                src = TMP_REG1;
                srcw = 0;
        }
 
-       inst = emit_x86_instruction(compiler, 2 | ((op & SLJIT_SINGLE_OP) ? EX86_PREF_F3 : EX86_PREF_F2) | EX86_SSE2_OP1, dst_r, 0, src, srcw);
+       inst = emit_x86_instruction(compiler, 2 | ((op & SLJIT_F32_OP) ? EX86_PREF_F3 : EX86_PREF_F2) | EX86_SSE2_OP1, dst_r, 0, src, srcw);
        FAIL_IF(!inst);
        *inst++ = GROUP_0F;
        *inst = CVTSI2SD_x_rm;
@@ -2375,27 +2398,27 @@ static SLJIT_INLINE sljit_si sljit_emit_fop1_convd_fromw(struct sljit_compiler *
        compiler->mode32 = 1;
 #endif
        if (dst_r == TMP_FREG)
-               return emit_sse2_store(compiler, op & SLJIT_SINGLE_OP, dst, dstw, TMP_FREG);
+               return emit_sse2_store(compiler, op & SLJIT_F32_OP, dst, dstw, TMP_FREG);
        return SLJIT_SUCCESS;
 }
 
-static SLJIT_INLINE sljit_si sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
        compiler->flags_saved = 0;
        if (!FAST_IS_REG(src1)) {
-               FAIL_IF(emit_sse2_load(compiler, op & SLJIT_SINGLE_OP, TMP_FREG, src1, src1w));
+               FAIL_IF(emit_sse2_load(compiler, op & SLJIT_F32_OP, TMP_FREG, src1, src1w));
                src1 = TMP_FREG;
        }
-       return emit_sse2_logic(compiler, UCOMISD_x_xm, !(op & SLJIT_SINGLE_OP), src1, src2, src2w);
+       return emit_sse2_logic(compiler, UCOMISD_x_xm, !(op & SLJIT_F32_OP), src1, src2, src2w);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_si dst_r;
+       sljit_s32 dst_r;
 
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
        compiler->mode32 = 1;
@@ -2404,65 +2427,65 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compile
        CHECK_ERROR();
        SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw);
 
-       if (GET_OPCODE(op) == SLJIT_DMOV) {
+       if (GET_OPCODE(op) == SLJIT_MOV_F64) {
                if (FAST_IS_REG(dst))
-                       return emit_sse2_load(compiler, op & SLJIT_SINGLE_OP, dst, src, srcw);
+                       return emit_sse2_load(compiler, op & SLJIT_F32_OP, dst, src, srcw);
                if (FAST_IS_REG(src))
-                       return emit_sse2_store(compiler, op & SLJIT_SINGLE_OP, dst, dstw, src);
-               FAIL_IF(emit_sse2_load(compiler, op & SLJIT_SINGLE_OP, TMP_FREG, src, srcw));
-               return emit_sse2_store(compiler, op & SLJIT_SINGLE_OP, dst, dstw, TMP_FREG);
+                       return emit_sse2_store(compiler, op & SLJIT_F32_OP, dst, dstw, src);
+               FAIL_IF(emit_sse2_load(compiler, op & SLJIT_F32_OP, TMP_FREG, src, srcw));
+               return emit_sse2_store(compiler, op & SLJIT_F32_OP, dst, dstw, TMP_FREG);
        }
 
-       if (GET_OPCODE(op) == SLJIT_CONVD_FROMS) {
+       if (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_F32) {
                dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG;
                if (FAST_IS_REG(src)) {
                        /* We overwrite the high bits of source. From SLJIT point of view,
                           this is not an issue.
                           Note: In SSE3, we could also use MOVDDUP and MOVSLDUP. */
-                       FAIL_IF(emit_sse2_logic(compiler, UNPCKLPD_x_xm, op & SLJIT_SINGLE_OP, src, src, 0));
+                       FAIL_IF(emit_sse2_logic(compiler, UNPCKLPD_x_xm, op & SLJIT_F32_OP, src, src, 0));
                }
                else {
-                       FAIL_IF(emit_sse2_load(compiler, !(op & SLJIT_SINGLE_OP), TMP_FREG, src, srcw));
+                       FAIL_IF(emit_sse2_load(compiler, !(op & SLJIT_F32_OP), TMP_FREG, src, srcw));
                        src = TMP_FREG;
                }
 
-               FAIL_IF(emit_sse2_logic(compiler, CVTPD2PS_x_xm, op & SLJIT_SINGLE_OP, dst_r, src, 0));
+               FAIL_IF(emit_sse2_logic(compiler, CVTPD2PS_x_xm, op & SLJIT_F32_OP, dst_r, src, 0));
                if (dst_r == TMP_FREG)
-                       return emit_sse2_store(compiler, op & SLJIT_SINGLE_OP, dst, dstw, TMP_FREG);
+                       return emit_sse2_store(compiler, op & SLJIT_F32_OP, dst, dstw, TMP_FREG);
                return SLJIT_SUCCESS;
        }
 
        if (SLOW_IS_REG(dst)) {
                dst_r = dst;
                if (dst != src)
-                       FAIL_IF(emit_sse2_load(compiler, op & SLJIT_SINGLE_OP, dst_r, src, srcw));
+                       FAIL_IF(emit_sse2_load(compiler, op & SLJIT_F32_OP, dst_r, src, srcw));
        }
        else {
                dst_r = TMP_FREG;
-               FAIL_IF(emit_sse2_load(compiler, op & SLJIT_SINGLE_OP, dst_r, src, srcw));
+               FAIL_IF(emit_sse2_load(compiler, op & SLJIT_F32_OP, dst_r, src, srcw));
        }
 
        switch (GET_OPCODE(op)) {
-       case SLJIT_DNEG:
-               FAIL_IF(emit_sse2_logic(compiler, XORPD_x_xm, 1, dst_r, SLJIT_MEM0(), (sljit_sw)(op & SLJIT_SINGLE_OP ? sse2_buffer : sse2_buffer + 8)));
+       case SLJIT_NEG_F64:
+               FAIL_IF(emit_sse2_logic(compiler, XORPD_x_xm, 1, dst_r, SLJIT_MEM0(), (sljit_sw)(op & SLJIT_F32_OP ? sse2_buffer : sse2_buffer + 8)));
                break;
 
-       case SLJIT_DABS:
-               FAIL_IF(emit_sse2_logic(compiler, ANDPD_x_xm, 1, dst_r, SLJIT_MEM0(), (sljit_sw)(op & SLJIT_SINGLE_OP ? sse2_buffer + 4 : sse2_buffer + 12)));
+       case SLJIT_ABS_F64:
+               FAIL_IF(emit_sse2_logic(compiler, ANDPD_x_xm, 1, dst_r, SLJIT_MEM0(), (sljit_sw)(op & SLJIT_F32_OP ? sse2_buffer + 4 : sse2_buffer + 12)));
                break;
        }
 
        if (dst_r == TMP_FREG)
-               return emit_sse2_store(compiler, op & SLJIT_SINGLE_OP, dst, dstw, TMP_FREG);
+               return emit_sse2_store(compiler, op & SLJIT_F32_OP, dst, dstw, TMP_FREG);
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src1, sljit_sw src1w,
-       sljit_si src2, sljit_sw src2w)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src1, sljit_sw src1w,
+       sljit_s32 src2, sljit_sw src2w)
 {
-       sljit_si dst_r;
+       sljit_s32 dst_r;
 
        CHECK_ERROR();
        CHECK(check_sljit_emit_fop2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
@@ -2478,43 +2501,43 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compile
                dst_r = dst;
                if (dst == src1)
                        ; /* Do nothing here. */
-               else if (dst == src2 && (op == SLJIT_DADD || op == SLJIT_DMUL)) {
+               else if (dst == src2 && (op == SLJIT_ADD_F64 || op == SLJIT_MUL_F64)) {
                        /* Swap arguments. */
                        src2 = src1;
                        src2w = src1w;
                }
                else if (dst != src2)
-                       FAIL_IF(emit_sse2_load(compiler, op & SLJIT_SINGLE_OP, dst_r, src1, src1w));
+                       FAIL_IF(emit_sse2_load(compiler, op & SLJIT_F32_OP, dst_r, src1, src1w));
                else {
                        dst_r = TMP_FREG;
-                       FAIL_IF(emit_sse2_load(compiler, op & SLJIT_SINGLE_OP, TMP_FREG, src1, src1w));
+                       FAIL_IF(emit_sse2_load(compiler, op & SLJIT_F32_OP, TMP_FREG, src1, src1w));
                }
        }
        else {
                dst_r = TMP_FREG;
-               FAIL_IF(emit_sse2_load(compiler, op & SLJIT_SINGLE_OP, TMP_FREG, src1, src1w));
+               FAIL_IF(emit_sse2_load(compiler, op & SLJIT_F32_OP, TMP_FREG, src1, src1w));
        }
 
        switch (GET_OPCODE(op)) {
-       case SLJIT_DADD:
-               FAIL_IF(emit_sse2(compiler, ADDSD_x_xm, op & SLJIT_SINGLE_OP, dst_r, src2, src2w));
+       case SLJIT_ADD_F64:
+               FAIL_IF(emit_sse2(compiler, ADDSD_x_xm, op & SLJIT_F32_OP, dst_r, src2, src2w));
                break;
 
-       case SLJIT_DSUB:
-               FAIL_IF(emit_sse2(compiler, SUBSD_x_xm, op & SLJIT_SINGLE_OP, dst_r, src2, src2w));
+       case SLJIT_SUB_F64:
+               FAIL_IF(emit_sse2(compiler, SUBSD_x_xm, op & SLJIT_F32_OP, dst_r, src2, src2w));
                break;
 
-       case SLJIT_DMUL:
-               FAIL_IF(emit_sse2(compiler, MULSD_x_xm, op & SLJIT_SINGLE_OP, dst_r, src2, src2w));
+       case SLJIT_MUL_F64:
+               FAIL_IF(emit_sse2(compiler, MULSD_x_xm, op & SLJIT_F32_OP, dst_r, src2, src2w));
                break;
 
-       case SLJIT_DDIV:
-               FAIL_IF(emit_sse2(compiler, DIVSD_x_xm, op & SLJIT_SINGLE_OP, dst_r, src2, src2w));
+       case SLJIT_DIV_F64:
+               FAIL_IF(emit_sse2(compiler, DIVSD_x_xm, op & SLJIT_F32_OP, dst_r, src2, src2w));
                break;
        }
 
        if (dst_r == TMP_FREG)
-               return emit_sse2_store(compiler, op & SLJIT_SINGLE_OP, dst, dstw, TMP_FREG);
+               return emit_sse2_store(compiler, op & SLJIT_F32_OP, dst, dstw, TMP_FREG);
        return SLJIT_SUCCESS;
 }
 
@@ -2524,7 +2547,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compile
 
 SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compiler *compiler)
 {
-       sljit_ub *inst;
+       sljit_u8 *inst;
        struct sljit_label *label;
 
        CHECK_ERROR_PTR();
@@ -2542,7 +2565,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compi
        PTR_FAIL_IF(!label);
        set_label(label, compiler);
 
-       inst = (sljit_ub*)ensure_buf(compiler, 2);
+       inst = (sljit_u8*)ensure_buf(compiler, 2);
        PTR_FAIL_IF(!inst);
 
        *inst++ = 0;
@@ -2551,9 +2574,9 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compi
        return label;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_si type)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_s32 type)
 {
-       sljit_ub *inst;
+       sljit_u8 *inst;
        struct sljit_jump *jump;
 
        CHECK_ERROR_PTR();
@@ -2580,7 +2603,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
        compiler->size += (type >= SLJIT_JUMP) ? (10 + 3) : (2 + 10 + 3);
 #endif
 
-       inst = (sljit_ub*)ensure_buf(compiler, 2);
+       inst = (sljit_u8*)ensure_buf(compiler, 2);
        PTR_FAIL_IF_NULL(inst);
 
        *inst++ = 0;
@@ -2588,9 +2611,9 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
        return jump;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compiler, sljit_si type, sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
 {
-       sljit_ub *inst;
+       sljit_u8 *inst;
        struct sljit_jump *jump;
 
        CHECK_ERROR();
@@ -2638,7 +2661,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compil
                compiler->size += 10 + 3;
 #endif
 
-               inst = (sljit_ub*)ensure_buf(compiler, 2);
+               inst = (sljit_u8*)ensure_buf(compiler, 2);
                FAIL_IF_NULL(inst);
 
                *inst++ = 0;
@@ -2657,18 +2680,18 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compil
        return SLJIT_SUCCESS;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_si op,
-       sljit_si dst, sljit_sw dstw,
-       sljit_si src, sljit_sw srcw,
-       sljit_si type)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
+       sljit_s32 dst, sljit_sw dstw,
+       sljit_s32 src, sljit_sw srcw,
+       sljit_s32 type)
 {
-       sljit_ub *inst;
-       sljit_ub cond_set = 0;
+       sljit_u8 *inst;
+       sljit_u8 cond_set = 0;
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-       sljit_si reg;
+       sljit_s32 reg;
 #else
        /* CHECK_EXTRA_REGS migh overwrite these values. */
-       sljit_si dst_save = dst;
+       sljit_s32 dst_save = dst;
        sljit_sw dstw_save = dstw;
 #endif
 
@@ -2690,7 +2713,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
 
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
        if (GET_OPCODE(op) == SLJIT_OR && !GET_ALL_FLAGS(op) && FAST_IS_REG(dst) && dst == src) {
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 4 + 3);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 4 + 3);
                FAIL_IF(!inst);
                INC_SIZE(4 + 3);
                /* Set low register to conditional flag. */
@@ -2706,7 +2729,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
 
        reg = (op == SLJIT_MOV && FAST_IS_REG(dst)) ? dst : TMP_REG1;
 
-       inst = (sljit_ub*)ensure_buf(compiler, 1 + 4 + 4);
+       inst = (sljit_u8*)ensure_buf(compiler, 1 + 4 + 4);
        FAIL_IF(!inst);
        INC_SIZE(4 + 4);
        /* Set low register to conditional flag. */
@@ -2735,7 +2758,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
        if (GET_OPCODE(op) < SLJIT_ADD && FAST_IS_REG(dst)) {
                if (reg_map[dst] <= 4) {
                        /* Low byte is accessible. */
-                       inst = (sljit_ub*)ensure_buf(compiler, 1 + 3 + 3);
+                       inst = (sljit_u8*)ensure_buf(compiler, 1 + 3 + 3);
                        FAIL_IF(!inst);
                        INC_SIZE(3 + 3);
                        /* Set low byte to conditional flag. */
@@ -2758,7 +2781,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
                        /* a xor reg, reg operation would overwrite the flags. */
                        EMIT_MOV(compiler, dst, 0, SLJIT_IMM, 0);
 
-                       inst = (sljit_ub*)ensure_buf(compiler, 1 + 3);
+                       inst = (sljit_u8*)ensure_buf(compiler, 1 + 3);
                        FAIL_IF(!inst);
                        INC_SIZE(3);
 
@@ -2769,7 +2792,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
                        return SLJIT_SUCCESS;
                }
 
-               inst = (sljit_ub*)ensure_buf(compiler, 1 + 1 + 3 + 3 + 1);
+               inst = (sljit_u8*)ensure_buf(compiler, 1 + 1 + 3 + 3 + 1);
                FAIL_IF(!inst);
                INC_SIZE(1 + 3 + 3 + 1);
                *inst++ = XCHG_EAX_r + reg_map[TMP_REG1];
@@ -2788,7 +2811,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
        if (GET_OPCODE(op) == SLJIT_OR && !GET_ALL_FLAGS(op) && FAST_IS_REG(dst) && dst == src && reg_map[dst] <= 4) {
                SLJIT_COMPILE_ASSERT(reg_map[SLJIT_R0] == 0, scratch_reg1_must_be_eax);
                if (dst != SLJIT_R0) {
-                       inst = (sljit_ub*)ensure_buf(compiler, 1 + 1 + 3 + 2 + 1);
+                       inst = (sljit_u8*)ensure_buf(compiler, 1 + 1 + 3 + 2 + 1);
                        FAIL_IF(!inst);
                        INC_SIZE(1 + 3 + 2 + 1);
                        /* Set low register to conditional flag. */
@@ -2801,7 +2824,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
                        *inst++ = XCHG_EAX_r + reg_map[TMP_REG1];
                }
                else {
-                       inst = (sljit_ub*)ensure_buf(compiler, 1 + 2 + 3 + 2 + 2);
+                       inst = (sljit_u8*)ensure_buf(compiler, 1 + 2 + 3 + 2 + 2);
                        FAIL_IF(!inst);
                        INC_SIZE(2 + 3 + 2 + 2);
                        /* Set low register to conditional flag. */
@@ -2819,7 +2842,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
        }
 
        /* Set TMP_REG1 to the bit. */
-       inst = (sljit_ub*)ensure_buf(compiler, 1 + 1 + 3 + 3 + 1);
+       inst = (sljit_u8*)ensure_buf(compiler, 1 + 1 + 3 + 3 + 1);
        FAIL_IF(!inst);
        INC_SIZE(1 + 3 + 3 + 1);
        *inst++ = XCHG_EAX_r + reg_map[TMP_REG1];
@@ -2845,7 +2868,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
 #endif /* SLJIT_CONFIG_X86_64 */
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_local_base(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw offset)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset)
 {
        CHECK_ERROR();
        CHECK(check_sljit_get_local_base(compiler, dst, dstw, offset));
@@ -2876,12 +2899,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_local_base(struct sljit_compiler *co
        return emit_mov(compiler, dst, dstw, SLJIT_SP, 0);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw init_value)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
 {
-       sljit_ub *inst;
+       sljit_u8 *inst;
        struct sljit_const *const_;
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-       sljit_si reg;
+       sljit_s32 reg;
 #endif
 
        CHECK_ERROR_PTR();
@@ -2908,7 +2931,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
                return NULL;
 #endif
 
-       inst = (sljit_ub*)ensure_buf(compiler, 2);
+       inst = (sljit_u8*)ensure_buf(compiler, 2);
        PTR_FAIL_IF(!inst);
 
        *inst++ = 0;
@@ -2926,18 +2949,18 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_addr)
 {
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-       *(sljit_sw*)addr = new_addr - (addr + 4);
+       sljit_unaligned_store_sw((void*)addr, new_addr - (addr + 4));
 #else
-       *(sljit_uw*)addr = new_addr;
+       sljit_unaligned_store_sw((void*)addr, (sljit_sw) new_addr);
 #endif
 }
 
 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_constant)
 {
-       *(sljit_sw*)addr = new_constant;
+       sljit_unaligned_store_sw((void*)addr, new_constant);
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_x86_is_sse2_available(void)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_x86_is_sse2_available(void)
 {
 #if (defined SLJIT_DETECT_SSE2 && SLJIT_DETECT_SSE2)
        if (cpu_has_sse2 == -1)
@@ -2948,34 +2971,34 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_x86_is_sse2_available(void)
 #endif
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_x86_is_cmov_available(void)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_x86_is_cmov_available(void)
 {
        if (cpu_has_cmov == -1)
                get_cpu_features();
        return cpu_has_cmov;
 }
 
-SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_x86_emit_cmov(struct sljit_compiler *compiler,
-       sljit_si type,
-       sljit_si dst_reg,
-       sljit_si src, sljit_sw srcw)
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_x86_emit_cmov(struct sljit_compiler *compiler,
+       sljit_s32 type,
+       sljit_s32 dst_reg,
+       sljit_s32 src, sljit_sw srcw)
 {
-       sljit_ub* inst;
+       sljit_u8* inst;
 
        CHECK_ERROR();
 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
        CHECK_ARGUMENT(sljit_x86_is_cmov_available());
-       CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_INT_OP)));
-       CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL && (type & 0xff) <= SLJIT_D_ORDERED);
-       CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(dst_reg & ~SLJIT_INT_OP));
+       CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_I32_OP)));
+       CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL && (type & 0xff) <= SLJIT_ORDERED_F64);
+       CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(dst_reg & ~SLJIT_I32_OP));
        FUNCTION_CHECK_SRC(src, srcw);
 #endif
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
        if (SLJIT_UNLIKELY(!!compiler->verbose)) {
                fprintf(compiler->verbose, "  x86_cmov%s %s%s, ",
-                       !(dst_reg & SLJIT_INT_OP) ? "" : ".i",
-                       JUMP_PREFIX(type), jump_names[type & 0xff]);
-               sljit_verbose_reg(compiler, dst_reg & ~SLJIT_INT_OP);
+                       !(dst_reg & SLJIT_I32_OP) ? "" : ".i",
+                       jump_names[type & 0xff], JUMP_POSTFIX(type));
+               sljit_verbose_reg(compiler, dst_reg & ~SLJIT_I32_OP);
                fprintf(compiler->verbose, ", ");
                sljit_verbose_param(compiler, src, srcw);
                fprintf(compiler->verbose, "\n");
@@ -2986,9 +3009,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_x86_emit_cmov(struct sljit_compiler *com
        CHECK_EXTRA_REGS(src, srcw, (void)0);
 
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-       compiler->mode32 = dst_reg & SLJIT_INT_OP;
+       compiler->mode32 = dst_reg & SLJIT_I32_OP;
 #endif
-       dst_reg &= ~SLJIT_INT_OP;
+       dst_reg &= ~SLJIT_I32_OP;
 
        if (SLJIT_UNLIKELY(src & SLJIT_IMM)) {
                EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_IMM, srcw);
index 5294b5f3f9be7c35a8f0ceb19812e9699bd3c6dd..ec5c321194a6f1b25bba2482d3ef894ab5c723dd 100644 (file)
@@ -163,11 +163,11 @@ SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_release_lock(void)
 #include <fcntl.h>
 
 /* Some old systems does not have MAP_ANON. */
-static sljit_si dev_zero = -1;
+static sljit_s32 dev_zero = -1;
 
 #if (defined SLJIT_SINGLE_THREADED && SLJIT_SINGLE_THREADED)
 
-static SLJIT_INLINE sljit_si open_dev_zero(void)
+static SLJIT_INLINE sljit_s32 open_dev_zero(void)
 {
        dev_zero = open("/dev/zero", O_RDWR);
        return dev_zero < 0;
@@ -179,10 +179,13 @@ static SLJIT_INLINE sljit_si open_dev_zero(void)
 
 static pthread_mutex_t dev_zero_mutex = PTHREAD_MUTEX_INITIALIZER;
 
-static SLJIT_INLINE sljit_si open_dev_zero(void)
+static SLJIT_INLINE sljit_s32 open_dev_zero(void)
 {
        pthread_mutex_lock(&dev_zero_mutex);
-       dev_zero = open("/dev/zero", O_RDWR);
+       /* The dev_zero might be initialized by another thread during the waiting. */
+       if (dev_zero < 0) {
+               dev_zero = open("/dev/zero", O_RDWR);
+       }
        pthread_mutex_unlock(&dev_zero_mutex);
        return dev_zero < 0;
 }
index 0f00edd93ca785ee7cd6ceea02f5a301545dcb67..b01643dbc1615e918bf26f1fa7bcc01555cd8b21 100644 (file)
@@ -604,6 +604,19 @@ AB.VE the turtle
 
 010203040506
 
+match 1:
+ a
+match 2:
+ b
+match 3:
+ c
+match 4:
+ d
+match 5:
+ e
+Rhubarb
+Custard Tart
+
 PUT NEW DATA ABOVE THIS LINE.
 =============================
 
index 3f6704cb0ca4fc03a975696f8328cc5f0b9ada0a..9d41817cc0ca743f84531efca083c152523b84f1 100644 (file)
@@ -10,7 +10,7 @@ RC=0
 7:PATTERN at the start of a line.
 8:In the middle of a line, PATTERN appears.
 10:This pattern is in lower case.
-610:Check up on PATTERN near the end.
+623:Check up on PATTERN near the end.
 RC=0
 ---------------------------- Test 4 ------------------------------
 4
@@ -19,7 +19,7 @@ RC=0
 ./testdata/grepinput:7:PATTERN at the start of a line.
 ./testdata/grepinput:8:In the middle of a line, PATTERN appears.
 ./testdata/grepinput:10:This pattern is in lower case.
-./testdata/grepinput:610:Check up on PATTERN near the end.
+./testdata/grepinput:623:Check up on PATTERN near the end.
 ./testdata/grepinputx:3:Here is the pattern again.
 ./testdata/grepinputx:5:Pattern
 ./testdata/grepinputx:42:This line contains pattern not on a line by itself.
@@ -28,7 +28,7 @@ RC=0
 7:PATTERN at the start of a line.
 8:In the middle of a line, PATTERN appears.
 10:This pattern is in lower case.
-610:Check up on PATTERN near the end.
+623:Check up on PATTERN near the end.
 3:Here is the pattern again.
 5:Pattern
 42:This line contains pattern not on a line by itself.
@@ -324,10 +324,10 @@ RC=0
 ./testdata/grepinput-9-
 ./testdata/grepinput:10:This pattern is in lower case.
 --
-./testdata/grepinput-607-PUT NEW DATA ABOVE THIS LINE.
-./testdata/grepinput-608-=============================
-./testdata/grepinput-609-
-./testdata/grepinput:610:Check up on PATTERN near the end.
+./testdata/grepinput-620-PUT NEW DATA ABOVE THIS LINE.
+./testdata/grepinput-621-=============================
+./testdata/grepinput-622-
+./testdata/grepinput:623:Check up on PATTERN near the end.
 --
 ./testdata/grepinputx-1-This is a second file of input for the pcregrep tests.
 ./testdata/grepinputx-2-
@@ -349,8 +349,8 @@ RC=0
 ./testdata/grepinput-12-Here follows a whole lot of stuff that makes the file over 24K long.
 ./testdata/grepinput-13-
 --
-./testdata/grepinput:610:Check up on PATTERN near the end.
-./testdata/grepinput-611-This is the last line of this file.
+./testdata/grepinput:623:Check up on PATTERN near the end.
+./testdata/grepinput-624-This is the last line of this file.
 --
 ./testdata/grepinputx:3:Here is the pattern again.
 ./testdata/grepinputx-4-
@@ -637,7 +637,8 @@ RC=0
 RC=0
 ---------------------------- Test 83 -----------------------------
 pcre2grep: line 4 of file ./testdata/grepinput3 is too long for the internal buffer
-pcre2grep: check the --buffer-size option
+pcre2grep: the buffer size is 100
+pcre2grep: use the --buffer-size option to change it
 RC=2
 ---------------------------- Test 84 -----------------------------
 testdata/grepinputv:fox jumps
@@ -755,3 +756,34 @@ RC=0
 RC=0
 ---------------------------- Test 109 -----------------------------
 RC=0
+---------------------------- Test 110 -----------------------------
+match 1:
+ a
+/1/a
+match 2:
+ b
+/2/b
+match 3:
+ c
+/3/c
+match 4:
+ d
+/4/d
+match 5:
+ e
+/5/e
+RC=0
+---------------------------- Test 111 -----------------------------
+607:0,12
+609:0,12
+611:0,12
+613:0,12
+615:0,12
+RC=0
+---------------------------- Test 112 -----------------------------
+37168,12
+37180,12
+37192,12
+37204,12
+37216,12
+RC=0
diff --git a/testdata/grepoutputC b/testdata/grepoutputC
new file mode 100644 (file)
index 0000000..0116645
--- /dev/null
@@ -0,0 +1,8 @@
+Arg1: [T] [he ] [ ] Arg2: |T| () () (0)
+Arg1: [T] [his] [s] Arg2: |T| () () (0)
+The quick brown
+This time it jumps and jumps and jumps.
+Arg1: [qu] [qu]
+Arg1: [ t] [ t]
+The quick brown
+This time it jumps and jumps and jumps.
index 1474eb9a6ba497acd3ce9f0f6152f981d8a0da06..76925fe0658bb7179d266b05f13a2ee6fe4abba9 100644 (file)
 #pop jit,jitverify
     abcdef
     
+/abcd/pushcopy,jitverify
+    abcd
+    
+#pop jitverify
+    abcd
+    
 # Test pattern compilation
 
 /(?:a|b|c|d|e)(?R)/jit=1
 
 /(.|.)*?bx/
     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabax
+    
+# Test JIT disable 
+
+/abc/
+    abc
+    abc\=no_jit 
+    
+/abc/jitfast
+    abc
+    abc\=no_jit 
+    
+# ---- 
+
+/[aC]/mg,firstline,newline=lf
+match\nmatch
+
+/[aCz]/mg,firstline,newline=lf
+match\nmatch
 
 # End of testinput17
index c75b84247b0fe4c4cce386da6c242175b1eeb911..e31b96e6d645c1311ac48b5a96d08945c7ad33f8 100644 (file)
     ab=cd
     ab\ncd
 
-/a(b)c/no_auto_capture
+/a(b)c/posix_nosub
     abc
 
-/a(?P<name>b)c/no_auto_capture
+/a(?P<name>b)c/posix_nosub
     abc
 
+/(a)\1/posix_nosub
+    zaay
+
 /a?|b?/
     abc
 \= Expect no match
@@ -92,6 +95,8 @@
 
 "(?(?C)"
 
+"(?(?C))"
+
 /abcd/substitute_extended
 
 /\[A]{1000000}**/expand,regerror_buffsize=31
index 071cca133d433819a166e222786f519610ed6cff..9d0759fbc30d7c115000163ceb65e5a95b4a6a8c 100644 (file)
 
 /(?R-:(?</
 
+/(?R-:(?<)/
+
 /(?(?C{\Q})(?!(?'/
 
 /(?(?C{\Q})(?!(?'abc')))/I
@@ -4792,12 +4794,29 @@ a)"xI
 /(*MARK:A\x00b)/mark,alt_verbnames
     abc
 
-# /(*MARK:A\x00b)/
-/28 2a 4d 41 52 4b 3a 41 00 62 29/mark,hex
+/"(*MARK:A" 00 "b)"/mark,hex
+    abc
+
+/"(*MARK:A" 00 "b)"/mark,hex,alt_verbnames
     abc
 
-# /(*MARK:A\x00b)/
-/28 2a 4d 41 52 4b 3a 41 00 62 29/mark,hex,alt_verbnames
+/efg/hex
+
+/eff/hex
+
+/effg/hex
+
+/(?J)(?'a'))(?'a')/
+
+/(?<=((?C)0))/
+    9010
+\= Expect no match
     abc
 
+/aaa/
+\[abc]{10000000000000000000000000000}
+\[a]{3}
+
+/\[AB]{6000000000000000000000}/expand
+
 # End of testinput2 
index 9ec3174a1e76d4a96d65ce418106acfa2aef33bf..c920e2acfc437bd21f0947a5ea03c5ef3391bef1 100644 (file)
@@ -1,5 +1,5 @@
-# This set of tests exercises the serialization/deserialization functions in
-# the library. It does not use UTF or JIT.
+# This set of tests exercises the serialization/deserialization and code copy
+# functions in the library. It does not use UTF or JIT.
 
 #forbid_utf
 
 
 #pop should give an error
     pqr
+    
+/abcd/pushcopy
+    abcd
+    
+#pop
+    abcd 
+
+#pop should give an error
+
+/abcd/push
+#popcopy
+    abcd
+    
+#pop
+    abcd 
+    
+/abcd/push
+#save testsaved1
+#pop should give an error
+
+#load testsaved1
+#popcopy 
+    abcd
+    
+#pop
+    abcd
+
+#pop should give an error
 
 # End of testinput20
index f684cf423a05dc37057ae782d74f5f86661de0a6..7ada9aaf9b1ad025787fb95250da47b1c13d6da6 100644 (file)
@@ -6,9 +6,11 @@
 /ab\Cde/utf,info
     abXde
 
-# This should produce an error diagnostic (\C in UTF lookbehind)
+# This should produce an error diagnostic (\C in UTF lookbehind) in 8-bit and
+# 16-bit modes, but not in 32-bit mode.
 
 /(?<=ab\Cde)X/utf
+    ab!deXYZ
 
 # Autopossessification tests
 
index c24b40fa3f656a4a05d33a57a5cba723b3f3ca43..de9227e44ec99206aca69875940bc756021b0076 100644 (file)
     aaaXY
 
 # Binary zero in callout string
-#  a  (  ?  C  '  x     z  '  )  b
-/ 61 28 3f 43 27 78 00 7a 27 29 62/hex
+/"a(?C'x" 00 "z')b"/hex
     abcdefgh
 
 /(?(?!)a|b)/
 /abcd/null_context
     abcd\=null_context
 
+/()()a+/no_auto_possess
+    aaa\=dfa,allcaptures
+    a\=dfa,allcaptures
+
 # End of testinput6
index ca3b1b98aa6e4dc9faf19ccba45c95cc3e98c40d..f4bb7095122811fd11a44e7926db6e18eb509c60 100644 (file)
 
 /((?1)(?2)(?3)(?4)(?5)(?6)(?7)(?8)(?9)(?9)(?8)(?7)(?6)(?5)(?4)(?3)(?2)(?1)(?0)){2,}()()()()()()()()()/debug
 
+/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
+
+/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))/-fullbincode
+
 # End of testinput8
index 0def4387b222a2691fceaa97477cd978fa3b63b9..f560f1b77ff917e732fd716adcf2b6b418b79afe 100644 (file)
@@ -392,6 +392,15 @@ JIT compilation was successful
     abcdef
  0: def (JIT)
     
+/abcd/pushcopy,jitverify
+** Applies only to compile when pattern is stacked with 'push': jitverify
+    abcd
+ 0: abcd (JIT)
+    
+#pop jitverify
+    abcd
+ 0: abcd
+    
 # Test pattern compilation
 
 /(?:a|b|c|d|e)(?R)/jit=1
@@ -507,5 +516,29 @@ Failed: error -46: JIT stack limit reached
 /(.|.)*?bx/
     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabax
 Failed: error -47: match limit exceeded
+    
+# Test JIT disable 
+
+/abc/
+    abc
+ 0: abc (JIT)
+    abc\=no_jit 
+ 0: abc
+    
+/abc/jitfast
+    abc
+ 0: abc (JIT)
+    abc\=no_jit 
+ 0: abc (JIT)
+    
+# ---- 
+
+/[aC]/mg,firstline,newline=lf
+match\nmatch
+ 0: a (JIT)
+
+/[aCz]/mg,firstline,newline=lf
+match\nmatch
+ 0: a (JIT)
 
 # End of testinput17
index 0a5ffffd5c0a1cff264f36d78432bffc43cf761a..294b121acf91e4ee98c0fd7d4dee8cf765f0eeb6 100644 (file)
@@ -105,14 +105,18 @@ No match: POSIX code 17: match failed
     ab\ncd
  0: ab\x0acd
 
-/a(b)c/no_auto_capture
+/a(b)c/posix_nosub
     abc
 Matched with REG_NOSUB
 
-/a(?P<name>b)c/no_auto_capture
+/a(?P<name>b)c/posix_nosub
     abc
 Matched with REG_NOSUB
 
+/(a)\1/posix_nosub
+    zaay
+Matched with REG_NOSUB
+
 /a?|b?/
     abc
  0: a
@@ -138,6 +142,9 @@ No match: POSIX code 17: match failed
 Failed: POSIX code 9: bad escape sequence at offset 3     
 
 "(?(?C)"
+Failed: POSIX code 11: unbalanced () at offset 6     
+
+"(?(?C))"
 Failed: POSIX code 3: pattern error at offset 2     
 
 /abcd/substitute_extended
index 7178410cfe8c22aebbfee508f56d9d4715e10e41..01cb193d071b2a8f9380bd850fa1617d2d8bb160 100644 (file)
@@ -545,7 +545,7 @@ Failed: error 127 at offset 13: conditional group contains more than two branche
 Failed: error 127 at offset 12: conditional group contains more than two branches
 
 /(?(1a)/
-Failed: error 126 at offset 4: malformed number or name after (?(
+Failed: error 114 at offset 6: missing closing parenthesis
 
 /(?(1a))/
 Failed: error 126 at offset 4: malformed number or name after (?(
@@ -14401,6 +14401,9 @@ Failed: error 106 at offset 353: missing terminating ] for character class
 ------------------------------------------------------------------
 
 /(?R-:(?</
+Failed: error 114 at offset 8: missing closing parenthesis
+
+/(?R-:(?<)/
 Failed: error 129 at offset 3: (?R or (?[+-]digits must be followed by )
 
 /(?(?C{\Q})(?!(?'/
@@ -14502,7 +14505,7 @@ No match
  0: ab
 
 /(?(8000000000/
-Failed: error 161 at offset 13: number is too big
+Failed: error 114 at offset 13: missing closing parenthesis
 
 /((?(R8000000000)))/
 Failed: error 161 at offset 16: number is too big
@@ -15146,16 +15149,58 @@ MK: A\x00b
  0: 
 MK: A\x00b
 
-# /(*MARK:A\x00b)/
-/28 2a 4d 41 52 4b 3a 41 00 62 29/mark,hex
+/"(*MARK:A" 00 "b)"/mark,hex
     abc
  0: 
 MK: A\x00b
 
-# /(*MARK:A\x00b)/
-/28 2a 4d 41 52 4b 3a 41 00 62 29/mark,hex,alt_verbnames
+/"(*MARK:A" 00 "b)"/mark,hex,alt_verbnames
     abc
  0: 
 MK: A\x00b
 
+/efg/hex
+** Unexpected non-hex-digit 'g' in hex pattern: quote missing?
+
+/eff/hex
+** Odd number of digits in hex pattern
+
+/effg/hex
+** Unexpected non-hex-digit 'g' in hex pattern: quote missing?
+
+/(?J)(?'a'))(?'a')/
+Failed: error 122 at offset 10: unmatched closing parenthesis
+
+/(?<=((?C)0))/
+    9010
+--->9010
+  0  ^       0
+  0   ^      0
+ 0: 
+ 1: 0
+\= Expect no match
+    abc
+--->abc
+  0  ^      0
+  0   ^     0
+  0    ^    0
+No match
+
+/aaa/
+\[abc]{10000000000000000000000000000}
+** Repeat count too large
+\[a]{3}
+ 0: aaa
+
+/\[AB]{6000000000000000000000}/expand
+** Pattern repeat count too large
+
 # End of testinput2 
+Error -63: PCRE2_ERROR_BADDATA (unknown error number)
+Error -62: bad serialized data
+Error -2: partial match
+Error -1: no match
+Error 0: PCRE2_ERROR_BADDATA (unknown error number)
+Error 100: no error
+Error 188: pattern string is longer than the limit set by the application
+Error 189: PCRE2_ERROR_BADDATA (unknown error number)
index e9230800ad0e695b705fdc850777a6ba46b51ddc..952b0bb47b28e412a5fcf8b72d2ac8522a9f3d97 100644 (file)
@@ -1,5 +1,5 @@
-# This set of tests exercises the serialization/deserialization functions in
-# the library. It does not use UTF or JIT.
+# This set of tests exercises the serialization/deserialization and code copy
+# functions in the library. It does not use UTF or JIT.
 
 #forbid_utf
 
@@ -97,5 +97,42 @@ Serialization failed: error -30: patterns do not all use the same character tabl
 #pop should give an error
 ** Can't pop off an empty stack
     pqr
+    
+/abcd/pushcopy
+    abcd
+ 0: abcd
+    
+#pop
+    abcd 
+ 0: abcd
+
+#pop should give an error
+** Can't pop off an empty stack
+
+/abcd/push
+#popcopy
+    abcd
+ 0: abcd
+    
+#pop
+    abcd 
+ 0: abcd
+    
+/abcd/push
+#save testsaved1
+#pop should give an error
+** Can't pop off an empty stack
+
+#load testsaved1
+#popcopy 
+    abcd
+ 0: abcd
+    
+#pop
+    abcd
+ 0: abcd
+
+#pop should give an error
+** Can't pop off an empty stack
 
 # End of testinput20
index ca1fd76f24850969e0f7f3abaf6b3504e4fda2dc..01c9153f79509639f42720519f2bc4ad3c984708 100644 (file)
@@ -13,10 +13,12 @@ Subject length lower bound = 0
     abXde
  0: abXde
 
-# This should produce an error diagnostic (\C in UTF lookbehind)
+# This should produce an error diagnostic (\C in UTF lookbehind) in 8-bit and
+# 16-bit modes, but not in 32-bit mode.
 
 /(?<=ab\Cde)X/utf
-Failed: error 136 at offset 10: \C is not allowed in a lookbehind assertion
+Failed: error 136 at offset 10: \C is not allowed in a lookbehind assertion in UTF-16 mode
+    ab!deXYZ
 
 # Autopossessification tests
 
index 91d0b05d17bbe5de90b81d794b4233cd9a604d39..100333fb21ab525e3298965d20baaa15d0945829 100644 (file)
@@ -9,14 +9,16 @@ Contains \C
 Options: utf
 First code unit = 'a'
 Last code unit = 'e'
-Subject length lower bound = 0
+Subject length lower bound = 5
     abXde
  0: abXde
 
-# This should produce an error diagnostic (\C in UTF lookbehind)
+# This should produce an error diagnostic (\C in UTF lookbehind) in 8-bit and
+# 16-bit modes, but not in 32-bit mode.
 
 /(?<=ab\Cde)X/utf
-Failed: error 136 at offset 10: \C is not allowed in a lookbehind assertion
+    ab!deXYZ
+ 0: X
 
 # Autopossessification tests
 
@@ -34,10 +36,10 @@ Failed: error 136 at offset 10: \C is not allowed in a lookbehind assertion
 /\C+\X \X+\C/Bx,utf
 ------------------------------------------------------------------
         Bra
-        Anybyte+
+        AllAny+
         extuni
         extuni+
-        Anybyte
+        AllAny
         Ket
         End
 ------------------------------------------------------------------
index acb31d655333c46441237f8262ecd848cab206a2..4814039a30f125e095b8a08427c2a879b2310d03 100644 (file)
@@ -13,10 +13,12 @@ Subject length lower bound = 0
     abXde
  0: abXde
 
-# This should produce an error diagnostic (\C in UTF lookbehind)
+# This should produce an error diagnostic (\C in UTF lookbehind) in 8-bit and
+# 16-bit modes, but not in 32-bit mode.
 
 /(?<=ab\Cde)X/utf
-Failed: error 136 at offset 10: \C is not allowed in a lookbehind assertion
+Failed: error 136 at offset 10: \C is not allowed in a lookbehind assertion in UTF-8 mode
+    ab!deXYZ
 
 # Autopossessification tests
 
index 9ae092b35bd3dfcb1a017434308d23880fc3de77..17616c8ef196a9c4d161244af721830cd1af8514 100644 (file)
@@ -7619,8 +7619,7 @@ Callout (8): `code`
  0: aaaX
 
 # Binary zero in callout string
-#  a  (  ?  C  '  x     z  '  )  b
-/ 61 28 3f 43 27 78 00 7a 27 29 62/hex
+/"a(?C'x" 00 "z')b"/hex
     abcdefgh
 Callout (5): 'x\x00z'
 --->abcdefgh
@@ -7673,4 +7672,14 @@ No match
     abcd\=null_context
  0: abcd
 
+/()()a+/no_auto_possess
+    aaa\=dfa,allcaptures
+** Ignored after DFA matching: allcaptures
+ 0: aaa
+ 1: aa
+ 2: a
+    a\=dfa,allcaptures
+** Ignored after DFA matching: allcaptures
+ 0: a
+
 # End of testinput6
index 05669bbeb1cceeb207ffe3bdad88ce1076c92384..39415b71dbdef0f83febf3e4d78a98fccbe8886e 100644 (file)
@@ -1027,4 +1027,10 @@ Capturing subpattern count = 10
 May match empty string
 Subject length lower bound = 0
 
+/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
+Failed: error 114 at offset 509: missing closing parenthesis
+
+/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))/-fullbincode
+Failed: error 186 at offset 490: regular expression is too complicated
+
 # End of testinput8
index 31884e14a68a0cd72caae1b76a2affa81a29554d..61a98eb436a50584eabceb0cf88c2af00a253901 100644 (file)
@@ -1023,4 +1023,9 @@ Capturing subpattern count = 10
 May match empty string
 Subject length lower bound = 0
 
+/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
+Failed: error 114 at offset 509: missing closing parenthesis
+
+/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))/-fullbincode
+
 # End of testinput8
index babd0c70f709912ea0bfdf9a981d32b46a0811aa..49ef506283c15764afa7a45c06d2e4423b296f7b 100644 (file)
@@ -1023,4 +1023,9 @@ Capturing subpattern count = 10
 May match empty string
 Subject length lower bound = 0
 
+/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
+Failed: error 114 at offset 509: missing closing parenthesis
+
+/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))/-fullbincode
+
 # End of testinput8
index babd0c70f709912ea0bfdf9a981d32b46a0811aa..49ef506283c15764afa7a45c06d2e4423b296f7b 100644 (file)
@@ -1023,4 +1023,9 @@ Capturing subpattern count = 10
 May match empty string
 Subject length lower bound = 0
 
+/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
+Failed: error 114 at offset 509: missing closing parenthesis
+
+/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))/-fullbincode
+
 # End of testinput8
index babd0c70f709912ea0bfdf9a981d32b46a0811aa..49ef506283c15764afa7a45c06d2e4423b296f7b 100644 (file)
@@ -1023,4 +1023,9 @@ Capturing subpattern count = 10
 May match empty string
 Subject length lower bound = 0
 
+/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
+Failed: error 114 at offset 509: missing closing parenthesis
+
+/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))/-fullbincode
+
 # End of testinput8
index 6a9aa0a760f0ed8f9b91c732c9e77fe3b315ffa0..0d15a8261c1360f6e8932422f7c6fc7b3381e9e7 100644 (file)
@@ -1026,4 +1026,9 @@ Capturing subpattern count = 10
 May match empty string
 Subject length lower bound = 0
 
+/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
+Failed: error 114 at offset 509: missing closing parenthesis
+
+/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))/-fullbincode
+
 # End of testinput8
index 2fe116822ed1b16db157c94f3b430b05b8610a4e..50d715d2491999dd4fd582ebcfe0acded0bc610b 100644 (file)
@@ -1024,4 +1024,9 @@ Capturing subpattern count = 10
 May match empty string
 Subject length lower bound = 0
 
+/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
+Failed: error 114 at offset 509: missing closing parenthesis
+
+/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))/-fullbincode
+
 # End of testinput8
index 91993b2409607d48dc8de587cc5522fc7570fc11..8ebfad5ba989cc58361fc43d3215f198819ba633 100644 (file)
@@ -1022,4 +1022,9 @@ Capturing subpattern count = 10
 May match empty string
 Subject length lower bound = 0
 
+/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
+Failed: error 114 at offset 509: missing closing parenthesis
+
+/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))/-fullbincode
+
 # End of testinput8
index 73e87d2eed251a674f82cdcf550266b1f184eb0d..f1d2671838b95e78a6b3375a4ce0a9947d2ed14a 100644 (file)
@@ -1,7 +1,15 @@
 {
    name
    Memcheck:Addr16
-   obj:*
-   obj:*
-   obj:*
+   obj:???
+   obj:???
+   obj:???
+}
+
+{
+   name
+   Memcheck:Cond
+   obj:???
+   obj:???
+   obj:???
 }
index 0d8a69016bde923e8b53b4d3e0ea150bc6325733..be856b167f859ab411dcf35944ae3124a94462ae 100644 (file)
@@ -159,7 +159,7 @@ No match
 /[[:alpha:]][[:lower:]][[:upper:]]/IB
 ------------------------------------------------------------------
         Bra
-        [A-Za-z\x83\x8a\x8c\x8e\x9a\x9c\x9e\x9f\xaa\xb2\xb3\xb5\xb9\xba\xc0-\xd6\xd8-\xf6\xf8-\xff]
+        [A-Za-z\x83\x8a\x8c\x8e\x9a\x9c\x9e\x9f\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\xff]
         [a-z\x83\x9a\x9c\x9e\xaa\xb5\xba\xdf-\xf6\xf8-\xff]
         [A-Z\x8a\x8c\x8e\x9f\xc0-\xd6\xd8-\xde]
         Ket
@@ -167,9 +167,9 @@ No match
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Starting code units: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 
-  a b c d e f g h i j k l m n o p q r s t u v w x y z \83 \8a \8c \8e \9a \9c \9e \9f ª ² ³ 
-  µ ¹ º À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ ß à á â 
-  ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ø ù ú û ü ý þ ÿ 
+  a b c d e f g h i j k l m n o p q r s t u v w x y z \83 \8a \8c \8e \9a \9c \9e \9f ª µ º 
+  À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å 
+  æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ø ù ú û ü ý þ ÿ 
 Subject length lower bound = 3
 
 # End of testinput3