basic_block bb;
aop_assert (pc->kind == ATP_ENTRY);
- if(pc->pc_entry.function_name!= NULL)
+ if(pc->pc_entry.function_name != NULL)
{
- if (strcmp(IDENTIFIER_POINTER (DECL_NAME (current_function_decl))
- ,pc->pc_entry.function_name)!=0)
+ if (strcmp( IDENTIFIER_POINTER (DECL_NAME (current_function_decl))
+ ,pc->pc_entry.function_name)!=0)
{
fprintf(stderr,"%s function does not match the pointcut specifier",
pc->pc_entry.function_name);
{
gimple_stmt_iterator gsi;
- for (gsi = gsi_start_bb (bb) ; !gsi_end_p (gsi) ; gsi_next (&gsi))
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
struct aop_joinpoint jp;
jp.pc = pc;
jp.gsi = &gsi;
+ jp.is_prepared = false;
cb (&jp, callback_param);
return;
}
aop_match_function_entry ()
{
struct aop_pointcut *pc;
-
pc = ggc_alloc (sizeof (struct aop_pointcut));
pc->kind = ATP_ENTRY;
pc->join_on = op_join_on_function_entry;
pc->insert_before = op_default_insert_before;
-
+ pc->prepare_for_weave = op_default_prepare_for_weave;
return pc;
}
void aop_filter_function_entry_pointcut(struct aop_pointcut *pc_function_entry,
const char *advice_function_entry)
{
- pc_function_entry->pc_entry.function_name=advice_function_entry;
+ pc_function_entry->pc_entry.function_name = advice_function_entry;
}
#include "aop-type.h"
#include "aop-dynval.h"
-
+//123456789012345678901234567890123456789012345678901234567890123456789012345678
static void
op_join_on_function_call (struct aop_pointcut *pc, join_callback cb,
void *callback_param)
FOR_EACH_BB(my_basic_block)
{
- for (gsi = gsi_start_bb (my_basic_block);
- !gsi_end_p (gsi);
- gsi_next (&gsi))
+ for (gsi = gsi_start_bb (my_basic_block) ; !gsi_end_p (gsi) ;
+ gsi_next (&gsi))
{
gimple my_statement = gsi_stmt (gsi);
- /* At this stage, there should be no GIMPLE statements with sub-statements. */
+ /* At this stage, there should be no GIMPLE
+ statements with sub-statements. */
gcc_assert(!gimple_has_substatements (my_statement));
if (gimple_code (my_statement) == GIMPLE_CALL)
{
- func = gimple_call_fn(my_statement);
+ func = gimple_call_fn (my_statement);
- if (TREE_CODE(func) != ADDR_EXPR)
+ if (TREE_CODE (func) != ADDR_EXPR)
{
- /* This is a call to a function pointer. Don't worry about it. */
- fprintf(stderr, "CALL_EXPR with non-ADDR_EXPR function.\n");
+ /* This is a call to a function pointer.
+ Don't worry about it. */
continue;
}
-
+
func_decl = TREE_OPERAND (func, 0);
func_name = IDENTIFIER_POINTER (DECL_NAME (func_decl));
if (strcmp (pc->pc_call.function_name, func_name) == 0)
{
- int num_args = gimple_call_num_args(my_statement);
- fprintf(stderr," Function call to %s has %d parameters passed.\n",pc->pc_call.function_name,num_args);
+ int num_args = gimple_call_num_args (my_statement);
+
struct aop_param_desc *iter = NULL;
if(pc->pc_call.param_list_head != NULL ) {
- iter = pc->pc_call.param_list_head;
+ iter = pc->pc_call.param_list_head;
while( iter->next != NULL ) {
- iter = iter->next;
- if(iter->param_id > num_args - 1 || iter->param_id < 0) {
- fprintf(stderr," Function call to %s does not satisfy the pointcut.\n",pc->pc_call.function_name);
- return;
+ iter = iter->next;
+
+ if(iter->param_id > num_args - 1 ||
+ iter->param_id < 0) {
+ return;
}
}
}
struct aop_joinpoint jp;
jp.pc = pc;
jp.gsi = &gsi;
+ jp.is_prepared = false;
cb (&jp, callback_param);
- fprintf (stderr,"Function call to %s captured...\n",pc->pc_call.function_name);
}
}
pc->kind = ATP_CALL;
pc->join_on = op_join_on_function_call;
pc->insert_after = op_default_insert_after;
+ pc->insert_before = op_default_insert_before;
+ pc->prepare_for_weave = op_default_prepare_for_weave;
/*
Initialize the list to NULL
*/
return pc;
}
-void aop_filter_function_call_pointcut(struct aop_pointcut *pc_function_call,
+void aop_filter_function_call_pointcut (struct aop_pointcut *pc_function_call,
const char *advice_function_call)
{
- pc_function_call->pc_call.function_name=advice_function_call;
+ pc_function_call->pc_call.function_name = advice_function_call;
}
-void aop_add_param_descriptor(struct aop_pointcut *pc,int param_id)
+void aop_add_param_descriptor (struct aop_pointcut *pc,int param_id)
{
struct aop_param_desc *iter = NULL;
- struct aop_param_desc *desc = ggc_alloc (sizeof (struct aop_param_desc));
- desc->param_id=param_id;
- desc->next = NULL;
+ struct aop_param_desc *desc = ggc_alloc (sizeof (struct aop_param_desc));
+ desc->param_id = param_id;
+ desc->next = NULL;
if(pc->pc_call.param_list_head == NULL ) {
- pc->pc_call.param_list_head= desc;
+ pc->pc_call.param_list_head = desc;
}
else {
- iter = pc->pc_call.param_list_head;
- while( iter->next != NULL ) {
- iter = iter->next;
- }
- iter->next = desc;
+ iter = pc->pc_call.param_list_head;
+ while( iter->next != NULL ) {
+ iter = iter->next;
+ }
+ iter->next = desc;
}
}
void aop_filter_function_call_pointcut_by_param_index(struct aop_pointcut *pc,
int param_id)
{
-
- aop_add_param_descriptor(pc,param_id);
+ aop_add_param_descriptor (pc, param_id);
}
we can grab its return value. */
if (gimple_call_lhs(stmt) == NULL)
{
- fprintf(stderr,"call_lhs is NULL\n");
/*
- tree new_lhs = create_tmp_var(gimple_call_return_type(stmt), "aop_result");
+ tree new_lhs = create_tmp_var(gimple_call_return_type(stmt),
+ "aop_result");
add_referenced_var(new_lhs);
new_lhs = make_ssa_name(new_lhs, stmt);
gimple_call_set_lhs(stmt, new_lhs);
update_stmt(stmt);
*/
}
- return_value = stabilize_reference(gimple_call_lhs(stmt));
- debug_gimple_stmt(stmt);
+ return_value = stabilize_reference (gimple_call_lhs (stmt));
+ debug_gimple_stmt (stmt);
return return_value;
}
gimple stmt;
tree param;
struct aop_joinpoint *jp = dv->jp;
-
aop_assert (dv->kind == ADV_FUN_PARAM);
aop_assert (jp->pc->kind == ATP_CALL);
stmt = gsi_stmt (*(jp->gsi));
- param = stabilize_reference(gimple_call_arg(stmt, dv->dynval_call.param_id));
+ param = stabilize_reference (gimple_call_arg (stmt, dv->dynval_call.param_id));
return param;
}