We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fa21fce commit 63965f1Copy full SHA for 63965f1
ext/opcache/jit/ir/ir.c
@@ -348,6 +348,12 @@ static void ir_grow_top(ir_ctx *ctx)
348
memset(ctx->use_lists + old_insns_limit, 0,
349
(ctx->insns_limit - old_insns_limit) * sizeof(ir_use_list));
350
}
351
+
352
+ if (ctx->cfg_map) {
353
+ ctx->cfg_map = ir_mem_realloc(ctx->cfg_map, ctx->insns_limit * sizeof(uint32_t));
354
+ memset(ctx->cfg_map + old_insns_limit, 0,
355
+ (ctx->insns_limit - old_insns_limit) * sizeof(uint32_t));
356
+ }
357
358
359
static ir_ref ir_next_insn(ir_ctx *ctx)
ext/opcache/jit/ir/ir.h
@@ -29,7 +29,9 @@ extern "C" {
29
# endif
30
/* Only supported is little endian for any arch on Windows,
31
so just fake the same for all. */
32
-# define __ORDER_LITTLE_ENDIAN__ 1
+# ifndef __ORDER_LITTLE_ENDIAN__
33
+# define __ORDER_LITTLE_ENDIAN__ 1
34
+# endif
35
# define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
36
# ifndef __has_builtin
37
# define __has_builtin(arg) (0)
@@ -958,10 +960,12 @@ IR_ALWAYS_INLINE void *ir_jit_compile(ir_ctx *ctx, int opt_level, size_t *size)
958
960
|| !ir_mem2ssa(ctx)) {
959
961
return NULL;
962
963
+ if (opt_level > 1) {
964
+ ir_reset_cfg(ctx);
965
966
967
968
if (opt_level > 1) {
- ir_reset_cfg(ctx);
969
if (!ir_sccp(ctx)) {
970
971
ext/opcache/jit/ir/ir_aarch64.dasc
@@ -925,7 +925,7 @@ binop_fp:
925
if (ctx->flags & IR_FUNCTION) {
926
ctx->flags |= IR_USE_FRAME_POINTER;
927
928
- ctx->flags2 |= IR_HAS_CALLS | IR_16B_FRAME_ALIGNMENT;
+ ctx->flags2 |= IR_HAS_CALLS;
929
return IR_CALL;
930
case IR_VAR:
931
return IR_SKIPPED | IR_VAR;
@@ -941,7 +941,7 @@ binop_fp:
941
942
943
944
- ctx->flags2 |= IR_HAS_ALLOCA | IR_16B_FRAME_ALIGNMENT;
+ ctx->flags2 |= IR_HAS_ALLOCA;
945
946
return IR_ALLOCA;
947
case IR_LOAD:
@@ -5788,12 +5788,12 @@ void ir_fix_stack_frame(ir_ctx *ctx)
5788
ctx->stack_frame_alignment = 0;
5789
ctx->call_stack_size = 0;
5790
5791
- if ((ctx->flags2 & IR_16B_FRAME_ALIGNMENT) && !(ctx->flags & IR_FUNCTION)) {
+ if (!(ctx->flags & IR_FUNCTION)) {
5792
while (IR_ALIGNED_SIZE(ctx->stack_frame_size, 16) != ctx->stack_frame_size) {
5793
ctx->stack_frame_size += sizeof(void*);
5794
ctx->stack_frame_alignment += sizeof(void*);
5795
5796
- } else if (ctx->flags2 & IR_16B_FRAME_ALIGNMENT) {
+ } else {
5797
/* Stack must be 16 byte aligned */
5798
if (!(ctx->flags & IR_FUNCTION)) {
5799
ext/opcache/jit/ir/ir_builder.h
@@ -461,7 +461,7 @@ extern "C" {
461
#define ir_COND_A(_op1, _op2, _op3) ir_fold3(_ir_CTX, IR_OPT(IR_COND, IR_ADDR), (_op1), (_op2), (_op3))
462
#define ir_COND_C(_op1, _op2, _op3) ir_fold3(_ir_CTX, IR_OPT(IR_COND, IR_CHAR), (_op1), (_op2), (_op3))
463
#define ir_COND_I8(_op1, _op2, _op3) ir_fold3(_ir_CTX, IR_OPT(IR_COND, IR_I8), (_op1), (_op2), (_op3))
464
-#define ir_COND_I16(_op1, _op2, _op3) ir_fold3(_ir_CTX, IR_OPT(IR_COMD, IR_I16), (_op1), (_op2), (_op3))
+#define ir_COND_I16(_op1, _op2, _op3) ir_fold3(_ir_CTX, IR_OPT(IR_COND, IR_I16), (_op1), (_op2), (_op3))
465
#define ir_COND_I32(_op1, _op2, _op3) ir_fold3(_ir_CTX, IR_OPT(IR_COND, IR_I32), (_op1), (_op2), (_op3))
466
#define ir_COND_I64(_op1, _op2, _op3) ir_fold3(_ir_CTX, IR_OPT(IR_COND, IR_I64), (_op1), (_op2), (_op3))
467
#define ir_COND_D(_op1, _op2, _op3) ir_fold3(_ir_CTX, IR_OPT(IR_COND, IR_DOUBLE), (_op1), (_op2), (_op3))
ext/opcache/jit/ir/ir_cfg.c
@@ -92,7 +92,7 @@ int ir_build_cfg(ir_ctx *ctx)
92
uint32_t len = ir_bitset_len(ctx->insns_count);
93
ir_bitset bb_starts = ir_mem_calloc(len * 2, IR_BITSET_BITS / 8);
94
ir_bitset bb_leaks = bb_starts + len;
95
- _blocks = ir_mem_calloc(ctx->insns_count, sizeof(uint32_t));
+ _blocks = ir_mem_calloc(ctx->insns_limit, sizeof(uint32_t));
96
ir_worklist_init(&worklist, ctx->insns_count);
97
98
/* First try to perform backward DFS search starting from "stop" nodes */
ext/opcache/jit/ir/ir_check.c
@@ -291,6 +291,12 @@ bool ir_check(const ir_ctx *ctx)
291
ok = 0;
292
293
break;
294
+ case IR_PARAM:
295
+ if (i > 2 && ctx->ir_base[i - 1].op != IR_PARAM) {
296
+ fprintf(stderr, "ir_base[%d].op PARAMs must be used only right after START\n", i);
297
+ ok = 0;
298
299
+ break;
300
301
302
if (ctx->use_lists) {
ext/opcache/jit/ir/ir_emit.c
@@ -272,10 +272,10 @@ static bool ir_is_same_mem_var(const ir_ctx *ctx, ir_ref r1, int32_t offset)
272
273
void *ir_resolve_sym_name(const char *name)
274
{
275
- void *handle = NULL;
276
void *addr;
277
278
#ifndef _WIN32
+ void *handle = NULL;
279
# ifdef RTLD_DEFAULT
280
handle = RTLD_DEFAULT;
281
ext/opcache/jit/ir/ir_private.h
@@ -137,9 +137,10 @@ IR_ALWAYS_INLINE uint32_t ir_ntz(uint32_t num)
137
/* Number of trailing zero bits (0x01 -> 0; 0x40 -> 6; 0x00 -> LEN) */
138
IR_ALWAYS_INLINE uint32_t ir_ntzl(uint64_t num)
139
140
-#if (defined(__GNUC__) || __has_builtin(__builtin_ctzl))
141
- return __builtin_ctzl(num);
142
-#elif defined(_WIN64)
+ // Note that the _WIN64 case should come before __has_builtin() below so that
+ // clang-cl on Windows will use the uint64_t version, not the "long" uint32_t
+ // version.
143
+#if defined(_WIN64)
144
unsigned long index;
145
146
if (!_BitScanForward64(&index, num)) {
@@ -148,6 +149,8 @@ IR_ALWAYS_INLINE uint32_t ir_ntzl(uint64_t num)
148
149
150
151
return (uint32_t) index;
152
+#elif (defined(__GNUC__) || __has_builtin(__builtin_ctzl))
153
+ return __builtin_ctzl(num);
154
#else
155
uint32_t n;
156
0 commit comments