From: Ketan Dixit Date: Thu, 15 Jul 2010 22:44:13 +0000 (-0400) Subject: Added common init function for joinpoint X-Git-Tag: release-v1.0~81 X-Git-Url: https://git.fsl.cs.stonybrook.edu/?a=commitdiff_plain;h=15a9e9b20652180858499cb0bf2fe5c678a6fdde;p=interaspect.git Added common init function for joinpoint --- diff --git a/src/aop-pc-assign.c b/src/aop-pc-assign.c index de05e0f..44f167f 100644 --- a/src/aop-pc-assign.c +++ b/src/aop-pc-assign.c @@ -303,11 +303,7 @@ op_join_on_assign (struct aop_pointcut *pc, join_callback cb, if (stmt_matches_pointcut (pc, stmt)) { struct aop_joinpoint jp; - jp.pc = pc; - jp.gsi = &gsi; - jp.stmt = stmt; - jp.is_prepared = false; - + init_joinpoint (&jp, &gsi, pc, stmt); cb (&jp, callback_param); } } diff --git a/src/aop-pc-entry.c b/src/aop-pc-entry.c index cd776d4..33c985b 100644 --- a/src/aop-pc-entry.c +++ b/src/aop-pc-entry.c @@ -65,9 +65,7 @@ op_join_on_function_entry (struct aop_pointcut *pc, join_callback cb, just to make sure that initialization is getting called.)*/ memset (&gsi, 0xfa, sizeof (gimple_stmt_iterator)); - jp.pc = pc; - jp.gsi = &gsi; - jp.is_prepared = false; + init_joinpoint (&jp, &gsi, pc, NULL); cb (&jp, callback_param); } diff --git a/src/aop-pc-exit.c b/src/aop-pc-exit.c index 3c9149c..ca31b76 100644 --- a/src/aop-pc-exit.c +++ b/src/aop-pc-exit.c @@ -60,10 +60,7 @@ op_join_on_function_exit (struct aop_pointcut *pc, join_callback cb, if (gimple_code (stmt) == GIMPLE_RETURN) { struct aop_joinpoint jp; - jp.pc = pc; - jp.gsi = &gsi; - jp.stmt = stmt; - jp.is_prepared = false; + init_joinpoint (&jp, &gsi, pc, stmt); cb (&jp, callback_param); /* It's possible that gsi is no longer a valid iterator diff --git a/src/aop-pc-fun-call.c b/src/aop-pc-fun-call.c index 9c8f7e9..5cc0da0 100644 --- a/src/aop-pc-fun-call.c +++ b/src/aop-pc-fun-call.c @@ -155,10 +155,7 @@ op_join_on_function_call (struct aop_pointcut *pc, join_callback cb, if (call_matches (pc, stmt)) { struct aop_joinpoint jp; - jp.pc = pc; - jp.gsi = &gsi; - jp.stmt = stmt; - jp.is_prepared = false; + init_joinpoint (&jp, &gsi, pc, stmt); cb (&jp, callback_param); } } diff --git a/src/aop-pointcut.c b/src/aop-pointcut.c index 5dddc88..cb72672 100644 --- a/src/aop-pointcut.c +++ b/src/aop-pointcut.c @@ -53,3 +53,16 @@ create_pointcut (enum aop_pckind kind) return pc; } + +/* +* Initialize a joinpoint with default values. +*/ +void +init_joinpoint (struct aop_joinpoint *jp, gimple_stmt_iterator *gsi, + struct aop_pointcut *pc, gimple stmt) +{ + jp->pc = pc; + jp->gsi = gsi; + jp->stmt = stmt; + jp->is_prepared = false; +} diff --git a/src/aop-pointcut.h b/src/aop-pointcut.h index f48d9de..6c6ff8c 100644 --- a/src/aop-pointcut.h +++ b/src/aop-pointcut.h @@ -108,6 +108,9 @@ struct aop_joinpoint { struct aop_pointcut *create_pointcut (enum aop_pckind kind); +void init_joinpoint (struct aop_joinpoint *jp, gimple_stmt_iterator *gsi, + struct aop_pointcut *pc, gimple stmt); + void op_default_prepare_for_weave (struct aop_joinpoint *jp); void op_default_insert_before (struct aop_joinpoint *jp, gimple stmt); void op_default_insert_after (struct aop_joinpoint *jp, gimple stmt);