Search
lxdream.org :: lxdream :: r899:18e0cdea76aa
lxdream 0.9.1
released Jun 29
Download Now
changeset899:18e0cdea76aa
parent898:fc3cfc0859fb
child900:609fa702406b
authornkeynes
dateSat Oct 25 12:36:42 2008 +0000 (11 years ago)
Add --enable-optimized flag (on by default).
When optimized, add -fomit-frame-pointer -fexceptions on non-Mac x86 (Unwinding doesn't seem to work correctly on Mac)
config.h.in
configure
configure.in
src/sh4/ia32abi.h
1.1 --- a/config.h.in Fri Oct 24 10:38:43 2008 +0000
1.2 +++ b/config.h.in Sat Oct 25 12:36:42 2008 +0000
1.3 @@ -43,6 +43,9 @@
1.4 /* Have esound support */
1.5 #undef HAVE_ESOUND
1.6
1.7 +/* Have exception stack-frame information */
1.8 +#undef HAVE_EXCEPTIONS
1.9 +
1.10 /* Define if the GNU gettext() function is already present or preinstalled. */
1.11 #undef HAVE_GETTEXT
1.12
2.1 --- a/configure Fri Oct 24 10:38:43 2008 +0000
2.2 +++ b/configure Sat Oct 25 12:36:42 2008 +0000
2.3 @@ -804,6 +804,7 @@
2.4 enable_dependency_tracking
2.5 enable_strict_warn
2.6 enable_translator
2.7 +enable_optimized
2.8 enable_trace
2.9 enable_watch
2.10 enable_sh4stats
2.11 @@ -1469,7 +1470,9 @@
2.12 --disable-dependency-tracking speeds up one-time build
2.13 --enable-dependency-tracking do not reject slow dependency extractors
2.14 --enable-strict-warn Enable strict compilation warnings
2.15 - --disable-translator Disable the SH4 translator (Enable by default)
2.16 + --disable-translator Disable the SH4 translator (Enabled by default)
2.17 + --disable-optimized Disable compile-time optimizations (Enabled by
2.18 + default)
2.19 --enable-trace Enable generation of IO traces (warning: hurts
2.20 performance)
2.21 --enable-watch Enable watchpoints in the debugger (warning: hurts
2.22 @@ -6565,6 +6568,13 @@
2.23 enable_translator=yes
2.24 fi
2.25
2.26 +# Check whether --enable-optimized was given.
2.27 +if test "${enable_optimized+set}" = set; then
2.28 + enableval=$enable_optimized; true
2.29 +else
2.30 + enable_optimized=yes
2.31 +fi
2.32 +
2.33 # Check whether --enable-trace was given.
2.34 if test "${enable_trace+set}" = set; then
2.35 enableval=$enable_trace; if test "$enableval" == "yes"; then
2.36 @@ -6628,11 +6638,17 @@
2.37
2.38
2.39
2.40 +if test "x$enable_optimized" = "xyes"; then
2.41 + CFLAGS="-g -O2"
2.42 +else
2.43 + CFLAGS="-g3"
2.44 +fi
2.45 if test "x$GCC" = "xyes"; then
2.46 CFLAGS="$CFLAGS -fno-strict-aliasing"
2.47 fi
2.48
2.49
2.50 +
2.51 lxdream_save_cppflags="$CPPFLAGS"
2.52 CPPFLAGS="$CPPFLAGS -x objective-c"
2.53 cat >conftest.$ac_ext <<_ACEOF
2.54 @@ -6849,6 +6865,14 @@
2.55 _ACEOF
2.56
2.57 fi
2.58 +if test "x$enable_optimized" = "xyes" -a "x$APPLE_BUILD" != "xyes"; then
2.59 + CFLAGS="$CFLAGS -fexceptions -fomit-frame-pointer"
2.60 +
2.61 +cat >>confdefs.h <<\_ACEOF
2.62 +#define HAVE_EXCEPTIONS 1
2.63 +_ACEOF
2.64 +
2.65 +fi
2.66
2.67
2.68
3.1 --- a/configure.in Fri Oct 24 10:38:43 2008 +0000
3.2 +++ b/configure.in Sat Oct 25 12:36:42 2008 +0000
3.3 @@ -23,8 +23,11 @@
3.4 AS_HELP_STRING( [--enable-strict-warn], [Enable strict compilation warnings]),
3.5 [CFLAGS="$CFLAGS -Werror -Wall -Wno-unused"], [])
3.6 AC_ARG_ENABLE( translator,
3.7 - AS_HELP_STRING( [--disable-translator], [Disable the SH4 translator (Enable by default)]),
3.8 + AS_HELP_STRING( [--disable-translator], [Disable the SH4 translator (Enabled by default)]),
3.9 [true], [enable_translator=yes] )
3.10 +AC_ARG_ENABLE( optimized,
3.11 + AS_HELP_STRING( [--disable-optimized], [Disable compile-time optimizations (Enabled by default)]),
3.12 + [true], [enable_optimized=yes] )
3.13 AC_ARG_ENABLE( trace,
3.14 AS_HELP_STRING( [--enable-trace], [Enable generation of IO traces (warning: hurts performance)]),
3.15 [if test "$enableval" == "yes"; then
3.16 @@ -52,10 +55,16 @@
3.17
3.18 dnl ------------
3.19
3.20 +if test "x$enable_optimized" = "xyes"; then
3.21 + CFLAGS="-g -O2"
3.22 +else
3.23 + CFLAGS="-g3"
3.24 +fi
3.25 if test "x$GCC" = "xyes"; then
3.26 CFLAGS="$CFLAGS -fno-strict-aliasing"
3.27 fi
3.28
3.29 +
3.30 dnl ------------ Check if we're building on Darwin --------------
3.31
3.32 dnl For starters, do we have a working objective-c compiler?
3.33 @@ -82,6 +91,10 @@
3.34 if test "x$HAVE_COCOA" = 'xyes' -a "x$with_gtk" = "xno"; then
3.35 AC_DEFINE(OSX_BUNDLE, [1], [Generating a bundled application])
3.36 fi
3.37 +if test "x$enable_optimized" = "xyes" -a "x$APPLE_BUILD" != "xyes"; then
3.38 + CFLAGS="$CFLAGS -fexceptions -fomit-frame-pointer"
3.39 + AC_DEFINE(HAVE_EXCEPTIONS, [1], [Have exception stack-frame information])
3.40 +fi
3.41
3.42 dnl ----------- Check for mandatory dependencies --------------
3.43 dnl Check for libpng (required)
4.1 --- a/src/sh4/ia32abi.h Fri Oct 24 10:38:43 2008 +0000
4.2 +++ b/src/sh4/ia32abi.h Sat Oct 25 12:36:42 2008 +0000
4.3 @@ -264,6 +264,46 @@
4.4 }
4.5 }
4.6
4.7 +/**
4.8 + * The unwind methods only work if we compiled with DWARF2 frame information
4.9 + * (ie -fexceptions), otherwise we have to use the direct frame scan.
4.10 + */
4.11 +#ifdef HAVE_EXCEPTIONS
4.12 +#include <unwind.h>
4.13 +
4.14 +struct UnwindInfo {
4.15 + int have_result;
4.16 + void *pc;
4.17 +};
4.18 +
4.19 +_Unwind_Reason_Code xlat_check_frame( struct _Unwind_Context *context, void *arg )
4.20 +{
4.21 + void *ebp = (void *)_Unwind_GetGR(context, 5);
4.22 + void *expect = (((uint8_t *)&sh4r) + 128 );
4.23 + struct UnwindInfo *info = arg;
4.24 + if( ebp == expect ) {
4.25 + info->have_result = 1;
4.26 + info->pc = (void *)_Unwind_GetIP(context);
4.27 + } else if( info->have_result ) {
4.28 + return _URC_NORMAL_STOP;
4.29 + }
4.30 +
4.31 + return _URC_NO_REASON;
4.32 +}
4.33 +
4.34 +void *xlat_get_native_pc()
4.35 +{
4.36 + struct _Unwind_Exception exc;
4.37 + struct UnwindInfo info;
4.38 +
4.39 + info.have_result = 0;
4.40 + void *result = NULL;
4.41 + _Unwind_Backtrace( xlat_check_frame, &info );
4.42 + if( info.have_result )
4.43 + return info.pc;
4.44 + return NULL;
4.45 +}
4.46 +#else
4.47 void *xlat_get_native_pc()
4.48 {
4.49 void *result = NULL;
4.50 @@ -286,6 +326,7 @@
4.51 : "eax", "ecx", "edx" );
4.52 return result;
4.53 }
4.54 +#endif
4.55
4.56 #endif /* !lxdream_ia32abi_H */
4.57
.