From 36b5339142e80015945ebdaf9e9af87fc753f306 Mon Sep 17 00:00:00 2001 From: Timo Paulssen Date: Mon, 27 May 2019 10:32:12 +0200 Subject: [PATCH] draft support for multi-root call graph by having a root node that has neither sf nor native_target_name set. --- src/profiler/instrument.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/profiler/instrument.c b/src/profiler/instrument.c index aa69502095..85640b7c0e 100644 --- a/src/profiler/instrument.c +++ b/src/profiler/instrument.c @@ -463,7 +463,7 @@ static MVMObject * dump_call_graph_node(MVMThreadContext *tc, ProfDumpStrs *pds, /* Use static frame memory address to get a unique ID. */ MVM_repr_bind_key_o(tc, node_hash, pds->id, box_i(tc, (MVMint64)(uintptr_t)pcn->sf)); - } else { + } else if (pcn->native_target_name) { MVMString *function_name_string = MVM_string_utf8_c8_decode(tc, tc->instance->VMString, pcn->native_target_name, strlen(pcn->native_target_name)); @@ -480,6 +480,18 @@ static MVMObject * dump_call_graph_node(MVMThreadContext *tc, ProfDumpStrs *pds, MVM_repr_bind_key_o(tc, node_hash, pds->id, box_i(tc, (MVMint64)(uintptr_t)pcn->native_target_name)); } + else { + MVM_repr_bind_key_o(tc, node_hash, pds->name, + box_s(tc, pds->call_graph)); + MVM_repr_bind_key_o(tc, node_hash, pds->file, + box_s(tc, pds->call_graph)); + + MVM_repr_bind_key_o(tc, node_hash, pds->line, + box_i(tc, -10)); + + MVM_repr_bind_key_o(tc, node_hash, pds->id, + box_i(tc, (MVMint64)(uintptr_t)pcn)); + } /* Entry counts. */ if (pcn->total_entries)