feat: add function-level slicing mode (--function-slice)#44
Open
lsz-asd wants to merge 9 commits into
Open
Conversation
Slicing Optimizations
Add function-level slicing as an alternative to line-level slicing. When --function-slice (-fs) is enabled, the slicing criterion is expanded from a single source line to all trace statements within the containing method, producing a method-grained backward slice. Changes: - CommandParser: add -fs/--function-slice CLI flag - Slicer: expand slicing criterion to all statements in target method - SlicePrettyPrinter: new utility class for method-grouped output - slicer4j.py: add -fs and -tcd options to Python wrapper New output files (function-slice mode only): - slice-function.log: slice results grouped by method signature - slice-pretty.log: human-readable report with dependency graph - slice-graph-function.pdf: method-level DOT dependency graph
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
Add function-level slicing as an alternative to the existing line-level
slicing. When
--function-slice(-fs) is enabled, the slicing criterionis expanded from a single source line to all trace statements within the
containing method, producing a method-grained backward slice.
Motivation
Line-level slicing answers "which lines affect this specific statement?"
Function-level slicing answers "which methods affect this entire function?"
This is useful for understanding inter-procedural dependencies at a higher
level of abstraction.
Changes
CommandParser.java-fs/--function-sliceCLI flagSlicer.javaSlicePrettyPrinter.javaslicer4j.py-fsand-tcdflags to Python wrapperNew output files (only with
-fs)slice-function.log— slice results grouped by method signatureslice-pretty.log— human-readable report with inter-method dependency graphslice-graph-function.pdf— method-level DOT dependency graphUsage
Test plan
main() and parse() methods
TextBuffer.expandCurrentSegment() dependencies
Screenshots