Skip to content
This repository has been archived by the owner on Jun 20, 2019. It is now read-only.

Remove IN_GCC code for xopCmp/xopEquals in compiler and library #465

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

Conversation

ibuclaw
Copy link
Member

@ibuclaw ibuclaw commented May 4, 2017

@yebblies - Just doing this out of curiosity...

@ibuclaw
Copy link
Member Author

ibuclaw commented May 10, 2017

As per testsuite, there are cases where this would still be broken. Probably reversing args for extern(D) functions would fix those cases, that ought to make debugging fun also (however, reversed args is currently the case in dmd debug code also).

@ibuclaw
Copy link
Member Author

ibuclaw commented Dec 30, 2017

Testing this PR: dlang/druntime#1417

Copy link
Contributor

@jpf91 jpf91 left a comment

Choose a reason for hiding this comment

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

Always nice to see some #ifdef IN_GCC go ;-)

* using the C calling convention, for which the arguments are never
* reversed (contrary to `extern (D)`).
*/
extern (C) bool function(in void*, in void*) xopEquals;
Copy link
Contributor

Choose a reason for hiding this comment

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

xopEquals is now in the global namespace. I wonder whether we should prefix all (new) extern(C) druntime functions with something?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think the frontend cares about that. As it makes the call through a function pointer, so this only changes ABI of how parameters are expected to be passed.

I didn't check the code in clone.d, but when I spoke to Daniel about it, I recall him saying that it's just an abi hack. The compiler sees xopCmp as a C function internally, but reverses the arguments as its really calling a D method.

This reversing of arguments never worked for gdc.

...

However I should check something about this, as it appears that the test for xopCmp parameter order was removed or no longer uses the generated xopCmp call.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, you're right, I totally forgot that this is just a pointer to a generated function (which then obviously has a unique name) 👍
Does the frontend emit these xopCmp functions as extern(C) or extern(D)?

Copy link
Member Author

Choose a reason for hiding this comment

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

That is just what I've pushed a test for. The __xopCmp function is marked as LINKd at least.

Copy link
Member Author

Choose a reason for hiding this comment

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

Although, now I think about it, it doesn't really matter for us as LINKd and LINKc are the same...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants