Skip to content

Commit 6b1e64d

Browse files
committed
Revert "Boolify JIT"
This is severely broken, better leave as it was before. This reverts commit d0b43cd.
1 parent 52f06c8 commit 6b1e64d

File tree

6 files changed

+53
-55
lines changed

6 files changed

+53
-55
lines changed

ext/opcache/jit/zend_jit.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ static const void *zend_jit_func_trace_counter_handler = NULL;
111111
static const void *zend_jit_ret_trace_counter_handler = NULL;
112112
static const void *zend_jit_loop_trace_counter_handler = NULL;
113113

114-
static bool zend_may_overflow(const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa);
114+
static int zend_may_overflow(const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa);
115115
static void ZEND_FASTCALL zend_runtime_jit(void);
116116

117117
static int zend_jit_trace_op_len(const zend_op *opline);
118-
static bool zend_jit_trace_may_exit(const zend_op_array *op_array, const zend_op *opline);
118+
static int zend_jit_trace_may_exit(const zend_op_array *op_array, const zend_op *opline);
119119
static uint32_t zend_jit_trace_get_exit_point(const zend_op *from_opline, const zend_op *to_opline, zend_jit_trace_rec *trace, uint32_t flags);
120120
static const void *zend_jit_trace_get_exit_addr(uint32_t n);
121121
static void zend_jit_trace_add_code(const void *start, uint32_t size);
@@ -487,7 +487,7 @@ static void *dasm_link_and_encode(dasm_State **dasm_state,
487487
return entry;
488488
}
489489

490-
static bool zend_may_overflow_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, zend_ssa *ssa)
490+
static int zend_may_overflow_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, zend_ssa *ssa)
491491
{
492492
int res;
493493

@@ -650,12 +650,12 @@ static bool zend_may_overflow_ex(const zend_op *opline, const zend_ssa_op *ssa_o
650650
}
651651
}
652652

