In the last week, I managed to finish constant propagation, improved my command line interface, and added testing for the command line interface. So I think my work, which I have done is sufficient for MVP. I have 7-8 types of analyses like constant propagation, liveness, nullness, constant conditions, etc. Of course, it doesn't handle all edge cases, for some inputs it can also crush. There is a big space for improvement, first of all, analyses are highly dependent on certain inputs, some code structures are hardcoded, so it should be more dynamic. Secondly, not all analyses can detect all possible problems within a scope of analysis. Thirdly, the parser doesn't handle properly method calls, because of my modifications to the initial grammar. Fourthly Control Flow Graph doesn't handle the throw, switches, for-each loop. Also I don't how analysis can behave on loops, and some optimizations on loops also can be beneficial. I need to handle namespaces for variables with respect to their context.
I plan to meet with my thesis advisor and discuss further steps on this week. |
|
During the 7th week, I was on vacation. I did the following tasks:
- Refactored the codebase to make it more readable and maintainable.
- Added more test cases for the existing analyzers to ensure their correctness and reliability.
- Enhanced my analyzers by handling more scenarios and cases.
- Implemented inter-procedural analysis within a class to improve the accuracy and efficiency of the analysis.
- Developed two new analyses: one for detecting the usage of SOQL fields and another for identifying expensive operations in loops.
- Started working on constant propagation analysis, but faced some challenges with updating the generated constraints. The problem was that some nodes involved variable manipulations, and the values of these variables depended on the previous nodes. However, the gen and kill sets were computed separately during the analyzer initialization, without considering the variable values. Therefore, I had to assign a generic value (T) to any unknown variable in a new node, and then update the constraints during the worklist algorithm. This required me to pass the whole expression to the node and modify the constraints in the transfer function accordingly. So this analyzer is in progress.
- I also created a basic command line interface using picocli and generated a native image for the project. However, I encountered a problem: the native image does not support the previews from JDK 20. Therefore, I will probably have to refactor some parts of the code. |
|
6th week report. The whole week I was working intensively on my full-time employment because I wanted to finish my tasks before going on vacation. So I was able to get back for my thesis only on the weekend. I was mostly refactoring my codebase, and cleaning up my CFG building logic. I introduced separate classes for each node type and started working on interprocedural analysis. I was trying to figure out how to connect graphs, and especially how to differentiate overloaded methods, and how to link arguments with parameters. As a future enhancement, I need to introduce namespaces for variables, because I need to differentiate the context of the declaration. So 6th week was basically cleanups, refactoring and kick off interprocedural graphs. |
|
During the first half of the 5th week, I faced challenges with propagating the correct predicates to the appropriate paths, as I was working on path-sensitive analysis. On Wednesday, I traveled to Prague for another grooming session. During the 3-hour train ride, I focused on building unit tests and discovered several bugs in my code, particularly in the construction of the control flow graph. As my codebase has been expanding, I felt it was crucial to start testing to ensure that new changes wouldn't disrupt existing functionalities.
I also decided to adopt the Test-Driven Development (TDD) approach, which I find particularly rewarding because it keeps me result-oriented. I wrote some preliminary tests in line with this approach.
On Thursday, I had a meeting with my thesis advisor. Although I had initially planned to meet him after implementing constant condition and nullness analysis, I realized that it could take more time, and I still needed his feedback to validate my efforts. We had an intensive review session, and he suggested that completing my existing tasks and adding 2-3 analyses specifically for Apex would suffice for a bachelor's thesis.
I then devoted myself to completing my remaining analyses, putting in substantial effort and eventually resolving the challenges. Working on constant conditions led me to some unexpected cases, and I ran multiple tests, achieving good results. By Sunday, I had figured out the basics of nullness analysis, although so far it's effective only on very small examples. However, the core functionality is now defined.
What's Next?
I have plans to extend the test cases for nullness analysis and undertake a significant refactoring of my codebase. Until now, my approach has been rather hasty, and I've relied on quick-and-dirty methods. This has led to repetitive code that I intend to clean up, incorporating some design patterns for better structure. Subsequently, I aim to broaden the scope of my analyses to include inter-procedural levels, which currently appears to be a challenging endeavor for me. Finally, I will be adding 2-3 specific analyses for Apex to round out my work. |
|
5042760503755650365765027949