-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
logging. Signed-off-by: David Korczynski <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,9 +18,14 @@ | |
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
import logging | ||
|
||
from pycg.machinery.pointers import NamePointer, LiteralPointer | ||
from pycg import utils | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class DefinitionManager(object): | ||
def __init__(self): | ||
self.defs = {} | ||
|
@@ -142,11 +147,19 @@ def update_pointsto_args(pointsto_args, arg, name): | |
pointsto_arg_def.add(item) | ||
return changed_something | ||
|
||
logger.info("Def-Iterating %d defs"%(len(self.defs))) | ||
if len(self.defs) > 9000: | ||
logger.info("The definition list is too large. This is likely to take forever. Avoid this step") | ||
return | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
DavidKorczynski
Author
Collaborator
|
||
|
||
for i in range(len(self.defs)): | ||
#logger.info("Def-idx-%d"%(i)) | ||
changed_something = False | ||
for ns, current_def in self.defs.items(): | ||
#logger.info("Def-idx2-%d"%(idx2)) | ||
# the name pointer of the definition we're currently iterating | ||
current_name_pointer = current_def.get_name_pointer() | ||
#print("Name point: %s"%(str(current_name_pointer))) | ||
# iterate the names the current definition points to items | ||
# for name in current_name_pointer.get(): | ||
for name in current_name_pointer.get().copy(): | ||
|
@@ -172,7 +185,6 @@ def update_pointsto_args(pointsto_args, arg, name): | |
pointsto_name_pointer.add_arg(arg_name, arg) | ||
continue | ||
changed_something = changed_something or update_pointsto_args(pointsto_args, arg, current_def.get_ns()) | ||
|
||
if not changed_something: | ||
break | ||
|
||
|
The main reason for the above change is that some projects will have 20K+ definitions, and the below six-nested loops will have a significant performance hit. ipykernel is the one that triggered this: google/oss-fuzz#9914
Note that this is an approimation suddenly, in that the converging will not happen in the usual manner. I don't think this should have significant impact on the results though -- at least not from initial experimentation.