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

convert blockopt.c to blockopt.d #8426

Merged
merged 4 commits into from
Jul 18, 2018
Merged

Conversation

wilzbach
Copy link
Member

@wilzbach wilzbach commented Jul 1, 2018

No description provided.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @wilzbach!

Bugzilla references

Your 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 locally

If 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"

@wilzbach wilzbach force-pushed the blockopt branch 3 times, most recently from 67bb9e1 to 9110a65 Compare July 1, 2018 19:24
vec_free(b.Bgen2);
vec_free(b.Bkill2);

memset(&b,0,b.sizeof);
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'm not sure whether this is the correct translation.

Copy link
Member

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.

b2->BC = BCret; /* a harmless one */
cmes3("brcombine(): %p goto %p eliminated\n",b,b2);
b.Bswitch = b2.Bswitch;
b.Bswitch = b2.Bswitch;
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'm not sure whether this is the correct translation.

Copy link
Member

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.

b2.Bnext = b.Bnext;
b.Bnext = b2;
b2.BC = b.BC;
b2.Bswitch = b.Bswitch;
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'm not sure whether this is the correct translation.

Copy link
Member

Choose a reason for hiding this comment

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

Same here.


////////////////////////////
// Storage allocator.

static block blkzero;
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok.

@wilzbach wilzbach force-pushed the blockopt branch 5 times, most recently from 38b92ea to 0f086ef Compare July 5, 2018 06:08
@wilzbach
Copy link
Member Author

wilzbach commented Jul 5, 2018

Not sure why Windows isn't passing.
Auto-tester simply times out for Windows when building sanitize_json:

timed out after 3600 seconds, step failed

and AppVeyor even fails while linking:

backend.lib(blockopt.obj) : error LNK2001: unresolved external symbol _D3dmd7backend5gflow12__ModuleInfoZ
``

@rainers
Copy link
Member

rainers commented Jul 5, 2018

and AppVeyor even fails while linking:

backend.lib(blockopt.obj) : error LNK2001: unresolved external symbol _D3dmd7backend5gflow12__ModuleInfoZ

This happens because some files are compiled with -betterC, but blockopt is not. I suspect some of the import dependencies have static this().


/* 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;
Copy link
Member

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.

@rainers
Copy link
Member

rainers commented Jul 6, 2018

Not sure why Windows isn't passing.
Auto-tester simply times out for Windows when building sanitize_json:

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).

@rainers
Copy link
Member

rainers commented Jul 6, 2018

handling of NTEXCEPTIONS was incorect, too. I pushed some fixes.

@wilzbach
Copy link
Member Author

wilzbach commented Jul 9, 2018

I pushed some fixes.

Wow. Thanks a lot! It's still failing in the Visual Studio build with:

  ..\dmd\backend\blockopt.d(55): error : Function type does not match previously declared function with the same mangled name: `mem_ffree` [C:\projects\dmd\src\vcbuild\dmd.vcxproj]

I don't see where it's apparently declared previously...

@rainers
Copy link
Member

rainers commented Jul 11, 2018

I don't see where it's apparently declared previously...

This is merge conflict because #8466 now also defines mem_ffree.

@wilzbach wilzbach force-pushed the blockopt branch 2 times, most recently from 6e802bd to 16be93f Compare July 11, 2018 09:47
@wilzbach
Copy link
Member Author

BTW this is passing the CIs now :)

@jacob-carlborg
Copy link
Contributor

BTW this is passing the CIs now :)

No 😊. Merge conflicts.

@wilzbach
Copy link
Member Author

No blush. Merge conflicts.

Resolved.

Copy link
Member

@WalterBright WalterBright left a 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.

@WalterBright WalterBright merged commit 31e7afa into dlang:master Jul 18, 2018
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

Successfully merging this pull request may close these issues.

5 participants