Skip to content

Conversation

@tsutsu
Copy link
Contributor

@tsutsu tsutsu commented Jan 16, 2018

Like with exthereum/evm#32, ABI.TypeEncoder.do_encode/2 and ABI.TypeDecoder.do_decode/2 are performing operations after the recursive self-call, and so can blow their stacks. This PR rephrases them into tail-call-with-accumulator style.

Bonus efficiency fix: instead of repeatedly joining binaries in do_encode/2, an iolist() is built and then baked into a binary at the end using :erlang.iolist_to_binary/1.

No visible behaviour changes. Tests pass.

Copy link
Contributor

@hayesgm hayesgm left a comment

Choose a reason for hiding this comment

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

Lgtm. Can you add a note in changelog and add yourself to contributors.

@tsutsu
Copy link
Contributor Author

tsutsu commented Jan 16, 2018

Sure, will do.

@tsutsu
Copy link
Contributor Author

tsutsu commented Jan 16, 2018

Actually, I don't see a contributors list in the repo files anywhere; what did you mean for me to add myself to?

@hayesgm
Copy link
Contributor

hayesgm commented Jan 16, 2018

@tsutsu in mix.exs

@tsutsu
Copy link
Contributor Author

tsutsu commented Jan 16, 2018

Ah, do you mean the Hex package[:maintainers] field? I believe that's supposed to be the set of people who can merge PRs to the repo.

@tsutsu tsutsu closed this Jan 16, 2018
@tsutsu tsutsu mentioned this pull request Jan 16, 2018
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