[pypy-commit] pypy default: (mjacob, arigo) Remove dead code chain: RPyString_FromString, RPyString_New, predeclare_utility_functions.
mjacob
pypy.commits at gmail.com
Sun Jun 5 18:14:47 EDT 2016
Author: Manuel Jacob <me at manueljacob.de>
Branch:
Changeset: r84957:b8761aab407c
Date: 2016-06-06 00:09 +0200
http://bitbucket.org/pypy/pypy/changeset/b8761aab407c/
Log: (mjacob, arigo) Remove dead code chain: RPyString_FromString,
RPyString_New, predeclare_utility_functions.
Fix in rtyper.py by Armin.
diff --git a/rpython/rtyper/rtyper.py b/rpython/rtyper/rtyper.py
--- a/rpython/rtyper/rtyper.py
+++ b/rpython/rtyper/rtyper.py
@@ -204,6 +204,9 @@
blockcount = 0
self.annmixlevel = None
while True:
+ # make sure all reprs so far have had their setup() called
+ self.call_all_setups()
+
# look for blocks not specialized yet
pending = [block for block in self.annotator.annotated
if block not in self.already_seen]
@@ -236,8 +239,6 @@
previous_percentage = percentage
self.log.event('specializing: %d / %d blocks (%d%%)' %
(n, total, percentage))
- # make sure all reprs so far have had their setup() called
- self.call_all_setups()
self.log.event('-=- specialized %d%s blocks -=-' % (
blockcount, newtext))
diff --git a/rpython/translator/c/database.py b/rpython/translator/c/database.py
--- a/rpython/translator/c/database.py
+++ b/rpython/translator/c/database.py
@@ -48,7 +48,6 @@
self.delayedfunctionptrs = []
self.completedcontainers = 0
self.containerstats = {}
- self.helpers = OrderedDict()
# late_initializations is for when the value you want to
# assign to a constant object is something C doesn't think is
diff --git a/rpython/translator/c/extfunc.py b/rpython/translator/c/extfunc.py
--- a/rpython/translator/c/extfunc.py
+++ b/rpython/translator/c/extfunc.py
@@ -7,27 +7,6 @@
from rpython.translator.c.support import cdecl
-def predeclare_common_types(db, rtyper):
- # Common types
- yield ('RPyString', STR)
-
-def predeclare_utility_functions(db, rtyper):
- # Common utility functions
- def RPyString_New(length=lltype.Signed):
- return mallocstr(length)
-
- for fname, f in locals().items():
- if isinstance(f, types.FunctionType):
- # XXX this is painful :(
- if fname in db.helpers:
- yield (fname, db.helpers[fname])
- else:
- # hack: the defaults give the type of the arguments
- graph = rtyper.annotate_helper(f, f.func_defaults)
- db.helpers[fname] = graph
- yield (fname, graph)
-
-
def predeclare_exception_data(exctransformer, rtyper):
# Exception-related types and constants
exceptiondata = rtyper.exceptiondata
@@ -56,11 +35,8 @@
def predeclare_all(db, rtyper):
- for fn in [predeclare_common_types,
- predeclare_utility_functions,
- ]:
- for t in fn(db, rtyper):
- yield t
+ # Common types
+ yield ('RPyString', STR)
exctransformer = db.exctransformer
for t in predeclare_exception_data(exctransformer, rtyper):
diff --git a/rpython/translator/c/src/rtyper.c b/rpython/translator/c/src/rtyper.c
--- a/rpython/translator/c/src/rtyper.c
+++ b/rpython/translator/c/src/rtyper.c
@@ -36,11 +36,3 @@
free(dump);
}
}
-
-RPyString *RPyString_FromString(char *buf)
-{
- int length = strlen(buf);
- RPyString *rps = RPyString_New(length);
- memcpy(rps->rs_chars.items, buf, length);
- return rps;
-}
diff --git a/rpython/translator/c/src/rtyper.h b/rpython/translator/c/src/rtyper.h
--- a/rpython/translator/c/src/rtyper.h
+++ b/rpython/translator/c/src/rtyper.h
@@ -11,4 +11,3 @@
RPY_EXTERN char *RPyString_AsCharP(RPyString *rps);
RPY_EXTERN void RPyString_FreeCache(void);
-RPY_EXTERN RPyString *RPyString_FromString(char *buf);
More information about the pypy-commit
mailing list