Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Fix MultiInfo parser + serialization bug #2265

Merged
merged 7 commits into from
Jun 18, 2021

Conversation

jared-barocsi
Copy link
Contributor

This PR addresses the issue highlighted in #2253: in particular, the firrtl parser can now reconstruct a MultiInfo structure that was previously serialized and compressed by the algorithm in #2212. This only results in a single level MultiInfo due to the flattening step of serialization, so it can not recreate a MultiInfo of MultiInfos or any such recursive source locator object.

Contributor Checklist

  • Did you add Scaladoc to every public function/method?
  • Did you add at least one test demonstrating the PR? (Test is added in another PR that needs to be merged.)
  • Did you delete any extraneous printlns/debugging code?
  • Did you specify the type of improvement?
  • Did you state the API impact?
  • Did you specify the code generation impact?
  • Did you request a desired merge strategy?
  • Did you add text to be included in the Release Notes for this change?

Type of Improvement

bug fix

API Impact

No change

Backend Code Generation Impact

Should have no impact.

Desired Merge Strategy

Squash and merge

Release Notes

Firrtl parser can now handle parsing a serialized, compressed source locator and return a MultiInfo object consisting of FileInfos.

Reviewer Checklist (only modified by reviewer)

  • Did you add the appropriate labels?
  • Did you mark the proper milestone (1.2.x, 1.3.0, 1.4.0) ?
  • Did you review?
  • Did you check whether all relevant Contributor checkboxes have been checked?
  • Did you mark as Please Merge?

jardhu added 3 commits June 10, 2021 11:42
FileInfo compression sorts the outputted entries alphabetically, but
this test did not reflect that fact
@ekiwi
Copy link
Contributor

ekiwi commented Jun 15, 2021

Looking good. Could you please add the test from #2253 to show that your PR solves the issue?

Copy link
Contributor

@azidar azidar left a comment

Choose a reason for hiding this comment

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

LGTM, just minor syntax nits.

@@ -321,4 +321,17 @@ class InfoSpec extends FirrtlFlatSpec with FirrtlMatchers {
for (line <- check)
result should containLine(line)
}

"Source Locators" should "not loose information when going through serialization + parsing" in {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"Source Locators" should "not loose information when going through serialization + parsing" in {
"Source Locators" should "not lose information when going through serialization + parsing" in {

Copy link
Contributor

Choose a reason for hiding this comment

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

my bad :(


// Grab each File.format line:col token from the input string
splitCompressedInfo.findAllIn(escaped).matchData.foreach { info =>
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary curly braces here

// If there were no subgroups, the regex matched against a non-conforming source locator
// pattern, so do not process it
case None => out = out :+ ir.FileInfo.fromEscaped(info.toString)
case Some(file) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
case Some(file) => {
case Some(file) =>

Again, unnecessary curly braces.

val lineDescriptors = info.group(2)
// Grab each line:col values from the separated (compressed) FileInfo.
splitLineDescriptors.findAllIn(lineDescriptors).matchData.foreach { lineDescriptor =>
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Again :)

@ekiwi ekiwi added this to the 1.5.0 milestone Jun 18, 2021
@ekiwi ekiwi added the Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI. label Jun 18, 2021
@mergify mergify bot merged commit eb0841d into chipsalliance:master Jun 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants