[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] pickles: Add btf-dump.pk BTF utility pickle
From: |
Jose E. Marchesi |
Subject: |
Re: [PATCH] pickles: Add btf-dump.pk BTF utility pickle |
Date: |
Sun, 14 Feb 2021 15:13:51 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> Hi David.
>
>> +fun btf_dump_int = (BTF_Int i) void:
>> + {
>> + printf (" offset=%v bits=%v %s%s%s",
>> + i.offset#b, i.bits#b,
>> + i.signed_p ? "SIGNED " : "",
>> + i.bool_p ? "BOOL " : "", i.char_p ? "CHAR " : "");
>> + }
>
> Every time I see something like i.offset#b or i.bits#b I wonder whether
> the elements i.offset and i.bits shouldn't be rather be offsets instead
> of integral values, i.e:
>
> type BTF_Int =
> struct uint<32>
> {
> uint<4>;
> uint<1>;
> uint<1> bool_p;
> uint<1> char_p;
> uint<1> signed_p;
> offset<uint<8>,b> offset;
> uint<8>;
> offset<uint<8>,b> bits;
>
> /* XXX turn `encoding' into a nested integral struct once we
> support it in the compiler. */
> method encoding = uint<4>:
> {
> return bool_p:::char_p:::signed_p;
> }
> };
>
> Would the above be appropriate?
> Other than that, this is great stuff! :)
Forgot to mention I pushed this patch. Still recommend you to consider
changing `offset' and `bits' in BTF_Int to offsets in a subsequent
patch.