653-
static bool zend_may_overflow(const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
653+
static int zend_may_overflow(const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
654654
{
655655
return zend_may_overflow_ex(opline, &ssa->ops[opline - op_array->opcodes], op_array, ssa);
656656
}
657657

658-
static ZEND_RESULT_CODE zend_jit_build_cfg(const zend_op_array *op_array, zend_cfg *cfg)
658+
static int zend_jit_build_cfg(const zend_op_array *op_array, zend_cfg *cfg)
659659
{
660660
uint32_t flags;
661661

@@ -689,7 +689,7 @@ static ZEND_RESULT_CODE zend_jit_build_cfg(const zend_op_array *op_array, zend_c
689689
return SUCCESS;
690690
}
691691

692-
static ZEND_RESULT_CODE zend_jit_op_array_analyze1(const zend_op_array *op_array, zend_script *script, zend_ssa *ssa)
692+
static int zend_jit_op_array_analyze1(const zend_op_array *op_array, zend_script *script, zend_ssa *ssa)
693693
{
694694
if (zend_jit_build_cfg(op_array, &ssa->cfg) != SUCCESS) {
695695
return FAILURE;
@@ -727,7 +727,7 @@ static ZEND_RESULT_CODE zend_jit_op_array_analyze1(const zend_op_array *op_array
727727
return SUCCESS;
728728
}
729729

730-
static ZEND_RESULT_CODE zend_jit_op_array_analyze2(const zend_op_array *op_array, zend_script *script, zend_ssa *ssa, uint32_t optimization_level)
730+
static int zend_jit_op_array_analyze2(const zend_op_array *op_array, zend_script *script, zend_ssa *ssa, uint32_t optimization_level)
731731
{
732732
if ((JIT_G(opt_level) >= ZEND_JIT_LEVEL_OPT_FUNC)
733733
&& ssa->cfg.blocks
@@ -742,7 +742,7 @@ static ZEND_RESULT_CODE zend_jit_op_array_analyze2(const zend_op_array *op_array
742742
return SUCCESS;
743743
}
744744

745-
static ZEND_RESULT_CODE zend_jit_add_range(zend_lifetime_interval **intervals, int var, uint32_t from, uint32_t to)
745+
static int zend_jit_add_range(zend_lifetime_interval **intervals, int var, uint32_t from, uint32_t to)
746746
{
747747
zend_lifetime_interval *ival = intervals[var];
748748

@@ -817,7 +817,7 @@ static ZEND_RESULT_CODE zend_jit_add_range(zend_lifetime_interval **intervals, i
817817
return SUCCESS;
818818
}
819819

820-
static ZEND_RESULT_CODE zend_jit_begin_range(zend_lifetime_interval **intervals, int var, uint32_t block_start, uint32_t from)
820+
static int zend_jit_begin_range(zend_lifetime_interval **intervals, int var, uint32_t block_start, uint32_t from)
821821
{
822822
if (block_start != from && intervals[var]) {
823823
zend_life_range *range = &intervals[var]->range;
@@ -863,7 +863,7 @@ static void zend_jit_insert_interval(zend_lifetime_interval **list, zend_lifetim
863863
}
864864
}
865865

866-
static ZEND_RESULT_CODE zend_jit_split_interval(zend_lifetime_interval *current, uint32_t pos, zend_lifetime_interval **list, zend_lifetime_interval **free)
866+
static int zend_jit_split_interval(zend_lifetime_interval *current, uint32_t pos, zend_lifetime_interval **list, zend_lifetime_interval **free)
867867
{
868868
zend_lifetime_interval *ival;
869869
zend_life_range *range = &current->range;
@@ -1072,7 +1072,7 @@ static void zend_jit_add_hint(zend_lifetime_interval **intervals, int dst, int s
10721072

10731073
/* See "Linear Scan Register Allocation on SSA Form", Christian Wimmer and
10741074
Michael Franz, CGO'10 (2010), Figure 4. */
1075-
static ZEND_RESULT_CODE zend_jit_compute_liveness(const zend_op_array *op_array, zend_ssa *ssa, zend_bitset candidates, zend_lifetime_interval **list)
1075+
static int zend_jit_compute_liveness(const zend_op_array *op_array, zend_ssa *ssa, zend_bitset candidates, zend_lifetime_interval **list)
10761076
{
10771077
int set_size, i, j, k, l;
10781078
uint32_t n;
@@ -1415,7 +1415,7 @@ static uint32_t zend_interval_intersection(zend_lifetime_interval *ival1, zend_l
14151415

14161416
/* See "Optimized Interval Splitting in a Linear Scan Register Allocator",
14171417
Christian Wimmer VEE'05 (2005), Figure 4. Allocation without spilling */
1418-
static bool zend_jit_try_allocate_free_reg(const zend_op_array *op_array, const zend_op **ssa_opcodes, zend_ssa *ssa, zend_lifetime_interval *current, zend_regset available, zend_regset *hints, zend_lifetime_interval *active, zend_lifetime_interval *inactive, zend_lifetime_interval **list, zend_lifetime_interval **free)
1418+
static int zend_jit_try_allocate_free_reg(const zend_op_array *op_array, const zend_op **ssa_opcodes, zend_ssa *ssa, zend_lifetime_interval *current, zend_regset available, zend_regset *hints, zend_lifetime_interval *active, zend_lifetime_interval *inactive, zend_lifetime_interval **list, zend_lifetime_interval **free)
14191419
{
14201420
zend_lifetime_interval *it;
14211421
uint32_t freeUntilPos[ZREG_NUM];
@@ -1639,7 +1639,7 @@ static bool zend_jit_try_allocate_free_reg(const zend_op_array *op_array, const
16391639
Christian Wimmer VEE'05 (2005), Figure 5. Allocation with spilling.
16401640
and "Linear Scan Register Allocation on SSA Form", Christian Wimmer and
16411641
Michael Franz, CGO'10 (2010), Figure 6. */
1642-
static bool zend_jit_allocate_blocked_reg(void)
1642+
static int zend_jit_allocate_blocked_reg(void)
16431643
{
16441644
/* TODO: ??? */
16451645
return 0;
@@ -1996,7 +1996,7 @@ static zend_lifetime_interval** zend_jit_allocate_registers(const zend_op_array
19961996
return NULL;
19971997
}
19981998

1999-
static ZEND_RESULT_CODE zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op *rt_opline)
1999+
static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op *rt_opline)
20002000
{
20012001
int b, i, end;
20022002
zend_op *opline;
@@ -3168,7 +3168,7 @@ static ZEND_RESULT_CODE zend_jit(const zend_op_array *op_array, zend_ssa *ssa, c
31683168
return FAILURE;
31693169
}
31703170

3171-
static ZEND_RESULT_CODE zend_jit_collect_calls(zend_op_array *op_array, zend_script *script)
3171+
static int zend_jit_collect_calls(zend_op_array *op_array, zend_script *script)
31723172
{
31733173
zend_func_info *func_info;
31743174

@@ -3215,7 +3215,7 @@ static void zend_jit_cleanup_func_info(zend_op_array *op_array)
32153215
}
32163216
}
32173217

3218-
static ZEND_RESULT_CODE zend_real_jit_func(zend_op_array *op_array, zend_script *script, const zend_op *rt_opline)
3218+
static int zend_real_jit_func(zend_op_array *op_array, zend_script *script, const zend_op *rt_opline)
32193219
{
32203220
zend_ssa ssa;
32213221
void *checkpoint;
@@ -3364,7 +3364,7 @@ void ZEND_FASTCALL zend_jit_hot_func(zend_execute_data *execute_data, const zend
33643364
/* JIT-ed code is going to be called by VM */
33653365
}
33663366

3367-
static ZEND_RESULT_CODE zend_jit_setup_hot_counters(zend_op_array *op_array)
3367+
static int zend_jit_setup_hot_counters(zend_op_array *op_array)
33683368
{
33693369
zend_op *opline = op_array->opcodes;
33703370
zend_jit_op_array_hot_extension *jit_extension;
@@ -3411,7 +3411,7 @@ static ZEND_RESULT_CODE zend_jit_setup_hot_counters(zend_op_array *op_array)
34113411
return SUCCESS;
34123412
}
34133413

3414-
static bool zend_needs_manual_jit(const zend_op_array *op_array)
3414+
static int zend_needs_manual_jit(const zend_op_array *op_array)
34153415
{
34163416
if (op_array->doc_comment) {
34173417
const char *s = ZSTR_VAL(op_array->doc_comment);
@@ -3431,7 +3431,7 @@ static bool zend_needs_manual_jit(const zend_op_array *op_array)
34313431

34323432
#include "jit/zend_jit_trace.c"
34333433

3434-
ZEND_EXT_API ZEND_RESULT_CODE zend_jit_op_array(zend_op_array *op_array, zend_script *script)
3434+
ZEND_EXT_API int zend_jit_op_array(zend_op_array *op_array, zend_script *script)
34353435
{
34363436
if (dasm_ptr == NULL) {
34373437
return FAILURE;
@@ -3493,7 +3493,7 @@ ZEND_EXT_API ZEND_RESULT_CODE zend_jit_op_array(zend_op_array *op_array, zend_sc
34933493
}
34943494
}
34953495

3496-
ZEND_EXT_API ZEND_RESULT_CODE zend_jit_script(zend_script *script)
3496+
ZEND_EXT_API int zend_jit_script(zend_script *script)
34973497
{
34983498
void *checkpoint;
34993499
zend_call_graph call_graph;
@@ -3526,7 +3526,7 @@ ZEND_EXT_API ZEND_RESULT_CODE zend_jit_script(zend_script *script)
35263526
JIT_G(trigger) == ZEND_JIT_ON_DOC_COMMENT) {
35273527

35283528
if (JIT_G(trigger) == ZEND_JIT_ON_DOC_COMMENT) {
3529-
bool do_jit = 0;
3529+
int do_jit = 0;
35303530
for (i = 0; i < call_graph.op_arrays_count; i++) {
35313531
if (zend_needs_manual_jit(call_graph.op_arrays[i])) {
35323532
do_jit = 1;
@@ -3683,7 +3683,7 @@ ZEND_EXT_API void zend_jit_protect(void)
36833683
#endif
36843684
}
36853685

3686-
static bool zend_jit_make_stubs(void)
3686+
static int zend_jit_make_stubs(void)
36873687
{
36883688
dasm_State* dasm_state = NULL;
36893689
uint32_t i;
@@ -3729,7 +3729,7 @@ static void zend_jit_globals_ctor(zend_jit_globals *jit_globals)
37293729
zend_jit_trace_init_caches();
37303730
}
37313731

3732-
static ZEND_RESULT_CODE zend_jit_parse_config_num(zend_long jit)
3732+
static int zend_jit_parse_config_num(zend_long jit)
37333733
{
37343734
if (jit == 0) {
37353735
JIT_G(on) = 0;
@@ -3760,7 +3760,7 @@ static ZEND_RESULT_CODE zend_jit_parse_config_num(zend_long jit)
37603760
return SUCCESS;
37613761
}
37623762

3763-
ZEND_EXT_API ZEND_RESULT_CODE zend_jit_config(zend_string *jit, int stage)
3763+
ZEND_EXT_API int zend_jit_config(zend_string *jit, int stage)
37643764
{
37653765
zend_ulong num;
37663766

@@ -3816,7 +3816,7 @@ ZEND_EXT_API ZEND_RESULT_CODE zend_jit_config(zend_string *jit, int stage)
38163816
return FAILURE;
38173817
}
38183818

3819-
ZEND_EXT_API ZEND_RESULT_CODE zend_jit_debug_config(zend_long old_val, zend_long new_val, int stage)
3819+
ZEND_EXT_API int zend_jit_debug_config(zend_long old_val, zend_long new_val, int stage)
38203820
{
38213821
if (stage != ZEND_INI_STAGE_STARTUP) {
38223822
if (((old_val ^ new_val) & ZEND_JIT_DEBUG_PERSISTENT) != 0) {
@@ -3847,7 +3847,7 @@ ZEND_EXT_API void zend_jit_init(void)
38473847
#endif
38483848
}
38493849

3850-
ZEND_EXT_API ZEND_RESULT_CODE zend_jit_startup(void *buf, size_t size, zend_bool reattached)
3850+
ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, zend_bool reattached)
38513851
{
38523852
int ret;
38533853

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ static zval* ZEND_FASTCALL zend_jit_symtable_lookup_w(HashTable *ht, zend_string
292292
return retval;
293293
}
294294

295-
static bool ZEND_FASTCALL zend_jit_undefined_op_helper(uint32_t var)
295+
static int ZEND_FASTCALL zend_jit_undefined_op_helper(uint32_t var)
296296
{
297297
const zend_execute_data *execute_data = EG(current_execute_data);
298298
zend_string *cv = EX(func)->op_array.vars[EX_VAR_TO_NUM(var)];
@@ -301,7 +301,7 @@ static bool ZEND_FASTCALL zend_jit_undefined_op_helper(uint32_t var)
301301
return EG(exception) == NULL;
302302
}
303303

304-
static bool ZEND_FASTCALL zend_jit_undefined_op_helper_write(HashTable *ht, uint32_t var)
304+
static int ZEND_FASTCALL zend_jit_undefined_op_helper_write(HashTable *ht, uint32_t var)
305305
{
306306
const zend_execute_data *execute_data = EG(current_execute_data);
307307
zend_string *cv = EX(func)->op_array.vars[EX_VAR_TO_NUM(var)];
@@ -460,7 +460,7 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_is_helper(zend_array *ht, zval *dim
460460
ZVAL_NULL(result);
461461
}
462462

463-
static bool ZEND_FASTCALL zend_jit_fetch_dim_isset_helper(zend_array *ht, zval *dim)
463+
static int ZEND_FASTCALL zend_jit_fetch_dim_isset_helper(zend_array *ht, zval *dim)
464464
{
465465
zend_long hval;
466466
zend_string *offset_key;
@@ -1137,7 +1137,7 @@ static void ZEND_FASTCALL zend_jit_fast_concat_helper(zval *result, zval *op1, z
11371137
ZSTR_VAL(result_str)[result_len] = '\0';
11381138
}
11391139

1140-
static bool ZEND_FASTCALL zend_jit_isset_dim_helper(zval *container, zval *offset)
1140+
static int ZEND_FASTCALL zend_jit_isset_dim_helper(zval *container, zval *offset)
11411141
{
11421142
if (UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) {
11431143
zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);

ext/opcache/jit/zend_jit_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_ret_trace_helper(ZEND_OPCODE_HAND
439439
ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_loop_trace_helper(ZEND_OPCODE_HANDLER_ARGS);
440440

441441
int ZEND_FASTCALL zend_jit_trace_hot_root(zend_execute_data *execute_data, const zend_op *opline);
442-
bool ZEND_FASTCALL zend_jit_trace_exit(uint32_t exit_num, zend_jit_registers_buf *regs);
442+
int ZEND_FASTCALL zend_jit_trace_exit(uint32_t exit_num, zend_jit_registers_buf *regs);
443443
zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *execute_data, const zend_op *opline, zend_jit_trace_rec *trace_buffer, uint8_t start, zend_bool is_megamorphc);
444444

445445
static zend_always_inline const zend_op* zend_jit_trace_get_exit_opline(zend_jit_trace_rec *trace, const zend_op *opline, zend_bool *exit_if_true)

ext/opcache/jit/zend_jit_oprofile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static void zend_jit_oprofile_register(const char *name,
3131
}
3232
}
3333

34-
static bool zend_jit_oprofile_startup(void)
34+
static int zend_jit_oprofile_startup(void)
3535
{
3636
op_agent = op_open_agent();
3737
if (!op_agent) {

0 commit comments

Comments
 (0)