2 * Stack-less Just-In-Time compiler
4 * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
6 * Redistribution and use in source and binary forms, with or without modification, are
7 * permitted provided that the following conditions are met:
9 * 1. Redistributions of source code must retain the above copyright notice, this list of
10 * conditions and the following disclaimer.
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.
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.
27 /* ppc 64-bit arch dependent functions. */
29 #if defined(__GNUC__) || (defined(__IBM_GCC_ASM) && __IBM_GCC_ASM)
30 #define ASM_SLJIT_CLZ(src, dst) \
31 __asm__ volatile ( "cntlzd %0, %1" : "=r"(dst) : "r"(src) )
32 #elif defined(__xlc__)
33 #error "Please enable GCC syntax for inline assembly statements"
35 #error "Must implement count leading zeroes"
38 #define PUSH_RLDICR(reg, shift) \
39 push_inst(compiler, RLDI(reg, reg, 63 - shift, shift, 1))
41 static sljit_s32
load_immediate(struct sljit_compiler
*compiler
, sljit_s32 reg
, sljit_sw imm
)
48 if (imm
<= SIMM_MAX
&& imm
>= SIMM_MIN
)
49 return push_inst(compiler
, ADDI
| D(reg
) | A(0) | IMM(imm
));
52 return push_inst(compiler
, ORI
| S(TMP_ZERO
) | A(reg
) | IMM(imm
));
54 if (imm
<= 0x7fffffffl
&& imm
>= -0x80000000l
) {
55 FAIL_IF(push_inst(compiler
, ADDIS
| D(reg
) | A(0) | IMM(imm
>> 16)));
56 return (imm
& 0xffff) ? push_inst(compiler
, ORI
| S(reg
) | A(reg
) | IMM(imm
)) : SLJIT_SUCCESS
;
59 /* Count leading zeroes. */
60 tmp
= (imm
>= 0) ? imm
: ~imm
;
61 ASM_SLJIT_CLZ(tmp
, shift
);
62 SLJIT_ASSERT(shift
> 0);
66 if ((tmp
& ~0xffff000000000000ul
) == 0) {
67 FAIL_IF(push_inst(compiler
, ADDI
| D(reg
) | A(0) | IMM(tmp
>> 48)));
69 return PUSH_RLDICR(reg
, shift
);
72 if ((tmp
& ~0xffffffff00000000ul
) == 0) {
73 FAIL_IF(push_inst(compiler
, ADDIS
| D(reg
) | A(0) | IMM(tmp
>> 48)));
74 FAIL_IF(push_inst(compiler
, ORI
| S(reg
) | A(reg
) | IMM(tmp
>> 32)));
76 return PUSH_RLDICR(reg
, shift
);
79 /* Cut out the 16 bit from immediate. */
81 tmp2
= imm
& ((1ul << (63 - shift
)) - 1);
84 FAIL_IF(push_inst(compiler
, ADDI
| D(reg
) | A(0) | IMM(tmp
>> 48)));
85 FAIL_IF(PUSH_RLDICR(reg
, shift
));
86 return push_inst(compiler
, ORI
| S(reg
) | A(reg
) | tmp2
);
89 if (tmp2
<= 0xffffffff) {
90 FAIL_IF(push_inst(compiler
, ADDI
| D(reg
) | A(0) | IMM(tmp
>> 48)));
91 FAIL_IF(PUSH_RLDICR(reg
, shift
));
92 FAIL_IF(push_inst(compiler
, ORIS
| S(reg
) | A(reg
) | (tmp2
>> 16)));
93 return (imm
& 0xffff) ? push_inst(compiler
, ORI
| S(reg
) | A(reg
) | IMM(tmp2
)) : SLJIT_SUCCESS
;
96 ASM_SLJIT_CLZ(tmp2
, shift2
);
99 if ((tmp2
& ~0xffff000000000000ul
) == 0) {
100 FAIL_IF(push_inst(compiler
, ADDI
| D(reg
) | A(0) | IMM(tmp
>> 48)));
102 shift
+= (63 - shift2
);
103 FAIL_IF(PUSH_RLDICR(reg
, shift
));
104 FAIL_IF(push_inst(compiler
, ORI
| S(reg
) | A(reg
) | (tmp2
>> 48)));
105 return PUSH_RLDICR(reg
, shift2
);
108 /* The general version. */
109 FAIL_IF(push_inst(compiler
, ADDIS
| D(reg
) | A(0) | IMM(imm
>> 48)));
110 FAIL_IF(push_inst(compiler
, ORI
| S(reg
) | A(reg
) | IMM(imm
>> 32)));
111 FAIL_IF(PUSH_RLDICR(reg
, 31));
112 FAIL_IF(push_inst(compiler
, ORIS
| S(reg
) | A(reg
) | IMM(imm
>> 16)));
113 return push_inst(compiler
, ORI
| S(reg
) | A(reg
) | IMM(imm
));
116 /* Simplified mnemonics: clrldi. */
117 #define INS_CLEAR_LEFT(dst, src, from) \
118 (RLDICL | S(src) | A(dst) | ((from) << 6) | (1 << 5))
120 /* Sign extension for integer operations. */
122 if ((flags & (ALT_SIGN_EXT | REG2_SOURCE)) == (ALT_SIGN_EXT | REG2_SOURCE)) { \
123 FAIL_IF(push_inst(compiler, EXTSW | S(src2) | A(TMP_REG2))); \
128 if (flags & ALT_SIGN_EXT) { \
129 if (flags & REG1_SOURCE) { \
130 FAIL_IF(push_inst(compiler, EXTSW | S(src1) | A(TMP_REG1))); \
133 if (flags & REG2_SOURCE) { \
134 FAIL_IF(push_inst(compiler, EXTSW | S(src2) | A(TMP_REG2))); \
139 #define BIN_IMM_EXTS() \
140 if ((flags & (ALT_SIGN_EXT | REG1_SOURCE)) == (ALT_SIGN_EXT | REG1_SOURCE)) { \
141 FAIL_IF(push_inst(compiler, EXTSW | S(src1) | A(TMP_REG1))); \
145 static SLJIT_INLINE sljit_s32
emit_single_op(struct sljit_compiler
*compiler
, sljit_s32 op
, sljit_s32 flags
,
146 sljit_s32 dst
, sljit_s32 src1
, sljit_s32 src2
)
151 SLJIT_ASSERT(src1
== TMP_REG1
);
153 return push_inst(compiler
, OR
| S(src2
) | A(dst
) | B(src2
));
154 return SLJIT_SUCCESS
;
158 SLJIT_ASSERT(src1
== TMP_REG1
);
159 if ((flags
& (REG_DEST
| REG2_SOURCE
)) == (REG_DEST
| REG2_SOURCE
)) {
160 if (op
== SLJIT_MOV_S32
)
161 return push_inst(compiler
, EXTSW
| S(src2
) | A(dst
));
162 return push_inst(compiler
, INS_CLEAR_LEFT(dst
, src2
, 0));
165 SLJIT_ASSERT(dst
== src2
);
167 return SLJIT_SUCCESS
;
171 SLJIT_ASSERT(src1
== TMP_REG1
);
172 if ((flags
& (REG_DEST
| REG2_SOURCE
)) == (REG_DEST
| REG2_SOURCE
)) {
173 if (op
== SLJIT_MOV_S8
)
174 return push_inst(compiler
, EXTSB
| S(src2
) | A(dst
));
175 return push_inst(compiler
, INS_CLEAR_LEFT(dst
, src2
, 24));
177 else if ((flags
& REG_DEST
) && op
== SLJIT_MOV_S8
)
178 return push_inst(compiler
, EXTSB
| S(src2
) | A(dst
));
180 SLJIT_ASSERT(dst
== src2
);
182 return SLJIT_SUCCESS
;
186 SLJIT_ASSERT(src1
== TMP_REG1
);
187 if ((flags
& (REG_DEST
| REG2_SOURCE
)) == (REG_DEST
| REG2_SOURCE
)) {
188 if (op
== SLJIT_MOV_S16
)
189 return push_inst(compiler
, EXTSH
| S(src2
) | A(dst
));
190 return push_inst(compiler
, INS_CLEAR_LEFT(dst
, src2
, 16));
193 SLJIT_ASSERT(dst
== src2
);
195 return SLJIT_SUCCESS
;
198 SLJIT_ASSERT(src1
== TMP_REG1
);
200 return push_inst(compiler
, NOR
| RC(flags
) | S(src2
) | A(dst
) | B(src2
));
203 SLJIT_ASSERT(src1
== TMP_REG1
);
205 if ((flags
& (ALT_FORM1
| ALT_SIGN_EXT
)) == (ALT_FORM1
| ALT_SIGN_EXT
)) {
206 FAIL_IF(push_inst(compiler
, RLDI(TMP_REG2
, src2
, 32, 31, 1)));
207 FAIL_IF(push_inst(compiler
, NEG
| OE(ALT_SET_FLAGS
) | RC(ALT_SET_FLAGS
) | D(dst
) | A(TMP_REG2
)));
208 return push_inst(compiler
, RLDI(dst
, dst
, 32, 32, 0));
212 /* Setting XER SO is not enough, CR SO is also needed. */
213 return push_inst(compiler
, NEG
| OE((flags
& ALT_FORM1
) ? ALT_SET_FLAGS
: 0) | RC(flags
) | D(dst
) | A(src2
));
216 SLJIT_ASSERT(src1
== TMP_REG1
);
217 if (flags
& ALT_FORM1
)
218 return push_inst(compiler
, CNTLZW
| S(src2
) | A(dst
));
219 return push_inst(compiler
, CNTLZD
| S(src2
) | A(dst
));
222 if (flags
& ALT_FORM1
) {
223 if (flags
& ALT_SIGN_EXT
) {
224 FAIL_IF(push_inst(compiler
, RLDI(TMP_REG1
, src1
, 32, 31, 1)));
226 FAIL_IF(push_inst(compiler
, RLDI(TMP_REG2
, src2
, 32, 31, 1)));
229 /* Setting XER SO is not enough, CR SO is also needed. */
230 FAIL_IF(push_inst(compiler
, ADD
| OE(ALT_SET_FLAGS
) | RC(ALT_SET_FLAGS
) | D(dst
) | A(src1
) | B(src2
)));
231 if (flags
& ALT_SIGN_EXT
)
232 return push_inst(compiler
, RLDI(dst
, dst
, 32, 32, 0));
233 return SLJIT_SUCCESS
;
236 if (flags
& ALT_FORM2
) {
237 /* Flags does not set: BIN_IMM_EXTS unnecessary. */
238 SLJIT_ASSERT(src2
== TMP_REG2
);
240 if (flags
& ALT_FORM3
)
241 return push_inst(compiler
, ADDIS
| D(dst
) | A(src1
) | compiler
->imm
);
243 if (flags
& ALT_FORM4
) {
244 FAIL_IF(push_inst(compiler
, ADDIS
| D(dst
) | A(src1
) | (((compiler
->imm
>> 16) & 0xffff) + ((compiler
->imm
>> 15) & 0x1))));
248 return push_inst(compiler
, ADDI
| D(dst
) | A(src1
) | (compiler
->imm
& 0xffff));
250 if (flags
& ALT_FORM3
) {
251 SLJIT_ASSERT(src2
== TMP_REG2
);
253 return push_inst(compiler
, ADDIC
| D(dst
) | A(src1
) | compiler
->imm
);
255 if (flags
& ALT_FORM4
) {
256 if (flags
& ALT_FORM5
)
257 FAIL_IF(push_inst(compiler
, ADDI
| D(dst
) | A(src1
) | compiler
->imm
));
259 FAIL_IF(push_inst(compiler
, ADD
| D(dst
) | A(src1
) | B(src2
)));
260 return push_inst(compiler
, CMPI
| A(dst
) | 0);
262 if (!(flags
& ALT_SET_FLAGS
))
263 return push_inst(compiler
, ADD
| D(dst
) | A(src1
) | B(src2
));
265 if (flags
& ALT_FORM5
)
266 return push_inst(compiler
, ADDC
| RC(ALT_SET_FLAGS
) | D(dst
) | A(src1
) | B(src2
));
267 return push_inst(compiler
, ADD
| RC(flags
) | D(dst
) | A(src1
) | B(src2
));
271 return push_inst(compiler
, ADDE
| D(dst
) | A(src1
) | B(src2
));
274 if (flags
& ALT_FORM1
) {
275 if (flags
& ALT_FORM2
) {
276 FAIL_IF(push_inst(compiler
, CMPLI
| CRD(0 | ((flags
& ALT_SIGN_EXT
) ? 0 : 1)) | A(src1
) | compiler
->imm
));
277 if (!(flags
& ALT_FORM3
))
278 return SLJIT_SUCCESS
;
279 return push_inst(compiler
, ADDI
| D(dst
) | A(src1
) | (-compiler
->imm
& 0xffff));
281 FAIL_IF(push_inst(compiler
, CMPL
| CRD(0 | ((flags
& ALT_SIGN_EXT
) ? 0 : 1)) | A(src1
) | B(src2
)));
282 if (!(flags
& ALT_FORM3
))
283 return SLJIT_SUCCESS
;
284 return push_inst(compiler
, SUBF
| D(dst
) | A(src2
) | B(src1
));
287 if (flags
& ALT_FORM2
) {
288 if (flags
& ALT_FORM3
) {
289 FAIL_IF(push_inst(compiler
, CMPI
| CRD(0 | ((flags
& ALT_SIGN_EXT
) ? 0 : 1)) | A(src1
) | compiler
->imm
));
290 if (!(flags
& ALT_FORM4
))
291 return SLJIT_SUCCESS
;
292 return push_inst(compiler
, ADDI
| D(dst
) | A(src1
) | (-compiler
->imm
& 0xffff));
294 FAIL_IF(push_inst(compiler
, CMP
| CRD(0 | ((flags
& ALT_SIGN_EXT
) ? 0 : 1)) | A(src1
) | B(src2
)));
295 if (!(flags
& ALT_FORM4
))
296 return SLJIT_SUCCESS
;
297 return push_inst(compiler
, SUBF
| D(dst
) | A(src2
) | B(src1
));
300 if (flags
& ALT_FORM3
) {
301 if (flags
& ALT_SIGN_EXT
) {
302 FAIL_IF(push_inst(compiler
, RLDI(TMP_REG1
, src1
, 32, 31, 1)));
304 FAIL_IF(push_inst(compiler
, RLDI(TMP_REG2
, src2
, 32, 31, 1)));
307 /* Setting XER SO is not enough, CR SO is also needed. */
308 FAIL_IF(push_inst(compiler
, SUBF
| OE(ALT_SET_FLAGS
) | RC(ALT_SET_FLAGS
) | D(dst
) | A(src2
) | B(src1
)));
309 if (flags
& ALT_SIGN_EXT
)
310 return push_inst(compiler
, RLDI(dst
, dst
, 32, 32, 0));
311 return SLJIT_SUCCESS
;
314 if (flags
& ALT_FORM4
) {
315 /* Flags does not set: BIN_IMM_EXTS unnecessary. */
316 SLJIT_ASSERT(src2
== TMP_REG2
);
317 return push_inst(compiler
, SUBFIC
| D(dst
) | A(src1
) | compiler
->imm
);
320 if (!(flags
& ALT_SET_FLAGS
))
321 return push_inst(compiler
, SUBF
| D(dst
) | A(src2
) | B(src1
));
323 if (flags
& ALT_FORM5
)
324 return push_inst(compiler
, SUBFC
| RC(ALT_SET_FLAGS
) | D(dst
) | A(src2
) | B(src1
));
325 return push_inst(compiler
, SUBF
| RC(flags
) | D(dst
) | A(src2
) | B(src1
));
329 return push_inst(compiler
, SUBFE
| D(dst
) | A(src2
) | B(src1
));
332 if (flags
& ALT_FORM1
) {
333 SLJIT_ASSERT(src2
== TMP_REG2
);
334 return push_inst(compiler
, MULLI
| D(dst
) | A(src1
) | compiler
->imm
);
337 if (flags
& ALT_FORM2
)
338 return push_inst(compiler
, MULLW
| OE(flags
) | RC(flags
) | D(dst
) | A(src2
) | B(src1
));
339 return push_inst(compiler
, MULLD
| OE(flags
) | RC(flags
) | D(dst
) | A(src2
) | B(src1
));
342 if (flags
& ALT_FORM1
) {
343 SLJIT_ASSERT(src2
== TMP_REG2
);
344 return push_inst(compiler
, ANDI
| S(src1
) | A(dst
) | compiler
->imm
);
346 if (flags
& ALT_FORM2
) {
347 SLJIT_ASSERT(src2
== TMP_REG2
);
348 return push_inst(compiler
, ANDIS
| S(src1
) | A(dst
) | compiler
->imm
);
350 return push_inst(compiler
, AND
| RC(flags
) | S(src1
) | A(dst
) | B(src2
));
353 if (flags
& ALT_FORM1
) {
354 SLJIT_ASSERT(src2
== TMP_REG2
);
355 return push_inst(compiler
, ORI
| S(src1
) | A(dst
) | compiler
->imm
);
357 if (flags
& ALT_FORM2
) {
358 SLJIT_ASSERT(src2
== TMP_REG2
);
359 return push_inst(compiler
, ORIS
| S(src1
) | A(dst
) | compiler
->imm
);
361 if (flags
& ALT_FORM3
) {
362 SLJIT_ASSERT(src2
== TMP_REG2
);
363 FAIL_IF(push_inst(compiler
, ORI
| S(src1
) | A(dst
) | IMM(compiler
->imm
)));
364 return push_inst(compiler
, ORIS
| S(dst
) | A(dst
) | IMM(compiler
->imm
>> 16));
366 return push_inst(compiler
, OR
| RC(flags
) | S(src1
) | A(dst
) | B(src2
));
369 if (flags
& ALT_FORM1
) {
370 SLJIT_ASSERT(src2
== TMP_REG2
);
371 return push_inst(compiler
, XORI
| S(src1
) | A(dst
) | compiler
->imm
);
373 if (flags
& ALT_FORM2
) {
374 SLJIT_ASSERT(src2
== TMP_REG2
);
375 return push_inst(compiler
, XORIS
| S(src1
) | A(dst
) | compiler
->imm
);
377 if (flags
& ALT_FORM3
) {
378 SLJIT_ASSERT(src2
== TMP_REG2
);
379 FAIL_IF(push_inst(compiler
, XORI
| S(src1
) | A(dst
) | IMM(compiler
->imm
)));
380 return push_inst(compiler
, XORIS
| S(dst
) | A(dst
) | IMM(compiler
->imm
>> 16));
382 return push_inst(compiler
, XOR
| RC(flags
) | S(src1
) | A(dst
) | B(src2
));
385 if (flags
& ALT_FORM1
) {
386 SLJIT_ASSERT(src2
== TMP_REG2
);
387 if (flags
& ALT_FORM2
) {
388 compiler
->imm
&= 0x1f;
389 return push_inst(compiler
, RLWINM
| RC(flags
) | S(src1
) | A(dst
) | (compiler
->imm
<< 11) | ((31 - compiler
->imm
) << 1));
391 compiler
->imm
&= 0x3f;
392 return push_inst(compiler
, RLDI(dst
, src1
, compiler
->imm
, 63 - compiler
->imm
, 1) | RC(flags
));
394 return push_inst(compiler
, ((flags
& ALT_FORM2
) ? SLW
: SLD
) | RC(flags
) | S(src1
) | A(dst
) | B(src2
));
397 if (flags
& ALT_FORM1
) {
398 SLJIT_ASSERT(src2
== TMP_REG2
);
399 if (flags
& ALT_FORM2
) {
400 compiler
->imm
&= 0x1f;
401 return push_inst(compiler
, RLWINM
| RC(flags
) | S(src1
) | A(dst
) | (((32 - compiler
->imm
) & 0x1f) << 11) | (compiler
->imm
<< 6) | (31 << 1));
403 compiler
->imm
&= 0x3f;
404 return push_inst(compiler
, RLDI(dst
, src1
, 64 - compiler
->imm
, compiler
->imm
, 0) | RC(flags
));
406 return push_inst(compiler
, ((flags
& ALT_FORM2
) ? SRW
: SRD
) | RC(flags
) | S(src1
) | A(dst
) | B(src2
));
409 if (flags
& ALT_FORM1
) {
410 SLJIT_ASSERT(src2
== TMP_REG2
);
411 if (flags
& ALT_FORM2
) {
412 compiler
->imm
&= 0x1f;
413 return push_inst(compiler
, SRAWI
| RC(flags
) | S(src1
) | A(dst
) | (compiler
->imm
<< 11));
415 compiler
->imm
&= 0x3f;
416 return push_inst(compiler
, SRADI
| RC(flags
) | S(src1
) | A(dst
) | ((compiler
->imm
& 0x1f) << 11) | ((compiler
->imm
& 0x20) >> 4));
418 return push_inst(compiler
, ((flags
& ALT_FORM2
) ? SRAW
: SRAD
) | RC(flags
) | S(src1
) | A(dst
) | B(src2
));
422 return SLJIT_SUCCESS
;
425 static sljit_s32
call_with_args(struct sljit_compiler
*compiler
, sljit_s32 arg_types
, sljit_s32
*src
)
427 sljit_s32 arg_count
= 0;
428 sljit_s32 word_arg_count
= 0;
433 reg
= *src
& REG_MASK
;
435 arg_types
>>= SLJIT_ARG_SHIFT
;
438 types
= (types
<< SLJIT_ARG_SHIFT
) | (arg_types
& SLJIT_ARG_MASK
);
440 switch (arg_types
& SLJIT_ARG_MASK
) {
441 case SLJIT_ARG_TYPE_F32
:
442 case SLJIT_ARG_TYPE_F64
:
449 if (arg_count
!= word_arg_count
&& arg_count
== reg
) {
450 FAIL_IF(push_inst(compiler
, OR
| S(reg
) | A(TMP_CALL_REG
) | B(reg
)));
456 arg_types
>>= SLJIT_ARG_SHIFT
;
460 switch (types
& SLJIT_ARG_MASK
) {
461 case SLJIT_ARG_TYPE_F32
:
462 case SLJIT_ARG_TYPE_F64
:
466 if (arg_count
!= word_arg_count
)
467 FAIL_IF(push_inst(compiler
, OR
| S(word_arg_count
) | A(arg_count
) | B(word_arg_count
)));
474 types
>>= SLJIT_ARG_SHIFT
;
477 return SLJIT_SUCCESS
;
480 static SLJIT_INLINE sljit_s32
emit_const(struct sljit_compiler
*compiler
, sljit_s32 reg
, sljit_sw init_value
)
482 FAIL_IF(push_inst(compiler
, ADDIS
| D(reg
) | A(0) | IMM(init_value
>> 48)));
483 FAIL_IF(push_inst(compiler
, ORI
| S(reg
) | A(reg
) | IMM(init_value
>> 32)));
484 FAIL_IF(PUSH_RLDICR(reg
, 31));
485 FAIL_IF(push_inst(compiler
, ORIS
| S(reg
) | A(reg
) | IMM(init_value
>> 16)));
486 return push_inst(compiler
, ORI
| S(reg
) | A(reg
) | IMM(init_value
));
489 SLJIT_API_FUNC_ATTRIBUTE
void sljit_set_jump_addr(sljit_uw addr
, sljit_uw new_target
, sljit_sw executable_offset
)
491 sljit_ins
*inst
= (sljit_ins
*)addr
;
492 SLJIT_UNUSED_ARG(executable_offset
);
494 SLJIT_UPDATE_WX_FLAGS(inst
, inst
+ 5, 0);
495 inst
[0] = (inst
[0] & 0xffff0000) | ((new_target
>> 48) & 0xffff);
496 inst
[1] = (inst
[1] & 0xffff0000) | ((new_target
>> 32) & 0xffff);
497 inst
[3] = (inst
[3] & 0xffff0000) | ((new_target
>> 16) & 0xffff);
498 inst
[4] = (inst
[4] & 0xffff0000) | (new_target
& 0xffff);
499 SLJIT_UPDATE_WX_FLAGS(inst
, inst
+ 5, 1);
500 inst
= (sljit_ins
*)SLJIT_ADD_EXEC_OFFSET(inst
, executable_offset
);
501 SLJIT_CACHE_FLUSH(inst
, inst
+ 5);
504 SLJIT_API_FUNC_ATTRIBUTE
void sljit_set_const(sljit_uw addr
, sljit_sw new_constant
, sljit_sw executable_offset
)
506 sljit_set_jump_addr(addr
, new_constant
, executable_offset
);