Skip to content

Cleanup makeGetSlabs in src/parseTools.js. NFC. #13290

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

Merged
merged 1 commit into from
Jan 21, 2021
Merged

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Jan 20, 2021

  • Make fall throughs more obvious.
  • Remove break after return.
  • Remove unused final return (it was unreachable).

@sbc100 sbc100 requested a review from kripken January 20, 2021 18:45
}
return [];
throw 'what, exactly, can we do for unknown types in TA2?! ' + [new Error().stack, ptr, type, allowMultiple, unsigned];
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should probably fix this error message too. I think TA2 refers to USE_TYPED_ARRAYS which was removed in 2015.

Do you know why this function used to return more than one thing? Were there multiple memory views that we used to try to keep in sync somehow?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, as you said, this is super-old...

I believe we used to not have a single linear memory, but separate ones per type. This was one of the approaches experimented with in the very early days.

Today I think this can return a single item, and the error here can just be "internal error".

@sbc100 sbc100 force-pushed the cleanup_makeGetSlabs branch from 146d248 to e9fa04e Compare January 20, 2021 19:22
}
return [];
throw 'what, exactly, can we do for unknown types in TA2?! ' + [new Error().stack, ptr, type, allowMultiple, unsigned];
Copy link
Member

Choose a reason for hiding this comment

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

Yes, as you said, this is super-old...

I believe we used to not have a single linear memory, but separate ones per type. This was one of the approaches experimented with in the very early days.

Today I think this can return a single item, and the error here can just be "internal error".

- Make fall throughs more obvious.
- Remove break after return.
- Remove unused final return (it was unreachable).
@sbc100 sbc100 force-pushed the cleanup_makeGetSlabs branch from e9fa04e to 9ae6e46 Compare January 21, 2021 01:26
@sbc100 sbc100 merged commit 7c2417d into master Jan 21, 2021
@sbc100 sbc100 deleted the cleanup_makeGetSlabs branch January 21, 2021 01:32
sbc100 added a commit that referenced this pull request Jan 21, 2021
Followup on #13290.  We only deal with a single heap
these days so we can remove some of the complexity here.
sbc100 added a commit that referenced this pull request Jan 21, 2021
Followup on #13290.  We only deal with a single heap
these days so we can remove some of the complexity here.
sbc100 added a commit that referenced this pull request Jan 22, 2021
Followup on #13290.  We only deal with a single heap
these days so we can remove some of the complexity here.
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.

2 participants