Skip to content

IDE Basics #240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 171 commits into
base: develop
Choose a base branch
from
Open

IDE Basics #240

wants to merge 171 commits into from

Conversation

Rkoer
Copy link

@Rkoer Rkoer commented Nov 15, 2024

  • IDE infrastructure
  • Basic IDE solver
  • Example implementation of linear constant propagation
  • Interaction capabilities
  • Example implementation of a linear constant propagation on fields

RobinKorke added 30 commits June 5, 2024 12:11
Currently, there will only be more than one entry/statement if there are multiple return sites. In the future, there will be a possibility to query for a single statement, so the property store can be used to realize this distinction.
/**
* The name of the variable the array is stored in
*/
String variable();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Using (TAC) variable names could be fragile and is hard to understand by reading the source code. Maybe it would be better to identify variables by the line they are declared in.

Copy link
Author

Choose a reason for hiding this comment

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

I guess we could add this, but there are tests (not the ones for LCPoF but esp. the ones for LCP) are more detailed and also check values that are not explicitly declared in the code.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we identify them by program counter or line number then? Program counters are at least guaranteed to be stable since we use a fixed compiler. Line numbers are a little more fragile as one might make non-semantic changes to the source files, but they are easier to understand from the source code.

@@ -0,0 +1,45 @@
/* BSD 2-Clause License - see OPAL/LICENSE for details. */
package org.opalj.fpcf.fixtures.lcp_on_fields;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could it be sensible to move these into a subpackage of the fixtures.linear_constant_propagation package?

Copy link
Author

Choose a reason for hiding this comment

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

That sounds logical. However, at the moment there are two separate test classes, one for LCP and one for LCPoF. When moving the fixtures inside the linear_constant_propagation package then the tests for LCP do pick up the fixtures for LCPoF too. I guess we would need to specify each test fixture for LCP manually instead of providing the package. Is there an alternative solution to this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

How about one fixture directory with two subdirectories, for LCP and LCPoF?

*
* @author Robin Körkemeier
*/
class IDEPropertiesTest extends PropertiesTest {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks like it should be a trait / abstract class

*
* @author Robin Körkemeier
*/
object LCPOnFieldsAnalysisScheduler
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think you need this as a separate object, it should be possible to just put new LCPOnFieldsAnalysisScheduler() with JavaIDEAnalysisSchedulerBase.RTACallGraph at its single use. If it is needed, I caution agains naming it the same as its parent class, to avoid confusion.

*
* @author Robin Körkemeier
*/
abstract class AbstractRepeatablePropertyMatcher extends AbstractPropertyMatcher {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems like a good idea. Can you apply it to the DirectCallMatcher as well (maybe in a separate PR)?

Copy link
Author

Choose a reason for hiding this comment

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

Sure, see PR#274

set.add(c)
}

def areDependeesEmpty: Boolean = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be more conventional to have a hasDependees method with inverted semantics

/**
* @return whether the phase is finished or has to be continued once the dependees are resolved
*/
private def performPhase1()(implicit s: State): Boolean = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Phase1/Phase2 are very non-descriptive names. Try to come up with better ones and at the very least, document these methods properly to make the code understandable.

)
}

logDebug("finished creation of properties and results")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider whether these log messages are really necessary

}
}

private def processCallFlow(path: Path, f: JumpFunction, qs: collection.Set[Callable])(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This code is poorly documented and uses many nondescriptives names. What are things like sp, n, rs, qs, d5, d5s, d3, sqs, etc.

*
* @author Robin Körkemeier
*/
class IDEAnalysis[Fact <: IDEFact, Value <: IDEValue, Statement, Callable <: Entity](
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are many complex methods in this class that should be properly documented, at least with a ScalaDoc on what they do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants