From 91fb6636f95f882b75170fb77c412ccc4a9b75f4 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Mon, 20 Apr 2015 15:52:27 +0200 Subject: erts,hipe: Fix bug in binary matching of writable binary Seen symptom: Hipe compiled code with <> = 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. --- lib/hipe/rtl/hipe_rtl_binary_match.erl | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/hipe/rtl/hipe_rtl_binary_match.erl b/lib/hipe/rtl/hipe_rtl_binary_match.erl index af8903904b..c906286cb4 100644 --- a/lib/hipe/rtl/hipe_rtl_binary_match.erl +++ b/lib/hipe/rtl/hipe_rtl_binary_match.erl @@ -704,6 +704,7 @@ get_base(Orig,Base) -> hipe_rtl:mk_alu(Base, Orig, 'add', hipe_rtl:mk_imm(?HEAP_BIN_DATA-2)), hipe_rtl:mk_goto(hipe_rtl:label_name(EndLbl)), REFCLbl, + hipe_rtl:mk_call([], emasculate_binary, [Orig], [], [], 'not_remote'), hipe_rtl:mk_load(Base, Orig, hipe_rtl:mk_imm(?PROC_BIN_BYTES-2)), EndLbl]. -- cgit v1.2.3