Issue #9203: Computed gotos are now enabled by default on supported
compilers (which are detected by the configure script). They can still be disable selectively by specifying --without-computed-gotos.
This commit is contained in:
parent
d835cf1c84
commit
042b128f58
|
@ -12,6 +12,10 @@ What's New in Python 3.2 Alpha 2?
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #9203: Computed gotos are now enabled by default on supported
|
||||||
|
compilers (which are detected by the configure script). They can still
|
||||||
|
be disable selectively by specifying --without-computed-gotos.
|
||||||
|
|
||||||
- Issue #9425: Create PyErr_WarnFormat() function, similar to PyErr_WarnEx()
|
- Issue #9425: Create PyErr_WarnFormat() function, similar to PyErr_WarnEx()
|
||||||
but use PyUnicode_FromFormatV() to format the warning message.
|
but use PyUnicode_FromFormatV() to format the warning message.
|
||||||
|
|
||||||
|
|
|
@ -840,11 +840,24 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
||||||
-fno-crossjumping).
|
-fno-crossjumping).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(USE_COMPUTED_GOTOS) && defined(DYNAMIC_EXECUTION_PROFILE)
|
#ifdef DYNAMIC_EXECUTION_PROFILE
|
||||||
#undef USE_COMPUTED_GOTOS
|
#undef USE_COMPUTED_GOTOS
|
||||||
|
#define USE_COMPUTED_GOTOS 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_COMPUTED_GOTOS
|
#ifdef HAVE_COMPUTED_GOTOS
|
||||||
|
#ifndef USE_COMPUTED_GOTOS
|
||||||
|
#define USE_COMPUTED_GOTOS 1
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#if defined(USE_COMPUTED_GOTOS) && USE_COMPUTED_GOTOS
|
||||||
|
#error "Computed gotos are not supported on this compiler."
|
||||||
|
#endif
|
||||||
|
#undef USE_COMPUTED_GOTOS
|
||||||
|
#define USE_COMPUTED_GOTOS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if USE_COMPUTED_GOTOS
|
||||||
/* Import the static jump table */
|
/* Import the static jump table */
|
||||||
#include "opcode_targets.h"
|
#include "opcode_targets.h"
|
||||||
|
|
||||||
|
@ -990,7 +1003,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(DYNAMIC_EXECUTION_PROFILE) || defined(USE_COMPUTED_GOTOS)
|
#if defined(DYNAMIC_EXECUTION_PROFILE) || USE_COMPUTED_GOTOS
|
||||||
#define PREDICT(op) if (0) goto PRED_##op
|
#define PREDICT(op) if (0) goto PRED_##op
|
||||||
#define PREDICTED(op) PRED_##op:
|
#define PREDICTED(op) PRED_##op:
|
||||||
#define PREDICTED_WITH_ARG(op) PRED_##op:
|
#define PREDICTED_WITH_ARG(op) PRED_##op:
|
||||||
|
@ -2838,7 +2851,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
||||||
oparg = oparg<<16 | NEXTARG();
|
oparg = oparg<<16 | NEXTARG();
|
||||||
goto dispatch_opcode;
|
goto dispatch_opcode;
|
||||||
|
|
||||||
#ifdef USE_COMPUTED_GOTOS
|
#if USE_COMPUTED_GOTOS
|
||||||
_unknown_opcode:
|
_unknown_opcode:
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# From configure.in Revision: 82090 .
|
# From configure.in Revision: 83580 .
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.65 for python 3.2.
|
# Generated by GNU Autoconf 2.65 for python 3.2.
|
||||||
#
|
#
|
||||||
|
@ -1421,8 +1421,9 @@ Optional Packages:
|
||||||
--with-libm=STRING math library
|
--with-libm=STRING math library
|
||||||
--with-libc=STRING C library
|
--with-libc=STRING C library
|
||||||
--with-wide-unicode Use 4-byte Unicode characters (default is 2 bytes)
|
--with-wide-unicode Use 4-byte Unicode characters (default is 2 bytes)
|
||||||
--with-computed-gotos Use computed gotos / threaded dispatch in evaluation
|
--with(out)-computed-gotos
|
||||||
loop (not available on all compilers)
|
Use computed gotos in evaluation loop (enabled by
|
||||||
|
default on supported compilers)
|
||||||
|
|
||||||
Some influential environment variables:
|
Some influential environment variables:
|
||||||
CC C compiler command
|
CC C compiler command
|
||||||
|
@ -1929,11 +1930,11 @@ else
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
$ac_includes_default
|
$ac_includes_default
|
||||||
enum { N = $2 / 2 - 1 };
|
|
||||||
int
|
int
|
||||||
main ()
|
main ()
|
||||||
{
|
{
|
||||||
static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
|
static int test_array [1 - 2 * !(enum { N = $2 / 2 - 1 };
|
||||||
|
0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
|
||||||
test_array [0] = 0
|
test_array [0] = 0
|
||||||
|
|
||||||
;
|
;
|
||||||
|
@ -1944,11 +1945,11 @@ if ac_fn_c_try_compile "$LINENO"; then :
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
$ac_includes_default
|
$ac_includes_default
|
||||||
enum { N = $2 / 2 - 1 };
|
|
||||||
int
|
int
|
||||||
main ()
|
main ()
|
||||||
{
|
{
|
||||||
static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
|
static int test_array [1 - 2 * !(enum { N = $2 / 2 - 1 };
|
||||||
|
($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
|
||||||
< ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))];
|
< ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))];
|
||||||
test_array [0] = 0
|
test_array [0] = 0
|
||||||
|
|
||||||
|
@ -9121,7 +9122,7 @@ fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_doc_strings" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_doc_strings" >&5
|
||||||
$as_echo "$with_doc_strings" >&6; }
|
$as_echo "$with_doc_strings" >&6; }
|
||||||
|
|
||||||
# Check for Python-specific malloc support
|
# Check if eval loop should use timestamp counter profiling
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-tsc" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-tsc" >&5
|
||||||
$as_echo_n "checking for --with-tsc... " >&6; }
|
$as_echo_n "checking for --with-tsc... " >&6; }
|
||||||
|
|
||||||
|
@ -13502,6 +13503,49 @@ $as_echo "#define HAVE_BROKEN_MBSTOWCS 1" >>confdefs.h
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports computed gotos" >&5
|
||||||
|
$as_echo_n "checking whether $CC supports computed gotos... " >&6; }
|
||||||
|
if test "${ac_cv_computed_gotos+set}" = set; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
if test "$cross_compiling" = yes; then :
|
||||||
|
ac_cv_computed_gotos=no
|
||||||
|
else
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
static void *targets[1] = { &&LABEL1 };
|
||||||
|
goto LABEL2;
|
||||||
|
LABEL1:
|
||||||
|
return 0;
|
||||||
|
LABEL2:
|
||||||
|
goto *targets[0];
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_run "$LINENO"; then :
|
||||||
|
ac_cv_computed_gotos=yes
|
||||||
|
else
|
||||||
|
ac_cv_computed_gotos=no
|
||||||
|
fi
|
||||||
|
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
||||||
|
conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_computed_gotos" >&5
|
||||||
|
$as_echo "$ac_cv_computed_gotos" >&6; }
|
||||||
|
if test "$ac_cv_computed_gotos" = yes
|
||||||
|
then
|
||||||
|
|
||||||
|
$as_echo "#define HAVE_COMPUTED_GOTOS 1" >>confdefs.h
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
# Check for --with-computed-gotos
|
# Check for --with-computed-gotos
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-computed-gotos" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-computed-gotos" >&5
|
||||||
$as_echo_n "checking for --with-computed-gotos... " >&6; }
|
$as_echo_n "checking for --with-computed-gotos... " >&6; }
|
||||||
|
@ -13509,21 +13553,28 @@ $as_echo_n "checking for --with-computed-gotos... " >&6; }
|
||||||
# Check whether --with-computed-gotos was given.
|
# Check whether --with-computed-gotos was given.
|
||||||
if test "${with_computed_gotos+set}" = set; then :
|
if test "${with_computed_gotos+set}" = set; then :
|
||||||
withval=$with_computed_gotos;
|
withval=$with_computed_gotos;
|
||||||
if test "$withval" != no
|
if test "$withval" = yes
|
||||||
then
|
then
|
||||||
|
|
||||||
$as_echo "#define USE_COMPUTED_GOTOS 1" >>confdefs.h
|
$as_echo "#define USE_COMPUTED_GOTOS 1" >>confdefs.h
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||||
$as_echo "yes" >&6; }
|
$as_echo "yes" >&6; }
|
||||||
else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
||||||
$as_echo "no" >&6; }
|
|
||||||
fi
|
fi
|
||||||
else
|
if test "$withval" = no
|
||||||
|
then
|
||||||
|
|
||||||
|
$as_echo "#define USE_COMPUTED_GOTOS 0" >>confdefs.h
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||||
$as_echo "no" >&6; }
|
$as_echo "no" >&6; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no value specified" >&5
|
||||||
|
$as_echo "no value specified" >&6; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -14086,8 +14137,8 @@ esac
|
||||||
|
|
||||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||||
# Files that config.status was made for.
|
# Files that config.status was made for.
|
||||||
config_files="$ac_config_files"
|
config_files="`echo $ac_config_files`"
|
||||||
config_headers="$ac_config_headers"
|
config_headers="`echo $ac_config_headers`"
|
||||||
|
|
||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
|
|
42
configure.in
42
configure.in
|
@ -4124,20 +4124,50 @@ then
|
||||||
wide chars that would be converted.])
|
wide chars that would be converted.])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(whether $CC supports computed gotos)
|
||||||
|
AC_CACHE_VAL(ac_cv_computed_gotos,
|
||||||
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[[
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
static void *targets[1] = { &&LABEL1 };
|
||||||
|
goto LABEL2;
|
||||||
|
LABEL1:
|
||||||
|
return 0;
|
||||||
|
LABEL2:
|
||||||
|
goto *targets[0];
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
]]])],
|
||||||
|
[ac_cv_computed_gotos=yes],
|
||||||
|
[ac_cv_computed_gotos=no],
|
||||||
|
[ac_cv_computed_gotos=no]))
|
||||||
|
AC_MSG_RESULT($ac_cv_computed_gotos)
|
||||||
|
if test "$ac_cv_computed_gotos" = yes
|
||||||
|
then
|
||||||
|
AC_DEFINE(HAVE_COMPUTED_GOTOS, 1,
|
||||||
|
[Define if the C compiler supports computed gotos.])
|
||||||
|
fi
|
||||||
|
|
||||||
# Check for --with-computed-gotos
|
# Check for --with-computed-gotos
|
||||||
AC_MSG_CHECKING(for --with-computed-gotos)
|
AC_MSG_CHECKING(for --with-computed-gotos)
|
||||||
AC_ARG_WITH(computed-gotos,
|
AC_ARG_WITH(computed-gotos,
|
||||||
AS_HELP_STRING([--with-computed-gotos],
|
AS_HELP_STRING([--with(out)-computed-gotos],
|
||||||
[Use computed gotos / threaded dispatch in evaluation loop (not available on all compilers)]),
|
[Use computed gotos in evaluation loop (enabled by default on supported compilers)]),
|
||||||
[
|
[
|
||||||
if test "$withval" != no
|
if test "$withval" = yes
|
||||||
then
|
then
|
||||||
AC_DEFINE(USE_COMPUTED_GOTOS, 1,
|
AC_DEFINE(USE_COMPUTED_GOTOS, 1,
|
||||||
[Define if you want to use computed gotos in ceval.c.])
|
[Define if you want to use computed gotos in ceval.c.])
|
||||||
AC_MSG_RESULT(yes)
|
AC_MSG_RESULT(yes)
|
||||||
else AC_MSG_RESULT(no)
|
fi
|
||||||
fi],
|
if test "$withval" = no
|
||||||
[AC_MSG_RESULT(no)])
|
then
|
||||||
|
AC_DEFINE(USE_COMPUTED_GOTOS, 0,
|
||||||
|
[Define if you want to use computed gotos in ceval.c.])
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
fi
|
||||||
|
],
|
||||||
|
[AC_MSG_RESULT(no value specified)])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,9 @@
|
||||||
/* Define to 1 if you have the `clock' function. */
|
/* Define to 1 if you have the `clock' function. */
|
||||||
#undef HAVE_CLOCK
|
#undef HAVE_CLOCK
|
||||||
|
|
||||||
|
/* Define if the C compiler supports computed gotos. */
|
||||||
|
#undef HAVE_COMPUTED_GOTOS
|
||||||
|
|
||||||
/* Define to 1 if you have the `confstr' function. */
|
/* Define to 1 if you have the `confstr' function. */
|
||||||
#undef HAVE_CONFSTR
|
#undef HAVE_CONFSTR
|
||||||
|
|
||||||
|
@ -1037,7 +1040,7 @@
|
||||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||||
#undef TM_IN_SYS_TIME
|
#undef TM_IN_SYS_TIME
|
||||||
|
|
||||||
/* Define if you want to use computed gotos in ceval.c. */
|
/* Define to 0 if you don't want to use computed gotos in ceval.c. */
|
||||||
#undef USE_COMPUTED_GOTOS
|
#undef USE_COMPUTED_GOTOS
|
||||||
|
|
||||||
/* Enable extensions on AIX 3, Interix. */
|
/* Enable extensions on AIX 3, Interix. */
|
||||||
|
|
Loading…
Reference in New Issue