Skip to content
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

Fix hipe bug when matching a writable binary #690

Closed
wants to merge 2 commits into from

Conversation

sverker
Copy link
Contributor

@sverker sverker commented Apr 20, 2015

This is a fix for a hipe problem reported by Johannes Weißl and Sebastian Egner:

http://erlang.org/pipermail/erlang-bugs/2015-April/004884.html

Seen symptom: Hipe compiled code with <<C/utf8, ...>> = Bin does sometimes
not match even though Bin contains a valid utf8 character. There might be
other possible binary matching symptoms, as the problem is not utf8
specific.

Problem: A writable binary was not "emasculated" when the matching started
(as it should) by the hipe compiled code.

Fix: Add a new primop emasculate_binary(Bin) that is called when
a matchstate is created.

ToDo: There are probably room for optimization. For example only call
emasculate_binary if ProcBin.flags is set.

Seen symptom: Hipe compiled code with <<C/utf8, ...>> = Bin does sometimes
not match even though Bin contains a valid utf8 character. There might be
other possible binary matching symptoms, as the problem is not utf8
specific.

Problem: A writable binary was not "emasculated" when the matching started
(as it should) by the hipe compiled code.

Fix: Add a new primop emasculate_binary(Bin) that is called when
a matchstate is created.

ToDo: There are probably room for optimization. For example only call
emasculate_binary if ProcBin.flags is set.
@weisslj
Copy link
Contributor

weisslj commented Apr 20, 2015

Thanks! The patch fixes the bug for us!

http://erlang.org/pipermail/erlang-bugs/2015-April/004910.html

@lpgauth
Copy link
Contributor

lpgauth commented Apr 20, 2015

amazing!

@OTP-Maintainer
Copy link

Patch has passed first testings and has been assigned to be reviewed


I am a script, I am not human


Only call emasculate_binary if ProcBin.flags is set,
which means it's a writable binary.
@sverker
Copy link
Contributor Author

sverker commented Apr 21, 2015

I did the optimization of checking ProcBin.flags.

@OTP-Maintainer
Copy link

Patch has passed first testings and has been assigned to be reviewed


I am a script, I am not human


@weisslj
Copy link
Contributor

weisslj commented Apr 21, 2015

I ran our application test suite successfully with e40aab7.

@mikpe
Copy link
Contributor

mikpe commented Apr 24, 2015

I reviewed both commits and tested them with the HiPE test suite on top of otp 17.5: no regressions. Thanks for fixing this.

@sverker
Copy link
Contributor Author

sverker commented May 6, 2015

Merged to master.

@sverker sverker closed this May 6, 2015
@sverker sverker reopened this May 6, 2015
@sverker sverker closed this May 6, 2015
@sverker sverker deleted the hipe_match_writable_binary_bug branch June 16, 2022 09:59
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.

None yet

5 participants