Skip to content

Commit 3a19726

Browse files
committed
Remove unneeded --disable-inline-optimization build parameter
In 1999, inline optimization was turned off by default. The commit log indicates this was done because GCC was running out of memory on some hosts when building the Zend executor. In 2003, inline optimization was re-enabled by default, but a build option was added to turn it off if one runs out of memory when building. Computing hardware has come a long way since 2003 and I doubt that anyone is running out of memory when building PHP now. Interestingly, this code set an unused variable called `INLINE_CFLAGS`. It actually disabled inline optimization by adding -O0 to the build command, not using `INLINE_CFLAGS`. Just to see how much memory GCC/Make are using when building PHP, I tried building with successively higher values of `ulimit -v` until it succeeded. Interestingly, while most of the codebase can be built with about 400MB of memory, ext/fileinfo/libmagic/apprentice.c requires 1.2GB, doubtless because it includes ext/fileinfo/data_file.c, which is more than 350,000 lines long. That is with GCC 7.5.0. Most users get PHP as a binary package anyways, so the question is, are *packagers* of PHP trying to build on machines with just 1GB RAM? And would they want to package a PHP interpreter built with *no optimizations*? I can't imagine either being true.
1 parent 4f26041 commit 3a19726

File tree

2 files changed

+1
-32
lines changed

2 files changed

+1
-32
lines changed

Zend/Zend.m4

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -196,18 +196,9 @@ AC_ARG_ENABLE([zts],
196196
[ZEND_ZTS=$enableval],
197197
[ZEND_ZTS=no])
198198
199-
AC_ARG_ENABLE([inline-optimization],
200-
[AS_HELP_STRING([--disable-inline-optimization],
201-
[If building zend_execute.lo fails, try this switch])],
202-
[ZEND_INLINE_OPTIMIZATION=$enableval],
203-
[ZEND_INLINE_OPTIMIZATION=yes])
204-
205199
AC_MSG_CHECKING(whether to enable thread-safety)
206200
AC_MSG_RESULT($ZEND_ZTS)
207201
208-
AC_MSG_CHECKING(whether to enable inline optimization for GCC)
209-
AC_MSG_RESULT($ZEND_INLINE_OPTIMIZATION)
210-
211202
AC_MSG_CHECKING(whether to enable Zend debugging)
212203
AC_MSG_RESULT($ZEND_DEBUG)
213204
@@ -232,18 +223,8 @@ if test "$ZEND_ZTS" = "yes"; then
232223
CFLAGS="$CFLAGS -DZTS"
233224
fi
234225
235-
changequote({,})
236-
if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then
237-
INLINE_CFLAGS=`echo $ac_n "$CFLAGS $ac_c" | sed s/-O[0-9s]*//`
238-
else
239-
INLINE_CFLAGS="$CFLAGS"
240-
fi
241-
changequote([,])
242-
243226
AC_C_INLINE
244227
245-
AC_SUBST(INLINE_CFLAGS)
246-
247228
AC_MSG_CHECKING(target system is Darwin)
248229
if echo "$target" | grep "darwin" > /dev/null; then
249230
AC_DEFINE([DARWIN], 1, [Define if the target system is darwin])

configure.ac

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,6 @@ old_CC=$CC
13711371

13721372
if test "$PHP_THREAD_SAFETY" = "yes" && test -n "$ac_cv_pthreads_cflags"; then
13731373
CXXFLAGS="$CXXFLAGS $ac_cv_pthreads_cflags"
1374-
INLINE_CFLAGS="$INLINE_CFLAGS $ac_cv_pthreads_cflags"
13751374
CPPFLAGS="$CPPFLAGS $ac_cv_pthreads_cflags"
13761375
fi
13771376

@@ -1425,7 +1424,6 @@ PHP_CONFIGURE_PART(Generating files)
14251424
CXXFLAGS_CLEAN=$CXXFLAGS
14261425
CFLAGS_CLEAN="$CFLAGS \$(PROF_FLAGS)"
14271426
CFLAGS="\$(CFLAGS_CLEAN) $standard_libtool_flag"
1428-
INLINE_CFLAGS="$INLINE_CFLAGS $standard_libtool_flag"
14291427
CXXFLAGS="$CXXFLAGS $standard_libtool_flag \$(PROF_FLAGS)"
14301428

14311429
if test "$PHP_PHAR" != "no" && test "$PHP_CLI" != "no"; then
@@ -1470,24 +1468,14 @@ PHP_ADD_SOURCES(Zend, \
14701468
zend_execute_API.c zend_highlight.c zend_llist.c \
14711469
zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
14721470
zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
1473-
zend_list.c zend_builtin_functions.c zend_attributes.c \
1471+
zend_list.c zend_builtin_functions.c zend_attributes.c zend_execute.c \
14741472
zend_ini.c zend_sort.c zend_multibyte.c zend_ts_hash.c zend_stream.c \
14751473
zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c zend_gc.c \
14761474
zend_closures.c zend_weakrefs.c zend_float.c zend_string.c zend_signal.c zend_generators.c \
14771475
zend_virtual_cwd.c zend_ast.c zend_objects.c zend_object_handlers.c zend_objects_API.c \
14781476
zend_default_classes.c zend_inheritance.c zend_smart_str.c zend_cpuinfo.c zend_gdb.c, \
14791477
-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
14801478

1481-
dnl Selectively disable optimization due to high RAM usage during compiling the
1482-
dnl executor.
1483-
if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then
1484-
flag=-O0
1485-
else
1486-
flag=
1487-
fi
1488-
1489-
PHP_ADD_SOURCES_X(Zend, zend_execute.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1,PHP_GLOBAL_OBJS,,$flag)
1490-
14911479
PHP_ADD_BUILD_DIR(main main/streams)
14921480
PHP_ADD_BUILD_DIR(TSRM)
14931481
PHP_ADD_BUILD_DIR(Zend)

0 commit comments

Comments
 (0)