Skip to content

Commit 05c50d3

Browse files
committed
global tick API support
1 parent 8aae33d commit 05c50d3

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Zend/zend_compile.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ ZEND_API zend_executor_globals executor_globals;
8181
static zend_op *zend_emit_op(znode *result, zend_uchar opcode, znode *op1, znode *op2);
8282
static zend_bool zend_try_ct_eval_array(zval *result, zend_ast *ast);
8383

84+
static zend_long zend_default_ticks = 0;
85+
8486
static void init_op(zend_op *op)
8587
{
8688
MAKE_NOP(op);
@@ -301,6 +303,12 @@ static void zend_end_namespace(void) /* {{{ */ {
301303
}
302304
/* }}} */
303305

306+
ZEND_API void zend_set_default_ticks(zend_long ticks) /* {{{ */
307+
{
308+
zend_default_ticks = ticks > 0 ? ticks : 0;
309+
}
310+
/* }}} */
311+
304312
void zend_file_context_begin(zend_file_context *prev_context) /* {{{ */
305313
{
306314
*prev_context = CG(file_context);
@@ -310,7 +318,7 @@ void zend_file_context_begin(zend_file_context *prev_context) /* {{{ */
310318
FC(current_namespace) = NULL;
311319
FC(in_namespace) = 0;
312320
FC(has_bracketed_namespaces) = 0;
313-
FC(declarables).ticks = 0;
321+
FC(declarables).ticks = zend_default_ticks;
314322
zend_hash_init(&FC(seen_symbols), 8, NULL, NULL, 0);
315323
}
316324
/* }}} */

Zend/zend_compile.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,8 @@ ZEND_API zend_bool zend_is_auto_global_str(char *name, size_t len);
814814
ZEND_API size_t zend_dirname(char *path, size_t len);
815815
ZEND_API void zend_set_function_arg_flags(zend_function *func);
816816

817+
ZEND_API void zend_set_default_ticks(zend_long ticks);
818+
817819
int ZEND_FASTCALL zendlex(zend_parser_stack_elem *elem);
818820

819821
void zend_assert_valid_class_name(const zend_string *const_name);

0 commit comments

Comments
 (0)