Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:25
erlang
2365-beam_disasm-Fix-translation-of-bs_get_-2-i...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2365-beam_disasm-Fix-translation-of-bs_get_-2-instruction.patch of Package erlang
From 42d5a0d6a42960fab3d3c1613a1967809c7a7d93 Mon Sep 17 00:00:00 2001 From: Michael Davis <mcarsondavis@gmail.com> Date: Thu, 10 Nov 2022 15:38:34 -0600 Subject: [PATCH 5/8] beam_disasm: Fix translation of bs_get_*2 instructions `beam_validator:vi/2` expects these instructions in the shape {test,Instruction,Fail,Live,[Ms,Size,Unit,Flags],Dst} For `bs_get_integer2`, `bs_get_binary2` and `bs_get_float2`. A similar translation is done by `beam_ssa_codegen:cg_bs_get/3`. For an example, this listing: match_string(<<Int/integer>>) -> Int; match_string(<<Float/float>>) -> Float; match_string(<<Bin/binary>>) -> Bin. becomes this asm: {function, match_string, 1, 2}. {label,1}. {line,[{location,"str.erl",3}]}. {func_info,{atom,str},{atom,match_string},1}. {label,2}. {'%',{var_info,{x,0},[accepts_match_context]}}. {test,bs_start_match3,{f,1},1,[{x,0}],{x,1}}. {bs_get_position,{x,1},{x,0},2}. {test,bs_get_integer2, {f,3}, 2, [{x,1}, {integer,8}, 1, {field_flags, [{anno,[3,{file,"str.erl"}]},unsigned,big]}], {x,2}}. {test,bs_test_tail2,{f,3},[{x,1},0]}. {move,{x,2},{x,0}}. return. {label,3}. {bs_set_position,{x,1},{x,0}}. {test,bs_get_float2, {f,4}, 2, [{x,1}, {integer,64}, 1, {field_flags, [{anno,[4,{file,"str.erl"}]},unsigned,big]}], {x,2}}. {test,bs_test_tail2,{f,4},[{x,1},0]}. {move,{x,2},{x,0}}. return. {label,4}. {bs_set_position,{x,1},{x,0}}. {test,bs_get_binary2, {f,5}, 2, [{x,1}, {atom,all}, 8, {field_flags, [{anno,[5,{file,"str.erl"}]},unsigned,big]}], {x,0}}. return. {label,5}. {bs_get_tail,{x,1},{x,0},2}. {jump,{f,1}}. --- lib/compiler/src/beam_disasm.erl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/compiler/src/beam_disasm.erl b/lib/compiler/src/beam_disasm.erl index 86d15809a5..f7fd1b509c 100644 --- a/lib/compiler/src/beam_disasm.erl +++ b/lib/compiler/src/beam_disasm.erl @@ -1054,15 +1054,15 @@ resolve_inst({is_function2=I,Args0},_,_,_) -> %% resolve_inst({bs_start_match2=I,[F,Reg,{u,Live},{u,Max},Ms]},_,_,_) -> {test,I,F,[Reg,Live,Max,Ms]}; -resolve_inst({bs_get_integer2=I,[Lbl,Ms,{u,Live},Arg2,{u,N},{u,U},Arg5]},_,_,_) -> - [A2,A5] = resolve_args([Arg2,Arg5]), - {test,I,Lbl,[Ms, Live,A2,N,decode_field_flags(U),A5]}; -resolve_inst({bs_get_binary2=I,[Lbl,Ms,{u,Live},Arg2,{u,N},{u,U},Arg5]},_,_,_) -> - [A2,A5] = resolve_args([Arg2,Arg5]), - {test,I,Lbl,[Ms, Live,A2,N,decode_field_flags(U),A5]}; -resolve_inst({bs_get_float2=I,[Lbl,Ms,{u,Live},Arg2,{u,N},{u,U},Arg5]},_,_,_) -> - [A2,A5] = resolve_args([Arg2,Arg5]), - {test,I,Lbl,[Ms, Live,A2,N,decode_field_flags(U),A5]}; +resolve_inst({bs_get_integer2=I,[Fail,Ms,{u,Live},Size0,{u,Unit},{u,Flags},Dst0]},_,_,_) -> + [Size,Dst] = resolve_args([Size0,Dst0]), + {test,I,Fail,Live,[Ms,Size,Unit,decode_field_flags(Flags)],Dst}; +resolve_inst({bs_get_binary2=I,[Fail,Ms,{u,Live},Size0,{u,Unit},{u,Flags},Dst0]},_,_,_) -> + [Size,Dst] = resolve_args([Size0,Dst0]), + {test,I,Fail,Live,[Ms,Size,Unit,decode_field_flags(Flags)],Dst}; +resolve_inst({bs_get_float2=I,[Fail,Ms,{u,Live},Size0,{u,Unit},{u,Flags},Dst0]},_,_,_) -> + [Size,Dst] = resolve_args([Size0,Dst0]), + {test,I,Fail,Live,[Ms,Size,Unit,decode_field_flags(Flags)],Dst}; resolve_inst({bs_skip_bits2=I,[Lbl,Ms,Arg2,{u,N},{u,U}]},_,_,_) -> A2 = resolve_arg(Arg2), {test,I,Lbl,[Ms,A2,N,decode_field_flags(U)]}; -- 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