Skip to content
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

Add special handling for zero-length arrays to enhance PTA precision #140

Merged
merged 2 commits into from
Feb 16, 2025

Conversation

cs-cat
Copy link
Contributor

@cs-cat cs-cat commented Feb 13, 2025

Maintaining a points-to-set for components of a zero-length array is unnecessary. Use a mock object ZeroLengthArray to represent the zero-length array object instead.

Some microbenchmarks suggest improvements in both precision and performance.

benchmark result on dacapo-2006:eclipse

context sensitivity var points-to (insens) var points-to (sens) array points-to
ci 2509,6346 N/A 65,1524
ci+patch 2496,6038 (-0.5%) N/A 62,7517 (-3.7%)
1obj 1142,7739 8890,1119 21,2872
1obj+patch 1136,7029 (-0.5%) 8829,0413 (-0.7%) 20,8039 (-2.3%)

@codecov-commenter
Copy link

codecov-commenter commented Feb 13, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 71.94%. Comparing base (3f3b802) to head (c7237a2).

Files with missing lines Patch % Lines
...taie/analysis/pta/core/heap/AbstractHeapModel.java 91.66% 0 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #140      +/-   ##
============================================
+ Coverage     71.91%   71.94%   +0.02%     
- Complexity     4354     4365      +11     
============================================
  Files           479      479              
  Lines         15856    15868      +12     
  Branches       2175     2179       +4     
============================================
+ Hits          11403    11416      +13     
- Misses         3571     3573       +2     
+ Partials        882      879       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@zhangt2333 zhangt2333 left a comment

Choose a reason for hiding this comment

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

Very great optimization. Thanks for your work.

I've left some suggestions for improving the clarity of the code. Please give feedback. Finally, don't forget to rerun and update the "*-expected.txt" file.

@cs-cat cs-cat changed the title Use mock objects for zero-length array Enhance precision and performance of PTA by special handling of new T[0] Feb 15, 2025
@cs-cat
Copy link
Contributor Author

cs-cat commented Feb 15, 2025

Thanks, @zhangt2333 !
Here are changes since the first version:

  • code: Factor out method isZeroSizedArrayAllocation to improve readability.
  • code: Include array type in alloc of the mock object.
  • tests: Use PTAAssert in ZeroSizedArray test.
  • misc: Reword commit and PR. Attach benchmark results in PR descriptopn.

@cs-cat
Copy link
Contributor Author

cs-cat commented Feb 15, 2025

revision 2:

  • ZeroSized -> ZeroLength
  • Add this PR to changelog

@cs-cat cs-cat changed the title Enhance precision and performance of PTA by special handling of new T[0] Add special handling for zero-length arrays to enhance PTA precision Feb 15, 2025
@zhangt2333 zhangt2333 merged commit f4f1c5d into pascal-lab:master Feb 16, 2025
4 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants