Skip to content

Implement iterative Pearce's SCC finding algoritm - #12528

Merged
dstogov merged 3 commits into
php:masterfrom
dstogov:scc_pearce
Oct 26, 2023
Merged

dstogov merged 3 commits into
php:masterfrom
dstogov:scc_pearce

Conversation

@dstogov

@dstogov dstogov commented Oct 26, 2023

Copy link
Copy Markdown
Member

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

dstogov commented Oct 26, 2023

Copy link
Copy Markdown
Member Author

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

@dstogov
dstogov requested a review from ndossche October 26, 2023 12:55

@ndossche ndossche left a comment •

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah. thanks.

@ndossche ndossche 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

Development

Successfully merging this pull request may close these issues.

Segmentation fault when generating composer autoload with 50k+ classes Bug #76844 PHP crashes on big file with array inside

2 participants