Repository navigation
Conversation
…aLocal, and AsmMethodSource **What does this PR address? (Why)** Local objects lack a slot index information local was originated from. This information is crucial for downstream analyses and code generators that need to map Jimple locals back to their original JVM stack frame slots. In particular used with Local packers/merging (analyses cannot distinguish between real local variables and stack ones). **What are the main implementation details? (What, How)** - Local extended with `slotIndex` field, constructor, getters, and withers. - Mirrored constructor, withers, and getters in `JavaLocal`. - Added factory overloads in `Jimple` and `JavaJimple`. - Preserved `equals` and `hashCode` semantics based on name/identity to maintain 100% backward compatibility with existing sets and maps. - In `AsmMethodSource`: assigned `localIdx` (slot 0) to `thisLocal` for non-static methods, assigned `localIdx` to formal parameter locals. **Checklist** *Code style & guidelines* - [x] I ran the formatter: `mvn com.spotify.fmt:fmt-maven-plugin:format` - [x] I added the necessary comments in the code - [x] I provided meaningful tests for my proposed change - [ ] I updated documentation (if needed) *Self-review* - [x] I performed a self-review of my code - [x] I added or updated tests where needed - [x] I have successfully run tests with your changes locally - [x] My branch is up to date with `develop` *Review* - [ ] CI checks are green - [ ] I requested a review from a core contributor
…nputLocation **What does this PR address? (Why)** This enables to specify extended analysis scopes to control optional analysis features. In particular it allows to enable specific processing in AsmMethodSource (e.g., LocalVariableTable debug info processing when required). **What are the main implementation details? (What, How)** - Introduced `AnalysisExtendedScope` enum in `sootup.core.inputlocation`. - Added default `getExtendedScope()` method to `AnalysisInputLocation` returning an empty set by default. - Added constructor overloads and static factory methods accepting `Set<AnalysisExtendedScope>` in `PathBasedAnalysisInputLocation`, `ArchiveBasedAnalysisInputLocation`, `DirectoryBasedAnalysisInputLocation`, `JavaClassPathAnalysisInputLocation`, and `WarArchiveAnalysisInputLocation`. - Extended scopes are stored as immutable `EnumSet` copies. - Added unit test covering extended scope propagation in `PathBasedAnalysisInputLocationTest`. **Checklist** *Code style & guidelines* - [x] I ran the formatter: `mvn com.spotify.fmt:fmt-maven-plugin:format` - [x] I added the necessary comments in the code - [x] I provided meaningful tests for my proposed change - [ ] I updated documentation (if needed) *Self-review* - [x] I performed a self-review of my code - [x] I added or updated tests where needed - [x] I have successfully run tests with my changes locally - [x] My branch is up to date with `develop` *Review* - [ ] CI checks are green - [ ] I requested a review from a core contributor
…nd metadata propagation **What does this PR address? (Why)** Adds statement-level LocalVariableTable debug scopes and metadata propagation to Jimple statements. As Body is subject to transformations and optimizations this makes difficult to connect LVT debug information to the final Jimple statements. Many options were considered for observing Body transformations callbacks to monitor body changes and update LVT mapping but this requires a lot of support in Delegates and is not error-prone. Instead, propagation of LVT information withing Statement location information allows to have Local variable visibility for each statement. Also existing Delegate implementation already supports location information adopting by Jimple changes that will also transfer/adopt LVT. **What are the main implementation details? (What, How)** - functionality to be enabled with `AnalysisExtendedScope.LocalVariableTable` in `AnalysisInputLocation`. - Added immutable `LocalVariableInfo` (name, slotIndex, descriptor) and `LocalVariableScope` models in `sootup.core.model`. - Introduced `LocalVariableStmtPositionInfo` extending `StmtPositionInfo` to attach immutable variable scopes to statement positions without mutating existing position structures or breaking subclasses. - Updated `StmtPositionInfo.withStmtPosition` to allow polymorphic preservation of attached metadata when line numbers change. - Added `LocalVariableTableLocals` to parse LVT entries, track start/end labels, resolve overlapping slot scopes, and produce per-instruction `LocalVariableScope` snapshots. - Attached scopes to converted Jimple statements and exception identity statements. - Documented scope handling in `docs/bodyinterceptors.md`. - Added tests. **Checklist** *Code style & guidelines* - [x] I ran the formatter: `mvn com.spotify.fmt:fmt-maven-plugin:format` - [x] I added the necessary comments in the code - [x] I provided meaningful tests for my proposed change - [x] I updated documentation (if needed) *Self-review* - [x] I performed a self-review of my code - [x] I added or updated tests where needed - [x] I have successfully run tests with my changes locally - [x] My branch is up to date with `develop` *Review* - [ ] CI checks are green - [x] I requested a review from a core contributor
7 of 10 tasks
dkimitsa
marked this pull request as draft
October 6, 2026 17:55
This branch has not been deployed
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.
depends on: #1777
What does this PR address? (Why)
This PR consist of 2 commits:
First:
Enables to specify extended analysis scopes to control optional analysis features.
In particular it allows to enable specific processing in AsmMethodSource (e.g., LocalVariableTable
debug info processing when required).
Second:
Adds statement-level LocalVariableTable debug scopes and metadata propagation to Jimple statements.
As Body is subject to transformations and optimizations this makes difficult to connect LVT debug information to the
final Jimple statements.
Many options were considered for observing Body transformations callbacks to monitor body changes and update LVT mapping
but this requires a lot of support in Delegates and is not error-prone.
Instead, propagation of LVT information withing Statement location information allows to have Local variable visibility for
each statement. Also existing Delegate implementation already supports location information adopting by Jimple changes that will also transfer/adopt LVT.
What are the main implementation details? (What, How)
AnalysisExtendedScope.LocalVariableTableinAnalysisInputLocation.LocalVariableInfo(name, slotIndex, descriptor) andLocalVariableScopemodels insootup.core.model.LocalVariableStmtPositionInfoextendingStmtPositionInfoto attach immutable variable scopes to statement positions without mutating existing position structures or breaking subclasses.StmtPositionInfo.withStmtPositionto allow polymorphic preservation of attached metadata when line numbers change.LocalVariableTableLocalsto parse LVT entries, track start/end labels, resolve overlapping slot scopes, and produce per-instructionLocalVariableScopesnapshots.docs/bodyinterceptors.md.Compatibility note
it breaks binary compatibility due StmtPositionInfo being changed from Class to Interface
Checklist
Code style & guidelines
mvn com.spotify.fmt:fmt-maven-plugin:formatSelf-review
developReview