Verified Commit 3f3db544 authored by Camil Staps's avatar Camil Staps
Browse files

Add instruction get_thunk_arity to get the "real" arity of a thunk, minus...

Add instruction get_thunk_arity to get the "real" arity of a thunk, minus added B-stack field in case of callgraph profiling
parent 730fe1db
Loading
Loading
Loading
Loading
+25
Changes for cgcode.c: 25 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -4086,6 +4086,31 @@ void code_get_desc_flags_b (void)
	s_push_b (graph_2);
}

void code_get_thunk_arity (void)
{
	INSTRUCTION_GRAPH graph_1,graph_2;

	graph_1=s_pop_b ();
#ifdef G_A64
	graph_2=g_load_sqb_id (-4,graph_1);
#else
	graph_2=g_load_id (-4,graph_1);
#endif

#ifdef PROFILE
	if (callgraph_profiling){
		INSTRUCTION_GRAPH graph_3,graph_4;

		graph_3=g_load_i (257);
		graph_4=g_sub (graph_3,graph_2);
		s_push_b (graph_4);
		return;
	}
#endif

	s_push_b (graph_2);
}

void code_get_thunk_desc (void)
{
	INSTRUCTION_GRAPH graph_1,graph_2;
+1
Changes for cgcodep.h: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ void code_get_desc_arity_offset (void);
void code_get_node_arity (int a_offset);
void code_get_desc0_number (void);
void code_get_desc_flags_b (void);
void code_get_thunk_arity (void);
void code_get_thunk_desc (void);
void code_gtC (VOID);
void code_gtI (VOID);
+1
Changes for cginput.c: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -2419,6 +2419,7 @@ static void put_instructions_in_table (void)
	put_instruction_name ("get_desc_flags_b",	parse_instruction,		code_get_desc_flags_b );	
	put_instruction_name ("get_desc0_number",	parse_instruction,		code_get_desc0_number );
	put_instruction_name ("get_node_arity",	parse_instruction_n,		code_get_node_arity );
	put_instruction_name ("get_thunk_arity",	parse_instruction,		code_get_thunk_arity );
	put_instruction_name ("get_thunk_desc",	parse_instruction,			code_get_thunk_desc );
	put_instruction_name ("gtC",			parse_instruction,			code_gtC );
	put_instruction_name ("gtI",			parse_instruction,			code_gtI );