-
Notifications
You must be signed in to change notification settings - Fork 119
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
Windows fixes #1537
Merged
Merged
Windows fixes #1537
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c750749
MSVC: Remove the vcxproj.filters files
ampli fdf053a
LinkGrammar.vcxproj: Update the list of source file names
ampli f0c591e
table_count(): Bugfix !USE_TABLE_TRACON
ampli 8703938
table_lookup(): Remove redundant check in assert()
ampli ed03595
table_lookup(): Print conflicting values in assert()
ampli dc9426b
table_lookup(): On !USE_TABLE_TRACON, return Count_bin type
ampli 267dada
estimate_log2_table_size(): Avoid warning on conversion to/from double
ampli b4f22e4
Change GNUC_NORETURN to NORETURN and define for MSVC too
ampli 3c23a1c
form_match_list(): Don't use _Atomic
ampli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 will clearly fail when multi-threading, as the increment
++id
can occur in two different threads (and so two threads get the samelid
) which means that the assert at line 1470 ofparse/count.c
might trigger. I'm going to put this back, but then disableVERIFY_MATCH_LIST
by default.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.
Such a problem cannot happen, since each LG thread accesses only its own data structures!
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.
fixed in fac11ac
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.
Note that the lid is put in the element list that a
form_match_list()
returns, and since it is an auto variable, all the elements of the list are guaranteed to get the same lid. Whenform_match_list()
returns, the thread that has invoked it fetches the id from the first element and validates that the rest use the same id (to validate that the list has not been corrupted, as happens sometimes during development). So the code here doesn't care at all what lid values are used in other threads, and even not in the same thread (as long as lid is constant in a single invocation of form_match_list()`, which is guaranteed). They can be always the same, or any random ones.The bug that got fixed then was due to an uninitialized id field on id==0.
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. I skimmed the code and saw this:
link-grammar/link-grammar/parse/count.c
Line 1472 in c098940
and (without over-analyzing it) made me think that assert might now trigger by accident. So I got nervous about it. So I put the Atomic back in, and undef'ed
VERIFY_MATCH_LIST
so it becomes invisible.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.
BTW, my comment "for multi-threading support" just tells why the assignment to an auto variable
lid
is needed.This is because a stable
lid
value is needed during the currentform_match_list()
call. (Hence I added "stable" to clarify it further.)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.
Go ahead and remove the
_Atomic
if you are sure. I wasn't going to think too hard about it.