Skip to content

Custom state on analysis init + custom call return logic#346

Merged
lucaneg merged 3 commits intomasterfrom
state-manipulation
Dec 9, 2025
Merged

Custom state on analysis init + custom call return logic#346
lucaneg merged 3 commits intomasterfrom
state-manipulation

Conversation

@lucaneg
Copy link
Member

@lucaneg lucaneg commented Dec 9, 2025

Description
SemanticDomain#makeLattice can now create arbitrary lattice elements that are kept as starting states for the analysis. SemanticDomain now also has a onCallReturn that allows custom modifications to the state returned by calls.

Fixed bugs
Closes #256

@lucaneg lucaneg added this to the 0.2 milestone Dec 9, 2025
@lucaneg lucaneg self-assigned this Dec 9, 2025
Copilot AI review requested due to automatic review settings December 9, 2025 09:48
@lucaneg lucaneg added 🐛 type:bug Something isn't working 🎆 type:feature New feature or request labels Dec 9, 2025
@lucaneg lucaneg added this to LiSA Dec 9, 2025
@lucaneg lucaneg added ⁉ priority:p2 Priority planning - level 2 🔍 scope:analysis Work regarding abstract domains or fixpoint algorithms 🌍 scope:interproc Work regarding interprocedural analyses or call graphs labels Dec 9, 2025
@lucaneg lucaneg moved this to PR WIP in LiSA Dec 9, 2025
@lucaneg lucaneg added the 🏗 resolution:wip Incomplete work - do not review yet label Dec 9, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for custom call return logic and custom initial states in the analysis framework. It introduces the onCallReturn method to both SemanticDomain and SemanticComponent interfaces, allowing domains to restore or modify state when execution returns from a callee. Additionally, it updates makeLattice to define the initial analysis state.

Key changes:

  • Added onCallReturn method to enable custom state restoration after function calls
  • Enhanced makeLattice documentation to clarify it returns the initial analysis state
  • Refactored initial state setup from LiSARunner into Analysis.makeLattice for better encapsulation

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
SemanticDomain.java Added abstract onCallReturn method and updated makeLattice documentation
SemanticComponent.java Added default onCallReturn method implementation and updated makeLattice documentation
Analysis.java Implemented onCallReturn and enhanced makeLattice to properly initialize analysis state
LiSARunner.java Simplified to use analysis.makeLattice() directly, removing local state initialization
ContextBasedAnalysis.java Integrated onCallReturn call after unscoping to restore caller state
TestAbstractDomain.java Added trivial onCallReturn implementation for test domain
TracePartitioning.java Added onCallReturn implementation with TODO for trace matching, updated makeLattice to return top
NonInterference.java Implemented onCallReturn to restore non-interference guards from caller
SimpleAbstractDomain.java Delegated onCallReturn to component domains and updated makeLattice to return top
Reachability.java Implemented onCallReturn to restore reachability status and updated makeLattice to start as reachable
DomainWithReplacement.java Fixed documentation comment from SemanticDomain to SemanticComponent

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lucaneg lucaneg removed the 🏗 resolution:wip Incomplete work - do not review yet label Dec 9, 2025
@lucaneg lucaneg moved this from PR WIP to PR Ready in LiSA Dec 9, 2025
@lucaneg lucaneg merged commit 03b8c05 into master Dec 9, 2025
3 checks passed
@lucaneg lucaneg deleted the state-manipulation branch December 9, 2025 09:58
@github-project-automation github-project-automation bot moved this from PR Ready to PR Merged in LiSA Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⁉ priority:p2 Priority planning - level 2 🔍 scope:analysis Work regarding abstract domains or fixpoint algorithms 🌍 scope:interproc Work regarding interprocedural analyses or call graphs 🐛 type:bug Something isn't working 🎆 type:feature New feature or request

Projects

Status: PR Merged

Development

Successfully merging this pull request may close these issues.

[BUG] Transferring InferenceSystem's state on returns

2 participants