Skip to content

Implement iterative Pearce's SCC finding algoritm #12528

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

Merged
merged 3 commits into from
Oct 26, 2023

Conversation

dstogov
Copy link
Member

@dstogov dstogov commented Oct 26, 2023

This fixes #11795

The proposed algorithm is a variation of Algorithm 4 described in https://whileydave.com/publications/Pea16_IPL_preprint.pdf . However this description has a bug (vS stack should be split into two stacks).
The fixed reference implementations are available at https://github.com/DavePearce/StronglyConnectedComponents

@dstogov
Copy link
Member Author

dstogov commented Oct 26, 2023

I propose to merge this into master and back-port to old PHP branches after testing.

@dstogov dstogov requested a review from nielsdos October 26, 2023 12:55
Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

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

I think it is right, I checked with the paper and reference implementation. Thank you.
Just one small remark.

I propose to merge this into master and back-port to old PHP branches after testing.

I agree.

case 7: use = iterator->use; goto state_7;
case 8: use = iterator->use; goto state_8;
case 9: phi = iterator->phi; goto state_9;
case 10: phi = iterator->phi; goto state_10;
Copy link
Member

Choose a reason for hiding this comment

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

Label state_10 is only defined in #ifdef SYM_RANGE. So this case must also be guarded with #ifdef SYM_RANGE.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah. thanks.

@nielsdos nielsdos linked an issue Oct 26, 2023 that may be closed by this pull request
@dstogov dstogov merged commit bd185c3 into php:master Oct 26, 2023
dstogov added a commit that referenced this pull request Oct 31, 2023
* PHP-8.1:
  Backport implementation of iterative Pearce's SCC finding algoritm (#12528)
dstogov added a commit that referenced this pull request Oct 31, 2023
* PHP-8.2:
  Backport implementation of iterative Pearce's SCC finding algoritm (#12528)
dstogov added a commit that referenced this pull request Oct 31, 2023
* PHP-8.3:
  Backport implementation of iterative Pearce's SCC finding algoritm (#12528)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants