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

Major blocker: DMD bogus forward and circular reference errors. #105

Open
Syniurge opened this issue Mar 27, 2018 · 1 comment
Open

Major blocker: DMD bogus forward and circular reference errors. #105

Syniurge opened this issue Mar 27, 2018 · 1 comment

Comments

@Syniurge
Copy link
Owner

Syniurge commented Mar 27, 2018

Right now the (last?) major blocker for many complex C++ libraries lies in incorrect forward and circular referencing errors, caused by how DMD's semantic phases are currently designed. Those phases are too "catchall" and for example calling dsym.semantic() when all the caller wants to know is if the dsym symbol has a member named "foo" creates dependencies between symbols that may result in wrong forward/circular referencing errors.

The qt5demo example just got updated to not rely on module map files (which will be replaced by a pragma(cppmap) parameter like proposed in https://github.com/Syniurge/Calypso/blob/documentation/calypso_proposal_pragma.md), but doesn't compile anymore because it triggers a circular referencing error within a Qt module.

I will fix a few more Calypso-specific issues, and then will start working on this again. I had a first shot at this last year: dlang/dmd#7018 but will soon restart from scratch from current DMD master.

It will consist in splitting importAll/semanticN functions into smaller blocks, and making DMD semantic analysis lazier especially for non-root modules (the ones not being codegen'd). The latter will also help against another Calypso issue which is the recursive instantiation of templates due to C++ being completely lazy whereas D isn't. For example the libstdc++/valarray.d test case fails because of recursive instantiation. Others would if there wasn't a RecursiveInstChecker semi-hack that detects simple cases of recursive recursions and discard the declarations, but discarding is pretty bad.

@Geod24
Copy link

Geod24 commented Jun 12, 2018

I suppose those fwd reference errors are what leads to messages such as:

../xdr/Stellar-SCP.h(611): Error: size of type .ℂcpp.xdr.xvector.xvector!(SCPQuorumSet, 4294967292u) is not known
../xdr/Stellar-SCP.h(611): Error: size of type .ℂcpp.xdr.xvector.xvector!(SCPQuorumSet, 4294967292u) is not known
../xdr/Stellar-SCP.h(611): Error: size of type .ℂcpp.xdr.xvector.xvector!(SCPQuorumSet, 4294967292u) is not known
../xdr/Stellar-SCP.h(611): Error: size of type .ℂcpp.xdr.xvector.xvector!(SCPQuorumSet, 4294967292u) is not known

?

Syniurge added a commit that referenced this issue Sep 30, 2019
…n .search()ed from D code.

In addition:
 - Skip all semantic analysis, mapped decls are "semantic3done" straightaway.
 - Referenced C++ declarations (by DeclReferencer) that need to get emitted aren't mapped to DMD declarations, the Clang declarations are simply attached to the instantiating module or function, until they're searched from D code in which case they get detached and mapped to DMD decls.

This is the most promising approach to fix Calypso's "archnemesis issue" #105, as it relieves DMD from a lot of stress.

As later commits prove, it worked(!) and drastically reduces build times.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants