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

Break dependency of expression.d on gluelayer.d #15786

Merged
merged 1 commit into from Dec 15, 2023

Conversation

RazvanN7
Copy link
Contributor

@RazvanN7 RazvanN7 commented Nov 7, 2023

No description provided.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @RazvanN7! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

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 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#15786"

@dkorpel
Copy link
Contributor

dkorpel commented Nov 7, 2023

Long term I want to to get rid of storing backend symbols inside frontend classes altogether

@ibuclaw
Copy link
Member

ibuclaw commented Nov 7, 2023

Long term I want to to get rid of storing backend symbols inside frontend classes altogether

We tried internal AA for each kind of backend symbol, but that was denied for being too slow (without benchmarking, but I think it is a given that anything is slower than direct pointer access).

ibuclaw
ibuclaw previously requested changes Nov 7, 2023
@@ -2373,7 +2372,7 @@ extern (C++) final class StructLiteralExp : Expression
// while `sym` is only used in `e2ir/s2ir/tocsym` which comes after
union
{
Symbol* sym; /// back end symbol to initialize with literal
Copy link
Member

Choose a reason for hiding this comment

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

I think this is incomplete. There's also typedefs to deal with.

Regardless, I don't think this is as small a change for C++ codebases as it is for D. So hold fire.

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought Symbol was dmd-only, so it wouldn't affect other compilers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Symbol seems to be an alias to a tree_node in gcc. I am expecting that all you need to do on the GCC side is to replace all occurences of sym to (tree_node*)sym.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dkorpel the gluelayer has a version(IN_GCC) that alias Symbol to an extern gcc symbol (tree_node). Still, I don't see how this makes things complicated for gdc.

Copy link
Contributor

Choose a reason for hiding this comment

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

Regardless, I don't think this is as small a change for C++ codebases as it is for D. So hold fire.

I highly doubt it. At most it requires the insertion of a couple of pointer casts.

LDC #ifs out the use of Symbol in module.h so the typedefs are a non-issue for us. Indeed dmd.gluelayer does not define Symbol with version (IN_LLVM), at all. The usage here is void* in D and llvm::Type* in the header file.

It has all of 4 uses which would add 4 pointer casts.

Also this PR affects only StructLiteralExp it doesn't touch any other uses of Symbol

@ibuclaw ibuclaw removed the auto-merge label Nov 7, 2023
@ibuclaw
Copy link
Member

ibuclaw commented Nov 7, 2023

@thewilsonator don't auto-merge after 15 minutes of the PR being open please. Not everyone affected is in the same timezone, and can respond in short notice. :-)

@RazvanN7
Copy link
Contributor Author

RazvanN7 commented Nov 7, 2023

Long term I want to to get rid of storing backend symbols inside frontend classes altogether

Agreed, however, apart from AAs, I don't really have an idea on how to do that.

@ibuclaw
Copy link
Member

ibuclaw commented Nov 7, 2023

Long term I want to to get rid of storing backend symbols inside frontend classes altogether

Agreed, however, apart from AAs, I don't really have an idea on how to do that.

There's the (possibly ill-defined) Compiler interface that supposed to let compiler vendors do things in an agnostic way. Compiler back-end types could be moved there:

struct Backend {
  version (MARS)
  union {
    Symbol* _sym;
    TYPE* _ctype;
    //... 
  }
  auto sym() { return _sym; }
  void sym(s) { _sym = s; }
}

but that just changes the names from one thing to another.

@RazvanN7
Copy link
Contributor Author

@ibuclaw how do we move forward from here? This is the last of expression.d's unwanted dependency.

@thewilsonator
Copy link
Contributor

@RazvanN7 please rebase

@thewilsonator thewilsonator dismissed ibuclaw’s stale review December 15, 2023 09:28

Not a disruptive change to C++ users, only requires a few pointer casts.

@dlang-bot dlang-bot merged commit a8b2f56 into dlang:master Dec 15, 2023
43 checks passed
@ibuclaw
Copy link
Member

ibuclaw commented Dec 15, 2023

Reverting because we agreed the proper way last DLF meeting.

@thewilsonator
Copy link
Contributor

... which is?

@ibuclaw
Copy link
Member

ibuclaw commented Dec 20, 2023

... which is?

You would already know if you didn't dismiss and merge PRs within 5 minutes.

Ask next time please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
5 participants