[dmd-internals] Fixing forward ref bugs for good

Walter Bright walter at digitalmars.com
Tue Sep 13 18:23:12 PDT 2011



On 9/13/2011 4:58 PM, Brad Roberts wrote:
> On Tue, 13 Sep 2011, Walter Bright wrote:
>
>> Don, just so you know, I've been thinking for a while about transitioning from
>> doing the semantic pass in order to doing it completely "on demand". In other
>> words, try to semantic a declaration. In the process, any declarations it
>> depends on are semantic'd if not already, recursively.
> Does the compiler have a graph of dependencies at all?

No. Dependencies are discovered by doing semantic analysis. Trying to split that 
into two separate phases would likely be complex and doesn't seem worthwhile.

>    Easy to walk
> without requiring pausing to do work at each node?  One of the things
> we talked about _ages_ ago that I've had kicking around in the back of my
> head ever sense was breaking the problem into two pieces.
>
> Piece 1: A process that finds nodes in the graph that have no
> unfulfilled dependencies and adds those to a queue to be analyzed.
>
> Piece 2: a thread pool of workers that pull those work items and analyzes
> them.
>
> As elements finish #2, #1 produces more work due to satisfied
> dependencies.  Repeat until no more work can be done.
>
> if the graph is fully analyzed, success, if not fail due to true
> circularness.
>
> For the time being, the worker probably needs to not really be using
> threads due to the over abundant use of global state.  But it could still
> be trivially iterated if those two pieces are actually reasonable to
> build.
>
> If the global state issues can be resolved (and I'm only aware of a few
> myself, but I'm sure there's more out there), parallel semantic analysis
> would be a nice speed boost.
>
> _______________________________________________
> dmd-internals mailing list
> dmd-internals at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals
>
>


More information about the dmd-internals mailing list