Skip to content

Cache scanner after kompile and reuse during k-compile-search-pattern#2390

Merged
rv-jenkins merged 12 commits intomasterfrom
cache_scanner
Jan 11, 2022
Merged

Cache scanner after kompile and reuse during k-compile-search-pattern#2390
rv-jenkins merged 12 commits intomasterfrom
cache_scanner

Conversation

@dwightguth
Copy link
Copy Markdown
Contributor

This PR will serialize the scanner during kompile and then reuse that scanner when compiling search patterns rather than having to recreate the scanner. This significantly brings down the time spent in k-compile-search-pattern when running krun --pattern.

The reason this diff is so large is that we have to ensure that the set of tokens in kompile and k-compile-search-pattern are exactly identical and in the same order, thus necessitating some work to ensure that tokens in the scanner get emitted in a completely deterministic ordering.

I will make kprovex also use this scanner in a followup PR. Note, however, that this will not be possible if the specification has macros in it... If we decide to support this case, we will have to fall back on recreating the scanner in the prover if the user does this. Thoughts?

I also fix a couple other minor unrelated bugs, including:

  • krun not emitting the command line invocation for k-compile-search-pattern when invoking krun -v
  • A false negative on the "invalid token precedence" error if the second production visited in the pair of inconsistent productions happens to not have the prec attribute.
  • delete some really old dead code

@dwightguth dwightguth marked this pull request as ready for review January 10, 2022 22:08
Copy link
Copy Markdown
Contributor

@radumereuta radumereuta left a comment

Choose a reason for hiding this comment

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

Just one comment.
I'll let @SchmErik give the final approval

return scanner;
}
public void setScanner(Scanner s) {
scanner = s;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Everything here is indented by 4. This line is indented only by 2.

Copy link
Copy Markdown
Contributor

@SchmErik SchmErik left a comment

Choose a reason for hiding this comment

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

Looks good to me. I think this brings up a few questions about the code base but I'll ask them internally. @dwightguth I'll approve but please address @radumereuta before placing the automerge label

@rv-jenkins rv-jenkins merged commit 2bd1552 into master Jan 11, 2022
@rv-jenkins rv-jenkins deleted the cache_scanner branch January 11, 2022 18:10
@dwightguth dwightguth restored the cache_scanner branch January 12, 2022 14:40
@dwightguth dwightguth deleted the cache_scanner branch January 12, 2022 14:40
dwightguth pushed a commit that referenced this pull request Jan 12, 2022
dwightguth pushed a commit that referenced this pull request Jan 12, 2022
dwightguth pushed a commit that referenced this pull request Jan 21, 2022
…ern` (#2390)

* fix bug where command line invocation was not printed with -v

* delete dead code

* code to serialize scanner

* implement Comparable on TerminalLike

* make tokens deterministic in numbering

* implement code to deserialize scanner

* add tests for bug

* fix #2372 - false negative of invalid precedence error

* fix bug involving syntax added by compiler to main module

* fix precedence conflict in test

* Fix indent

Co-authored-by: rv-jenkins <admin@runtimeverification.com>
rv-jenkins added a commit that referenced this pull request Jan 25, 2022
* Cache scanner after `kompile` and reuse during `k-compile-search-pattern` (#2390)

* fix bug where command line invocation was not printed with -v

* delete dead code

* code to serialize scanner

* implement Comparable on TerminalLike

* make tokens deterministic in numbering

* implement code to deserialize scanner

* add tests for bug

* fix #2372 - false negative of invalid precedence error

* fix bug involving syntax added by compiler to main module

* fix precedence conflict in test

* Fix indent

Co-authored-by: rv-jenkins <admin@runtimeverification.com>

* don't cache scanner in kprove

Co-authored-by: rv-jenkins <admin@runtimeverification.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants