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

Revert "Split core.thread.fiber to package.d and base.d" #16850

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ibuclaw
Copy link
Member

@ibuclaw ibuclaw commented Sep 18, 2024

Reverts #16695

Splitting cannot be done unless the Fiber detection code is either:

  • Duplicated between both base and fiber modules
  • Isolated to a common module (can't use version anymore)

https://github.com/dlang/dmd/blob/master/druntime/src/core/thread/fiber/package.d#L22-L165

Without, the static if (__traits(compiles, ucontext_t)) condition in both modules resolves to different values, causing build failures on ucontext_t targets.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @ibuclaw!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#16850"

@ibuclaw ibuclaw added the Regression PRs that fix regressions label Sep 18, 2024
@thewilsonator
Copy link
Contributor

Isolated to a common module

This would be the preferred choice here.

@denizzzka
Copy link
Contributor

@ibuclaw why reverting instead of fixing?

~2 months no one noticed this problem

@ibuclaw
Copy link
Member Author

ibuclaw commented Sep 18, 2024

Isolated to a common module

This would be the preferred choice here.

I didn't look too deeply, but it's a chance that won't work either - what is allowed inside static if vs. version.

@ibuclaw
Copy link
Member Author

ibuclaw commented Sep 18, 2024

@ibuclaw why reverting instead of fixing?

~2 months no one noticed this problem

No one thought to test, it shouldn't be down on me to check all permutations on a regular basis.

@denizzzka
Copy link
Contributor

denizzzka commented Sep 19, 2024

Without, the static if (__traits(compiles, ucontext_t)) condition in both modules resolves to different values

What is reason why this happens?

For example, maybe Phobos library binary are built on system where there is ucontext_t available and then application program is compiled on system where is no ucontext_t?

@ibuclaw
Copy link
Member Author

ibuclaw commented Sep 19, 2024

Without, the static if (__traits(compiles, ucontext_t)) condition in both modules resolves to different values

What is reason why this happens?

For example, maybe Phobos library binary are built on system where there is ucontext_t available and then application program is compiled on system where is no ucontext_t?

No, the Fiber Platform Detection code needs to exist in all modules that any fiber package gets split into.

@denizzzka
Copy link
Contributor

But this is not a "code" - it is only executed during compilation on platforms which provides ucontext_t facility

I.e., I don't understand nature of the error that is occurring here

@ibuclaw
Copy link
Member Author

ibuclaw commented Sep 20, 2024

But this is not a "code" - it is only executed during compilation on platforms which provides ucontext_t facility

That's not how fiber detection works. Ucontext is used if all else fails (or there is a shadow stack such as Intel CET). There's a split brain as one module detects it should use ucontext, but the other does no detection.

I.e., I don't understand nature of the error that is occurring here

Then this should be merged to unbreak master.

@denizzzka
Copy link
Contributor

This is what I don't understand:

There's a split brain as one module detects it should use ucontext, but the other does no detection.

How does this literally happens? How the same compile-time expression in the same environment can be compiled with different result?

@ibuclaw
Copy link
Member Author

ibuclaw commented Sep 22, 2024

This is what I don't understand:

There's a split brain as one module detects it should use ucontext, but the other does no detection.

How does this literally happens? How the same compile-time expression in the same environment can be compiled with different result?

Because of the fiber detection code influences it.

@denizzzka
Copy link
Contributor

"fiber detection code" is

static if (__traits(compiles, ucontext_t))

?

If "yes" we returning to this question: #16850 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Regression PRs that fix regressions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants