def on_finish(): # Now traverse all of the data seen at every previous pass print('on_finish') if 0: print('num_ggc_collections: %i ' % num_ggc_collections) # Call gcc._force_garbage_collection(), and verify that on_ggc_start # gets called: old_collections = num_ggc_collections gcc._force_garbage_collection() # num_ggc_collections should have increased by 1: assert num_ggc_collections > 0 assert num_ggc_collections == old_collections + 1 print('num_ggc_collections: new - old: %i ' % (num_ggc_collections - old_collections)) if 0: print('num_ggc_collections: %i ' % num_ggc_collections)
import gcc class UnusedArg(gcc.GimplePass): def execute(self, fun): pass ps = UnusedArg(name='UnusedArg') ps.register_after('lower') gcc._force_garbage_collection()