-
-
Notifications
You must be signed in to change notification settings - Fork 606
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
convert blockopt.c to blockopt.d #8426
Conversation
Thanks for your pull request, @wilzbach! Bugzilla referencesYour 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 locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + dmd#8426" |
67bb9e1
to
9110a65
Compare
src/dmd/backend/blockopt.d
Outdated
vec_free(b.Bgen2); | ||
vec_free(b.Bkill2); | ||
|
||
memset(&b,0,b.sizeof); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether this is the correct translation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't. It's supposed to zero the pointers to the vectors that were just freed. An easy way to do this is to write a nested function:
static void vfree(ref vec_t* v) { vec_free(v); v = null; }
and call that instead of vec_free.
src/dmd/backend/blockopt.d
Outdated
b2->BC = BCret; /* a harmless one */ | ||
cmes3("brcombine(): %p goto %p eliminated\n",b,b2); | ||
b.Bswitch = b2.Bswitch; | ||
b.Bswitch = b2.Bswitch; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether this is the correct translation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is copying too little, it should be somethink llike
b.BC = b2.BC;
b.cover_BS[] = b2.cover_BS[];
with
// add member at least as large as the other elements of this union
void[jcatchvar.sizeof + Bscope_index.sizeof + Blast_index.sizeof] cover_BS;
added to the respective union in block
.
src/dmd/backend/blockopt.d
Outdated
b2.Bnext = b.Bnext; | ||
b.Bnext = b2; | ||
b2.BC = b.BC; | ||
b2.Bswitch = b.Bswitch; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether this is the correct translation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
d6eed7b
to
61511fb
Compare
|
||
//////////////////////////// | ||
// Storage allocator. | ||
|
||
static block blkzero; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Walter usually coverts static
to private
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in a private __gshared
block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
38b92ea
to
0f086ef
Compare
Not sure why Windows isn't passing.
and AppVeyor even fails while linking:
|
This happens because some files are compiled with -betterC, but blockopt is not. I suspect some of the import dependencies have |
src/dmd/backend/blockopt.d
Outdated
|
||
/* Search for two blocks that have the same successor list. | ||
If the first expressions both lists are the same, split | ||
off a new block with that expression in it. | ||
*/ | ||
for (block *b = startblock; b; b = b->Bnext) | ||
static if (SCPP_OR_NTEXCEPTIONS) | ||
bool additionalAnd = b.Btry == bn.Btry; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems not to be actually compiled, but it has to be inside the inner loop.
It's not the building of sanitize_json, but the execution of the d_do_test unittests: it waits forever for threads to join when it returns from main. I guess there are still code gen bugs (after my proposed changes). |
handling of NTEXCEPTIONS was incorect, too. I pushed some fixes. |
Wow. Thanks a lot! It's still failing in the Visual Studio build with:
I don't see where it's apparently declared previously... |
This is merge conflict because #8466 now also defines mem_ffree. |
6e802bd
to
16be93f
Compare
BTW this is passing the CIs now :) |
No 😊. Merge conflicts. |
fix handling NTEXCCEPTIONS
Resolved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Fix the memset as described, and it's good to go.
No description provided.