[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] pickles: small updates to btf.pk and btf-dump.pk
From: |
David Faust |
Subject: |
[PATCH] pickles: small updates to btf.pk and btf-dump.pk |
Date: |
Tue, 16 Feb 2021 11:11:59 -0800 |
Change BTF_Int.offset and BTF_Int.bits to offset types. Update
BTF_Section to properly use header.type_off and header.str_off.
2021-02-16 David Faust <david.faust@oracle.com>
* pickles/btf.pk (BTF_Int): Make `offset` and `bits` into offset types.
(BTF_Section): Properly use header type_off and str_off.
(btf_types): Remove now-redundant function.
(btf_strings): Likewise.
* pickles/btf-dump.pk (btf_dump_int): Account for above type changes.
---
Thanks very much to Jose's feedback :)
OK to push?
pickles/btf-dump.pk | 2 +-
pickles/btf.pk | 22 ++++++++--------------
2 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/pickles/btf-dump.pk b/pickles/btf-dump.pk
index 739659a5..26ea98f0 100644
--- a/pickles/btf-dump.pk
+++ b/pickles/btf-dump.pk
@@ -23,7 +23,7 @@ load btf;
fun btf_dump_int = (BTF_Int i) void:
{
printf (" offset=%v bits=%v %s%s%s",
- i.offset#b, i.bits#b,
+ i.offset, i.bits,
i.signed_p ? "SIGNED " : "",
i.bool_p ? "BOOL " : "", i.char_p ? "CHAR " : "");
}
diff --git a/pickles/btf.pk b/pickles/btf.pk
index 7b3bea96..64ac704e 100644
--- a/pickles/btf.pk
+++ b/pickles/btf.pk
@@ -52,9 +52,9 @@ type BTF_Int =
uint<1> bool_p;
uint<1> char_p;
uint<1> signed_p;
- uint<8> offset;
+ offset<uint<8>,b> offset;
uint<8>;
- uint<8> bits;
+ offset<uint<8>,b> bits;
/* XXX turn `encoding' into a nested integral struct once we
support it in the compiler. */
@@ -200,8 +200,12 @@ type BTF_Section =
struct
{
BTF_Header header;
- BTF_Type[header.type_len] types;
- string[header.str_len] strings;
+
+ var type_off = OFFSET + header.type_off;
+ var str_off = OFFSET + header.str_off;
+
+ BTF_Type[header.type_len] types @ type_off;
+ string[header.str_len] strings @ str_off;
/* Given an offset into the BTF strings section, return the string. */
@@ -210,13 +214,3 @@ type BTF_Section =
return string @ strings'offset + off;
}
};
-
-fun btf_types = (BTF_Header hdr) BTF_Type[]:
- {
- return BTF_Type[hdr.type_len] @ (hdr'offset + hdr'size + hdr.type_off);
- }
-
-fun btf_strings = (BTF_Header hdr) string[]:
- {
- return string[hdr.str_len] @ (hdr'offset + hdr'size + hdr.str_off);
- }
--
2.30.0
- [PATCH] pickles: small updates to btf.pk and btf-dump.pk,
David Faust <=