def gather_all_code_objs(): all_code_objs = rgc.do_get_objects(try_cast_to_code) for code in all_code_objs: uid = code._vmprof_unique_id if uid != 0: self._write_code_registration(uid, full_name_func(code)) prev()
def get_referrers(space, args_w): """Return the list of objects that directly refer to any of objs.""" if not rgc.has_gcflag_extra(): raise missing_operation(space) # xxx uses a lot of memory to make the list of all W_Root objects, # but it's simpler this way and more correct than the previous # version of this code (issue #2612). It is potentially very slow # because each of the n calls to _list_w_obj_referents() could take # O(n) time as well, in theory, but I hope in practice the whole # thing takes much less than O(n^2). We could re-add an algorithm # that visits most objects only once, if needed... all_objects_w = rgc.do_get_objects(try_cast_gcref_to_w_root) result_w = [] for w_obj in all_objects_w: refs_w = [] gcref = rgc.cast_instance_to_gcref(w_obj) _list_w_obj_referents(gcref, refs_w) for w_arg in args_w: if w_arg in refs_w: result_w.append(w_obj) rgc.assert_no_more_gcflags() return space.newlist(result_w)
def get_objects(space): """Return a list of all app-level objects.""" if not rgc.has_gcflag_extra(): raise missing_operation(space) result_w = rgc.do_get_objects(try_cast_gcref_to_w_root) return space.newlist(result_w)
def gather_all_code_objs(self, space): all_code_objs = rgc.do_get_objects(try_cast_to_pycode) for code in all_code_objs: self.register_code(space, code)