pub struct DexPool {
pub dex_labels: Vec<String>,
pub order: Vec<String>,
/* private fields */
}Fields§
§dex_labels: Vec<String>Human label per image (“weibo!classes.dex”) for the provenance header; defaults to “dex N” until the CLI names the inputs.
order: Vec<String>Class names in insertion order (stable for output).
Implementations§
Source§impl DexPool
impl DexPool
pub fn new() -> Self
Sourcepub fn ctor_ref_sigs(&self, class: &str) -> Option<&FxHashSet<String>>
pub fn ctor_ref_sigs(&self, class: &str) -> Option<&FxHashSet<String>>
Referenced <init> argument-descriptor set for a class internal
name (see ctor_refs). Builds the whole index on first call by
scanning every image’s method-id table for <init> refs — cheap
(flat table, integer name-idx compare against the interned
“
Sourcepub fn proto_desc_parsed(
&self,
di: usize,
proto_idx: u32,
) -> Arc<MethodDescriptor> ⓘ
pub fn proto_desc_parsed( &self, di: usize, proto_idx: u32, ) -> Arc<MethodDescriptor> ⓘ
Shared MethodDescriptor of a proto (one parse per image).
Sourcepub fn type_name_arc(&self, di: usize, type_idx: u32) -> Arc<str> ⓘ
pub fn type_name_arc(&self, di: usize, type_idx: u32) -> Arc<str> ⓘ
Shared internal class name of a type id (one strip+alloc per image).
Sourcepub fn type_java(&self, di: usize, type_idx: u32) -> Arc<JavaType> ⓘ
pub fn type_java(&self, di: usize, type_idx: u32) -> Arc<JavaType> ⓘ
Shared parsed type of a type id.
Sourcepub fn outer_of(&self, name: &str) -> Option<&str>
pub fn outer_of(&self, name: &str) -> Option<&str>
The outer class of name, from the cached map (borrowed).
Sourcepub fn children_of(&self, internal: &str) -> &[String]
pub fn children_of(&self, internal: &str) -> &[String]
Direct nested children of internal (any $ depth 1), cached.
(Perf: returns a borrowed slice — the owned-Vec clone ran once per
class on 98k-class runs.)
Sourcepub fn add_dex(&mut self, dex: DexFile) -> usize
pub fn add_dex(&mut self, dex: DexFile) -> usize
Adds one image; duplicate class names keep their first definition.
Returns the image’s index — call set_dex_label with it to give the
provenance header a real origin instead of the default “dex N”.
Sourcepub fn add_names(&mut self, names: impl IntoIterator<Item = String>)
pub fn add_names(&mut self, names: impl IntoIterator<Item = String>)
Registers class NAMES only; the PoolClass (annotation reads
included) is materialized on first get. Duplicate class names
keep their first definition, matching add_dex.
Register class names without any image. Later add_dex_lazy for a
real image keeps the first registration (first-wins, matching the
eager/lazy builders); names never materialize.
pub fn add_dex_lazy(&mut self, dex: DexFile) -> usize
Sourcepub fn add_dex_lazy_arc(&mut self, dex: Arc<DexFile>) -> usize
pub fn add_dex_lazy_arc(&mut self, dex: Arc<DexFile>) -> usize
Lazy registration from a shared image. The two-tier single-class path rebuilds its pool after loading additional images; keeping the parsed image in an Arc avoids re-parsing it on every round.
Sourcepub fn set_dex_label(&mut self, idx: usize, label: impl Into<String>)
pub fn set_dex_label(&mut self, idx: usize, label: impl Into<String>)
Label the image at idx (see add_dex).
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn get(&self, internal: &str) -> Option<&PoolClass>
Sourcepub fn set_facade_skip_unparsed(&self)
pub fn set_facade_skip_unparsed(&self)
Skip unparsed NameOnly classes during Kotlin facade analysis.
Sourcepub fn clear_name_only_miss(&self)
pub fn clear_name_only_miss(&self)
Clear the NameOnly-materialization marker (call before rendering).
Sourcepub fn name_only_miss_name(&self) -> Option<String>
pub fn name_only_miss_name(&self) -> Option<String>
Name of the first NameOnly class the renderer requested.
Sourcepub fn name_only_misses(&self) -> Vec<String>
pub fn name_only_misses(&self) -> Vec<String>
Every NameOnly class the renderer requested since the last clear.
Sourcepub fn name_only_missed(&self) -> bool
pub fn name_only_missed(&self) -> bool
True when rendering needed a class whose image was not parsed.
Sourcepub fn materialize_all(&self, threads: usize)
pub fn materialize_all(&self, threads: usize)
Materialize every lazy entry (parallel across the given chunk count). After this the pool is observationally identical to an eagerly-built one — including the annotation-aware outer-map — while the annotation reads ran on worker threads instead of the serial pool build (~0.2s on weibo).
Sourcepub fn dex(&self, idx: usize) -> Option<Arc<DexFile>>
pub fn dex(&self, idx: usize) -> Option<Arc<DexFile>>
One image as an Arc snapshot (borrows of the snapshot live as long as the caller holds the Arc).
pub fn dex_count(&self) -> usize
Sourcepub fn root_pkg_segs(&self) -> &FxHashSet<String>
pub fn root_pkg_segs(&self) -> &FxHashSet<String>
First path segments of every package in the pool (cached once).
Sourcepub fn package_simples(&self) -> &FxHashMap<String, Arc<FxHashSet<String>>>
pub fn package_simples(&self) -> &FxHashMap<String, Arc<FxHashSet<String>>>
Package → simple names of its direct classes, cached once per pool (the import-collision gate consults it per class — the uncached scan was O(classes²) and 10×’d weixin’s wall time).
Sourcepub fn kotlin_facade_map(
&self,
) -> &FxHashMap<String, (String, Option<Arc<(FxHashSet<(String, String)>, FxHashSet<String>)>>)>
pub fn kotlin_facade_map( &self, ) -> &FxHashMap<String, (String, Option<Arc<(FxHashSet<(String, String)>, FxHashSet<String>)>>)>
Kotlin multi-file class facades: the compiler splits a file facade
(kotlin.text.StringsKt) into package-private parts
(StringsKt__StringsKt, StringsKt__StringsJVMKt) and call sites
target the PARTS directly. Java cannot access a package-private
class cross-package (“StringsKt__StringsKt在kotlin.text中不是公共的”
— 1.4k lark root errors), but the public facade EXTENDS the parts,
so static members resolve through it: rewrite the reference’s owner
class to the facade. part → base, gated on base existing, being
public, and transitively extending the part (static inheritance is
the resolution guarantee).
pub fn class_names(&self) -> impl Iterator<Item = &str>
Sourcepub fn is_subtype(&self, sub: &str, sup: &str) -> bool
pub fn is_subtype(&self, sub: &str, sup: &str) -> bool
True when sub is assignable to sup (internal names), walking the
pool’s hierarchy. Unknown classes are never assignable (conservative).
Source§impl DexPool
Classes to emit as their own compilation units: top-level classes plus
anonymous/local/lambda-shaped ones (clean members render inline).
impl DexPool
Classes to emit as their own compilation units: top-level classes plus anonymous/local/lambda-shaped ones (clean members render inline).
Sourcepub fn snapshot_accessor_code(&self)
pub fn snapshot_accessor_code(&self)
Arm image retirement (full-decompile driver only): count one
pending class per image by pool ownership.
Snapshot every synthetic-static accessor body (the exact predicate
inline_accessors uses) as RAW code_item bytes, so cross-image
accessor reads during worker runs survive image retirement.
Call AFTER materialization and BEFORE arm_retirement; idempotent
(first fill wins). Raw memcpy, no decode — accessors are numerous
(weixin ~100k) but only a fraction are ever inlined, so decoding
stays lazy at the use site. The slice bound covers the fixed
header + insns + try items with generous handler slack (accessor
tries are vanishingly rare; the snapshot is a deterministic
function of the image either way).
Sourcepub fn accessor_code(&self, dex_idx: usize, code_off: u32) -> Option<Arc<[u8]>>
pub fn accessor_code(&self, dex_idx: usize, code_off: u32) -> Option<Arc<[u8]>>
Snapshotted accessor code_item bytes, when the snapshot was taken.
Parse with CodeItem::parse(&bytes, 0).
pub fn arm_retirement(&self)
Sourcepub fn report_class_done(&self, class_name: &str) -> Option<usize>
pub fn report_class_done(&self, class_name: &str) -> Option<usize>
Report one class finished; Some(image) when it was the image’s last class (driver batches these into release_images).
Sourcepub fn release_images(&self, indexes: &[usize])
pub fn release_images(&self, indexes: &[usize])
Release the images’ inflated bytes. Safe: the driver calls this
only when every class of each image is emitted or failed; new
dex() snapshots still work (tables valid, code accessors empty).