Pull OutBuffer into dmd.common and use it from both frontend and backend#12832
Pull OutBuffer into dmd.common and use it from both frontend and backend#12832dlang-bot merged 10 commits intodlang:masterfrom
Conversation
|
Thanks for your pull request, @andralex! 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#12832" |
|
I'll add commits in such a way that the initial commit contains all the drudgery. The others can be reviewed against the first so the differences are easily visible. Example. |
|
Nice! I would have expected a large section of red in the backend removing the backend's out buffer, although this is WIP so I understand. |
|
(resolved merge conflict) |
|
Isn't root already common to dmd and the backend?
…On Thu, Jul 8, 2021, 4:47 AM Nicholas Wilson ***@***.***> wrote:
(resolved merge conflict)
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#12832 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAVWSCBLCMGVOGMV2VD3SI3TWUGVVANCNFSM477MVX7Q>
.
|
|
Per @WalterBright there's no dependency of the backend on @WalterBright please advise. |
|
Yeah, I ran into those trying to compile DMD on macOS AArch64 (see #12764). |
|
Shouldn't the backend's Although note that
Are you referencing this discussion ?
This is still a sideway import. |
Yah, I plan to replace its uses incrementally and then eliminate it. That should make testing smooth (lesson learned with the mmfiles...).
I'd need to hear more about that.
We'll see. It's actually simpler to keep
The view "Never import a file from an uplevel directory" or "Never import a file from an uplevel directory and then sideways" comes straight from a "high level modules depend on low level modules and low level modules should not depend on high level modules" viewpoint. The sideways part is "low level modules should not depend on other low level modules". All of these are fallacious as explained by Robert Martin, so these points will be dismantled in good order. High level modules and low level modules should depend on abstractions. As that book from Harvard on negotiation says: don't argue your point. Don't argue against the other person's point. By everything sacred don't argue against the other person's character. Argue the principle. And you will win. |
I keep removing them and they keep creeping back in. |
|
The |
|
Reached an impasse with integrating This makes it impossible to use |
| import core.sys.posix.sys.mman : munmap; | ||
| import core.sys.posix.unistd : close; | ||
|
|
||
| // Cannot call fprintf from inside a destructor, so exiting silently. |
There was a problem hiding this comment.
Can't be proud of this :-/
| import core.sys.windows.winbase; | ||
| import core.sys.windows.winnt; | ||
| import core.sys.posix.fcntl; | ||
| import core.sys.posix.unistd; |
There was a problem hiding this comment.
Importing windows and posix api's should be gated with version declarations.
There was a problem hiding this comment.
Hmmm, actually they're gated inside. So I don't think we should have both. What's best?
WalterBright
left a comment
There was a problem hiding this comment.
Most important issues:
- no null checks on malloc calls
- use of obsolete
AWindows APIs
|
See Phobos for how to convert D strings to Windows W strings. |
0e927f1 to
4414bbb
Compare
4414bbb to
60181d5
Compare
|
@WalterBright I made the requested changes and also asked a couple of questions - thanks! |
Since the introduction of PR dlang#12832, `dtor` got uncommented and introduced heap usage after a free() call. This patch moves the dtor to the right place. It also adds some tests with `-main -c` to prevent this to happen again, since those args triggers the issue. Signed-off-by: Luís Ferreira <contact@lsferreira.net>
Since the introduction of PR #12832, `dtor` got uncommented and introduced heap usage after a free() call. This patch moves the dtor to the right place. It also adds some tests with `-main -c` to prevent this to happen again, since those args triggers the issue. Signed-off-by: Luís Ferreira <contact@lsferreira.net>
This eliminates the duplication between
OutBuffer(frontend) andOutbuffer(backend), which is exacerbated by the addition of memory-mapped files.Going forward modules in
dmd.commoncan be used across both frontend and backend.