[pypy-svn] r23471 - in pypy/dist/pypy/translator/c: . src
mwh at codespeak.net
mwh at codespeak.net
Sat Feb 18 21:50:11 CET 2006
Author: mwh
Date: Sat Feb 18 21:49:18 2006
New Revision: 23471
Modified:
pypy/dist/pypy/translator/c/extfunc.py
pypy/dist/pypy/translator/c/src/ll_math.h
pypy/dist/pypy/translator/c/src/ll_os.h
Log:
don't annotate helpers for external functions which are never going to be
called by the translated program. speeds up the translator/c tests by ~20%.
as usual with the pypy mystery tour, this didn't require a very long lever, but
took a fair while to find a good place to stand :)
Modified: pypy/dist/pypy/translator/c/extfunc.py
==============================================================================
--- pypy/dist/pypy/translator/c/extfunc.py (original)
+++ pypy/dist/pypy/translator/c/extfunc.py Sat Feb 18 21:49:18 2006
@@ -138,15 +138,27 @@
fptr = rtyper.annotate_helper(func, argtypes)
return (func.__name__, fptr)
- yield annotate(ll_math.ll_frexp_result, lltype.Float, lltype.Signed)
- yield annotate(ll_math.ll_modf_result, lltype.Float, lltype.Float)
- yield annotate(ll_os.ll_stat_result, *([lltype.Signed] * 10))
-
- args = [lltype.Signed, lltype.Signed, lltype.Signed, lltype.Ptr(STR),
- lltype.Ptr(STR), lltype.Signed, lltype.Signed, lltype.Signed]
- yield annotate(ll__socket.ll__socket_addrinfo, *args)
- args = [lltype.Ptr(STR), lltype.Signed, lltype.Signed, lltype.Signed]
- yield annotate(ll__socket.ll__socket_sockname, *args)
+ if ll_math.ll_math_frexp in db.externalfuncs:
+ yield annotate(ll_math.ll_frexp_result, lltype.Float, lltype.Signed)
+ yield ('LL_NEED_MATH_FREXP', 1)
+
+ if ll_math.ll_math_modf in db.externalfuncs:
+ yield annotate(ll_math.ll_modf_result, lltype.Float, lltype.Float)
+ yield ('LL_NEED_MATH_MODF', 1)
+
+ if (ll_os.ll_os_stat in db.externalfuncs or
+ ll_os.ll_os_fstat in db.externalfuncs):
+ yield annotate(ll_os.ll_stat_result, *([lltype.Signed] * 10))
+ yield ('LL_NEED_OS_STAT', 1)
+
+# these helpers don't seem to be used anywhere any more/yet/???
+
+## args = [lltype.Signed, lltype.Signed, lltype.Signed, lltype.Ptr(STR),
+## lltype.Ptr(STR), lltype.Signed, lltype.Signed, lltype.Signed]
+## yield annotate(ll__socket.ll__socket_addrinfo, *args)
+
+## args = [lltype.Ptr(STR), lltype.Signed, lltype.Signed, lltype.Signed]
+## yield annotate(ll__socket.ll__socket_sockname, *args)
def predeclare_extfuncs(db, rtyper):
modules = {}
Modified: pypy/dist/pypy/translator/c/src/ll_math.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/ll_math.h (original)
+++ pypy/dist/pypy/translator/c/src/ll_math.h Sat Feb 18 21:49:18 2006
@@ -71,6 +71,8 @@
return r;
}
+#ifdef LL_NEED_MATH_FREXP
+
RPyFREXP_RESULT* LL_math_frexp(double x) {
int expo;
double m;
@@ -80,6 +82,8 @@
return ll_frexp_result(m, expo);
}
+#endif
+
double LL_math_atan2(double x, double y) {
double r;
LL_MATH_ERROR_RESET;
@@ -113,6 +117,8 @@
}
+#ifdef LL_NEED_MATH_MODF
+
RPyMODF_RESULT* LL_math_modf(double x) {
double intpart, fracpart;
LL_MATH_ERROR_RESET;
@@ -121,6 +127,8 @@
return ll_modf_result(fracpart, intpart);
}
+#endif
+
/* simple math function */
double LL_math_acos(double x) {
Modified: pypy/dist/pypy/translator/c/src/ll_os.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/ll_os.h (original)
+++ pypy/dist/pypy/translator/c/src/ll_os.h Sat Feb 18 21:49:18 2006
@@ -107,6 +107,8 @@
return fd;
}
+#ifdef LL_NEED_OS_STAT
+
RPySTAT_RESULT* _stat_construct_result_helper(STRUCT_STAT st) {
long res0, res1, res2, res3, res4, res5, res6, res7, res8, res9;
res0 = (long)st.st_mode;
@@ -146,6 +148,8 @@
return _stat_construct_result_helper(st);
}
+#endif
+
long LL_os_lseek(long fd, long pos, long how) {
#if defined(MS_WIN64) || defined(MS_WINDOWS)
PY_LONG_LONG res;
More information about the Pypy-commit
mailing list