From cd64085694c7c4aa96312e88905015eea4d8b63d Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Thu, 26 Dec 2024 18:01:31 -0700 Subject: lib9p: Split the generated tables up --- build-aux/stack.c.gen | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'build-aux') diff --git a/build-aux/stack.c.gen b/build-aux/stack.c.gen index 61d7bce..a3288b0 100755 --- a/build-aux/stack.c.gen +++ b/build-aux/stack.c.gen @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # build-aux/stack.c.gen - Analyze stack sizes for compiled objects # -# Copyright (C) 2024 Luke T. Shumaker +# Copyright (C) 2024-2025 Luke T. Shumaker # SPDX-License-Identifier: AGPL-3.0-or-later import os.path @@ -375,25 +375,18 @@ def main( if m := re_tmessage_handler.fullmatch(line): tmessage_handlers.add(m.group("handler")) - lib9p_versions: dict[str, set[str]] | None = None + lib9p_msgs: set[str] = set() if any(fname.endswith("lib9p/9p.c") for fname in c_fnames): generated_c = next( fname for fname in c_fnames if fname.endswith("lib9p/9p.generated.c") ) - re_lib9p_msg_entry = re.compile(r"^\s*_MSG\((?P\S+)\),$") - lib9p_versions = { - "validate": set(), - "marshal": set(), - "unmarshal": set(), - } + re_lib9p_msg_entry = re.compile(r"^\s*_MSG_(?:[A-Z]+)\((?P\S+)\),$") with open(generated_c, "r") as fh: for line in fh: line = line.rstrip() if m := re_lib9p_msg_entry.fullmatch(line): typ = m.group("typ") - lib9p_versions["validate"].add(f"validate_{typ}") - lib9p_versions["unmarshal"].add(f"unmarshal_{typ}") - lib9p_versions["marshal"].add(f"marshal_{typ}") + lib9p_msgs.add(typ) re_call_vcall = re.compile(r"VCALL\((?P[^,]+), (?P[^,)]+)[,)].*") @@ -417,10 +410,10 @@ def main( ] if tmessage_handlers and "/srv.c:" in loc and "tmessage_handlers[typ](" in line: return sorted(tmessage_handlers) - if lib9p_versions and "/9p.c:" in loc: - for meth in lib9p_versions.keys(): + if lib9p_msgs and "/9p.c:" in loc: + for meth in ["validate", "unmarshal", "marshal"]: if line.startswith(f"table.{meth}("): - return sorted(lib9p_versions[meth]) + return sorted(f"{meth}_{msg}" for msg in lib9p_msgs) return None hooks_indirect_callees += [sbc_indirect_callees] -- cgit v1.2.3-2-g168b From c3b9d7e802d7d2e31131692d621515ac88178ebb Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Mon, 16 Dec 2024 14:51:10 -0500 Subject: lib9p: Split lib9p_{validate,unmarshal,marshal} into _Tmsg and _Rmsg variants --- build-aux/stack.c.gen | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build-aux') diff --git a/build-aux/stack.c.gen b/build-aux/stack.c.gen index a3288b0..6602bdc 100755 --- a/build-aux/stack.c.gen +++ b/build-aux/stack.c.gen @@ -412,7 +412,7 @@ def main( return sorted(tmessage_handlers) if lib9p_msgs and "/9p.c:" in loc: for meth in ["validate", "unmarshal", "marshal"]: - if line.startswith(f"table.{meth}("): + if line.startswith(f"tentry.{meth}("): return sorted(f"{meth}_{msg}" for msg in lib9p_msgs) return None -- cgit v1.2.3-2-g168b From a02f59f255006a2d6cb236fe2448b69c9c223adb Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Wed, 18 Dec 2024 12:35:20 -0700 Subject: stack.c.gen: Monitor printf and assert overhead --- build-aux/stack.c.gen | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'build-aux') diff --git a/build-aux/stack.c.gen b/build-aux/stack.c.gen index 6602bdc..0568af0 100755 --- a/build-aux/stack.c.gen +++ b/build-aux/stack.c.gen @@ -746,6 +746,9 @@ def main( return True return False + def misc_filter(name: str) -> bool: + return name.endswith(":__lm_printf") or name == "__assert_msg_fail" + def location_xform(loc: str) -> str: if not loc.startswith("/"): return loc @@ -780,6 +783,7 @@ def main( app_func_filters={ "Threads": thread_filter, "Interrupt handlers": intrhandler_filter, + "Misc": misc_filter, }, app_location_xform=location_xform, app_indirect_callees=indirect_callees, -- cgit v1.2.3-2-g168b