Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf annotate: Move raw_comment and raw_func_start fields out of 'struct ins_operands'

Thoese two fields are used only for the jump_ops, so move them into the
union to save some bytes. Also add jump__delete() callback not to free
the fields as they didn't allocate new strings.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: WANG Rui <wangrui@loongson.cn>
Cc: linux-toolchains@vger.kernel.org
Cc: linux-trace-devel@vger.kernel.org
Link: https://lore.kernel.org/r/20231110000012.3538610-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
fb7fd2a1 ded8c484

+20 -9
+3 -3
tools/perf/arch/loongarch/annotate/instructions.c
··· 61 61 const char *c = strchr(ops->raw, '#'); 62 62 u64 start, end; 63 63 64 - ops->raw_comment = strchr(ops->raw, arch->objdump.comment_char); 65 - ops->raw_func_start = strchr(ops->raw, '<'); 64 + ops->jump.raw_comment = strchr(ops->raw, arch->objdump.comment_char); 65 + ops->jump.raw_func_start = strchr(ops->raw, '<'); 66 66 67 - if (ops->raw_func_start && c > ops->raw_func_start) 67 + if (ops->jump.raw_func_start && c > ops->jump.raw_func_start) 68 68 c = NULL; 69 69 70 70 if (c++ != NULL)
+13 -4
tools/perf/util/annotate.c
··· 340 340 */ 341 341 static inline const char *validate_comma(const char *c, struct ins_operands *ops) 342 342 { 343 - if (ops->raw_comment && c > ops->raw_comment) 343 + if (ops->jump.raw_comment && c > ops->jump.raw_comment) 344 344 return NULL; 345 345 346 - if (ops->raw_func_start && c > ops->raw_func_start) 346 + if (ops->jump.raw_func_start && c > ops->jump.raw_func_start) 347 347 return NULL; 348 348 349 349 return c; ··· 359 359 const char *c = strchr(ops->raw, ','); 360 360 u64 start, end; 361 361 362 - ops->raw_comment = strchr(ops->raw, arch->objdump.comment_char); 363 - ops->raw_func_start = strchr(ops->raw, '<'); 362 + ops->jump.raw_comment = strchr(ops->raw, arch->objdump.comment_char); 363 + ops->jump.raw_func_start = strchr(ops->raw, '<'); 364 364 365 365 c = validate_comma(c, ops); 366 366 ··· 462 462 ops->target.offset); 463 463 } 464 464 465 + static void jump__delete(struct ins_operands *ops __maybe_unused) 466 + { 467 + /* 468 + * The ops->jump.raw_comment and ops->jump.raw_func_start belong to the 469 + * raw string, don't free them. 470 + */ 471 + } 472 + 465 473 static struct ins_ops jump_ops = { 474 + .free = jump__delete, 466 475 .parse = jump__parse, 467 476 .scnprintf = jump__scnprintf, 468 477 };
+4 -2
tools/perf/util/annotate.h
··· 31 31 32 32 struct ins_operands { 33 33 char *raw; 34 - char *raw_comment; 35 - char *raw_func_start; 36 34 struct { 37 35 char *raw; 38 36 char *name; ··· 50 52 struct ins ins; 51 53 struct ins_operands *ops; 52 54 } locked; 55 + struct { 56 + char *raw_comment; 57 + char *raw_func_start; 58 + } jump; 53 59 }; 54 60 }; 55 61