Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
1105-beam_disasm-Decode-field-flags.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1105-beam_disasm-Decode-field-flags.patch of Package erlang
From ba564849ba257e1910dbbe6d01d327b925d674be Mon Sep 17 00:00:00 2001 From: Michael Davis <mcarsondavis@gmail.com> Date: Fri, 28 Oct 2022 16:38:34 -0500 Subject: [PATCH] beam_disasm: Decode field flags `beam_validator:bs_integer_type/2` expects field flags to be a list of atoms (little, signed, native, etc.). This change reverses the bitflag encoding done in `beam_asm:flag_to_bit/1` and `beam_asm:encode_arg/2` to decode the field flags in `beam_disasm` as `beam_validator` expects. --- lib/compiler/src/beam_disasm.erl | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/compiler/src/beam_disasm.erl b/lib/compiler/src/beam_disasm.erl index 73207922cb..fbe8845858 100644 --- a/lib/compiler/src/beam_disasm.erl +++ b/lib/compiler/src/beam_disasm.erl @@ -1209,13 +1209,20 @@ resolve_arg_unsigned({u,N}) when is_integer(N), N >= 0 -> N. resolve_arg_integer({i,N}) when is_integer(N) -> {integer,N}. %%----------------------------------------------------------------------- -%% 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 -%% numbers (BSF_LITTLE 2 -- BSF_SIGNED 4) have a semantic significance; -%% others are just hints for speeding up the execution; see "erl_bits.h". +%% Decodes field flags within bitstrings such as `Var/signed' or +%% `Var/little'. This is the opposite of `beam_asm:flag_to_bit/1'. +%% Also see "erl_bits.h". %%----------------------------------------------------------------------- -decode_field_flags(FF) -> +decode_field_flags(0) -> + {field_flags,[]}; +decode_field_flags(FieldFlags) when is_integer(FieldFlags) -> + FF = lists:filter( + fun + (little) -> (FieldFlags band 16#02) == 16#02; + (signed) -> (FieldFlags band 16#04) == 16#04; + (native) -> (FieldFlags band 16#10) == 16#10 + end, [little, signed, native]), {field_flags,FF}. %%----------------------------------------------------------------------- -- 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