Skip to content

Commit fc1b0a2

Browse files
ondrejmirtesclaude
andcommitted
Mark the turbo registration functions cold
They run once per process at module startup; ZEND_COLD makes the compiler optimise their bodies for size and move them out of the hot text. The method handlers they register are separate functions whose addresses escape, and keep their optimisation. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qi7GRGMn9ZuY2jSc97wqBF
1 parent a190177 commit fc1b0a2

4 files changed

Lines changed: 360 additions & 356 deletions

File tree

‎turbo-ext/src/Engine.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ zif_handler pt_native_closure_invoke_handler();
106106
* pending exception */
107107
zv::Val pt_native_closure_to_closure(zval *closure);
108108

109-
void pt_register_native_closure();
109+
ZEND_COLD void pt_register_native_closure();
110110

111111
/* }}} */
112112

‎turbo-ext/src/TypeTraits.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,7 @@ void pt_type_trait_constant_numeric_comparison(reg::Class &cls)
13501350

13511351
/* {{{ module startup */
13521352

1353-
static void pt_register_native_callback();
1353+
static ZEND_COLD void pt_register_native_callback();
13541354

13551355
void pt_register_type_traits()
13561356
{

‎turbo-ext/src/TypeTraits.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ zv::Val pt_constant_string_get_value(zend_object *object);
293293
[[nodiscard]] bool pt_call_fci(zend_fcall_info *fci, zend_fcall_info_cache *fcc, uint32_t argc, zval *argv, zval *retval);
294294

295295
/* module startup: the internal helper classes the trait code needs */
296-
void pt_register_type_traits();
296+
ZEND_COLD void pt_register_type_traits();
297297

298298
/* }}} */
299299

0 commit comments

Comments
 (0)