Increment match_calls atomically

This ensures the correctness of the counter value, i.e. the value is the number of calls to the match() method.
This commit is contained in:
neko1235 2019-09-10 21:16:49 -07:00 committed by GitHub
parent f11ce46ddf
commit db0a57c6ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -103,7 +103,9 @@ public class LexerATNSimulator extends ATNSimulator {
}
public int match(CharStream input, int mode) {
match_calls++;
synchronized (LexerATNSimulator.class) {
match_calls++;
}
this.mode = mode;
int mark = input.mark();
try {