Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive

Comments

fixup for cycle detection#1720

Merged
MartinNowak merged 2 commits intodlang:stablefrom
schveiguy:deprecatecycle
Dec 23, 2016
Merged

fixup for cycle detection#1720
MartinNowak merged 2 commits intodlang:stablefrom
schveiguy:deprecatecycle

Conversation

@schveiguy
Copy link
Member

Adds new "deprecate" mode for cycle handling: if cycle is detected, runs original flawed algorithm. If that algorithm finds no cycle, continue execution of the program with old sorted order, but print a deprecation warning to stderr.

Still needs doc update. Ping @MartinNowak

@dlang-bot
Copy link
Contributor

Fix Bugzilla Description
16211 [REG 2.058] Cyclic dependencies broken again

@schveiguy
Copy link
Member Author

Ping @Dicebot @CyberShadow

@mihails-strasuns
Copy link
Contributor

Thanks a lot! Will test later today.

auto midx = edges[sp.curMod][sp.curDep];
// if midx is -1, then this isn't part of this DSO.
if (midx != -1 && !bts(reachable, midx))
if (!bts(reachable, midx))
Copy link
Member

Choose a reason for hiding this comment

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

Seems correct but slightly unrelated (though you prolly double checked for the old implementation).
That means we could change the type of edges to uint, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I realized this was a remnant from the implementation that still used the findModule function. I don't put cross-module dependencies as -1 in the edges array, so no point in checking for -1 here.

Copy link
Member Author

Choose a reason for hiding this comment

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

That means we could change the type of edges to uint, right?

Hm... probably could. I don't think it's too important though, no chance of having over 2 billion modules to sort. I'm leery of unsigned math, too.

@MartinNowak
Copy link
Member

Thanks, fixes Higgs and vibe-d/libasync.

@MartinNowak MartinNowak merged commit bf9d001 into dlang:stable Dec 23, 2016
@schveiguy
Copy link
Member Author

fixes Higgs and vibe-d/libasync

curious, I'm assuming you get the deprecation printout?

@mihails-strasuns
Copy link
Contributor

Just got to test it, work like a charm:

Deprecation 16211 warning:
A cycle has been detected in your program that was undetected prior to DMD
2.072. This program will continue, but will not operate when using DMD 2.073
to compile. Use runtime option --DRT-oncycle=print to see the cycle details.

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.

4 participants