Move cblock, lblock and fwdrefs out of frontend, making it a part of IRState#4854
Move cblock, lblock and fwdrefs out of frontend, making it a part of IRState#4854WalterBright merged 4 commits intodlang:masterfrom
Conversation
1a2989e to
96359cf
Compare
|
Tests were passing, so push in commit for |
|
I've now removed uses of DMD has some catching up to do. |
|
Oh ok, I see what's going on. How about using aav instead of a linear lookup? The number of labels per function can get big when auto-generated switch-cases are involved. |
|
It would also allow removing some of the types from headers, since aav uses |
|
I've now completely remove |
70184f1 to
d693ce7
Compare
|
@yebblies - the fact that it's a pointer doesn't seem to sit too well (unlike the stack allocated array). If the AA is initialized deep in a nested block, the parents won't see the initialization. I'll see if there is a destructor that allows copying back up. |
|
Ooh, actually it's a bit worse. There's a slight reorder that needs to be done. |
|
@yebblies - I think it should be good... There's now a pointer to the stack which should be shared across all IRState levels in the function. |
Move cblock, lblock and fwdrefs out of frontend, making it a part of IRState
As requested in #4569
@yebblies - this has O(n) search complexity, it should really be O(1).
@WalterBright - useless refactoring that only benefits GDC+LDC. But at least the crossing between C++ <-> D boundaries have been reduced.
I noticed during writing this that
Blocks fwdrefswill only ever have an array length of0or1- this seemed odd until I discovered that DMD only errors at the label location, and not the location of the original goto. This seems a bit backwards, considering (contrived example):So I fixed it up so it errors at the location of the goto (mimicking what GDC does), for good or ill...
If all is good, I'll add
cblockto this list too, as I've made it so thatgetLabelis compatible.