Mercurial > paraspace
changeset 52:67aa8ca8fff3
untested dex_deptracker.update_offset()
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Tue, 21 Jun 2011 18:36:45 +0800 |
parents | 00d106f6c427 |
children | 705356005362 |
files | paraspace/dex_deptracker.py |
diffstat | 1 files changed, 23 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/paraspace/dex_deptracker.py Mon Jun 20 22:19:37 2011 +0800 +++ b/paraspace/dex_deptracker.py Tue Jun 21 18:36:45 2011 +0800 @@ -265,7 +265,7 @@ return all_dep_decls -class _marker(dexfile.relocatable): +class _marker(dexfile.null_relocatable): back_type = None pass @@ -696,17 +696,30 @@ def update_offset(dexroot, all_dep_decls): - depon_dep_map = _build_sub_depon_dep(all_dep_decls) - - def skip_dep(obj, parents, name_path): - if name_path in all_dep_decls: - return True - return False + from dexfile import man_off + + moff = man_off(0) + queue = [dexroot] - for obj, parents, name_path in \ - _travel_dex_relocatable(dexroot, skip_func=skip_dep): - if name_path not in depon_dep_map: + while queue: + obj = queue.pop() + if isinstance(obj, _marker): + obj.set_marker(moff()) + pass + if isinstance(obj, dexfile.relocatable): + moff(obj.sizeof()) + pass + + if isinstance(obj, dexfile.ref): continue + if not isinstance(obj, dexfile.relocatable): + continue + + children = list(obj.children()) + attrs = [_dex_tree_get_child(obj, child) + for child in children] + attrs.reverse() + queue = queue + attrs pass pass