druntime: Treat WASI as Posix - #5230
Conversation
|
If/when this gets approved, I'll upstream it to DMD. It's easier to iterate on the functional codebase. |
b11a1cb to
d699021
Compare
|
Oh wow, that was very quick - and it's green! 👍 How's the situation with |
|
The hello-world size has increased a bit; was that one of the reasons you wanted to use the native API? I'm wondering if compiling/linking wasi-libc as an LTO lib would get rid of that overhead again. |
Relatively. Worked on it like...6 hours straight (and then some). Felt plenty long at the time :p But also, "all in a day's work".
There were enough differences that I feel the separate version is justified. Some headers are simply not supported at all, some are only available if you link in an extra library (see e.g. https://github.com/ldc-developers/ldc/pull/5230/changes#diff-48f529363632c9ca331332afb7e1b096e7396119f70ca4575abde282818a6d53), some individual functions are only available with emulation https://github.com/ldc-developers/ldc/pull/5230/changes#diff-c3629923a6cac8402dffd7abc4d4041a361be668ca72c64f1ac75a97051a9afeR96), and in |
d699021 to
4426490
Compare
|
Impressive work. 👍 - Alright, all good wrt. NOT predefining After a quick superficial glance, it seems like you used Out of curiosity, have you tried cross-compiling the With |
That was also part of the motivation yes (though it only decreases if you don't have any other C code using the same). LTO MIGHT help. Might have more of a noticable impact if applied to libc as well and not just DRuntime...I can try that (default |
Yup, that's exactly why. If we ever get no-libc DRuntime (or realistically, an alternate libc), then I suppose that means we'd drop
No, not yet. I ran out of time last night. I'll try that out shortly.
So far, it seems so. |
Right.
Fine by me. [I'd expect most of these to be in |
Maybe because of the reliance on available timezone data? (apt package |
Also yeah, no timezone files on system means that unittest can't be run |
| " and link with -lwasi-emulated-mman"); | ||
| } else version = EmulatedOrNotWASI; | ||
|
|
||
| version (EmulatedOrNotWASI): |
There was a problem hiding this comment.
[As LDC-specific change, I'm using a version = Supported in multiple modules, to disable them on specific targets. They are defined internally per-module only.]
There was a problem hiding this comment.
Looks like only for stdcpp.
Are you suggesting renaming these to Supported instead (keeping them the same otherwise; and still upstreaming)?
There was a problem hiding this comment.
Yeah just wrt. renaming to some consistent internal version, making it clear at a glance what it's about (since the …OrNotWASI suffix is what's relevant in 99% of cases :) when looking at the module).
|
Okay, there's a few things I have to tweak. Would never have thought to check e.g.: |
|
Cool that you got it working! Yeah I think this test is a showcase for D, extremely powerful and yet very compact. Most of the code I think is actually for some nice formatting, e.g., when structs layout diverge - I was pretty blown away when I saw the first failures on CI and opened that file... |
|
And if you got it to pass (maybe/probably having to add some excludes to the existing lists), we could enable it for CI too (after running the druntime unittests), to make sure it doesn't regress. |
57c8506 to
173281f
Compare
173281f to
0afb5d9
Compare
|
If you want, I can squash this just a bit so we get three clean commits. (squash the first 4 together, rename the last two a little bit so they make more sense in isolation) |
|
Yep please do. 👍 |
5ddec4e to
8c11222
Compare
| alias int_fast16_t = short; /// | ||
| alias uint_fast16_t = ushort; /// | ||
| alias int_fast32_t = int; /// | ||
| alias uint_fast32_t = uint; /// |
There was a problem hiding this comment.
Is that the only thing (only want to reset the CI once more)?
There was a problem hiding this comment.
Okay, since its been this long, I'm going to let CI finish.
I can tweak that and squash it in, and (if CI, other than circleci Ubuntu) is green, we can just merge before the next run finishes.
There was a problem hiding this comment.
Yep, the rest is fine, just noticed this tininess while checking the 2 last commits separately.
[I don't understand why Circle still fails after #5232; it should rebase to the latest PR-merge-head automatically.]
|
Okay. All green (sans circleci). |
8c11222 to
447dcac
Compare
|
Okay...now to upstream it. Hopefully |
Adds WASI (or rather
wasi-libc) support tocore.sys.posix, and makes all WASI triples definePosix.Also removes or adjust other
WASIspecific code accordingly.