[pythran] JIT-typing: part2

  • From: serge Guelton <serge.guelton@xxxxxxxxxxxxxxxx>
  • To: Mehdi AMINI <mehdi.amini@xxxxxxxxxxxxxxx>
  • Date: Tue, 26 Feb 2013 10:18:20 +0100

Hi again Mehdi,

I have been thining some more cocnerning how to extract all the
functions to compile into Pythran when you only have the starting point.
instead of trying to rebuild the graph, one could just extract all the
imported identifiers from the function, and recursievly extract the
relevant infos. Something like:

newly_called_functions = {'entry_point'}
called_functions = set(newly_called_functions)
while len(newly_called_functions) > 0:
    ncf = list(newly_called_functions)
    newly_called_functions = set()
    for f in newly_called_functions.iter():
        ids = imported_ids(f)
        fids = {id for id in ids if isfunction(id)}
        new_fids = fids - called_functions
        newly_called_functions.update(new_fids)
    called_functions.update(newly_called_functions)
print called_functions

looks better?




Other related posts:

  • » [pythran] JIT-typing: part2 - serge Guelton