perf+refactor: clean Workspace API, remove SearchEngine, optimize index building#1
Merged
perf+refactor: clean Workspace API, remove SearchEngine, optimize index building#1
Conversation
Handle types like Vector.<int> by recursively resolving the base type and type parameters via CONSTANT_TypeName in both resolve_multiname and resolve_multiname_full.
Cover all functions: resolve_multiname, resolve_multiname_full, parse_slot_trait, parse_method_trait, parse_class_trait, resolve_traits, and build_method_body_map (39 tests).
Allows building CONSTANT_TypeName multinames (e.g. Vector.<int>) programmatically, matching the existing qname/multiname/rtqname API.
Adds bytecode-level field access analysis that tracks OP_getproperty (read), OP_setproperty (write), and OP_initproperty (init) across all method bodies. Includes per-field queries (readers_of, writers_of), per-method queries (fields_read_by, fields_written_by), constructor assignment tracking, and a CLI command (flashkit fields).
…gine - Fix O(n*m) bug in ReferenceIndex (11s → 2s for BrawlhallaAir.swf) - Add unified single-pass bytecode decoder (3x redundant decoding → 1x) - Add lazy index building on Workspace (built on first access, cached) - Add clean API methods on Workspace (search_strings, references_to, field_writers, get_subclasses, callers, etc.) so users never need to import or construct analysis indexes directly - Add analysis properties on ClassInfo/FieldInfo/MethodInfoResolved (cls.strings, field.readers, method.fields_written) - Remove SearchEngine module (fully replaced by Workspace methods) - Move search tests to workspace tests - Update all CLI commands to use Workspace API directly - Total load time: ~15s → ~3s for BrawlhallaAir.swf
4f313f7 to
009d285
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ws.search_strings(),ws.references_to(),ws.callers(),ws.field_writers(), etc.) so users never need to import analysis indexes directlycls.strings,field.readers,method.fields_written)Changes
Performance:
ReferenceIndex._index_method_bodies→ O(n) with dict lookupunified.pysingle-pass bytecode decoder — builds StringIndex, ReferenceIndex, and FieldAccessIndex in one pass instead of 3 separate decodesscan_relevant_opcodes()fast-path in disasm that skips full instruction decodingAPI cleanup:
ws.method()— no need to importStringIndex,ReferenceIndex, etc.cls.strings,cls.references_to,cls.subclasses,cls.ancestorsfield.readers,field.writersmethod.fields_read,method.fields_writtenRemoved:
flashkit/search/module (SearchEngine, ClassResult, MemberResult, StringResult)tests/search/— coverage moved totests/workspace/test_workspace.pyTest plan