Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:25
erlang
0160-beam_disasm-Fix-bs_create_bin-6-resolution...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0160-beam_disasm-Fix-bs_create_bin-6-resolution.patch of Package erlang
From 2127f85d57862c9d19008a0df2cfd6b83ea5d5ae Mon Sep 17 00:00:00 2001 From: Michael Davis <mcarsondavis@gmail.com> Date: Mon, 7 Nov 2022 11:23:09 -0600 Subject: [PATCH] beam_disasm: Fix bs_create_bin/6 resolution The `bs_create_bin/6` instruction was previously not fully translated by `beam_disasm`. This change resolves some of the args in the instruction (unwrapping `u` tags) and resolves the operation list to satisfy the checks in `beam_validator:verify_create_bin_list/2`. --- lib/compiler/src/beam_disasm.erl | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/lib/compiler/src/beam_disasm.erl b/lib/compiler/src/beam_disasm.erl index 5f1ec19d59..73207922cb 100644 --- a/lib/compiler/src/beam_disasm.erl +++ b/lib/compiler/src/beam_disasm.erl @@ -1261,8 +1261,11 @@ resolve_inst({recv_marker_use,[Reg]},_,_,_) -> %% OTP 25. %% -resolve_inst({bs_create_bin,Args},_,_,_) -> - {bs_create_bin,Args}; +resolve_inst({bs_create_bin, + [{Fail,{u,Heap},{u,Live},{u,Unit},Dst,{z,1},{u,_},List0}]}, + _, Strings, _) -> + List = resolve_bs_create_bin_list(List0, Strings), + {bs_create_bin,Fail,Heap,Live,Unit,Dst,{list,List}}; resolve_inst({call_fun2,[Tag,{u,Arity},Func]},_,_,_) -> {call_fun2,Tag,Arity,Func}; resolve_inst({nif_start,[]},_,_,_) -> @@ -1306,6 +1309,24 @@ resolve_arg_unsigned({u,N}) when is_integer(N), N >= 0 -> N. resolve_arg_integer({i,N}) when is_integer(N) -> {integer,N}. +%%----------------------------------------------------------------------- +%% Resolves the OpList for the bs_create_bin/6 instruction +%%----------------------------------------------------------------------- + +resolve_bs_create_bin_list( + [{atom,string}=Type,Seg0,Unit0,Flags,Offset0,Size0|Rest], Strings) -> + [Seg,Unit,Offset,{integer,Len}=Size] = + resolve_args([Seg0,Unit0,Offset0,Size0]), + <<_:Offset/binary,Bin:Len/binary,_/binary>> = Strings, + [Type,Seg,Unit,Flags,{string,Bin},Size | + resolve_bs_create_bin_list(Rest, Strings)]; +resolve_bs_create_bin_list([Type,Seg0,Unit0,Flags,Val0,Size0|Rest], Strings) -> + [Seg,Unit,Val,Size] = resolve_args([Seg0,Unit0,Val0,Size0]), + [Type,Seg,Unit,Flags,Val,Size | + resolve_bs_create_bin_list(Rest, Strings)]; +resolve_bs_create_bin_list([], _Str) -> + []. + %%----------------------------------------------------------------------- %% The purpose of the following is just to add a hook for future changes. %% Currently, field flags are numbers 1-2-4-8 and only two of these -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor