mirror of
https://github.com/torvalds/linux
synced 2024-09-30 16:29:47 +00:00
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>
This commit is contained in:
parent
ded8c48497
commit
fb7fd2a14a
|
@ -61,10 +61,10 @@ static int loongarch_jump__parse(struct arch *arch, struct ins_operands *ops, st
|
||||||
const char *c = strchr(ops->raw, '#');
|
const char *c = strchr(ops->raw, '#');
|
||||||
u64 start, end;
|
u64 start, end;
|
||||||
|
|
||||||
ops->raw_comment = strchr(ops->raw, arch->objdump.comment_char);
|
ops->jump.raw_comment = strchr(ops->raw, arch->objdump.comment_char);
|
||||||
ops->raw_func_start = strchr(ops->raw, '<');
|
ops->jump.raw_func_start = strchr(ops->raw, '<');
|
||||||
|
|
||||||
if (ops->raw_func_start && c > ops->raw_func_start)
|
if (ops->jump.raw_func_start && c > ops->jump.raw_func_start)
|
||||||
c = NULL;
|
c = NULL;
|
||||||
|
|
||||||
if (c++ != NULL)
|
if (c++ != NULL)
|
||||||
|
|
|
@ -340,10 +340,10 @@ bool ins__is_call(const struct ins *ins)
|
||||||
*/
|
*/
|
||||||
static inline const char *validate_comma(const char *c, struct ins_operands *ops)
|
static inline const char *validate_comma(const char *c, struct ins_operands *ops)
|
||||||
{
|
{
|
||||||
if (ops->raw_comment && c > ops->raw_comment)
|
if (ops->jump.raw_comment && c > ops->jump.raw_comment)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (ops->raw_func_start && c > ops->raw_func_start)
|
if (ops->jump.raw_func_start && c > ops->jump.raw_func_start)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
|
@ -359,8 +359,8 @@ static int jump__parse(struct arch *arch, struct ins_operands *ops, struct map_s
|
||||||
const char *c = strchr(ops->raw, ',');
|
const char *c = strchr(ops->raw, ',');
|
||||||
u64 start, end;
|
u64 start, end;
|
||||||
|
|
||||||
ops->raw_comment = strchr(ops->raw, arch->objdump.comment_char);
|
ops->jump.raw_comment = strchr(ops->raw, arch->objdump.comment_char);
|
||||||
ops->raw_func_start = strchr(ops->raw, '<');
|
ops->jump.raw_func_start = strchr(ops->raw, '<');
|
||||||
|
|
||||||
c = validate_comma(c, ops);
|
c = validate_comma(c, ops);
|
||||||
|
|
||||||
|
@ -462,7 +462,16 @@ static int jump__scnprintf(struct ins *ins, char *bf, size_t size,
|
||||||
ops->target.offset);
|
ops->target.offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void jump__delete(struct ins_operands *ops __maybe_unused)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* The ops->jump.raw_comment and ops->jump.raw_func_start belong to the
|
||||||
|
* raw string, don't free them.
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
static struct ins_ops jump_ops = {
|
static struct ins_ops jump_ops = {
|
||||||
|
.free = jump__delete,
|
||||||
.parse = jump__parse,
|
.parse = jump__parse,
|
||||||
.scnprintf = jump__scnprintf,
|
.scnprintf = jump__scnprintf,
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,8 +31,6 @@ struct ins {
|
||||||
|
|
||||||
struct ins_operands {
|
struct ins_operands {
|
||||||
char *raw;
|
char *raw;
|
||||||
char *raw_comment;
|
|
||||||
char *raw_func_start;
|
|
||||||
struct {
|
struct {
|
||||||
char *raw;
|
char *raw;
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -52,6 +50,10 @@ struct ins_operands {
|
||||||
struct ins ins;
|
struct ins ins;
|
||||||
struct ins_operands *ops;
|
struct ins_operands *ops;
|
||||||
} locked;
|
} locked;
|
||||||
|
struct {
|
||||||
|
char *raw_comment;
|
||||||
|
char *raw_func_start;
|
||||||
|
} jump;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue