-
-
Notifications
You must be signed in to change notification settings - Fork 636
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
Fixes compilation of ucontext_t based Fibers implementations #20923
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request and interest in making D better, @denizzzka! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour 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 locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#20923" |
In the future I plan to get rid of |
I replaced This is that To make bisection for this further back is need to build old versions of the compiler. If someone has this set up, it would be great to get help by bisection result with the commit where Don't want to lose Posix |
I think you're forgetting to update |
Thank you, confirmed! Indeed, I can add tests for So looks like this PR can be merged |
...My proposal about testing: c13b055 By specifying |
Available only on Posix platforms. Useful for testing purposes.
I decided not to move I added |
It's not a special case, x86_64 CET uses this path for example (at least until I add support for shadow stacks in the asm Fibers), as well as on many ports of all major distributions. So it's been battle tested for years. |
I expressed myself not properly: I mean the use |
// NOTE: The ucontext implementation requires architecture specific | ||
// data definitions to operate so testing for it must be done | ||
// by checking for the existence of ucontext_t rather than by | ||
// a version identifier. Please note that this is considered | ||
// an obsolescent feature according to the POSIX spec, so a | ||
// custom solution is still preferred. | ||
import core.sys.posix.ucontext : getcontext, makecontext, MINSIGSTKSZ, swapcontext, ucontext_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If things are being functionally changed, then documentation of the code should be reflected also please.
For instance, I see that whoever changed this to a selective import, didn't realise importing the entire module was deliberate, as there is a chance that the type doesn't exist on the target according to the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe restore the original intention with
// NOTE: The ucontext implementation requires architecture specific | |
// data definitions to operate so testing for it must be done | |
// by checking for the existence of ucontext_t rather than by | |
// a version identifier. Please note that this is considered | |
// an obsolescent feature according to the POSIX spec, so a | |
// custom solution is still preferred. | |
import core.sys.posix.ucontext : getcontext, makecontext, MINSIGSTKSZ, swapcontext, ucontext_t; | |
// NOTE: The ucontext implementation requires architecture specific | |
// data definitions to operate so testing for it must be done | |
// by checking for the existence of ucontext_t rather than by | |
// a version identifier. Please note that this is considered | |
// an obsolescent feature according to the POSIX spec, so a | |
// custom solution is still preferred. | |
static if (__traits(compiles, { import core.sys.posix.ucontext : ucontext_t; }) | |
import core.sys.posix.ucontext : getcontext, makecontext, MINSIGSTKSZ, swapcontext, ucontext_t; | |
else | |
static assert(false, "No native support for Fibers detected and ucontext_t not available for use as a fallback"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't work even if I write:
static if (true)
import core.sys.posix.ucontext : getcontext, makecontext, MINSIGSTKSZ, swapcontext, ucontext_t;
else
static assert(false, "No native support for Fibers detected and ucontext_t not available for use as a fallback");
base.d
compilation fails if such changes added
Looks similar as #20487
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compilation error will happen in such case and source of issue will become clear
(Please close conversation if you have no ideas what to do with this)
68bc44f
to
71466f8
Compare
Fixes issue brought in #16695 (#16695 (comment))
But also I found that (probably) CI execution was broken before #16695 forucontext_t
-basedFiber
implementationsI have no systems that using
ucontext_t
and I "emulated" them on my x86_64 Linux system by disabling other context switching approaches by using temporary code commenting:After that I successfully compiled and run tests by command:
and got error:
But same error I got then compiling commit e3aee67 that was made few days earlier than #16695