aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/hipe/hipe_bif0.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2015-04-20 15:52:27 +0200
committerSverker Eriksson <[email protected]>2015-04-20 15:52:27 +0200
commit91fb6636f95f882b75170fb77c412ccc4a9b75f4 (patch)
tree17e33497bf2f9c72f2d096210fc61eb204a38f1d /erts/emulator/hipe/hipe_bif0.c
parent545890576542e4be630df8772654b99bd0306f62 (diff)
downloadotp-91fb6636f95f882b75170fb77c412ccc4a9b75f4.tar.gz
otp-91fb6636f95f882b75170fb77c412ccc4a9b75f4.tar.bz2
otp-91fb6636f95f882b75170fb77c412ccc4a9b75f4.zip
erts,hipe: Fix bug in binary matching of writable binary
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.
Diffstat (limited to 'erts/emulator/hipe/hipe_bif0.c')
-rw-r--r--erts/emulator/hipe/hipe_bif0.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/erts/emulator/hipe/hipe_bif0.c b/erts/emulator/hipe/hipe_bif0.c
index 8af174170d..de2ea0ecde 100644
--- a/erts/emulator/hipe/hipe_bif0.c
+++ b/erts/emulator/hipe/hipe_bif0.c
@@ -1028,6 +1028,14 @@ void hipe_emulate_fpe(Process* p)
}
#endif
+void hipe_emasculate_binary(Eterm bin)
+{
+ ProcBin* pb = (ProcBin *) boxed_val(bin);
+ if (pb->thing_word == HEADER_PROC_BIN && pb->flags != 0) {
+ erts_emasculate_writable_binary(pb);
+ }
+}
+
#if 0 /* XXX: unused */
/*
* At least parts of this should be inlined in native code.