Skip to content

Adjust static inline functions which don't inline #18454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Zend/zend_ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@

ZEND_API zend_ast_process_t zend_ast_process = NULL;

static inline void *zend_ast_alloc(size_t size) {
static void *zend_ast_alloc(size_t size) {
return zend_arena_alloc(&CG(ast_arena), size);
}

static inline void *zend_ast_realloc(void *old, size_t old_size, size_t new_size) {
static void *zend_ast_realloc(void *old, size_t old_size, size_t new_size) {
void *new = zend_ast_alloc(new_size);
memcpy(new, old, old_size);
return new;
}

static inline size_t zend_ast_list_size(uint32_t children) {
static size_t zend_ast_list_size(uint32_t children) {
return sizeof(zend_ast_list) - sizeof(zend_ast *) + sizeof(zend_ast *) * children;
}

Expand Down Expand Up @@ -494,7 +494,7 @@ zend_ast *zend_ast_create_concat_op(zend_ast *op0, zend_ast *op1) {
return zend_ast_create_binary_op(ZEND_CONCAT, op0, op1);
}

static inline bool is_power_of_two(uint32_t n) {
static zend_always_inline bool is_power_of_two(uint32_t n) {
return ((n != 0) && (n == (n & (~n + 1))));
}

Expand Down
6 changes: 3 additions & 3 deletions Zend/zend_builtin_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ flf_clean:;
Z_FLF_PARAM_FREE_STR(2, property_tmp)
}

static inline void _class_exists_impl(zval *return_value, zend_string *name, bool autoload, int flags, int skip_flags) /* {{{ */
static zend_always_inline void _class_exists_impl(zval *return_value, zend_string *name, bool autoload, int flags, int skip_flags) /* {{{ */
{
zend_string *lcname;
zend_class_entry *ce;
Expand Down Expand Up @@ -1088,7 +1088,7 @@ static inline void _class_exists_impl(zval *return_value, zend_string *name, boo
}
/* {{{ */

static inline void class_exists_impl(INTERNAL_FUNCTION_PARAMETERS, int flags, int skip_flags) /* {{{ */
static void class_exists_impl(INTERNAL_FUNCTION_PARAMETERS, int flags, int skip_flags) /* {{{ */
{
zend_string *name;
bool autoload = true;
Expand Down Expand Up @@ -1386,7 +1386,7 @@ ZEND_FUNCTION(get_exception_handler)
}
}

static inline void get_declared_class_impl(INTERNAL_FUNCTION_PARAMETERS, int flags) /* {{{ */
static void get_declared_class_impl(INTERNAL_FUNCTION_PARAMETERS, int flags) /* {{{ */
{
zend_string *key;
zval *zv;
Expand Down
34 changes: 14 additions & 20 deletions Zend/zend_exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,9 @@ static int zend_implement_throwable(zend_class_entry *interface, zend_class_entr
}
/* }}} */

static inline zend_class_entry *i_get_exception_base(zend_object *object) /* {{{ */
{
return instanceof_function(object->ce, zend_ce_exception) ? zend_ce_exception : zend_ce_error;
}
/* }}} */

ZEND_API zend_class_entry *zend_get_exception_base(zend_object *object) /* {{{ */
{
return i_get_exception_base(object);
return instanceof_function(object->ce, zend_ce_exception) ? zend_ce_exception : zend_ce_error;
}
/* }}} */

Expand All @@ -115,17 +109,17 @@ void zend_exception_set_previous(zend_object *exception, zend_object *add_previo
ZVAL_OBJ(&zv, exception);
ex = &zv;
do {
ancestor = zend_read_property_ex(i_get_exception_base(add_previous), add_previous, ZSTR_KNOWN(ZEND_STR_PREVIOUS), 1, &rv);
ancestor = zend_read_property_ex(zend_get_exception_base(add_previous), add_previous, ZSTR_KNOWN(ZEND_STR_PREVIOUS), 1, &rv);
ZVAL_DEREF(ancestor);
while (Z_TYPE_P(ancestor) == IS_OBJECT) {
if (Z_OBJ_P(ancestor) == Z_OBJ_P(ex)) {
OBJ_RELEASE(add_previous);
return;
}
ancestor = zend_read_property_ex(i_get_exception_base(Z_OBJ_P(ancestor)), Z_OBJ_P(ancestor), ZSTR_KNOWN(ZEND_STR_PREVIOUS), 1, &rv);
ancestor = zend_read_property_ex(zend_get_exception_base(Z_OBJ_P(ancestor)), Z_OBJ_P(ancestor), ZSTR_KNOWN(ZEND_STR_PREVIOUS), 1, &rv);
ZVAL_DEREF(ancestor);
}
base_ce = i_get_exception_base(Z_OBJ_P(ex));
base_ce = zend_get_exception_base(Z_OBJ_P(ex));
previous = zend_read_property_ex(base_ce, Z_OBJ_P(ex), ZSTR_KNOWN(ZEND_STR_PREVIOUS), 1, &rv);
ZVAL_DEREF(previous);
if (Z_TYPE_P(previous) == IS_NULL) {
Expand Down Expand Up @@ -273,7 +267,7 @@ static zend_object *zend_default_exception_new(zend_class_entry *class_type) /*
}
Z_SET_REFCOUNT(trace, 0);

base_ce = i_get_exception_base(object);
base_ce = zend_get_exception_base(object);

if (EXPECTED((class_type != zend_ce_parse_error && class_type != zend_ce_compile_error)
|| !(filename = zend_get_compiled_filename()))) {
Expand Down Expand Up @@ -311,7 +305,7 @@ ZEND_METHOD(Exception, __construct)
zend_class_entry *base_ce;

object = ZEND_THIS;
base_ce = i_get_exception_base(Z_OBJ_P(object));
base_ce = zend_get_exception_base(Z_OBJ_P(object));

if (zend_parse_parameters(ZEND_NUM_ARGS(), "|SlO!", &message, &code, &previous, zend_ce_throwable) == FAILURE) {
RETURN_THROWS();
Expand All @@ -335,9 +329,9 @@ ZEND_METHOD(Exception, __construct)

/* {{{ Exception unserialize checks */
#define CHECK_EXC_TYPE(id, type) \
pvalue = zend_read_property_ex(i_get_exception_base(Z_OBJ_P(object)), Z_OBJ_P(object), ZSTR_KNOWN(id), 1, &value); \
pvalue = zend_read_property_ex(zend_get_exception_base(Z_OBJ_P(object)), Z_OBJ_P(object), ZSTR_KNOWN(id), 1, &value); \
if (Z_TYPE_P(pvalue) != IS_NULL && Z_TYPE_P(pvalue) != type) { \
zend_unset_property(i_get_exception_base(Z_OBJ_P(object)), Z_OBJ_P(object), ZSTR_VAL(ZSTR_KNOWN(id)), ZSTR_LEN(ZSTR_KNOWN(id))); \
zend_unset_property(zend_get_exception_base(Z_OBJ_P(object)), Z_OBJ_P(object), ZSTR_VAL(ZSTR_KNOWN(id)), ZSTR_LEN(ZSTR_KNOWN(id))); \
}

ZEND_METHOD(Exception, __wakeup)
Expand Down Expand Up @@ -401,9 +395,9 @@ ZEND_METHOD(ErrorException, __construct)
/* }}} */

#define GET_PROPERTY(object, id) \
zend_read_property_ex(i_get_exception_base(Z_OBJ_P(object)), Z_OBJ_P(object), ZSTR_KNOWN(id), 0, &rv)
zend_read_property_ex(zend_get_exception_base(Z_OBJ_P(object)), Z_OBJ_P(object), ZSTR_KNOWN(id), 0, &rv)
#define GET_PROPERTY_SILENT(object, id) \
zend_read_property_ex(i_get_exception_base(Z_OBJ_P(object)), Z_OBJ_P(object), ZSTR_KNOWN(id), 1, &rv)
zend_read_property_ex(zend_get_exception_base(Z_OBJ_P(object)), Z_OBJ_P(object), ZSTR_KNOWN(id), 1, &rv)

/* {{{ Get the file in which the exception occurred */
ZEND_METHOD(Exception, getFile)
Expand Down Expand Up @@ -621,7 +615,7 @@ ZEND_METHOD(Exception, getTraceAsString)
ZEND_PARSE_PARAMETERS_NONE();

zval *object = ZEND_THIS;
zend_class_entry *base_ce = i_get_exception_base(Z_OBJ_P(object));
zend_class_entry *base_ce = zend_get_exception_base(Z_OBJ_P(object));
zval rv;
const zval *trace = zend_read_property_ex(base_ce, Z_OBJ_P(object), ZSTR_KNOWN(ZEND_STR_TRACE), 1, &rv);
if (EG(exception)) {
Expand Down Expand Up @@ -725,7 +719,7 @@ ZEND_METHOD(Exception, __toString)

exception = ZEND_THIS;
/* Reset apply counts */
while (Z_TYPE_P(exception) == IS_OBJECT && (base_ce = i_get_exception_base(Z_OBJ_P(exception))) && instanceof_function(Z_OBJCE_P(exception), base_ce)) {
while (Z_TYPE_P(exception) == IS_OBJECT && (base_ce = zend_get_exception_base(Z_OBJ_P(exception))) && instanceof_function(Z_OBJCE_P(exception), base_ce)) {
if (Z_IS_RECURSIVE_P(exception)) {
Z_UNPROTECT_RECURSION_P(exception);
} else {
Expand All @@ -736,7 +730,7 @@ ZEND_METHOD(Exception, __toString)
}

exception = ZEND_THIS;
base_ce = i_get_exception_base(Z_OBJ_P(exception));
base_ce = zend_get_exception_base(Z_OBJ_P(exception));

/* We store the result in the private property string so we can access
* the result in uncaught exception handlers without memleaks. */
Expand Down Expand Up @@ -928,7 +922,7 @@ ZEND_API ZEND_COLD zend_result zend_exception_error(zend_object *ex, int severit
if (Z_TYPE(tmp) != IS_STRING) {
zend_error(E_WARNING, "%s::__toString() must return a string", ZSTR_VAL(ce_exception->name));
} else {
zend_update_property_ex(i_get_exception_base(ex), ex, ZSTR_KNOWN(ZEND_STR_STRING), &tmp);
zend_update_property_ex(zend_get_exception_base(ex), ex, ZSTR_KNOWN(ZEND_STR_STRING), &tmp);
}
}
zval_ptr_dtor(&tmp);
Expand Down
6 changes: 3 additions & 3 deletions Zend/zend_generators.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ static zend_always_inline void clear_link_to_root(zend_generator *generator) {
}

/* Check if the node 'generator' is running in a fiber */
static inline bool check_node_running_in_fiber(zend_generator *generator) {
static bool check_node_running_in_fiber(zend_generator *generator) {
ZEND_ASSERT(generator->execute_data);

if (EXPECTED(generator->flags & ZEND_GENERATOR_IN_FIBER)) {
Expand Down Expand Up @@ -872,7 +872,7 @@ ZEND_API void zend_generator_resume(zend_generator *orig_generator) /* {{{ */
}
/* }}} */

static inline void zend_generator_ensure_initialized(zend_generator *generator) /* {{{ */
static void zend_generator_ensure_initialized(zend_generator *generator) /* {{{ */
{
if (UNEXPECTED(Z_TYPE(generator->value) == IS_UNDEF) && EXPECTED(generator->execute_data) && EXPECTED(generator->node.parent == NULL)) {
zend_generator_resume(generator);
Expand All @@ -881,7 +881,7 @@ static inline void zend_generator_ensure_initialized(zend_generator *generator)
}
/* }}} */

static inline void zend_generator_rewind(zend_generator *generator) /* {{{ */
static void zend_generator_rewind(zend_generator *generator) /* {{{ */
{
zend_generator_ensure_initialized(generator);

Expand Down
2 changes: 1 addition & 1 deletion ext/hash/hash_gost.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
AA(v, l, r); \
}

static inline void Gost(PHP_GOST_CTX *context, uint32_t data[8])
static void Gost(PHP_GOST_CTX *context, uint32_t data[8])
{
int i;
uint32_t l, r, t, key[8], u[8], v[8], w[8], s[8], *h = context->state, *m = data;
Expand Down
2 changes: 1 addition & 1 deletion ext/hash/hash_snefru.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void ph(uint32_t h[16])
}
#endif

static inline void Snefru(uint32_t input[16])
static void Snefru(uint32_t input[16])
{
static const int shifts[4] = {16, 8, 16, 24};
int b, index, rshift, lshift;
Expand Down
2 changes: 1 addition & 1 deletion ext/hash/hash_tiger.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
}
/* }}} */

static inline void TigerFinalize(PHP_TIGER_CTX *context)
static void TigerFinalize(PHP_TIGER_CTX *context)
{
context->passed += (uint64_t) context->length << 3;

Expand Down
2 changes: 1 addition & 1 deletion ext/json/json_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ bool php_json_is_valid_double(double d) /* {{{ */
}
/* }}} */

static inline void php_json_encode_double(smart_str *buf, double d, int options) /* {{{ */
static void php_json_encode_double(smart_str *buf, double d, int options) /* {{{ */
{
size_t len;
char num[ZEND_DOUBLE_MAX_LENGTH];
Expand Down
2 changes: 1 addition & 1 deletion ext/opcache/ZendAccelerator.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ static ZEND_FUNCTION(accel_chdir)
ZCG(cwd_check) = true;
}

static inline zend_string* accel_getcwd(void)
static zend_string* accel_getcwd(void)
{
if (ZCG(cwd)) {
return ZCG(cwd);
Expand Down
2 changes: 1 addition & 1 deletion ext/random/engine_mt19937.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ ZEND_STATIC_ASSERT(
#define twist(m,u,v) (m ^ (mixBits(u,v) >> 1) ^ ((uint32_t)(-(int32_t)(loBit(v))) & 0x9908b0dfU))
#define twist_php(m,u,v) (m ^ (mixBits(u,v) >> 1) ^ ((uint32_t)(-(int32_t)(loBit(u))) & 0x9908b0dfU))

static inline void mt19937_reload(php_random_status_state_mt19937 *state)
static void mt19937_reload(php_random_status_state_mt19937 *state)
{
uint32_t *p = state->state;

Expand Down
6 changes: 3 additions & 3 deletions ext/spl/spl_iterators.c
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ static zend_function *spl_dual_it_get_method(zend_object **object, zend_string *

#define APPENDIT_CHECK_CTOR(intern) SPL_CHECK_CTOR(intern, AppendIterator)

static inline zend_result spl_dual_it_fetch(spl_dual_it_object *intern, int check_more);
static zend_result spl_dual_it_fetch(spl_dual_it_object *intern, int check_more);

static inline zend_result spl_cit_check_flags(zend_long flags)
{
Expand Down Expand Up @@ -1481,7 +1481,7 @@ static inline zend_result spl_dual_it_valid(spl_dual_it_object *intern)
return intern->inner.iterator->funcs->valid(intern->inner.iterator);
}

static inline zend_result spl_dual_it_fetch(spl_dual_it_object *intern, int check_more)
static zend_result spl_dual_it_fetch(spl_dual_it_object *intern, int check_more)
{
zval *data;

Expand Down Expand Up @@ -2125,7 +2125,7 @@ static inline zend_result spl_limit_it_valid(spl_dual_it_object *intern)
}
}

static inline void spl_limit_it_seek(spl_dual_it_object *intern, zend_long pos)
static void spl_limit_it_seek(spl_dual_it_object *intern, zend_long pos)
{
zval zpos;

Expand Down
8 changes: 4 additions & 4 deletions ext/standard/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ PHP_FUNCTION(rsort)
}
/* }}} */

static inline int php_array_user_compare_unstable(Bucket *f, Bucket *s) /* {{{ */
static int php_array_user_compare_unstable(Bucket *f, Bucket *s) /* {{{ */
{
zval args[2];
zval retval;
Expand Down Expand Up @@ -923,7 +923,7 @@ PHP_FUNCTION(uasort)
}
/* }}} */

static inline int php_array_user_key_compare_unstable(Bucket *f, Bucket *s) /* {{{ */
static int php_array_user_key_compare_unstable(Bucket *f, Bucket *s) /* {{{ */
{
zval args[2];
zval retval;
Expand Down Expand Up @@ -1614,7 +1614,7 @@ PHP_FUNCTION(array_walk_recursive)
* 0 = return boolean
* 1 = return key
*/
static inline void _php_search_array(zval *return_value, zval *value, zval *array, bool strict, int behavior) /* {{{ */
static zend_always_inline void _php_search_array(zval *return_value, zval *value, zval *array, bool strict, int behavior) /* {{{ */
{
zval *entry; /* pointer to array entry */
zend_ulong num_idx;
Expand Down Expand Up @@ -1706,7 +1706,7 @@ static inline void _php_search_array(zval *return_value, zval *value, zval *arra
* 0 = return boolean
* 1 = return key
*/
static inline void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
{
zval *value, /* value to check for */
*array; /* array to check in */
Expand Down
14 changes: 7 additions & 7 deletions ext/standard/formatted_print.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static const char hexchars[] = "0123456789abcdef";
static const char HEXCHARS[] = "0123456789ABCDEF";

/* php_spintf_appendchar() {{{ */
inline static void
static void
php_sprintf_appendchar(zend_string **buffer, size_t *pos, char add)
{
if ((*pos + 1) >= ZSTR_LEN(*buffer)) {
Expand All @@ -58,7 +58,7 @@ php_sprintf_appendchar(zend_string **buffer, size_t *pos, char add)
/* }}} */

/* php_spintf_appendchar() {{{ */
inline static void
static void
php_sprintf_appendchars(zend_string **buffer, size_t *pos, char *add, size_t len)
{
if ((*pos + len) >= ZSTR_LEN(*buffer)) {
Expand All @@ -77,7 +77,7 @@ php_sprintf_appendchars(zend_string **buffer, size_t *pos, char *add, size_t len
/* }}} */

/* php_spintf_appendstring() {{{ */
inline static void
static void
php_sprintf_appendstring(zend_string **buffer, size_t *pos, char *add,
size_t min_width, size_t max_width, char padding,
size_t alignment, size_t len, bool neg, int expprec, int always_sign)
Expand Down Expand Up @@ -134,7 +134,7 @@ php_sprintf_appendstring(zend_string **buffer, size_t *pos, char *add,
/* }}} */

/* php_spintf_appendint() {{{ */
inline static void
static void
php_sprintf_appendint(zend_string **buffer, size_t *pos, zend_long number,
size_t width, char padding, size_t alignment,
int always_sign)
Expand Down Expand Up @@ -178,7 +178,7 @@ php_sprintf_appendint(zend_string **buffer, size_t *pos, zend_long number,
/* }}} */

/* php_spintf_appenduint() {{{ */
inline static void
static void
php_sprintf_appenduint(zend_string **buffer, size_t *pos,
zend_ulong number,
size_t width, char padding, size_t alignment)
Expand Down Expand Up @@ -210,7 +210,7 @@ php_sprintf_appenduint(zend_string **buffer, size_t *pos,
/* }}} */

/* php_spintf_appenddouble() {{{ */
inline static void
static void
php_sprintf_appenddouble(zend_string **buffer, size_t *pos,
double number,
size_t width, char padding,
Expand Down Expand Up @@ -318,7 +318,7 @@ php_sprintf_appenddouble(zend_string **buffer, size_t *pos,
/* }}} */

/* php_spintf_appendd2n() {{{ */
inline static void
static void
php_sprintf_append2n(zend_string **buffer, size_t *pos, zend_long number,
size_t width, char padding, size_t alignment, int n,
const char *chartable, int expprec)
Expand Down
Loading