"Fossies" - the Fresh Open Source Software Archive

Member "pcre2-10.36/src/sljit/sljitLir.c" (3 Nov 2020, 84826 Bytes) of package /linux/misc/pcre2-10.36.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "sljitLir.c" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 10.35_vs_10.36.

    1 /*
    2  *    Stack-less Just-In-Time compiler
    3  *
    4  *    Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without modification, are
    7  * permitted provided that the following conditions are met:
    8  *
    9  *   1. Redistributions of source code must retain the above copyright notice, this list of
   10  *      conditions and the following disclaimer.
   11  *
   12  *   2. Redistributions in binary form must reproduce the above copyright notice, this list
   13  *      of conditions and the following disclaimer in the documentation and/or other materials
   14  *      provided with the distribution.
   15  *
   16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND CONTRIBUTORS ``AS IS'' AND ANY
   17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
   19  * SHALL THE COPYRIGHT HOLDER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
   21  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
   22  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
   24  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   25  */
   26 
   27 #include "sljitLir.h"
   28 
   29 #ifdef _WIN32
   30 
   31 #include <windows.h>
   32 
   33 #endif /* _WIN32 */
   34 
   35 #if !(defined SLJIT_STD_MACROS_DEFINED && SLJIT_STD_MACROS_DEFINED)
   36 
   37 /* These libraries are needed for the macros below. */
   38 #include <stdlib.h>
   39 #include <string.h>
   40 
   41 #endif /* SLJIT_STD_MACROS_DEFINED */
   42 
   43 #define CHECK_ERROR() \
   44     do { \
   45         if (SLJIT_UNLIKELY(compiler->error)) \
   46             return compiler->error; \
   47     } while (0)
   48 
   49 #define CHECK_ERROR_PTR() \
   50     do { \
   51         if (SLJIT_UNLIKELY(compiler->error)) \
   52             return NULL; \
   53     } while (0)
   54 
   55 #define FAIL_IF(expr) \
   56     do { \
   57         if (SLJIT_UNLIKELY(expr)) \
   58             return compiler->error; \
   59     } while (0)
   60 
   61 #define PTR_FAIL_IF(expr) \
   62     do { \
   63         if (SLJIT_UNLIKELY(expr)) \
   64             return NULL; \
   65     } while (0)
   66 
   67 #define FAIL_IF_NULL(ptr) \
   68     do { \
   69         if (SLJIT_UNLIKELY(!(ptr))) { \
   70             compiler->error = SLJIT_ERR_ALLOC_FAILED; \
   71             return SLJIT_ERR_ALLOC_FAILED; \
   72         } \
   73     } while (0)
   74 
   75 #define PTR_FAIL_IF_NULL(ptr) \
   76     do { \
   77         if (SLJIT_UNLIKELY(!(ptr))) { \
   78             compiler->error = SLJIT_ERR_ALLOC_FAILED; \
   79             return NULL; \
   80         } \
   81     } while (0)
   82 
   83 #define PTR_FAIL_WITH_EXEC_IF(ptr) \
   84     do { \
   85         if (SLJIT_UNLIKELY(!(ptr))) { \
   86             compiler->error = SLJIT_ERR_EX_ALLOC_FAILED; \
   87             return NULL; \
   88         } \
   89     } while (0)
   90 
   91 #if !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
   92 
   93 #define VARIABLE_FLAG_SHIFT (10)
   94 #define VARIABLE_FLAG_MASK (0x3f << VARIABLE_FLAG_SHIFT)
   95 #define GET_FLAG_TYPE(op) ((op) >> VARIABLE_FLAG_SHIFT)
   96 
   97 #define GET_OPCODE(op) \
   98     ((op) & ~(SLJIT_I32_OP | SLJIT_SET_Z | VARIABLE_FLAG_MASK))
   99 
  100 #define HAS_FLAGS(op) \
  101     ((op) & (SLJIT_SET_Z | VARIABLE_FLAG_MASK))
  102 
  103 #define GET_ALL_FLAGS(op) \
  104     ((op) & (SLJIT_I32_OP | SLJIT_SET_Z | VARIABLE_FLAG_MASK))
  105 
  106 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
  107 #define TYPE_CAST_NEEDED(op) \
  108     ((op) >= SLJIT_MOV_U8 && (op) <= SLJIT_MOV_S32)
  109 #else
  110 #define TYPE_CAST_NEEDED(op) \
  111     ((op) >= SLJIT_MOV_U8 && (op) <= SLJIT_MOV_S16)
  112 #endif
  113 
  114 #define BUF_SIZE    4096
  115 
  116 #if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
  117 #define ABUF_SIZE   2048
  118 #else
  119 #define ABUF_SIZE   4096
  120 #endif
  121 
  122 /* Parameter parsing. */
  123 #define REG_MASK        0x3f
  124 #define OFFS_REG(reg)       (((reg) >> 8) & REG_MASK)
  125 #define OFFS_REG_MASK       (REG_MASK << 8)
  126 #define TO_OFFS_REG(reg)    ((reg) << 8)
  127 /* When reg cannot be unused. */
  128 #define FAST_IS_REG(reg)    ((reg) <= REG_MASK)
  129 /* When reg can be unused. */
  130 #define SLOW_IS_REG(reg)    ((reg) > 0 && (reg) <= REG_MASK)
  131 
  132 /* Mask for argument types. */
  133 #define SLJIT_DEF_MASK ((1 << SLJIT_DEF_SHIFT) - 1)
  134 
  135 /* Jump flags. */
  136 #define JUMP_LABEL  0x1
  137 #define JUMP_ADDR   0x2
  138 /* SLJIT_REWRITABLE_JUMP is 0x1000. */
  139 
  140 #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
  141 #   define PATCH_MB     0x4
  142 #   define PATCH_MW     0x8
  143 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
  144 #   define PATCH_MD     0x10
  145 #endif
  146 #   define TYPE_SHIFT   13
  147 #endif
  148 
  149 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
  150 #   define IS_BL        0x4
  151 #   define PATCH_B      0x8
  152 #endif
  153 
  154 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
  155 #   define CPOOL_SIZE   512
  156 #endif
  157 
  158 #if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
  159 #   define IS_COND      0x04
  160 #   define IS_BL        0x08
  161     /* conditional + imm8 */
  162 #   define PATCH_TYPE1  0x10
  163     /* conditional + imm20 */
  164 #   define PATCH_TYPE2  0x20
  165     /* IT + imm24 */
  166 #   define PATCH_TYPE3  0x30
  167     /* imm11 */
  168 #   define PATCH_TYPE4  0x40
  169     /* imm24 */
  170 #   define PATCH_TYPE5  0x50
  171     /* BL + imm24 */
  172 #   define PATCH_BL     0x60
  173     /* 0xf00 cc code for branches */
  174 #endif
  175 
  176 #if (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
  177 #   define IS_COND      0x004
  178 #   define IS_CBZ       0x008
  179 #   define IS_BL        0x010
  180 #   define PATCH_B      0x020
  181 #   define PATCH_COND   0x040
  182 #   define PATCH_ABS48  0x080
  183 #   define PATCH_ABS64  0x100
  184 #endif
  185 
  186 #if (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
  187 #   define IS_COND      0x004
  188 #   define IS_CALL      0x008
  189 #   define PATCH_B      0x010
  190 #   define PATCH_ABS_B  0x020
  191 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
  192 #   define PATCH_ABS32  0x040
  193 #   define PATCH_ABS48  0x080
  194 #endif
  195 #   define REMOVE_COND  0x100
  196 #endif
  197 
  198 #if (defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
  199 #   define IS_MOVABLE   0x004
  200 #   define IS_JAL       0x008
  201 #   define IS_CALL      0x010
  202 #   define IS_BIT26_COND    0x020
  203 #   define IS_BIT16_COND    0x040
  204 #   define IS_BIT23_COND    0x080
  205 
  206 #   define IS_COND      (IS_BIT26_COND | IS_BIT16_COND | IS_BIT23_COND)
  207 
  208 #   define PATCH_B      0x100
  209 #   define PATCH_J      0x200
  210 
  211 #if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
  212 #   define PATCH_ABS32  0x400
  213 #   define PATCH_ABS48  0x800
  214 #endif
  215 
  216     /* instruction types */
  217 #   define MOVABLE_INS  0
  218     /* 1 - 31 last destination register */
  219     /* no destination (i.e: store) */
  220 #   define UNMOVABLE_INS    32
  221     /* FPU status register */
  222 #   define FCSR_FCC     33
  223 #endif
  224 
  225 #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
  226 #   define IS_MOVABLE   0x04
  227 #   define IS_COND      0x08
  228 #   define IS_CALL      0x10
  229 
  230 #   define PATCH_B      0x20
  231 #   define PATCH_CALL   0x40
  232 
  233     /* instruction types */
  234 #   define MOVABLE_INS  0
  235     /* 1 - 31 last destination register */
  236     /* no destination (i.e: store) */
  237 #   define UNMOVABLE_INS    32
  238 
  239 #   define DST_INS_MASK 0xff
  240 
  241     /* ICC_SET is the same as SET_FLAGS. */
  242 #   define ICC_IS_SET   (1 << 23)
  243 #   define FCC_IS_SET   (1 << 24)
  244 #endif
  245 
  246 /* Stack management. */
  247 
  248 #define GET_SAVED_REGISTERS_SIZE(scratches, saveds, extra) \
  249     (((scratches < SLJIT_NUMBER_OF_SCRATCH_REGISTERS ? 0 : (scratches - SLJIT_NUMBER_OF_SCRATCH_REGISTERS)) + \
  250         (saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? saveds : SLJIT_NUMBER_OF_SAVED_REGISTERS) + \
  251         extra) * sizeof(sljit_sw))
  252 
  253 #define ADJUST_LOCAL_OFFSET(p, i) \
  254     if ((p) == (SLJIT_MEM1(SLJIT_SP))) \
  255         (i) += SLJIT_LOCALS_OFFSET;
  256 
  257 #endif /* !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED) */
  258 
  259 /* Utils can still be used even if SLJIT_CONFIG_UNSUPPORTED is set. */
  260 #include "sljitUtils.c"
  261 
  262 #if !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
  263 
  264 #if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR)
  265 
  266 #if (defined SLJIT_PROT_EXECUTABLE_ALLOCATOR && SLJIT_PROT_EXECUTABLE_ALLOCATOR)
  267 #include "sljitProtExecAllocator.c"
  268 #elif (defined SLJIT_WX_EXECUTABLE_ALLOCATOR && SLJIT_WX_EXECUTABLE_ALLOCATOR)
  269 #include "sljitWXExecAllocator.c"
  270 #else
  271 #include "sljitExecAllocator.c"
  272 #endif
  273 
  274 #endif
  275 
  276 #if (defined SLJIT_PROT_EXECUTABLE_ALLOCATOR && SLJIT_PROT_EXECUTABLE_ALLOCATOR)
  277 #define SLJIT_ADD_EXEC_OFFSET(ptr, exec_offset) ((sljit_u8 *)(ptr) + (exec_offset))
  278 #else
  279 #define SLJIT_ADD_EXEC_OFFSET(ptr, exec_offset) ((sljit_u8 *)(ptr))
  280 #endif
  281 
  282 #ifndef SLJIT_UPDATE_WX_FLAGS
  283 #define SLJIT_UPDATE_WX_FLAGS(from, to, enable_exec)
  284 #endif
  285 
  286 /* Argument checking features. */
  287 
  288 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
  289 
  290 /* Returns with error when an invalid argument is passed. */
  291 
  292 #define CHECK_ARGUMENT(x) \
  293     do { \
  294         if (SLJIT_UNLIKELY(!(x))) \
  295             return 1; \
  296     } while (0)
  297 
  298 #define CHECK_RETURN_TYPE sljit_s32
  299 #define CHECK_RETURN_OK return 0
  300 
  301 #define CHECK(x) \
  302     do { \
  303         if (SLJIT_UNLIKELY(x)) { \
  304             compiler->error = SLJIT_ERR_BAD_ARGUMENT; \
  305             return SLJIT_ERR_BAD_ARGUMENT; \
  306         } \
  307     } while (0)
  308 
  309 #define CHECK_PTR(x) \
  310     do { \
  311         if (SLJIT_UNLIKELY(x)) { \
  312             compiler->error = SLJIT_ERR_BAD_ARGUMENT; \
  313             return NULL; \
  314         } \
  315     } while (0)
  316 
  317 #define CHECK_REG_INDEX(x) \
  318     do { \
  319         if (SLJIT_UNLIKELY(x)) { \
  320             return -2; \
  321         } \
  322     } while (0)
  323 
  324 #elif (defined SLJIT_DEBUG && SLJIT_DEBUG)
  325 
  326 /* Assertion failure occures if an invalid argument is passed. */
  327 #undef SLJIT_ARGUMENT_CHECKS
  328 #define SLJIT_ARGUMENT_CHECKS 1
  329 
  330 #define CHECK_ARGUMENT(x) SLJIT_ASSERT(x)
  331 #define CHECK_RETURN_TYPE void
  332 #define CHECK_RETURN_OK return
  333 #define CHECK(x) x
  334 #define CHECK_PTR(x) x
  335 #define CHECK_REG_INDEX(x) x
  336 
  337 #elif (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
  338 
  339 /* Arguments are not checked. */
  340 #define CHECK_RETURN_TYPE void
  341 #define CHECK_RETURN_OK return
  342 #define CHECK(x) x
  343 #define CHECK_PTR(x) x
  344 #define CHECK_REG_INDEX(x) x
  345 
  346 #else
  347 
  348 /* Arguments are not checked. */
  349 #define CHECK(x)
  350 #define CHECK_PTR(x)
  351 #define CHECK_REG_INDEX(x)
  352 
  353 #endif /* SLJIT_ARGUMENT_CHECKS */
  354 
  355 /* --------------------------------------------------------------------- */
  356 /*  Public functions                                                     */
  357 /* --------------------------------------------------------------------- */
  358 
  359 #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
  360 #define SLJIT_NEEDS_COMPILER_INIT 1
  361 static sljit_s32 compiler_initialized = 0;
  362 /* A thread safe initialization. */
  363 static void init_compiler(void);
  364 #endif
  365 
  366 SLJIT_API_FUNC_ATTRIBUTE struct sljit_compiler* sljit_create_compiler(void *allocator_data, void *exec_allocator_data)
  367 {
  368     struct sljit_compiler *compiler = (struct sljit_compiler*)SLJIT_MALLOC(sizeof(struct sljit_compiler), allocator_data);
  369     if (!compiler)
  370         return NULL;
  371     SLJIT_ZEROMEM(compiler, sizeof(struct sljit_compiler));
  372 
  373     SLJIT_COMPILE_ASSERT(
  374         sizeof(sljit_s8) == 1 && sizeof(sljit_u8) == 1
  375         && sizeof(sljit_s16) == 2 && sizeof(sljit_u16) == 2
  376         && sizeof(sljit_s32) == 4 && sizeof(sljit_u32) == 4
  377         && (sizeof(sljit_p) == 4 || sizeof(sljit_p) == 8)
  378         && sizeof(sljit_p) <= sizeof(sljit_sw)
  379         && (sizeof(sljit_sw) == 4 || sizeof(sljit_sw) == 8)
  380         && (sizeof(sljit_uw) == 4 || sizeof(sljit_uw) == 8),
  381         invalid_integer_types);
  382     SLJIT_COMPILE_ASSERT(SLJIT_I32_OP == SLJIT_F32_OP,
  383         int_op_and_single_op_must_be_the_same);
  384     SLJIT_COMPILE_ASSERT(SLJIT_REWRITABLE_JUMP != SLJIT_F32_OP,
  385         rewritable_jump_and_single_op_must_not_be_the_same);
  386     SLJIT_COMPILE_ASSERT(!(SLJIT_EQUAL & 0x1) && !(SLJIT_LESS & 0x1) && !(SLJIT_EQUAL_F64 & 0x1) && !(SLJIT_JUMP & 0x1),
  387         conditional_flags_must_be_even_numbers);
  388 
  389     /* Only the non-zero members must be set. */
  390     compiler->error = SLJIT_SUCCESS;
  391 
  392     compiler->allocator_data = allocator_data;
  393     compiler->exec_allocator_data = exec_allocator_data;
  394     compiler->buf = (struct sljit_memory_fragment*)SLJIT_MALLOC(BUF_SIZE, allocator_data);
  395     compiler->abuf = (struct sljit_memory_fragment*)SLJIT_MALLOC(ABUF_SIZE, allocator_data);
  396 
  397     if (!compiler->buf || !compiler->abuf) {
  398         if (compiler->buf)
  399             SLJIT_FREE(compiler->buf, allocator_data);
  400         if (compiler->abuf)
  401             SLJIT_FREE(compiler->abuf, allocator_data);
  402         SLJIT_FREE(compiler, allocator_data);
  403         return NULL;
  404     }
  405 
  406     compiler->buf->next = NULL;
  407     compiler->buf->used_size = 0;
  408     compiler->abuf->next = NULL;
  409     compiler->abuf->used_size = 0;
  410 
  411     compiler->scratches = -1;
  412     compiler->saveds = -1;
  413     compiler->fscratches = -1;
  414     compiler->fsaveds = -1;
  415     compiler->local_size = -1;
  416 
  417 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
  418     compiler->args = -1;
  419 #endif
  420 
  421 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
  422     compiler->cpool = (sljit_uw*)SLJIT_MALLOC(CPOOL_SIZE * sizeof(sljit_uw)
  423         + CPOOL_SIZE * sizeof(sljit_u8), allocator_data);
  424     if (!compiler->cpool) {
  425         SLJIT_FREE(compiler->buf, allocator_data);
  426         SLJIT_FREE(compiler->abuf, allocator_data);
  427         SLJIT_FREE(compiler, allocator_data);
  428         return NULL;
  429     }
  430     compiler->cpool_unique = (sljit_u8*)(compiler->cpool + CPOOL_SIZE);
  431     compiler->cpool_diff = 0xffffffff;
  432 #endif
  433 
  434 #if (defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
  435     compiler->delay_slot = UNMOVABLE_INS;
  436 #endif
  437 
  438 #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
  439     compiler->delay_slot = UNMOVABLE_INS;
  440 #endif
  441 
  442 #if (defined SLJIT_NEEDS_COMPILER_INIT && SLJIT_NEEDS_COMPILER_INIT)
  443     if (!compiler_initialized) {
  444         init_compiler();
  445         compiler_initialized = 1;
  446     }
  447 #endif
  448 
  449     return compiler;
  450 }
  451 
  452 SLJIT_API_FUNC_ATTRIBUTE void sljit_free_compiler(struct sljit_compiler *compiler)
  453 {
  454     struct sljit_memory_fragment *buf;
  455     struct sljit_memory_fragment *curr;
  456     void *allocator_data = compiler->allocator_data;
  457     SLJIT_UNUSED_ARG(allocator_data);
  458 
  459     buf = compiler->buf;
  460     while (buf) {
  461         curr = buf;
  462         buf = buf->next;
  463         SLJIT_FREE(curr, allocator_data);
  464     }
  465 
  466     buf = compiler->abuf;
  467     while (buf) {
  468         curr = buf;
  469         buf = buf->next;
  470         SLJIT_FREE(curr, allocator_data);
  471     }
  472 
  473 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
  474     SLJIT_FREE(compiler->cpool, allocator_data);
  475 #endif
  476     SLJIT_FREE(compiler, allocator_data);
  477 }
  478 
  479 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_compiler_memory_error(struct sljit_compiler *compiler)
  480 {
  481     if (compiler->error == SLJIT_SUCCESS)
  482         compiler->error = SLJIT_ERR_ALLOC_FAILED;
  483 }
  484 
  485 #if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
  486 SLJIT_API_FUNC_ATTRIBUTE void sljit_free_code(void* code, void *exec_allocator_data)
  487 {
  488     SLJIT_UNUSED_ARG(exec_allocator_data);
  489 
  490     /* Remove thumb mode flag. */
  491     SLJIT_FREE_EXEC((void*)((sljit_uw)code & ~0x1), exec_allocator_data);
  492 }
  493 #elif (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)
  494 SLJIT_API_FUNC_ATTRIBUTE void sljit_free_code(void* code, void *exec_allocator_data)
  495 {
  496     SLJIT_UNUSED_ARG(exec_allocator_data);
  497 
  498     /* Resolve indirection. */
  499     code = (void*)(*(sljit_uw*)code);
  500     SLJIT_FREE_EXEC(code, exec_allocator_data);
  501 }
  502 #else
  503 SLJIT_API_FUNC_ATTRIBUTE void sljit_free_code(void* code, void *exec_allocator_data)
  504 {
  505     SLJIT_UNUSED_ARG(exec_allocator_data);
  506 
  507     SLJIT_FREE_EXEC(code, exec_allocator_data);
  508 }
  509 #endif
  510 
  511 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_label(struct sljit_jump *jump, struct sljit_label* label)
  512 {
  513     if (SLJIT_LIKELY(!!jump) && SLJIT_LIKELY(!!label)) {
  514         jump->flags &= ~JUMP_ADDR;
  515         jump->flags |= JUMP_LABEL;
  516         jump->u.label = label;
  517     }
  518 }
  519 
  520 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_target(struct sljit_jump *jump, sljit_uw target)
  521 {
  522     if (SLJIT_LIKELY(!!jump)) {
  523         jump->flags &= ~JUMP_LABEL;
  524         jump->flags |= JUMP_ADDR;
  525         jump->u.target = target;
  526     }
  527 }
  528 
  529 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_put_label(struct sljit_put_label *put_label, struct sljit_label *label)
  530 {
  531     if (SLJIT_LIKELY(!!put_label))
  532         put_label->label = label;
  533 }
  534 
  535 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_current_flags(struct sljit_compiler *compiler, sljit_s32 current_flags)
  536 {
  537     SLJIT_UNUSED_ARG(compiler);
  538     SLJIT_UNUSED_ARG(current_flags);
  539 
  540 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
  541     if ((current_flags & ~(VARIABLE_FLAG_MASK | SLJIT_I32_OP | SLJIT_SET_Z)) == 0) {
  542         compiler->last_flags = GET_FLAG_TYPE(current_flags) | (current_flags & (SLJIT_I32_OP | SLJIT_SET_Z));
  543     }
  544 #endif
  545 }
  546 
  547 /* --------------------------------------------------------------------- */
  548 /*  Private functions                                                    */
  549 /* --------------------------------------------------------------------- */
  550 
  551 static void* ensure_buf(struct sljit_compiler *compiler, sljit_uw size)
  552 {
  553     sljit_u8 *ret;
  554     struct sljit_memory_fragment *new_frag;
  555 
  556     SLJIT_ASSERT(size <= 256);
  557     if (compiler->buf->used_size + size <= (BUF_SIZE - (sljit_uw)SLJIT_OFFSETOF(struct sljit_memory_fragment, memory))) {
  558         ret = compiler->buf->memory + compiler->buf->used_size;
  559         compiler->buf->used_size += size;
  560         return ret;
  561     }
  562     new_frag = (struct sljit_memory_fragment*)SLJIT_MALLOC(BUF_SIZE, compiler->allocator_data);
  563     PTR_FAIL_IF_NULL(new_frag);
  564     new_frag->next = compiler->buf;
  565     compiler->buf = new_frag;
  566     new_frag->used_size = size;
  567     return new_frag->memory;
  568 }
  569 
  570 static void* ensure_abuf(struct sljit_compiler *compiler, sljit_uw size)
  571 {
  572     sljit_u8 *ret;
  573     struct sljit_memory_fragment *new_frag;
  574 
  575     SLJIT_ASSERT(size <= 256);
  576     if (compiler->abuf->used_size + size <= (ABUF_SIZE - (sljit_uw)SLJIT_OFFSETOF(struct sljit_memory_fragment, memory))) {
  577         ret = compiler->abuf->memory + compiler->abuf->used_size;
  578         compiler->abuf->used_size += size;
  579         return ret;
  580     }
  581     new_frag = (struct sljit_memory_fragment*)SLJIT_MALLOC(ABUF_SIZE, compiler->allocator_data);
  582     PTR_FAIL_IF_NULL(new_frag);
  583     new_frag->next = compiler->abuf;
  584     compiler->abuf = new_frag;
  585     new_frag->used_size = size;
  586     return new_frag->memory;
  587 }
  588 
  589 SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, sljit_s32 size)
  590 {
  591     CHECK_ERROR_PTR();
  592 
  593 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
  594     if (size <= 0 || size > 128)
  595         return NULL;
  596     size = (size + 7) & ~7;
  597 #else
  598     if (size <= 0 || size > 64)
  599         return NULL;
  600     size = (size + 3) & ~3;
  601 #endif
  602     return ensure_abuf(compiler, size);
  603 }
  604 
  605 static SLJIT_INLINE void reverse_buf(struct sljit_compiler *compiler)
  606 {
  607     struct sljit_memory_fragment *buf = compiler->buf;
  608     struct sljit_memory_fragment *prev = NULL;
  609     struct sljit_memory_fragment *tmp;
  610 
  611     do {
  612         tmp = buf->next;
  613         buf->next = prev;
  614         prev = buf;
  615         buf = tmp;
  616     } while (buf != NULL);
  617 
  618     compiler->buf = prev;
  619 }
  620 
  621 static SLJIT_INLINE sljit_s32 get_arg_count(sljit_s32 arg_types)
  622 {
  623     sljit_s32 arg_count = 0;
  624 
  625     arg_types >>= SLJIT_DEF_SHIFT;
  626     while (arg_types) {
  627         arg_count++;
  628         arg_types >>= SLJIT_DEF_SHIFT;
  629     }
  630 
  631     return arg_count;
  632 }
  633 
  634 
  635 /* Only used in RISC architectures where the instruction size is constant */
  636 #if !(defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) \
  637     && !(defined SLJIT_CONFIG_S390X && SLJIT_CONFIG_S390X)
  638 
  639 static SLJIT_INLINE sljit_uw compute_next_addr(struct sljit_label *label, struct sljit_jump *jump,
  640     struct sljit_const *const_, struct sljit_put_label *put_label)
  641 {
  642     sljit_uw result = ~(sljit_uw)0;
  643 
  644     if (label)
  645         result = label->size;
  646 
  647     if (jump && jump->addr < result)
  648         result = jump->addr;
  649 
  650     if (const_ && const_->addr < result)
  651         result = const_->addr;
  652 
  653     if (put_label && put_label->addr < result)
  654         result = put_label->addr;
  655 
  656     return result;
  657 }
  658 
  659 #endif /* !SLJIT_CONFIG_X86 && !SLJIT_CONFIG_S390X */
  660 
  661 static SLJIT_INLINE void set_emit_enter(struct sljit_compiler *compiler,
  662     sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
  663     sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
  664 {
  665     SLJIT_UNUSED_ARG(args);
  666     SLJIT_UNUSED_ARG(local_size);
  667 
  668     compiler->options = options;
  669     compiler->scratches = scratches;
  670     compiler->saveds = saveds;
  671     compiler->fscratches = fscratches;
  672     compiler->fsaveds = fsaveds;
  673 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
  674     compiler->logical_local_size = local_size;
  675 #endif
  676 }
  677 
  678 static SLJIT_INLINE void set_set_context(struct sljit_compiler *compiler,
  679     sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
  680     sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
  681 {
  682     SLJIT_UNUSED_ARG(args);
  683     SLJIT_UNUSED_ARG(local_size);
  684 
  685     compiler->options = options;
  686     compiler->scratches = scratches;
  687     compiler->saveds = saveds;
  688     compiler->fscratches = fscratches;
  689     compiler->fsaveds = fsaveds;
  690 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
  691     compiler->logical_local_size = local_size;
  692 #endif
  693 }
  694 
  695 static SLJIT_INLINE void set_label(struct sljit_label *label, struct sljit_compiler *compiler)
  696 {
  697     label->next = NULL;
  698     label->size = compiler->size;
  699     if (compiler->last_label)
  700         compiler->last_label->next = label;
  701     else
  702         compiler->labels = label;
  703     compiler->last_label = label;
  704 }
  705 
  706 static SLJIT_INLINE void set_jump(struct sljit_jump *jump, struct sljit_compiler *compiler, sljit_s32 flags)
  707 {
  708     jump->next = NULL;
  709     jump->flags = flags;
  710     if (compiler->last_jump)
  711         compiler->last_jump->next = jump;
  712     else
  713         compiler->jumps = jump;
  714     compiler->last_jump = jump;
  715 }
  716 
  717 static SLJIT_INLINE void set_const(struct sljit_const *const_, struct sljit_compiler *compiler)
  718 {
  719     const_->next = NULL;
  720     const_->addr = compiler->size;
  721     if (compiler->last_const)
  722         compiler->last_const->next = const_;
  723     else
  724         compiler->consts = const_;
  725     compiler->last_const = const_;
  726 }
  727 
  728 static SLJIT_INLINE void set_put_label(struct sljit_put_label *put_label, struct sljit_compiler *compiler, sljit_uw offset)
  729 {
  730     put_label->next = NULL;
  731     put_label->label = NULL;
  732     put_label->addr = compiler->size - offset;
  733     put_label->flags = 0;
  734     if (compiler->last_put_label)
  735         compiler->last_put_label->next = put_label;
  736     else
  737         compiler->put_labels = put_label;
  738     compiler->last_put_label = put_label;
  739 }
  740 
  741 #define ADDRESSING_DEPENDS_ON(exp, reg) \
  742     (((exp) & SLJIT_MEM) && (((exp) & REG_MASK) == reg || OFFS_REG(exp) == reg))
  743 
  744 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
  745 
  746 #define FUNCTION_CHECK_IS_REG(r) \
  747     (((r) >= SLJIT_R0 && (r) < (SLJIT_R0 + compiler->scratches)) \
  748     || ((r) > (SLJIT_S0 - compiler->saveds) && (r) <= SLJIT_S0))
  749 
  750 #define FUNCTION_CHECK_IS_FREG(fr) \
  751     (((fr) >= SLJIT_FR0 && (fr) < (SLJIT_FR0 + compiler->fscratches)) \
  752     || ((fr) > (SLJIT_FS0 - compiler->fsaveds) && (fr) <= SLJIT_FS0))
  753 
  754 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
  755 #define CHECK_IF_VIRTUAL_REGISTER(p) ((p) <= SLJIT_S3 && (p) >= SLJIT_S8)
  756 #else
  757 #define CHECK_IF_VIRTUAL_REGISTER(p) 0
  758 #endif
  759 
  760 static sljit_s32 function_check_src_mem(struct sljit_compiler *compiler, sljit_s32 p, sljit_sw i)
  761 {
  762     if (compiler->scratches == -1 || compiler->saveds == -1)
  763         return 0;
  764 
  765     if (!(p & SLJIT_MEM))
  766         return 0;
  767 
  768     if (!((p & REG_MASK) == SLJIT_UNUSED || FUNCTION_CHECK_IS_REG(p & REG_MASK)))
  769         return 0;
  770 
  771     if (CHECK_IF_VIRTUAL_REGISTER(p & REG_MASK))
  772         return 0;
  773 
  774     if (p & OFFS_REG_MASK) {
  775         if ((p & REG_MASK) == SLJIT_UNUSED)
  776             return 0;
  777 
  778         if (!(FUNCTION_CHECK_IS_REG(OFFS_REG(p))))
  779             return 0;
  780 
  781         if (CHECK_IF_VIRTUAL_REGISTER(OFFS_REG(p)))
  782             return 0;
  783 
  784         if ((i & ~0x3) != 0)
  785             return 0;
  786     }
  787 
  788     return (p & ~(SLJIT_MEM | REG_MASK | OFFS_REG_MASK)) == 0;
  789 }
  790 
  791 #define FUNCTION_CHECK_SRC_MEM(p, i) \
  792     CHECK_ARGUMENT(function_check_src_mem(compiler, p, i));
  793 
  794 static sljit_s32 function_check_src(struct sljit_compiler *compiler, sljit_s32 p, sljit_sw i)
  795 {
  796     if (compiler->scratches == -1 || compiler->saveds == -1)
  797         return 0;
  798 
  799     if (FUNCTION_CHECK_IS_REG(p))
  800         return (i == 0);
  801 
  802     if (p == SLJIT_IMM)
  803         return 1;
  804 
  805     if (p == SLJIT_MEM1(SLJIT_SP))
  806         return (i >= 0 && i < compiler->logical_local_size);
  807 
  808     return function_check_src_mem(compiler, p, i);
  809 }
  810 
  811 #define FUNCTION_CHECK_SRC(p, i) \
  812     CHECK_ARGUMENT(function_check_src(compiler, p, i));
  813 
  814 static sljit_s32 function_check_dst(struct sljit_compiler *compiler, sljit_s32 p, sljit_sw i, sljit_s32 unused)
  815 {
  816     if (compiler->scratches == -1 || compiler->saveds == -1)
  817         return 0;
  818 
  819     if (FUNCTION_CHECK_IS_REG(p) || ((unused) && (p) == SLJIT_UNUSED))
  820         return (i == 0);
  821 
  822     if (p == SLJIT_MEM1(SLJIT_SP))
  823         return (i >= 0 && i < compiler->logical_local_size);
  824 
  825     return function_check_src_mem(compiler, p, i);
  826 }
  827 
  828 #define FUNCTION_CHECK_DST(p, i, unused) \
  829     CHECK_ARGUMENT(function_check_dst(compiler, p, i, unused));
  830 
  831 static sljit_s32 function_fcheck(struct sljit_compiler *compiler, sljit_s32 p, sljit_sw i)
  832 {
  833     if (compiler->scratches == -1 || compiler->saveds == -1)
  834         return 0;
  835 
  836     if (FUNCTION_CHECK_IS_FREG(p))
  837         return (i == 0);
  838 
  839     if (p == SLJIT_MEM1(SLJIT_SP))
  840         return (i >= 0 && i < compiler->logical_local_size);
  841 
  842     return function_check_src_mem(compiler, p, i);
  843 }
  844 
  845 #define FUNCTION_FCHECK(p, i) \
  846     CHECK_ARGUMENT(function_fcheck(compiler, p, i));
  847 
  848 #endif /* SLJIT_ARGUMENT_CHECKS */
  849 
  850 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
  851 
  852 SLJIT_API_FUNC_ATTRIBUTE void sljit_compiler_verbose(struct sljit_compiler *compiler, FILE* verbose)
  853 {
  854     compiler->verbose = verbose;
  855 }
  856 
  857 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
  858 #ifdef _WIN64
  859 #   define SLJIT_PRINT_D    "I64"
  860 #else
  861 #   define SLJIT_PRINT_D    "l"
  862 #endif
  863 #else
  864 #   define SLJIT_PRINT_D    ""
  865 #endif
  866 
  867 static void sljit_verbose_reg(struct sljit_compiler *compiler, sljit_s32 r)
  868 {
  869     if (r < (SLJIT_R0 + compiler->scratches))
  870         fprintf(compiler->verbose, "r%d", r - SLJIT_R0);
  871     else if (r != SLJIT_SP)
  872         fprintf(compiler->verbose, "s%d", SLJIT_NUMBER_OF_REGISTERS - r);
  873     else
  874         fprintf(compiler->verbose, "sp");
  875 }
  876 
  877 static void sljit_verbose_freg(struct sljit_compiler *compiler, sljit_s32 r)
  878 {
  879     if (r < (SLJIT_FR0 + compiler->fscratches))
  880         fprintf(compiler->verbose, "fr%d", r - SLJIT_FR0);
  881     else
  882         fprintf(compiler->verbose, "fs%d", SLJIT_NUMBER_OF_FLOAT_REGISTERS - r);
  883 }
  884 
  885 static void sljit_verbose_param(struct sljit_compiler *compiler, sljit_s32 p, sljit_sw i)
  886 {
  887     if ((p) & SLJIT_IMM)
  888         fprintf(compiler->verbose, "#%" SLJIT_PRINT_D "d", (i));
  889     else if ((p) & SLJIT_MEM) {
  890         if ((p) & REG_MASK) {
  891             fputc('[', compiler->verbose);
  892             sljit_verbose_reg(compiler, (p) & REG_MASK);
  893             if ((p) & OFFS_REG_MASK) {
  894                 fprintf(compiler->verbose, " + ");
  895                 sljit_verbose_reg(compiler, OFFS_REG(p));
  896                 if (i)
  897                     fprintf(compiler->verbose, " * %d", 1 << (i));
  898             }
  899             else if (i)
  900                 fprintf(compiler->verbose, " + %" SLJIT_PRINT_D "d", (i));
  901             fputc(']', compiler->verbose);
  902         }
  903         else
  904             fprintf(compiler->verbose, "[#%" SLJIT_PRINT_D "d]", (i));
  905     } else if (p)
  906         sljit_verbose_reg(compiler, p);
  907     else
  908         fprintf(compiler->verbose, "unused");
  909 }
  910 
  911 static void sljit_verbose_fparam(struct sljit_compiler *compiler, sljit_s32 p, sljit_sw i)
  912 {
  913     if ((p) & SLJIT_MEM) {
  914         if ((p) & REG_MASK) {
  915             fputc('[', compiler->verbose);
  916             sljit_verbose_reg(compiler, (p) & REG_MASK);
  917             if ((p) & OFFS_REG_MASK) {
  918                 fprintf(compiler->verbose, " + ");
  919                 sljit_verbose_reg(compiler, OFFS_REG(p));
  920                 if (i)
  921                     fprintf(compiler->verbose, "%d", 1 << (i));
  922             }
  923             else if (i)
  924                 fprintf(compiler->verbose, " + %" SLJIT_PRINT_D "d", (i));
  925             fputc(']', compiler->verbose);
  926         }
  927         else
  928             fprintf(compiler->verbose, "[#%" SLJIT_PRINT_D "d]", (i));
  929     }
  930     else
  931         sljit_verbose_freg(compiler, p);
  932 }
  933 
  934 static const char* op0_names[] = {
  935     (char*)"breakpoint", (char*)"nop", (char*)"lmul.uw", (char*)"lmul.sw",
  936     (char*)"divmod.u", (char*)"divmod.s", (char*)"div.u", (char*)"div.s",
  937     (char*)"endbr", (char*)"skip_frames_before_return"
  938 };
  939 
  940 static const char* op1_names[] = {
  941     (char*)"", (char*)".u8", (char*)".s8", (char*)".u16",
  942     (char*)".s16", (char*)".u32", (char*)".s32", (char*)".p",
  943     (char*)"", (char*)".u8", (char*)".s8", (char*)".u16",
  944     (char*)".s16", (char*)".u32", (char*)".s32", (char*)".p",
  945     (char*)"not", (char*)"neg", (char*)"clz",
  946 };
  947 
  948 static const char* op2_names[] = {
  949     (char*)"add", (char*)"addc", (char*)"sub", (char*)"subc",
  950     (char*)"mul", (char*)"and", (char*)"or", (char*)"xor",
  951     (char*)"shl", (char*)"lshr", (char*)"ashr",
  952 };
  953 
  954 static const char* op_src_names[] = {
  955     (char*)"fast_return", (char*)"skip_frames_before_fast_return",
  956     (char*)"prefetch_l1", (char*)"prefetch_l2",
  957     (char*)"prefetch_l3", (char*)"prefetch_once",
  958 };
  959 
  960 static const char* fop1_names[] = {
  961     (char*)"mov", (char*)"conv", (char*)"conv", (char*)"conv",
  962     (char*)"conv", (char*)"conv", (char*)"cmp", (char*)"neg",
  963     (char*)"abs",
  964 };
  965 
  966 static const char* fop2_names[] = {
  967     (char*)"add", (char*)"sub", (char*)"mul", (char*)"div"
  968 };
  969 
  970 #define JUMP_POSTFIX(type) \
  971     ((type & 0xff) <= SLJIT_MUL_NOT_OVERFLOW ? ((type & SLJIT_I32_OP) ? "32" : "") \
  972     : ((type & 0xff) <= SLJIT_ORDERED_F64 ? ((type & SLJIT_F32_OP) ? ".f32" : ".f64") : ""))
  973 
  974 static char* jump_names[] = {
  975     (char*)"equal", (char*)"not_equal",
  976     (char*)"less", (char*)"greater_equal",
  977     (char*)"greater", (char*)"less_equal",
  978     (char*)"sig_less", (char*)"sig_greater_equal",
  979     (char*)"sig_greater", (char*)"sig_less_equal",
  980     (char*)"overflow", (char*)"not_overflow",
  981     (char*)"mul_overflow", (char*)"mul_not_overflow",
  982     (char*)"carry", (char*)"",
  983     (char*)"equal", (char*)"not_equal",
  984     (char*)"less", (char*)"greater_equal",
  985     (char*)"greater", (char*)"less_equal",
  986     (char*)"unordered", (char*)"ordered",
  987     (char*)"jump", (char*)"fast_call",
  988     (char*)"call", (char*)"call.cdecl"
  989 };
  990 
  991 static char* call_arg_names[] = {
  992     (char*)"void", (char*)"sw", (char*)"uw", (char*)"s32", (char*)"u32", (char*)"f32", (char*)"f64"
  993 };
  994 
  995 #endif /* SLJIT_VERBOSE */
  996 
  997 /* --------------------------------------------------------------------- */
  998 /*  Arch dependent                                                       */
  999 /* --------------------------------------------------------------------- */
 1000 
 1001 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS) \
 1002     || (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1003 
 1004 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_generate_code(struct sljit_compiler *compiler)
 1005 {
 1006 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1007     struct sljit_jump *jump;
 1008 #endif
 1009 
 1010     SLJIT_UNUSED_ARG(compiler);
 1011 
 1012 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1013     CHECK_ARGUMENT(compiler->size > 0);
 1014     jump = compiler->jumps;
 1015     while (jump) {
 1016         /* All jumps have target. */
 1017         CHECK_ARGUMENT(jump->flags & (JUMP_LABEL | JUMP_ADDR));
 1018         jump = jump->next;
 1019     }
 1020 #endif
 1021     CHECK_RETURN_OK;
 1022 }
 1023 
 1024 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_enter(struct sljit_compiler *compiler,
 1025     sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
 1026     sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 1027 {
 1028 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1029     sljit_s32 types, arg_count, curr_type;
 1030 #endif
 1031 
 1032     SLJIT_UNUSED_ARG(compiler);
 1033 
 1034 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1035     CHECK_ARGUMENT(!(options & ~SLJIT_F64_ALIGNMENT));
 1036     CHECK_ARGUMENT(scratches >= 0 && scratches <= SLJIT_NUMBER_OF_REGISTERS);
 1037     CHECK_ARGUMENT(saveds >= 0 && saveds <= SLJIT_NUMBER_OF_REGISTERS);
 1038     CHECK_ARGUMENT(scratches + saveds <= SLJIT_NUMBER_OF_REGISTERS);
 1039     CHECK_ARGUMENT(fscratches >= 0 && fscratches <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
 1040     CHECK_ARGUMENT(fsaveds >= 0 && fsaveds <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
 1041     CHECK_ARGUMENT(fscratches + fsaveds <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
 1042     CHECK_ARGUMENT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);
 1043     CHECK_ARGUMENT((arg_types & SLJIT_DEF_MASK) == 0);
 1044 
 1045     types = (arg_types >> SLJIT_DEF_SHIFT);
 1046     arg_count = 0;
 1047     while (types != 0 && arg_count < 3) {
 1048         curr_type = (types & SLJIT_DEF_MASK);
 1049         CHECK_ARGUMENT(curr_type == SLJIT_ARG_TYPE_SW || curr_type == SLJIT_ARG_TYPE_UW);
 1050         arg_count++;
 1051         types >>= SLJIT_DEF_SHIFT;
 1052     }
 1053     CHECK_ARGUMENT(arg_count <= saveds && types == 0);
 1054 
 1055     compiler->last_flags = 0;
 1056 #endif
 1057 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1058     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1059         fprintf(compiler->verbose, "  enter options:%s args[", (options & SLJIT_F64_ALIGNMENT) ? "f64_align" : "");
 1060 
 1061         arg_types >>= SLJIT_DEF_SHIFT;
 1062         while (arg_types) {
 1063             fprintf(compiler->verbose, "%s", call_arg_names[arg_types & SLJIT_DEF_MASK]);
 1064             arg_types >>= SLJIT_DEF_SHIFT;
 1065             if (arg_types)
 1066                 fprintf(compiler->verbose, ",");
 1067         }
 1068 
 1069         fprintf(compiler->verbose, "] scratches:%d saveds:%d fscratches:%d fsaveds:%d local_size:%d\n",
 1070             scratches, saveds, fscratches, fsaveds, local_size);
 1071     }
 1072 #endif
 1073     CHECK_RETURN_OK;
 1074 }
 1075 
 1076 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_set_context(struct sljit_compiler *compiler,
 1077     sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
 1078     sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 1079 {
 1080 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1081     sljit_s32 types, arg_count, curr_type;
 1082 #endif
 1083 
 1084     SLJIT_UNUSED_ARG(compiler);
 1085 
 1086 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1087     CHECK_ARGUMENT(!(options & ~SLJIT_F64_ALIGNMENT));
 1088     CHECK_ARGUMENT(scratches >= 0 && scratches <= SLJIT_NUMBER_OF_REGISTERS);
 1089     CHECK_ARGUMENT(saveds >= 0 && saveds <= SLJIT_NUMBER_OF_REGISTERS);
 1090     CHECK_ARGUMENT(scratches + saveds <= SLJIT_NUMBER_OF_REGISTERS);
 1091     CHECK_ARGUMENT(fscratches >= 0 && fscratches <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
 1092     CHECK_ARGUMENT(fsaveds >= 0 && fsaveds <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
 1093     CHECK_ARGUMENT(fscratches + fsaveds <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
 1094     CHECK_ARGUMENT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);
 1095 
 1096     types = (arg_types >> SLJIT_DEF_SHIFT);
 1097     arg_count = 0;
 1098     while (types != 0 && arg_count < 3) {
 1099         curr_type = (types & SLJIT_DEF_MASK);
 1100         CHECK_ARGUMENT(curr_type == SLJIT_ARG_TYPE_SW || curr_type == SLJIT_ARG_TYPE_UW);
 1101         arg_count++;
 1102         types >>= SLJIT_DEF_SHIFT;
 1103     }
 1104     CHECK_ARGUMENT(arg_count <= saveds && types == 0);
 1105 
 1106     compiler->last_flags = 0;
 1107 #endif
 1108 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1109     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1110         fprintf(compiler->verbose, "  set_context options:%s args[", (options & SLJIT_F64_ALIGNMENT) ? "f64_align" : "");
 1111 
 1112         arg_types >>= SLJIT_DEF_SHIFT;
 1113         while (arg_types) {
 1114             fprintf(compiler->verbose, "%s", call_arg_names[arg_types & SLJIT_DEF_MASK]);
 1115             arg_types >>= SLJIT_DEF_SHIFT;
 1116             if (arg_types)
 1117                 fprintf(compiler->verbose, ",");
 1118         }
 1119 
 1120         fprintf(compiler->verbose, "] scratches:%d saveds:%d fscratches:%d fsaveds:%d local_size:%d\n",
 1121             scratches, saveds, fscratches, fsaveds, local_size);
 1122     }
 1123 #endif
 1124     CHECK_RETURN_OK;
 1125 }
 1126 
 1127 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
 1128 {
 1129 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1130     CHECK_ARGUMENT(compiler->scratches >= 0);
 1131     if (op != SLJIT_UNUSED) {
 1132         CHECK_ARGUMENT(op >= SLJIT_MOV && op <= SLJIT_MOV_P);
 1133         FUNCTION_CHECK_SRC(src, srcw);
 1134     }
 1135     else
 1136         CHECK_ARGUMENT(src == 0 && srcw == 0);
 1137     compiler->last_flags = 0;
 1138 #endif
 1139 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1140     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1141         if (op == SLJIT_UNUSED)
 1142             fprintf(compiler->verbose, "  return\n");
 1143         else {
 1144             fprintf(compiler->verbose, "  return%s ", op1_names[op - SLJIT_OP1_BASE]);
 1145             sljit_verbose_param(compiler, src, srcw);
 1146             fprintf(compiler->verbose, "\n");
 1147         }
 1148     }
 1149 #endif
 1150     CHECK_RETURN_OK;
 1151 }
 1152 
 1153 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
 1154 {
 1155 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1156     FUNCTION_CHECK_DST(dst, dstw, 0);
 1157     compiler->last_flags = 0;
 1158 #endif
 1159 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1160     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1161         fprintf(compiler->verbose, "  fast_enter ");
 1162         sljit_verbose_param(compiler, dst, dstw);
 1163         fprintf(compiler->verbose, "\n");
 1164     }
 1165 #endif
 1166     CHECK_RETURN_OK;
 1167 }
 1168 
 1169 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op)
 1170 {
 1171 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1172     CHECK_ARGUMENT((op >= SLJIT_BREAKPOINT && op <= SLJIT_LMUL_SW)
 1173         || ((op & ~SLJIT_I32_OP) >= SLJIT_DIVMOD_UW && (op & ~SLJIT_I32_OP) <= SLJIT_DIV_SW)
 1174         || (op >= SLJIT_ENDBR && op <= SLJIT_SKIP_FRAMES_BEFORE_RETURN));
 1175     CHECK_ARGUMENT(GET_OPCODE(op) < SLJIT_LMUL_UW || GET_OPCODE(op) >= SLJIT_ENDBR || compiler->scratches >= 2);
 1176     if ((GET_OPCODE(op) >= SLJIT_LMUL_UW && GET_OPCODE(op) <= SLJIT_DIV_SW) || op == SLJIT_SKIP_FRAMES_BEFORE_RETURN)
 1177         compiler->last_flags = 0;
 1178 #endif
 1179 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1180     if (SLJIT_UNLIKELY(!!compiler->verbose))
 1181     {
 1182         fprintf(compiler->verbose, "  %s", op0_names[GET_OPCODE(op) - SLJIT_OP0_BASE]);
 1183         if (GET_OPCODE(op) >= SLJIT_DIVMOD_UW && GET_OPCODE(op) <= SLJIT_DIV_SW) {
 1184             fprintf(compiler->verbose, (op & SLJIT_I32_OP) ? "32" : "w");
 1185         }
 1186         fprintf(compiler->verbose, "\n");
 1187     }
 1188 #endif
 1189     CHECK_RETURN_OK;
 1190 }
 1191 
 1192 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op,
 1193     sljit_s32 dst, sljit_sw dstw,
 1194     sljit_s32 src, sljit_sw srcw)
 1195 {
 1196     if (SLJIT_UNLIKELY(compiler->skip_checks)) {
 1197         compiler->skip_checks = 0;
 1198         CHECK_RETURN_OK;
 1199     }
 1200 
 1201 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1202     CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_MOV && GET_OPCODE(op) <= SLJIT_CLZ);
 1203 
 1204     switch (GET_OPCODE(op)) {
 1205     case SLJIT_NOT:
 1206         /* Only SLJIT_I32_OP and SLJIT_SET_Z are allowed. */
 1207         CHECK_ARGUMENT(!(op & VARIABLE_FLAG_MASK));
 1208         break;
 1209     case SLJIT_NEG:
 1210         CHECK_ARGUMENT(!(op & VARIABLE_FLAG_MASK)
 1211             || GET_FLAG_TYPE(op) == SLJIT_OVERFLOW);
 1212         break;
 1213     case SLJIT_MOV:
 1214     case SLJIT_MOV_U32:
 1215     case SLJIT_MOV_P:
 1216         /* Nothing allowed */
 1217         CHECK_ARGUMENT(!(op & (SLJIT_I32_OP | SLJIT_SET_Z | VARIABLE_FLAG_MASK)));
 1218         break;
 1219     default:
 1220         /* Only SLJIT_I32_OP is allowed. */
 1221         CHECK_ARGUMENT(!(op & (SLJIT_SET_Z | VARIABLE_FLAG_MASK)));
 1222         break;
 1223     }
 1224 
 1225     FUNCTION_CHECK_DST(dst, dstw, HAS_FLAGS(op));
 1226     FUNCTION_CHECK_SRC(src, srcw);
 1227 
 1228     if (GET_OPCODE(op) >= SLJIT_NOT) {
 1229         CHECK_ARGUMENT(src != SLJIT_IMM);
 1230         compiler->last_flags = GET_FLAG_TYPE(op) | (op & (SLJIT_I32_OP | SLJIT_SET_Z));
 1231     }
 1232 #endif
 1233 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1234     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1235         if (GET_OPCODE(op) <= SLJIT_MOV_P)
 1236         {
 1237             fprintf(compiler->verbose, "  mov%s%s ", !(op & SLJIT_I32_OP) ? "" : "32",
 1238                 (op != SLJIT_MOV32) ? op1_names[GET_OPCODE(op) - SLJIT_OP1_BASE] : "");
 1239         }
 1240         else
 1241         {
 1242             fprintf(compiler->verbose, "  %s%s%s%s%s ", op1_names[GET_OPCODE(op) - SLJIT_OP1_BASE], !(op & SLJIT_I32_OP) ? "" : "32",
 1243                 !(op & SLJIT_SET_Z) ? "" : ".z", !(op & VARIABLE_FLAG_MASK) ? "" : ".",
 1244                 !(op & VARIABLE_FLAG_MASK) ? "" : jump_names[GET_FLAG_TYPE(op)]);
 1245         }
 1246 
 1247         sljit_verbose_param(compiler, dst, dstw);
 1248         fprintf(compiler->verbose, ", ");
 1249         sljit_verbose_param(compiler, src, srcw);
 1250         fprintf(compiler->verbose, "\n");
 1251     }
 1252 #endif
 1253     CHECK_RETURN_OK;
 1254 }
 1255 
 1256 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op,
 1257     sljit_s32 dst, sljit_sw dstw,
 1258     sljit_s32 src1, sljit_sw src1w,
 1259     sljit_s32 src2, sljit_sw src2w)
 1260 {
 1261     if (SLJIT_UNLIKELY(compiler->skip_checks)) {
 1262         compiler->skip_checks = 0;
 1263         CHECK_RETURN_OK;
 1264     }
 1265 
 1266 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1267     CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_ADD && GET_OPCODE(op) <= SLJIT_ASHR);
 1268 
 1269     switch (GET_OPCODE(op)) {
 1270     case SLJIT_AND:
 1271     case SLJIT_OR:
 1272     case SLJIT_XOR:
 1273     case SLJIT_SHL:
 1274     case SLJIT_LSHR:
 1275     case SLJIT_ASHR:
 1276         CHECK_ARGUMENT(!(op & VARIABLE_FLAG_MASK));
 1277         break;
 1278     case SLJIT_MUL:
 1279         CHECK_ARGUMENT(!(op & SLJIT_SET_Z));
 1280         CHECK_ARGUMENT(!(op & VARIABLE_FLAG_MASK)
 1281             || GET_FLAG_TYPE(op) == SLJIT_MUL_OVERFLOW);
 1282         break;
 1283     case SLJIT_ADD:
 1284         CHECK_ARGUMENT(!(op & VARIABLE_FLAG_MASK)
 1285             || GET_FLAG_TYPE(op) == GET_FLAG_TYPE(SLJIT_SET_CARRY)
 1286             || GET_FLAG_TYPE(op) == SLJIT_OVERFLOW);
 1287         break;
 1288     case SLJIT_SUB:
 1289         CHECK_ARGUMENT(!(op & VARIABLE_FLAG_MASK)
 1290             || (GET_FLAG_TYPE(op) >= SLJIT_LESS && GET_FLAG_TYPE(op) <= SLJIT_OVERFLOW)
 1291             || GET_FLAG_TYPE(op) == GET_FLAG_TYPE(SLJIT_SET_CARRY));
 1292         break;
 1293     case SLJIT_ADDC:
 1294     case SLJIT_SUBC:
 1295         CHECK_ARGUMENT(!(op & VARIABLE_FLAG_MASK)
 1296             || GET_FLAG_TYPE(op) == GET_FLAG_TYPE(SLJIT_SET_CARRY));
 1297         CHECK_ARGUMENT((compiler->last_flags & 0xff) == GET_FLAG_TYPE(SLJIT_SET_CARRY));
 1298         CHECK_ARGUMENT((op & SLJIT_I32_OP) == (compiler->last_flags & SLJIT_I32_OP));
 1299         break;
 1300     default:
 1301         SLJIT_UNREACHABLE();
 1302         break;
 1303     }
 1304 
 1305     FUNCTION_CHECK_DST(dst, dstw, HAS_FLAGS(op));
 1306     FUNCTION_CHECK_SRC(src1, src1w);
 1307     FUNCTION_CHECK_SRC(src2, src2w);
 1308     compiler->last_flags = GET_FLAG_TYPE(op) | (op & (SLJIT_I32_OP | SLJIT_SET_Z));
 1309 #endif
 1310 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1311     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1312         fprintf(compiler->verbose, "  %s%s%s%s%s ", op2_names[GET_OPCODE(op) - SLJIT_OP2_BASE], !(op & SLJIT_I32_OP) ? "" : "32",
 1313             !(op & SLJIT_SET_Z) ? "" : ".z", !(op & VARIABLE_FLAG_MASK) ? "" : ".",
 1314             !(op & VARIABLE_FLAG_MASK) ? "" : jump_names[GET_FLAG_TYPE(op)]);
 1315         sljit_verbose_param(compiler, dst, dstw);
 1316         fprintf(compiler->verbose, ", ");
 1317         sljit_verbose_param(compiler, src1, src1w);
 1318         fprintf(compiler->verbose, ", ");
 1319         sljit_verbose_param(compiler, src2, src2w);
 1320         fprintf(compiler->verbose, "\n");
 1321     }
 1322 #endif
 1323     CHECK_RETURN_OK;
 1324 }
 1325 
 1326 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op_src(struct sljit_compiler *compiler, sljit_s32 op,
 1327     sljit_s32 src, sljit_sw srcw)
 1328 {
 1329 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1330     CHECK_ARGUMENT(op >= SLJIT_FAST_RETURN && op <= SLJIT_PREFETCH_ONCE);
 1331     FUNCTION_CHECK_SRC(src, srcw);
 1332 
 1333     if (op == SLJIT_FAST_RETURN || op == SLJIT_SKIP_FRAMES_BEFORE_FAST_RETURN)
 1334     {
 1335         CHECK_ARGUMENT(src != SLJIT_IMM);
 1336         compiler->last_flags = 0;
 1337     }
 1338     else if (op >= SLJIT_PREFETCH_L1 && op <= SLJIT_PREFETCH_ONCE)
 1339     {
 1340         CHECK_ARGUMENT(src & SLJIT_MEM);
 1341     }
 1342 #endif
 1343 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1344     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1345         fprintf(compiler->verbose, "  %s ", op_src_names[op - SLJIT_OP_SRC_BASE]);
 1346         sljit_verbose_param(compiler, src, srcw);
 1347         fprintf(compiler->verbose, "\n");
 1348     }
 1349 #endif
 1350     CHECK_RETURN_OK;
 1351 }
 1352 
 1353 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_get_register_index(sljit_s32 reg)
 1354 {
 1355     SLJIT_UNUSED_ARG(reg);
 1356 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1357     CHECK_ARGUMENT(reg > 0 && reg <= SLJIT_NUMBER_OF_REGISTERS);
 1358 #endif
 1359     CHECK_RETURN_OK;
 1360 }
 1361 
 1362 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_get_float_register_index(sljit_s32 reg)
 1363 {
 1364     SLJIT_UNUSED_ARG(reg);
 1365 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1366     CHECK_ARGUMENT(reg > 0 && reg <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
 1367 #endif
 1368     CHECK_RETURN_OK;
 1369 }
 1370 
 1371 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op_custom(struct sljit_compiler *compiler,
 1372     void *instruction, sljit_s32 size)
 1373 {
 1374 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1375     int i;
 1376 #endif
 1377 
 1378     SLJIT_UNUSED_ARG(compiler);
 1379 
 1380 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1381     CHECK_ARGUMENT(instruction);
 1382 
 1383 #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
 1384     CHECK_ARGUMENT(size > 0 && size < 16);
 1385 #elif (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
 1386     CHECK_ARGUMENT((size == 2 && (((sljit_sw)instruction) & 0x1) == 0)
 1387         || (size == 4 && (((sljit_sw)instruction) & 0x3) == 0));
 1388 #elif (defined SLJIT_CONFIG_S390X && SLJIT_CONFIG_S390X)
 1389     CHECK_ARGUMENT(size == 2 || size == 4 || size == 6);
 1390 #else
 1391     CHECK_ARGUMENT(size == 4 && (((sljit_sw)instruction) & 0x3) == 0);
 1392 #endif
 1393 
 1394     compiler->last_flags = 0;
 1395 #endif
 1396 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1397     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1398         fprintf(compiler->verbose, "  op_custom");
 1399         for (i = 0; i < size; i++)
 1400             fprintf(compiler->verbose, " 0x%x", ((sljit_u8*)instruction)[i]);
 1401         fprintf(compiler->verbose, "\n");
 1402     }
 1403 #endif
 1404     CHECK_RETURN_OK;
 1405 }
 1406 
 1407 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op,
 1408     sljit_s32 dst, sljit_sw dstw,
 1409     sljit_s32 src, sljit_sw srcw)
 1410 {
 1411     if (SLJIT_UNLIKELY(compiler->skip_checks)) {
 1412         compiler->skip_checks = 0;
 1413         CHECK_RETURN_OK;
 1414     }
 1415 
 1416 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1417     CHECK_ARGUMENT(sljit_has_cpu_feature(SLJIT_HAS_FPU));
 1418     CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_MOV_F64 && GET_OPCODE(op) <= SLJIT_ABS_F64);
 1419     CHECK_ARGUMENT(!(op & (SLJIT_SET_Z | VARIABLE_FLAG_MASK)));
 1420     FUNCTION_FCHECK(src, srcw);
 1421     FUNCTION_FCHECK(dst, dstw);
 1422 #endif
 1423 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1424     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1425         if (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_F32)
 1426             fprintf(compiler->verbose, "  %s%s ", fop1_names[SLJIT_CONV_F64_FROM_F32 - SLJIT_FOP1_BASE],
 1427                 (op & SLJIT_F32_OP) ? ".f32.from.f64" : ".f64.from.f32");
 1428         else
 1429             fprintf(compiler->verbose, "  %s%s ", fop1_names[GET_OPCODE(op) - SLJIT_FOP1_BASE],
 1430                 (op & SLJIT_F32_OP) ? ".f32" : ".f64");
 1431 
 1432         sljit_verbose_fparam(compiler, dst, dstw);
 1433         fprintf(compiler->verbose, ", ");
 1434         sljit_verbose_fparam(compiler, src, srcw);
 1435         fprintf(compiler->verbose, "\n");
 1436     }
 1437 #endif
 1438     CHECK_RETURN_OK;
 1439 }
 1440 
 1441 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_s32 op,
 1442     sljit_s32 src1, sljit_sw src1w,
 1443     sljit_s32 src2, sljit_sw src2w)
 1444 {
 1445 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1446     compiler->last_flags = GET_FLAG_TYPE(op) | (op & (SLJIT_I32_OP | SLJIT_SET_Z));
 1447 #endif
 1448 
 1449     if (SLJIT_UNLIKELY(compiler->skip_checks)) {
 1450         compiler->skip_checks = 0;
 1451         CHECK_RETURN_OK;
 1452     }
 1453 
 1454 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1455     CHECK_ARGUMENT(sljit_has_cpu_feature(SLJIT_HAS_FPU));
 1456     CHECK_ARGUMENT(GET_OPCODE(op) == SLJIT_CMP_F64);
 1457     CHECK_ARGUMENT(!(op & SLJIT_SET_Z));
 1458     CHECK_ARGUMENT((op & VARIABLE_FLAG_MASK)
 1459         || (GET_FLAG_TYPE(op) >= SLJIT_EQUAL_F64 && GET_FLAG_TYPE(op) <= SLJIT_ORDERED_F64));
 1460     FUNCTION_FCHECK(src1, src1w);
 1461     FUNCTION_FCHECK(src2, src2w);
 1462 #endif
 1463 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1464     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1465         fprintf(compiler->verbose, "  %s%s", fop1_names[SLJIT_CMP_F64 - SLJIT_FOP1_BASE], (op & SLJIT_F32_OP) ? ".f32" : ".f64");
 1466         if (op & VARIABLE_FLAG_MASK) {
 1467             fprintf(compiler->verbose, ".%s_f", jump_names[GET_FLAG_TYPE(op)]);
 1468         }
 1469         fprintf(compiler->verbose, " ");
 1470         sljit_verbose_fparam(compiler, src1, src1w);
 1471         fprintf(compiler->verbose, ", ");
 1472         sljit_verbose_fparam(compiler, src2, src2w);
 1473         fprintf(compiler->verbose, "\n");
 1474     }
 1475 #endif
 1476     CHECK_RETURN_OK;
 1477 }
 1478 
 1479 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_conv_sw_from_f64(struct sljit_compiler *compiler, sljit_s32 op,
 1480     sljit_s32 dst, sljit_sw dstw,
 1481     sljit_s32 src, sljit_sw srcw)
 1482 {
 1483     if (SLJIT_UNLIKELY(compiler->skip_checks)) {
 1484         compiler->skip_checks = 0;
 1485         CHECK_RETURN_OK;
 1486     }
 1487 
 1488 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1489     CHECK_ARGUMENT(sljit_has_cpu_feature(SLJIT_HAS_FPU));
 1490     CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_CONV_SW_FROM_F64 && GET_OPCODE(op) <= SLJIT_CONV_S32_FROM_F64);
 1491     CHECK_ARGUMENT(!(op & (SLJIT_SET_Z | VARIABLE_FLAG_MASK)));
 1492     FUNCTION_FCHECK(src, srcw);
 1493     FUNCTION_CHECK_DST(dst, dstw, 0);
 1494 #endif
 1495 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1496     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1497         fprintf(compiler->verbose, "  %s%s.from%s ", fop1_names[GET_OPCODE(op) - SLJIT_FOP1_BASE],
 1498             (GET_OPCODE(op) == SLJIT_CONV_S32_FROM_F64) ? ".s32" : ".sw",
 1499             (op & SLJIT_F32_OP) ? ".f32" : ".f64");
 1500         sljit_verbose_param(compiler, dst, dstw);
 1501         fprintf(compiler->verbose, ", ");
 1502         sljit_verbose_fparam(compiler, src, srcw);
 1503         fprintf(compiler->verbose, "\n");
 1504     }
 1505 #endif
 1506     CHECK_RETURN_OK;
 1507 }
 1508 
 1509 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_conv_f64_from_sw(struct sljit_compiler *compiler, sljit_s32 op,
 1510     sljit_s32 dst, sljit_sw dstw,
 1511     sljit_s32 src, sljit_sw srcw)
 1512 {
 1513     if (SLJIT_UNLIKELY(compiler->skip_checks)) {
 1514         compiler->skip_checks = 0;
 1515         CHECK_RETURN_OK;
 1516     }
 1517 
 1518 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1519     CHECK_ARGUMENT(sljit_has_cpu_feature(SLJIT_HAS_FPU));
 1520     CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_CONV_F64_FROM_SW && GET_OPCODE(op) <= SLJIT_CONV_F64_FROM_S32);
 1521     CHECK_ARGUMENT(!(op & (SLJIT_SET_Z | VARIABLE_FLAG_MASK)));
 1522     FUNCTION_CHECK_SRC(src, srcw);
 1523     FUNCTION_FCHECK(dst, dstw);
 1524 #endif
 1525 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1526     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1527         fprintf(compiler->verbose, "  %s%s.from%s ", fop1_names[GET_OPCODE(op) - SLJIT_FOP1_BASE],
 1528             (op & SLJIT_F32_OP) ? ".f32" : ".f64",
 1529             (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_S32) ? ".s32" : ".sw");
 1530         sljit_verbose_fparam(compiler, dst, dstw);
 1531         fprintf(compiler->verbose, ", ");
 1532         sljit_verbose_param(compiler, src, srcw);
 1533         fprintf(compiler->verbose, "\n");
 1534     }
 1535 #endif
 1536     CHECK_RETURN_OK;
 1537 }
 1538 
 1539 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op,
 1540     sljit_s32 dst, sljit_sw dstw,
 1541     sljit_s32 src1, sljit_sw src1w,
 1542     sljit_s32 src2, sljit_sw src2w)
 1543 {
 1544 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1545     CHECK_ARGUMENT(sljit_has_cpu_feature(SLJIT_HAS_FPU));
 1546     CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_ADD_F64 && GET_OPCODE(op) <= SLJIT_DIV_F64);
 1547     CHECK_ARGUMENT(!(op & (SLJIT_SET_Z | VARIABLE_FLAG_MASK)));
 1548     FUNCTION_FCHECK(src1, src1w);
 1549     FUNCTION_FCHECK(src2, src2w);
 1550     FUNCTION_FCHECK(dst, dstw);
 1551 #endif
 1552 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1553     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1554         fprintf(compiler->verbose, "  %s%s ", fop2_names[GET_OPCODE(op) - SLJIT_FOP2_BASE], (op & SLJIT_F32_OP) ? ".f32" : ".f64");
 1555         sljit_verbose_fparam(compiler, dst, dstw);
 1556         fprintf(compiler->verbose, ", ");
 1557         sljit_verbose_fparam(compiler, src1, src1w);
 1558         fprintf(compiler->verbose, ", ");
 1559         sljit_verbose_fparam(compiler, src2, src2w);
 1560         fprintf(compiler->verbose, "\n");
 1561     }
 1562 #endif
 1563     CHECK_RETURN_OK;
 1564 }
 1565 
 1566 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_label(struct sljit_compiler *compiler)
 1567 {
 1568     SLJIT_UNUSED_ARG(compiler);
 1569 
 1570     if (SLJIT_UNLIKELY(compiler->skip_checks)) {
 1571         compiler->skip_checks = 0;
 1572         CHECK_RETURN_OK;
 1573     }
 1574 
 1575 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1576     compiler->last_flags = 0;
 1577 #endif
 1578 
 1579 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1580     if (SLJIT_UNLIKELY(!!compiler->verbose))
 1581         fprintf(compiler->verbose, "label:\n");
 1582 #endif
 1583     CHECK_RETURN_OK;
 1584 }
 1585 
 1586 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_jump(struct sljit_compiler *compiler, sljit_s32 type)
 1587 {
 1588     if (SLJIT_UNLIKELY(compiler->skip_checks)) {
 1589         compiler->skip_checks = 0;
 1590         CHECK_RETURN_OK;
 1591     }
 1592 
 1593 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1594     CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP | SLJIT_I32_OP)));
 1595     CHECK_ARGUMENT((type & 0xff) != GET_FLAG_TYPE(SLJIT_SET_CARRY) && (type & 0xff) != (GET_FLAG_TYPE(SLJIT_SET_CARRY) + 1));
 1596     CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL && (type & 0xff) <= SLJIT_FAST_CALL);
 1597     CHECK_ARGUMENT((type & 0xff) < SLJIT_JUMP || !(type & SLJIT_I32_OP));
 1598 
 1599     if ((type & 0xff) < SLJIT_JUMP) {
 1600         if ((type & 0xff) <= SLJIT_NOT_ZERO)
 1601             CHECK_ARGUMENT(compiler->last_flags & SLJIT_SET_Z);
 1602         else
 1603             CHECK_ARGUMENT((type & 0xff) == (compiler->last_flags & 0xff)
 1604                 || ((type & 0xff) == SLJIT_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_OVERFLOW)
 1605                 || ((type & 0xff) == SLJIT_MUL_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_MUL_OVERFLOW));
 1606         CHECK_ARGUMENT((type & SLJIT_I32_OP) == (compiler->last_flags & SLJIT_I32_OP));
 1607     }
 1608 #endif
 1609 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1610     if (SLJIT_UNLIKELY(!!compiler->verbose))
 1611         fprintf(compiler->verbose, "  jump%s %s%s\n", !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r",
 1612             jump_names[type & 0xff], JUMP_POSTFIX(type));
 1613 #endif
 1614     CHECK_RETURN_OK;
 1615 }
 1616 
 1617 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_call(struct sljit_compiler *compiler, sljit_s32 type,
 1618     sljit_s32 arg_types)
 1619 {
 1620 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1621     sljit_s32 i, types, curr_type, scratches, fscratches;
 1622 
 1623     CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP)));
 1624     CHECK_ARGUMENT((type & 0xff) == SLJIT_CALL || (type & 0xff) == SLJIT_CALL_CDECL);
 1625 
 1626     types = arg_types;
 1627     scratches = 0;
 1628     fscratches = 0;
 1629     for (i = 0; i < 5; i++) {
 1630         curr_type = (types & SLJIT_DEF_MASK);
 1631         CHECK_ARGUMENT(curr_type <= SLJIT_ARG_TYPE_F64);
 1632         if (i > 0) {
 1633             if (curr_type == 0) {
 1634                 break;
 1635             }
 1636             if (curr_type >= SLJIT_ARG_TYPE_F32)
 1637                 fscratches++;
 1638             else
 1639                 scratches++;
 1640         } else {
 1641             if (curr_type >= SLJIT_ARG_TYPE_F32) {
 1642                 CHECK_ARGUMENT(compiler->fscratches > 0);
 1643             } else if (curr_type >= SLJIT_ARG_TYPE_SW) {
 1644                 CHECK_ARGUMENT(compiler->scratches > 0);
 1645             }
 1646         }
 1647         types >>= SLJIT_DEF_SHIFT;
 1648     }
 1649     CHECK_ARGUMENT(compiler->scratches >= scratches);
 1650     CHECK_ARGUMENT(compiler->fscratches >= fscratches);
 1651     CHECK_ARGUMENT(types == 0);
 1652 #endif
 1653 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1654     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1655         fprintf(compiler->verbose, "  %s%s ret[%s", jump_names[type & 0xff],
 1656             !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r", call_arg_names[arg_types & SLJIT_DEF_MASK]);
 1657 
 1658         arg_types >>= SLJIT_DEF_SHIFT;
 1659         if (arg_types) {
 1660             fprintf(compiler->verbose, "], args[");
 1661             do {
 1662                 fprintf(compiler->verbose, "%s", call_arg_names[arg_types & SLJIT_DEF_MASK]);
 1663                 arg_types >>= SLJIT_DEF_SHIFT;
 1664                 if (arg_types)
 1665                     fprintf(compiler->verbose, ",");
 1666             } while (arg_types);
 1667         }
 1668         fprintf(compiler->verbose, "]\n");
 1669     }
 1670 #endif
 1671     CHECK_RETURN_OK;
 1672 }
 1673 
 1674 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_cmp(struct sljit_compiler *compiler, sljit_s32 type,
 1675     sljit_s32 src1, sljit_sw src1w,
 1676     sljit_s32 src2, sljit_sw src2w)
 1677 {
 1678 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1679     CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP | SLJIT_I32_OP)));
 1680     CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL && (type & 0xff) <= SLJIT_SIG_LESS_EQUAL);
 1681     FUNCTION_CHECK_SRC(src1, src1w);
 1682     FUNCTION_CHECK_SRC(src2, src2w);
 1683     compiler->last_flags = 0;
 1684 #endif
 1685 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1686     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1687         fprintf(compiler->verbose, "  cmp%s %s%s, ", !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r",
 1688             jump_names[type & 0xff], (type & SLJIT_I32_OP) ? "32" : "");
 1689         sljit_verbose_param(compiler, src1, src1w);
 1690         fprintf(compiler->verbose, ", ");
 1691         sljit_verbose_param(compiler, src2, src2w);
 1692         fprintf(compiler->verbose, "\n");
 1693     }
 1694 #endif
 1695     CHECK_RETURN_OK;
 1696 }
 1697 
 1698 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_s32 type,
 1699     sljit_s32 src1, sljit_sw src1w,
 1700     sljit_s32 src2, sljit_sw src2w)
 1701 {
 1702 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1703     CHECK_ARGUMENT(sljit_has_cpu_feature(SLJIT_HAS_FPU));
 1704     CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP | SLJIT_F32_OP)));
 1705     CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL_F64 && (type & 0xff) <= SLJIT_ORDERED_F64);
 1706     FUNCTION_FCHECK(src1, src1w);
 1707     FUNCTION_FCHECK(src2, src2w);
 1708     compiler->last_flags = 0;
 1709 #endif
 1710 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1711     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1712         fprintf(compiler->verbose, "  fcmp%s %s%s, ", !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r",
 1713             jump_names[type & 0xff], (type & SLJIT_F32_OP) ? ".f32" : ".f64");
 1714         sljit_verbose_fparam(compiler, src1, src1w);
 1715         fprintf(compiler->verbose, ", ");
 1716         sljit_verbose_fparam(compiler, src2, src2w);
 1717         fprintf(compiler->verbose, "\n");
 1718     }
 1719 #endif
 1720     CHECK_RETURN_OK;
 1721 }
 1722 
 1723 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type,
 1724     sljit_s32 src, sljit_sw srcw)
 1725 {
 1726     if (SLJIT_UNLIKELY(compiler->skip_checks)) {
 1727         compiler->skip_checks = 0;
 1728         CHECK_RETURN_OK;
 1729     }
 1730 
 1731 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1732     CHECK_ARGUMENT(type >= SLJIT_JUMP && type <= SLJIT_FAST_CALL);
 1733     FUNCTION_CHECK_SRC(src, srcw);
 1734 #endif
 1735 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1736     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1737         fprintf(compiler->verbose, "  ijump.%s ", jump_names[type]);
 1738         sljit_verbose_param(compiler, src, srcw);
 1739         fprintf(compiler->verbose, "\n");
 1740     }
 1741 #endif
 1742     CHECK_RETURN_OK;
 1743 }
 1744 
 1745 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type,
 1746     sljit_s32 arg_types,
 1747     sljit_s32 src, sljit_sw srcw)
 1748 {
 1749 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1750     sljit_s32 i, types, curr_type, scratches, fscratches;
 1751 
 1752     CHECK_ARGUMENT(type == SLJIT_CALL || type == SLJIT_CALL_CDECL);
 1753     FUNCTION_CHECK_SRC(src, srcw);
 1754 
 1755     types = arg_types;
 1756     scratches = 0;
 1757     fscratches = 0;
 1758     for (i = 0; i < 5; i++) {
 1759         curr_type = (types & SLJIT_DEF_MASK);
 1760         CHECK_ARGUMENT(curr_type <= SLJIT_ARG_TYPE_F64);
 1761         if (i > 0) {
 1762             if (curr_type == 0) {
 1763                 break;
 1764             }
 1765             if (curr_type >= SLJIT_ARG_TYPE_F32)
 1766                 fscratches++;
 1767             else
 1768                 scratches++;
 1769         } else {
 1770             if (curr_type >= SLJIT_ARG_TYPE_F32) {
 1771                 CHECK_ARGUMENT(compiler->fscratches > 0);
 1772             } else if (curr_type >= SLJIT_ARG_TYPE_SW) {
 1773                 CHECK_ARGUMENT(compiler->scratches > 0);
 1774             }
 1775         }
 1776         types >>= SLJIT_DEF_SHIFT;
 1777     }
 1778     CHECK_ARGUMENT(compiler->scratches >= scratches);
 1779     CHECK_ARGUMENT(compiler->fscratches >= fscratches);
 1780     CHECK_ARGUMENT(types == 0);
 1781 #endif
 1782 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1783     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1784         fprintf(compiler->verbose, "  i%s%s ret[%s", jump_names[type & 0xff],
 1785             !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r", call_arg_names[arg_types & SLJIT_DEF_MASK]);
 1786 
 1787         arg_types >>= SLJIT_DEF_SHIFT;
 1788         if (arg_types) {
 1789             fprintf(compiler->verbose, "], args[");
 1790             do {
 1791                 fprintf(compiler->verbose, "%s", call_arg_names[arg_types & SLJIT_DEF_MASK]);
 1792                 arg_types >>= SLJIT_DEF_SHIFT;
 1793                 if (arg_types)
 1794                     fprintf(compiler->verbose, ",");
 1795             } while (arg_types);
 1796         }
 1797         fprintf(compiler->verbose, "], ");
 1798         sljit_verbose_param(compiler, src, srcw);
 1799         fprintf(compiler->verbose, "\n");
 1800     }
 1801 #endif
 1802     CHECK_RETURN_OK;
 1803 }
 1804 
 1805 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
 1806     sljit_s32 dst, sljit_sw dstw,
 1807     sljit_s32 type)
 1808 {
 1809 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1810     CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_I32_OP)));
 1811     CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL && (type & 0xff) <= SLJIT_ORDERED_F64);
 1812     CHECK_ARGUMENT((type & 0xff) != GET_FLAG_TYPE(SLJIT_SET_CARRY) && (type & 0xff) != (GET_FLAG_TYPE(SLJIT_SET_CARRY) + 1));
 1813     CHECK_ARGUMENT(op == SLJIT_MOV || op == SLJIT_MOV32
 1814         || (GET_OPCODE(op) >= SLJIT_AND && GET_OPCODE(op) <= SLJIT_XOR));
 1815     CHECK_ARGUMENT(!(op & VARIABLE_FLAG_MASK));
 1816 
 1817     if ((type & 0xff) <= SLJIT_NOT_ZERO)
 1818         CHECK_ARGUMENT(compiler->last_flags & SLJIT_SET_Z);
 1819     else
 1820         CHECK_ARGUMENT((type & 0xff) == (compiler->last_flags & 0xff)
 1821             || ((type & 0xff) == SLJIT_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_OVERFLOW)
 1822             || ((type & 0xff) == SLJIT_MUL_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_MUL_OVERFLOW));
 1823 
 1824     FUNCTION_CHECK_DST(dst, dstw, 0);
 1825 
 1826     if (GET_OPCODE(op) >= SLJIT_ADD)
 1827         compiler->last_flags = GET_FLAG_TYPE(op) | (op & (SLJIT_I32_OP | SLJIT_SET_Z));
 1828 #endif
 1829 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1830     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1831         fprintf(compiler->verbose, "  flags%s %s%s, ",
 1832             !(op & SLJIT_SET_Z) ? "" : ".z",
 1833             GET_OPCODE(op) < SLJIT_OP2_BASE ? "mov" : op2_names[GET_OPCODE(op) - SLJIT_OP2_BASE],
 1834             GET_OPCODE(op) < SLJIT_OP2_BASE ? op1_names[GET_OPCODE(op) - SLJIT_OP1_BASE] : ((op & SLJIT_I32_OP) ? "32" : ""));
 1835         sljit_verbose_param(compiler, dst, dstw);
 1836         fprintf(compiler->verbose, ", %s%s\n", jump_names[type & 0xff], JUMP_POSTFIX(type));
 1837     }
 1838 #endif
 1839     CHECK_RETURN_OK;
 1840 }
 1841 
 1842 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_cmov(struct sljit_compiler *compiler, sljit_s32 type,
 1843     sljit_s32 dst_reg,
 1844     sljit_s32 src, sljit_sw srcw)
 1845 {
 1846 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1847     CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_I32_OP)));
 1848     CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL && (type & 0xff) <= SLJIT_ORDERED_F64);
 1849 
 1850     CHECK_ARGUMENT(compiler->scratches != -1 && compiler->saveds != -1);
 1851     CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(dst_reg & ~SLJIT_I32_OP));
 1852     if (src != SLJIT_IMM) {
 1853         CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(src));
 1854         CHECK_ARGUMENT(srcw == 0);
 1855     }
 1856 
 1857     if ((type & 0xff) <= SLJIT_NOT_ZERO)
 1858         CHECK_ARGUMENT(compiler->last_flags & SLJIT_SET_Z);
 1859     else
 1860         CHECK_ARGUMENT((type & 0xff) == (compiler->last_flags & 0xff)
 1861             || ((type & 0xff) == SLJIT_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_OVERFLOW)
 1862             || ((type & 0xff) == SLJIT_MUL_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_MUL_OVERFLOW));
 1863 #endif
 1864 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1865     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1866         fprintf(compiler->verbose, "  cmov%s %s%s, ",
 1867             !(dst_reg & SLJIT_I32_OP) ? "" : "32",
 1868             jump_names[type & 0xff], JUMP_POSTFIX(type));
 1869         sljit_verbose_reg(compiler, dst_reg & ~SLJIT_I32_OP);
 1870         fprintf(compiler->verbose, ", ");
 1871         sljit_verbose_param(compiler, src, srcw);
 1872         fprintf(compiler->verbose, "\n");
 1873     }
 1874 #endif
 1875     CHECK_RETURN_OK;
 1876 }
 1877 
 1878 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_mem(struct sljit_compiler *compiler, sljit_s32 type,
 1879     sljit_s32 reg,
 1880     sljit_s32 mem, sljit_sw memw)
 1881 {
 1882 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1883     CHECK_ARGUMENT((type & 0xff) >= SLJIT_MOV && (type & 0xff) <= SLJIT_MOV_P);
 1884     CHECK_ARGUMENT(!(type & SLJIT_I32_OP) || ((type & 0xff) != SLJIT_MOV && (type & 0xff) != SLJIT_MOV_U32 && (type & 0xff) != SLJIT_MOV_P));
 1885     CHECK_ARGUMENT((type & SLJIT_MEM_PRE) || (type & SLJIT_MEM_POST));
 1886     CHECK_ARGUMENT((type & (SLJIT_MEM_PRE | SLJIT_MEM_POST)) != (SLJIT_MEM_PRE | SLJIT_MEM_POST));
 1887     CHECK_ARGUMENT((type & ~(0xff | SLJIT_I32_OP | SLJIT_MEM_STORE | SLJIT_MEM_SUPP | SLJIT_MEM_PRE | SLJIT_MEM_POST)) == 0);
 1888 
 1889     FUNCTION_CHECK_SRC_MEM(mem, memw);
 1890     CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(reg));
 1891 
 1892     CHECK_ARGUMENT((mem & REG_MASK) != SLJIT_UNUSED && (mem & REG_MASK) != reg);
 1893 #endif
 1894 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1895     if (!(type & SLJIT_MEM_SUPP) && SLJIT_UNLIKELY(!!compiler->verbose)) {
 1896         if (sljit_emit_mem(compiler, type | SLJIT_MEM_SUPP, reg, mem, memw) == SLJIT_ERR_UNSUPPORTED)
 1897             fprintf(compiler->verbose, "  //");
 1898 
 1899         fprintf(compiler->verbose, "  mem%s.%s%s%s ",
 1900             !(type & SLJIT_I32_OP) ? "" : "32",
 1901             (type & SLJIT_MEM_STORE) ? "st" : "ld",
 1902             op1_names[(type & 0xff) - SLJIT_OP1_BASE],
 1903             (type & SLJIT_MEM_PRE) ? ".pre" : ".post");
 1904         sljit_verbose_reg(compiler, reg);
 1905         fprintf(compiler->verbose, ", ");
 1906         sljit_verbose_param(compiler, mem, memw);
 1907         fprintf(compiler->verbose, "\n");
 1908     }
 1909 #endif
 1910     CHECK_RETURN_OK;
 1911 }
 1912 
 1913 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fmem(struct sljit_compiler *compiler, sljit_s32 type,
 1914     sljit_s32 freg,
 1915     sljit_s32 mem, sljit_sw memw)
 1916 {
 1917 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1918     CHECK_ARGUMENT((type & 0xff) == SLJIT_MOV_F64);
 1919     CHECK_ARGUMENT((type & SLJIT_MEM_PRE) || (type & SLJIT_MEM_POST));
 1920     CHECK_ARGUMENT((type & (SLJIT_MEM_PRE | SLJIT_MEM_POST)) != (SLJIT_MEM_PRE | SLJIT_MEM_POST));
 1921     CHECK_ARGUMENT((type & ~(0xff | SLJIT_I32_OP | SLJIT_MEM_STORE | SLJIT_MEM_SUPP | SLJIT_MEM_PRE | SLJIT_MEM_POST)) == 0);
 1922 
 1923     FUNCTION_CHECK_SRC_MEM(mem, memw);
 1924     CHECK_ARGUMENT(FUNCTION_CHECK_IS_FREG(freg));
 1925 #endif
 1926 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1927     if (!(type & SLJIT_MEM_SUPP) && SLJIT_UNLIKELY(!!compiler->verbose)) {
 1928         if (sljit_emit_fmem(compiler, type | SLJIT_MEM_SUPP, freg, mem, memw) == SLJIT_ERR_UNSUPPORTED)
 1929             fprintf(compiler->verbose, "  //");
 1930 
 1931         fprintf(compiler->verbose, "  fmem.%s%s%s ",
 1932             (type & SLJIT_MEM_STORE) ? "st" : "ld",
 1933             !(type & SLJIT_I32_OP) ? ".f64" : ".f32",
 1934             (type & SLJIT_MEM_PRE) ? ".pre" : ".post");
 1935         sljit_verbose_freg(compiler, freg);
 1936         fprintf(compiler->verbose, ", ");
 1937         sljit_verbose_param(compiler, mem, memw);
 1938         fprintf(compiler->verbose, "\n");
 1939     }
 1940 #endif
 1941     CHECK_RETURN_OK;
 1942 }
 1943 
 1944 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset)
 1945 {
 1946     /* Any offset is allowed. */
 1947     SLJIT_UNUSED_ARG(offset);
 1948 
 1949 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1950     FUNCTION_CHECK_DST(dst, dstw, 0);
 1951 #endif
 1952 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1953     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1954         fprintf(compiler->verbose, "  local_base ");
 1955         sljit_verbose_param(compiler, dst, dstw);
 1956         fprintf(compiler->verbose, ", #%" SLJIT_PRINT_D "d\n", offset);
 1957     }
 1958 #endif
 1959     CHECK_RETURN_OK;
 1960 }
 1961 
 1962 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
 1963 {
 1964     SLJIT_UNUSED_ARG(init_value);
 1965 
 1966 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1967     FUNCTION_CHECK_DST(dst, dstw, 0);
 1968 #endif
 1969 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1970     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1971         fprintf(compiler->verbose, "  const ");
 1972         sljit_verbose_param(compiler, dst, dstw);
 1973         fprintf(compiler->verbose, ", #%" SLJIT_PRINT_D "d\n", init_value);
 1974     }
 1975 #endif
 1976     CHECK_RETURN_OK;
 1977 }
 1978 
 1979 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
 1980 {
 1981 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 1982     FUNCTION_CHECK_DST(dst, dstw, 0);
 1983 #endif
 1984 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 1985     if (SLJIT_UNLIKELY(!!compiler->verbose)) {
 1986         fprintf(compiler->verbose, "  put_label ");
 1987         sljit_verbose_param(compiler, dst, dstw);
 1988         fprintf(compiler->verbose, "\n");
 1989     }
 1990 #endif
 1991     CHECK_RETURN_OK;
 1992 }
 1993 
 1994 #endif /* SLJIT_ARGUMENT_CHECKS || SLJIT_VERBOSE */
 1995 
 1996 #define SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw) \
 1997     SLJIT_COMPILE_ASSERT(!(SLJIT_CONV_SW_FROM_F64 & 0x1) && !(SLJIT_CONV_F64_FROM_SW & 0x1), \
 1998         invalid_float_opcodes); \
 1999     if (GET_OPCODE(op) >= SLJIT_CONV_SW_FROM_F64 && GET_OPCODE(op) <= SLJIT_CMP_F64) { \
 2000         if (GET_OPCODE(op) == SLJIT_CMP_F64) { \
 2001             CHECK(check_sljit_emit_fop1_cmp(compiler, op, dst, dstw, src, srcw)); \
 2002             ADJUST_LOCAL_OFFSET(dst, dstw); \
 2003             ADJUST_LOCAL_OFFSET(src, srcw); \
 2004             return sljit_emit_fop1_cmp(compiler, op, dst, dstw, src, srcw); \
 2005         } \
 2006         if ((GET_OPCODE(op) | 0x1) == SLJIT_CONV_S32_FROM_F64) { \
 2007             CHECK(check_sljit_emit_fop1_conv_sw_from_f64(compiler, op, dst, dstw, src, srcw)); \
 2008             ADJUST_LOCAL_OFFSET(dst, dstw); \
 2009             ADJUST_LOCAL_OFFSET(src, srcw); \
 2010             return sljit_emit_fop1_conv_sw_from_f64(compiler, op, dst, dstw, src, srcw); \
 2011         } \
 2012         CHECK(check_sljit_emit_fop1_conv_f64_from_sw(compiler, op, dst, dstw, src, srcw)); \
 2013         ADJUST_LOCAL_OFFSET(dst, dstw); \
 2014         ADJUST_LOCAL_OFFSET(src, srcw); \
 2015         return sljit_emit_fop1_conv_f64_from_sw(compiler, op, dst, dstw, src, srcw); \
 2016     } \
 2017     CHECK(check_sljit_emit_fop1(compiler, op, dst, dstw, src, srcw)); \
 2018     ADJUST_LOCAL_OFFSET(dst, dstw); \
 2019     ADJUST_LOCAL_OFFSET(src, srcw);
 2020 
 2021 static SLJIT_INLINE sljit_s32 emit_mov_before_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
 2022 {
 2023     /* Return if don't need to do anything. */
 2024     if (op == SLJIT_UNUSED)
 2025         return SLJIT_SUCCESS;
 2026 
 2027 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
 2028     /* At the moment the pointer size is always equal to sljit_sw. May be changed in the future. */
 2029     if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_P))
 2030         return SLJIT_SUCCESS;
 2031 #else
 2032     if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_U32 || op == SLJIT_MOV_S32 || op == SLJIT_MOV_P))
 2033         return SLJIT_SUCCESS;
 2034 #endif
 2035 
 2036 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS) \
 2037         || (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 2038     compiler->skip_checks = 1;
 2039 #endif
 2040     return sljit_emit_op1(compiler, op, SLJIT_RETURN_REG, 0, src, srcw);
 2041 }
 2042 
 2043 #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) \
 2044         || (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC) \
 2045         || (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32) \
 2046         || ((defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS) && !(defined SLJIT_MIPS_REV && SLJIT_MIPS_REV >= 1 && SLJIT_MIPS_REV < 6))
 2047 
 2048 static SLJIT_INLINE sljit_s32 sljit_emit_cmov_generic(struct sljit_compiler *compiler, sljit_s32 type,
 2049     sljit_s32 dst_reg,
 2050     sljit_s32 src, sljit_sw srcw)
 2051 {
 2052     struct sljit_label *label;
 2053     struct sljit_jump *jump;
 2054     sljit_s32 op = (dst_reg & SLJIT_I32_OP) ? SLJIT_MOV32 : SLJIT_MOV;
 2055 
 2056 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
 2057         || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 2058     compiler->skip_checks = 1;
 2059 #endif
 2060     jump = sljit_emit_jump(compiler, type ^ 0x1);
 2061     FAIL_IF(!jump);
 2062 
 2063 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
 2064         || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 2065     compiler->skip_checks = 1;
 2066 #endif
 2067     FAIL_IF(sljit_emit_op1(compiler, op, dst_reg & ~SLJIT_I32_OP, 0, src, srcw));
 2068 
 2069 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
 2070         || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 2071     compiler->skip_checks = 1;
 2072 #endif
 2073     label = sljit_emit_label(compiler);
 2074     FAIL_IF(!label);
 2075     sljit_set_label(jump, label);
 2076     return SLJIT_SUCCESS;
 2077 }
 2078 
 2079 #endif
 2080 
 2081 /* CPU description section */
 2082 
 2083 #if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
 2084 #define SLJIT_CPUINFO_PART1 " 32bit ("
 2085 #elif (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
 2086 #define SLJIT_CPUINFO_PART1 " 64bit ("
 2087 #else
 2088 #error "Internal error: CPU type info missing"
 2089 #endif
 2090 
 2091 #if (defined SLJIT_LITTLE_ENDIAN && SLJIT_LITTLE_ENDIAN)
 2092 #define SLJIT_CPUINFO_PART2 "little endian + "
 2093 #elif (defined SLJIT_BIG_ENDIAN && SLJIT_BIG_ENDIAN)
 2094 #define SLJIT_CPUINFO_PART2 "big endian + "
 2095 #else
 2096 #error "Internal error: CPU type info missing"
 2097 #endif
 2098 
 2099 #if (defined SLJIT_UNALIGNED && SLJIT_UNALIGNED)
 2100 #define SLJIT_CPUINFO_PART3 "unaligned)"
 2101 #else
 2102 #define SLJIT_CPUINFO_PART3 "aligned)"
 2103 #endif
 2104 
 2105 #define SLJIT_CPUINFO SLJIT_CPUINFO_PART1 SLJIT_CPUINFO_PART2 SLJIT_CPUINFO_PART3
 2106 
 2107 #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
 2108 #   include "sljitNativeX86_common.c"
 2109 #elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
 2110 #   include "sljitNativeARM_32.c"
 2111 #elif (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
 2112 #   include "sljitNativeARM_32.c"
 2113 #elif (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
 2114 #   include "sljitNativeARM_T2_32.c"
 2115 #elif (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
 2116 #   include "sljitNativeARM_64.c"
 2117 #elif (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
 2118 #   include "sljitNativePPC_common.c"
 2119 #elif (defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
 2120 #   include "sljitNativeMIPS_common.c"
 2121 #elif (defined SLJIT_CONFIG_SPARC && SLJIT_CONFIG_SPARC)
 2122 #   include "sljitNativeSPARC_common.c"
 2123 #elif (defined SLJIT_CONFIG_S390X && SLJIT_CONFIG_S390X)
 2124 #   include "sljitNativeS390X.c"
 2125 #endif
 2126 
 2127 #if !(defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
 2128 
 2129 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_s32 type,
 2130     sljit_s32 src1, sljit_sw src1w,
 2131     sljit_s32 src2, sljit_sw src2w)
 2132 {
 2133     /* Default compare for most architectures. */
 2134     sljit_s32 flags, tmp_src, condition;
 2135     sljit_sw tmp_srcw;
 2136 
 2137     CHECK_ERROR_PTR();
 2138     CHECK_PTR(check_sljit_emit_cmp(compiler, type, src1, src1w, src2, src2w));
 2139 
 2140     condition = type & 0xff;
 2141 #if (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
 2142     if ((condition == SLJIT_EQUAL || condition == SLJIT_NOT_EQUAL)) {
 2143         if ((src1 & SLJIT_IMM) && !src1w) {
 2144             src1 = src2;
 2145             src1w = src2w;
 2146             src2 = SLJIT_IMM;
 2147             src2w = 0;
 2148         }
 2149         if ((src2 & SLJIT_IMM) && !src2w)
 2150             return emit_cmp_to0(compiler, type, src1, src1w);
 2151     }
 2152 #endif
 2153 
 2154     if (SLJIT_UNLIKELY((src1 & SLJIT_IMM) && !(src2 & SLJIT_IMM))) {
 2155         /* Immediate is preferred as second argument by most architectures. */
 2156         switch (condition) {
 2157         case SLJIT_LESS:
 2158             condition = SLJIT_GREATER;
 2159             break;
 2160         case SLJIT_GREATER_EQUAL:
 2161             condition = SLJIT_LESS_EQUAL;
 2162             break;
 2163         case SLJIT_GREATER:
 2164             condition = SLJIT_LESS;
 2165             break;
 2166         case SLJIT_LESS_EQUAL:
 2167             condition = SLJIT_GREATER_EQUAL;
 2168             break;
 2169         case SLJIT_SIG_LESS:
 2170             condition = SLJIT_SIG_GREATER;
 2171             break;
 2172         case SLJIT_SIG_GREATER_EQUAL:
 2173             condition = SLJIT_SIG_LESS_EQUAL;
 2174             break;
 2175         case SLJIT_SIG_GREATER:
 2176             condition = SLJIT_SIG_LESS;
 2177             break;
 2178         case SLJIT_SIG_LESS_EQUAL:
 2179             condition = SLJIT_SIG_GREATER_EQUAL;
 2180             break;
 2181         }
 2182 
 2183         type = condition | (type & (SLJIT_I32_OP | SLJIT_REWRITABLE_JUMP));
 2184         tmp_src = src1;
 2185         src1 = src2;
 2186         src2 = tmp_src;
 2187         tmp_srcw = src1w;
 2188         src1w = src2w;
 2189         src2w = tmp_srcw;
 2190     }
 2191 
 2192     if (condition <= SLJIT_NOT_ZERO)
 2193         flags = SLJIT_SET_Z;
 2194     else
 2195         flags = condition << VARIABLE_FLAG_SHIFT;
 2196 
 2197 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
 2198         || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 2199     compiler->skip_checks = 1;
 2200 #endif
 2201     PTR_FAIL_IF(sljit_emit_op2(compiler, SLJIT_SUB | flags | (type & SLJIT_I32_OP),
 2202         SLJIT_UNUSED, 0, src1, src1w, src2, src2w));
 2203 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
 2204         || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 2205     compiler->skip_checks = 1;
 2206 #endif
 2207     return sljit_emit_jump(compiler, condition | (type & (SLJIT_REWRITABLE_JUMP | SLJIT_I32_OP)));
 2208 }
 2209 
 2210 #endif
 2211 
 2212 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_s32 type,
 2213     sljit_s32 src1, sljit_sw src1w,
 2214     sljit_s32 src2, sljit_sw src2w)
 2215 {
 2216     CHECK_ERROR_PTR();
 2217     CHECK_PTR(check_sljit_emit_fcmp(compiler, type, src1, src1w, src2, src2w));
 2218 
 2219 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
 2220         || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 2221     compiler->skip_checks = 1;
 2222 #endif
 2223     sljit_emit_fop1(compiler, SLJIT_CMP_F64 | ((type & 0xff) << VARIABLE_FLAG_SHIFT) | (type & SLJIT_I32_OP), src1, src1w, src2, src2w);
 2224 
 2225 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
 2226         || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 2227     compiler->skip_checks = 1;
 2228 #endif
 2229     return sljit_emit_jump(compiler, type);
 2230 }
 2231 
 2232 #if !(defined SLJIT_CONFIG_ARM_32 && SLJIT_CONFIG_ARM_32) \
 2233     && !(defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64) \
 2234     && !(defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
 2235 
 2236 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_mem(struct sljit_compiler *compiler, sljit_s32 type,
 2237     sljit_s32 reg,
 2238     sljit_s32 mem, sljit_sw memw)
 2239 {
 2240     SLJIT_UNUSED_ARG(compiler);
 2241     SLJIT_UNUSED_ARG(type);
 2242     SLJIT_UNUSED_ARG(reg);
 2243     SLJIT_UNUSED_ARG(mem);
 2244     SLJIT_UNUSED_ARG(memw);
 2245 
 2246     CHECK_ERROR();
 2247     CHECK(check_sljit_emit_mem(compiler, type, reg, mem, memw));
 2248 
 2249     return SLJIT_ERR_UNSUPPORTED;
 2250 }
 2251 
 2252 #endif
 2253 
 2254 #if !(defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64) \
 2255     && !(defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
 2256 
 2257 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fmem(struct sljit_compiler *compiler, sljit_s32 type,
 2258     sljit_s32 freg,
 2259     sljit_s32 mem, sljit_sw memw)
 2260 {
 2261     SLJIT_UNUSED_ARG(compiler);
 2262     SLJIT_UNUSED_ARG(type);
 2263     SLJIT_UNUSED_ARG(freg);
 2264     SLJIT_UNUSED_ARG(mem);
 2265     SLJIT_UNUSED_ARG(memw);
 2266 
 2267     CHECK_ERROR();
 2268     CHECK(check_sljit_emit_fmem(compiler, type, freg, mem, memw));
 2269 
 2270     return SLJIT_ERR_UNSUPPORTED;
 2271 }
 2272 
 2273 #endif
 2274 
 2275 #if !(defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) \
 2276     && !(defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
 2277 
 2278 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset)
 2279 {
 2280     CHECK_ERROR();
 2281     CHECK(check_sljit_get_local_base(compiler, dst, dstw, offset));
 2282 
 2283     ADJUST_LOCAL_OFFSET(SLJIT_MEM1(SLJIT_SP), offset);
 2284 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
 2285         || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
 2286     compiler->skip_checks = 1;
 2287 #endif
 2288     if (offset != 0)
 2289         return sljit_emit_op2(compiler, SLJIT_ADD, dst, dstw, SLJIT_SP, 0, SLJIT_IMM, offset);
 2290     return sljit_emit_op1(compiler, SLJIT_MOV, dst, dstw, SLJIT_SP, 0);
 2291 }
 2292 
 2293 #endif
 2294 
 2295 #else /* SLJIT_CONFIG_UNSUPPORTED */
 2296 
 2297 /* Empty function bodies for those machines, which are not (yet) supported. */
 2298 
 2299 SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void)
 2300 {
 2301     return "unsupported";
 2302 }
 2303 
 2304 SLJIT_API_FUNC_ATTRIBUTE struct sljit_compiler* sljit_create_compiler(void *allocator_data, void *exec_allocator_data)
 2305 {
 2306     SLJIT_UNUSED_ARG(allocator_data);
 2307     SLJIT_UNUSED_ARG(exec_allocator_data);
 2308     SLJIT_UNREACHABLE();
 2309     return NULL;
 2310 }
 2311 
 2312 SLJIT_API_FUNC_ATTRIBUTE void sljit_free_compiler(struct sljit_compiler *compiler)
 2313 {
 2314     SLJIT_UNUSED_ARG(compiler);
 2315     SLJIT_UNREACHABLE();
 2316 }
 2317 
 2318 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_compiler_memory_error(struct sljit_compiler *compiler)
 2319 {
 2320     SLJIT_UNUSED_ARG(compiler);
 2321     SLJIT_UNREACHABLE();
 2322 }
 2323 
 2324 SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, sljit_s32 size)
 2325 {
 2326     SLJIT_UNUSED_ARG(compiler);
 2327     SLJIT_UNUSED_ARG(size);
 2328     SLJIT_UNREACHABLE();
 2329     return NULL;
 2330 }
 2331 
 2332 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 2333 SLJIT_API_FUNC_ATTRIBUTE void sljit_compiler_verbose(struct sljit_compiler *compiler, FILE* verbose)
 2334 {
 2335     SLJIT_UNUSED_ARG(compiler);
 2336     SLJIT_UNUSED_ARG(verbose);
 2337     SLJIT_UNREACHABLE();
 2338 }
 2339 #endif
 2340 
 2341 SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler)
 2342 {
 2343     SLJIT_UNUSED_ARG(compiler);
 2344     SLJIT_UNREACHABLE();
 2345     return NULL;
 2346 }
 2347 
 2348 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_has_cpu_feature(sljit_s32 feature_type)
 2349 {
 2350     SLJIT_UNUSED_ARG(feature_type);
 2351     SLJIT_UNREACHABLE();
 2352     return 0;
 2353 }
 2354 
 2355 SLJIT_API_FUNC_ATTRIBUTE void sljit_free_code(void* code, void *exec_allocator_data)
 2356 {
 2357     SLJIT_UNUSED_ARG(code);
 2358     SLJIT_UNUSED_ARG(exec_allocator_data);
 2359     SLJIT_UNREACHABLE();
 2360 }
 2361 
 2362 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
 2363     sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
 2364     sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 2365 {
 2366     SLJIT_UNUSED_ARG(compiler);
 2367     SLJIT_UNUSED_ARG(options);
 2368     SLJIT_UNUSED_ARG(arg_types);
 2369     SLJIT_UNUSED_ARG(scratches);
 2370     SLJIT_UNUSED_ARG(saveds);
 2371     SLJIT_UNUSED_ARG(fscratches);
 2372     SLJIT_UNUSED_ARG(fsaveds);
 2373     SLJIT_UNUSED_ARG(local_size);
 2374     SLJIT_UNREACHABLE();
 2375     return SLJIT_ERR_UNSUPPORTED;
 2376 }
 2377 
 2378 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
 2379     sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
 2380     sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
 2381 {
 2382     SLJIT_UNUSED_ARG(compiler);
 2383     SLJIT_UNUSED_ARG(options);
 2384     SLJIT_UNUSED_ARG(arg_types);
 2385     SLJIT_UNUSED_ARG(scratches);
 2386     SLJIT_UNUSED_ARG(saveds);
 2387     SLJIT_UNUSED_ARG(fscratches);
 2388     SLJIT_UNUSED_ARG(fsaveds);
 2389     SLJIT_UNUSED_ARG(local_size);
 2390     SLJIT_UNREACHABLE();
 2391     return SLJIT_ERR_UNSUPPORTED;
 2392 }
 2393 
 2394 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
 2395 {
 2396     SLJIT_UNUSED_ARG(compiler);
 2397     SLJIT_UNUSED_ARG(op);
 2398     SLJIT_UNUSED_ARG(src);
 2399     SLJIT_UNUSED_ARG(srcw);
 2400     SLJIT_UNREACHABLE();
 2401     return SLJIT_ERR_UNSUPPORTED;
 2402 }
 2403 
 2404 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
 2405 {
 2406     SLJIT_UNUSED_ARG(compiler);
 2407     SLJIT_UNUSED_ARG(dst);
 2408     SLJIT_UNUSED_ARG(dstw);
 2409     SLJIT_UNREACHABLE();
 2410     return SLJIT_ERR_UNSUPPORTED;
 2411 }
 2412 
 2413 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op)
 2414 {
 2415     SLJIT_UNUSED_ARG(compiler);
 2416     SLJIT_UNUSED_ARG(op);
 2417     SLJIT_UNREACHABLE();
 2418     return SLJIT_ERR_UNSUPPORTED;
 2419 }
 2420 
 2421 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op,
 2422     sljit_s32 dst, sljit_sw dstw,
 2423     sljit_s32 src, sljit_sw srcw)
 2424 {
 2425     SLJIT_UNUSED_ARG(compiler);
 2426     SLJIT_UNUSED_ARG(op);
 2427     SLJIT_UNUSED_ARG(dst);
 2428     SLJIT_UNUSED_ARG(dstw);
 2429     SLJIT_UNUSED_ARG(src);
 2430     SLJIT_UNUSED_ARG(srcw);
 2431     SLJIT_UNREACHABLE();
 2432     return SLJIT_ERR_UNSUPPORTED;
 2433 }
 2434 
 2435 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op,
 2436     sljit_s32 dst, sljit_sw dstw,
 2437     sljit_s32 src1, sljit_sw src1w,
 2438     sljit_s32 src2, sljit_sw src2w)
 2439 {
 2440     SLJIT_UNUSED_ARG(compiler);
 2441     SLJIT_UNUSED_ARG(op);
 2442     SLJIT_UNUSED_ARG(dst);
 2443     SLJIT_UNUSED_ARG(dstw);
 2444     SLJIT_UNUSED_ARG(src1);
 2445     SLJIT_UNUSED_ARG(src1w);
 2446     SLJIT_UNUSED_ARG(src2);
 2447     SLJIT_UNUSED_ARG(src2w);
 2448     SLJIT_UNREACHABLE();
 2449     return SLJIT_ERR_UNSUPPORTED;
 2450 }
 2451 
 2452 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_src(struct sljit_compiler *compiler, sljit_s32 op,
 2453     sljit_s32 src, sljit_sw srcw)
 2454 {
 2455     SLJIT_UNUSED_ARG(compiler);
 2456     SLJIT_UNUSED_ARG(op);
 2457     SLJIT_UNUSED_ARG(src);
 2458     SLJIT_UNUSED_ARG(srcw);
 2459     SLJIT_UNREACHABLE();
 2460     return SLJIT_ERR_UNSUPPORTED;
 2461 }
 2462 
 2463 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
 2464 {
 2465     SLJIT_UNREACHABLE();
 2466     return reg;
 2467 }
 2468 
 2469 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
 2470     void *instruction, sljit_s32 size)
 2471 {
 2472     SLJIT_UNUSED_ARG(compiler);
 2473     SLJIT_UNUSED_ARG(instruction);
 2474     SLJIT_UNUSED_ARG(size);
 2475     SLJIT_UNREACHABLE();
 2476     return SLJIT_ERR_UNSUPPORTED;
 2477 }
 2478 
 2479 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_current_flags(struct sljit_compiler *compiler, sljit_s32 current_flags)
 2480 {
 2481     SLJIT_UNUSED_ARG(compiler);
 2482     SLJIT_UNUSED_ARG(current_flags);
 2483 }
 2484 
 2485 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op,
 2486     sljit_s32 dst, sljit_sw dstw,
 2487     sljit_s32 src, sljit_sw srcw)
 2488 {
 2489     SLJIT_UNUSED_ARG(compiler);
 2490     SLJIT_UNUSED_ARG(op);
 2491     SLJIT_UNUSED_ARG(dst);
 2492     SLJIT_UNUSED_ARG(dstw);
 2493     SLJIT_UNUSED_ARG(src);
 2494     SLJIT_UNUSED_ARG(srcw);
 2495     SLJIT_UNREACHABLE();
 2496     return SLJIT_ERR_UNSUPPORTED;
 2497 }
 2498 
 2499 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op,
 2500     sljit_s32 dst, sljit_sw dstw,
 2501     sljit_s32 src1, sljit_sw src1w,
 2502     sljit_s32 src2, sljit_sw src2w)
 2503 {
 2504     SLJIT_UNUSED_ARG(compiler);
 2505     SLJIT_UNUSED_ARG(op);
 2506     SLJIT_UNUSED_ARG(dst);
 2507     SLJIT_UNUSED_ARG(dstw);
 2508     SLJIT_UNUSED_ARG(src1);
 2509     SLJIT_UNUSED_ARG(src1w);
 2510     SLJIT_UNUSED_ARG(src2);
 2511     SLJIT_UNUSED_ARG(src2w);
 2512     SLJIT_UNREACHABLE();
 2513     return SLJIT_ERR_UNSUPPORTED;
 2514 }
 2515 
 2516 SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compiler *compiler)
 2517 {
 2518     SLJIT_UNUSED_ARG(compiler);
 2519     SLJIT_UNREACHABLE();
 2520     return NULL;
 2521 }
 2522 
 2523 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_s32 type)
 2524 {
 2525     SLJIT_UNUSED_ARG(compiler);
 2526     SLJIT_UNUSED_ARG(type);
 2527     SLJIT_UNREACHABLE();
 2528     return NULL;
 2529 }
 2530 
 2531 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_call(struct sljit_compiler *compiler, sljit_s32 type,
 2532     sljit_s32 arg_types)
 2533 {
 2534     SLJIT_UNUSED_ARG(compiler);
 2535     SLJIT_UNUSED_ARG(type);
 2536     SLJIT_UNUSED_ARG(arg_types);
 2537     SLJIT_UNREACHABLE();
 2538     return NULL;
 2539 }
 2540 
 2541 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_s32 type,
 2542     sljit_s32 src1, sljit_sw src1w,
 2543     sljit_s32 src2, sljit_sw src2w)
 2544 {
 2545     SLJIT_UNUSED_ARG(compiler);
 2546     SLJIT_UNUSED_ARG(type);
 2547     SLJIT_UNUSED_ARG(src1);
 2548     SLJIT_UNUSED_ARG(src1w);
 2549     SLJIT_UNUSED_ARG(src2);
 2550     SLJIT_UNUSED_ARG(src2w);
 2551     SLJIT_UNREACHABLE();
 2552     return NULL;
 2553 }
 2554 
 2555 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_s32 type,
 2556     sljit_s32 src1, sljit_sw src1w,
 2557     sljit_s32 src2, sljit_sw src2w)
 2558 {
 2559     SLJIT_UNUSED_ARG(compiler);
 2560     SLJIT_UNUSED_ARG(type);
 2561     SLJIT_UNUSED_ARG(src1);
 2562     SLJIT_UNUSED_ARG(src1w);
 2563     SLJIT_UNUSED_ARG(src2);
 2564     SLJIT_UNUSED_ARG(src2w);
 2565     SLJIT_UNREACHABLE();
 2566     return NULL;
 2567 }
 2568 
 2569 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_label(struct sljit_jump *jump, struct sljit_label* label)
 2570 {
 2571     SLJIT_UNUSED_ARG(jump);
 2572     SLJIT_UNUSED_ARG(label);
 2573     SLJIT_UNREACHABLE();
 2574 }
 2575 
 2576 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_target(struct sljit_jump *jump, sljit_uw target)
 2577 {
 2578     SLJIT_UNUSED_ARG(jump);
 2579     SLJIT_UNUSED_ARG(target);
 2580     SLJIT_UNREACHABLE();
 2581 }
 2582 
 2583 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_put_label(struct sljit_put_label *put_label, struct sljit_label *label)
 2584 {
 2585     SLJIT_UNUSED_ARG(put_label);
 2586     SLJIT_UNUSED_ARG(label);
 2587     SLJIT_UNREACHABLE();
 2588 }
 2589 
 2590 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
 2591 {
 2592     SLJIT_UNUSED_ARG(compiler);
 2593     SLJIT_UNUSED_ARG(type);
 2594     SLJIT_UNUSED_ARG(src);
 2595     SLJIT_UNUSED_ARG(srcw);
 2596     SLJIT_UNREACHABLE();
 2597     return SLJIT_ERR_UNSUPPORTED;
 2598 }
 2599 
 2600 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type,
 2601     sljit_s32 arg_types,
 2602     sljit_s32 src, sljit_sw srcw)
 2603 {
 2604     SLJIT_UNUSED_ARG(compiler);
 2605     SLJIT_UNUSED_ARG(type);
 2606     SLJIT_UNUSED_ARG(arg_types);
 2607     SLJIT_UNUSED_ARG(src);
 2608     SLJIT_UNUSED_ARG(srcw);
 2609     SLJIT_UNREACHABLE();
 2610     return SLJIT_ERR_UNSUPPORTED;
 2611 }
 2612 
 2613 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
 2614     sljit_s32 dst, sljit_sw dstw,
 2615     sljit_s32 type)
 2616 {
 2617     SLJIT_UNUSED_ARG(compiler);
 2618     SLJIT_UNUSED_ARG(op);
 2619     SLJIT_UNUSED_ARG(dst);
 2620     SLJIT_UNUSED_ARG(dstw);
 2621     SLJIT_UNUSED_ARG(type);
 2622     SLJIT_UNREACHABLE();
 2623     return SLJIT_ERR_UNSUPPORTED;
 2624 }
 2625 
 2626 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_cmov(struct sljit_compiler *compiler, sljit_s32 type,
 2627     sljit_s32 dst_reg,
 2628     sljit_s32 src, sljit_sw srcw)
 2629 {
 2630     SLJIT_UNUSED_ARG(compiler);
 2631     SLJIT_UNUSED_ARG(type);
 2632     SLJIT_UNUSED_ARG(dst_reg);
 2633     SLJIT_UNUSED_ARG(src);
 2634     SLJIT_UNUSED_ARG(srcw);
 2635     SLJIT_UNREACHABLE();
 2636     return SLJIT_ERR_UNSUPPORTED;
 2637 }
 2638 
 2639 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_mem(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 reg, sljit_s32 mem, sljit_sw memw)
 2640 {
 2641     SLJIT_UNUSED_ARG(compiler);
 2642     SLJIT_UNUSED_ARG(type);
 2643     SLJIT_UNUSED_ARG(reg);
 2644     SLJIT_UNUSED_ARG(mem);
 2645     SLJIT_UNUSED_ARG(memw);
 2646     SLJIT_UNREACHABLE();
 2647     return SLJIT_ERR_UNSUPPORTED;
 2648 }
 2649 
 2650 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fmem(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 freg, sljit_s32 mem, sljit_sw memw)
 2651 {
 2652     SLJIT_UNUSED_ARG(compiler);
 2653     SLJIT_UNUSED_ARG(type);
 2654     SLJIT_UNUSED_ARG(freg);
 2655     SLJIT_UNUSED_ARG(mem);
 2656     SLJIT_UNUSED_ARG(memw);
 2657     SLJIT_UNREACHABLE();
 2658     return SLJIT_ERR_UNSUPPORTED;
 2659 }
 2660 
 2661 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset)
 2662 {
 2663     SLJIT_UNUSED_ARG(compiler);
 2664     SLJIT_UNUSED_ARG(dst);
 2665     SLJIT_UNUSED_ARG(dstw);
 2666     SLJIT_UNUSED_ARG(offset);
 2667     SLJIT_UNREACHABLE();
 2668     return SLJIT_ERR_UNSUPPORTED;
 2669 }
 2670 
 2671 SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw initval)
 2672 {
 2673     SLJIT_UNUSED_ARG(compiler);
 2674     SLJIT_UNUSED_ARG(dst);
 2675     SLJIT_UNUSED_ARG(dstw);
 2676     SLJIT_UNUSED_ARG(initval);
 2677     SLJIT_UNREACHABLE();
 2678     return NULL;
 2679 }
 2680 
 2681 SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
 2682 {
 2683     SLJIT_UNUSED_ARG(compiler);
 2684     SLJIT_UNUSED_ARG(dst);
 2685     SLJIT_UNUSED_ARG(dstw);
 2686     return NULL;
 2687 }
 2688 
 2689 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_target, sljit_sw executable_offset)
 2690 {
 2691     SLJIT_UNUSED_ARG(addr);
 2692     SLJIT_UNUSED_ARG(new_target);
 2693     SLJIT_UNUSED_ARG(executable_offset);
 2694     SLJIT_UNREACHABLE();
 2695 }
 2696 
 2697 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_constant, sljit_sw executable_offset)
 2698 {
 2699     SLJIT_UNUSED_ARG(addr);
 2700     SLJIT_UNUSED_ARG(new_constant);
 2701     SLJIT_UNUSED_ARG(executable_offset);
 2702     SLJIT_UNREACHABLE();
 2703 }
 2704 
 2705 #endif /* !SLJIT_CONFIG_UNSUPPORTED */