(module)
| 64 | |
| 65 | |
| 66 | def optimizeCompiledPythonModule(module): |
| 67 | module_name = module.getFullName() |
| 68 | |
| 69 | optimization_logger.info_if_file( |
| 70 | "Doing module local optimizations for '{module_name}'.".format( |
| 71 | module_name=module_name |
| 72 | ), |
| 73 | other_logger=progress_logger, |
| 74 | ) |
| 75 | |
| 76 | touched = False |
| 77 | |
| 78 | # TODO: Make this an option for the user to control instead. |
| 79 | if isShowProgress() and isShowMemory(): |
| 80 | memory_watch = MemoryWatch() |
| 81 | |
| 82 | # Temporary workaround, since we do some optimization based on the last pass results |
| 83 | # that are then not yet fully seen in the traces yet until another time around, we |
| 84 | # allow to continue the loop even without changes one more time. |
| 85 | unchanged_count = 0 |
| 86 | |
| 87 | # Count the micro passes, so we can see how often we looped |
| 88 | micro_pass = 0 |
| 89 | |
| 90 | while True: |
| 91 | micro_pass += 1 |
| 92 | |
| 93 | # Indicator that new variables or changed were added in the previous |
| 94 | # pass, will require another pass to fully propagate. |
| 95 | added_variables = "changed_variable_usage" in tag_set |
| 96 | tag_set.clear() |
| 97 | |
| 98 | try: |
| 99 | # print("Compute module") |
| 100 | with withChangeIndicationsTo(signalChange): |
| 101 | scopes_were_incomplete = module.computeModule() |
| 102 | except SystemExit: |
| 103 | raise |
| 104 | except BaseException: |
| 105 | general.info("Interrupted while working on '%s'." % module) |
| 106 | raise |
| 107 | |
| 108 | if scopes_were_incomplete or added_variables: |
| 109 | tag_set.add("var_usage") |
| 110 | added_variables = False |
| 111 | |
| 112 | Graphs.onModuleOptimizationStep(module) |
| 113 | |
| 114 | if ( |
| 115 | unchanged_count == 1 |
| 116 | and tag_set |
| 117 | and not isExperimental("ignore-extra-micro-pass") |
| 118 | ): |
| 119 | optimization_logger.sysexit( |
| 120 | """\ |
| 121 | Changes made after there were already no changes for module '%s' \ |
| 122 | in the extra micro pass that checks for that to not happen \ |
| 123 | that is done in debug mode: '%s'""" % (module_name, tag_set.asString()), |
no test coverage detected
searching dependent graphs…