From: Justin Seyster Date: Thu, 12 Aug 2010 20:13:01 +0000 (-0400) Subject: aop_join_on_copy() support for assignment pointcut. X-Git-Tag: release-v1.0~73^2~4 X-Git-Url: https://git.fsl.cs.stonybrook.edu/?a=commitdiff_plain;h=be8413dda9ea63cc5e3ffb3f7fff6b0d51a20aee;p=interaspect.git aop_join_on_copy() support for assignment pointcut. --- diff --git a/src/aop-pc-assign.c b/src/aop-pc-assign.c index 84dc685..5964704 100644 --- a/src/aop-pc-assign.c +++ b/src/aop-pc-assign.c @@ -34,6 +34,7 @@ #include #include "aop.h" +#include "aop-duplicate.h" #include "aop-dynval.h" #include "aop-pointcut.h" #include "aop-type.h" @@ -96,7 +97,6 @@ aop_capture_lhs_name (struct aop_joinpoint *jp) } } - /* Given an expression from the lhs of an assignment, return true unless it is a temporary variable created by the compiler. @@ -301,6 +301,24 @@ stmt_matches_pointcut (struct aop_pointcut *pc, gimple stmt) } } +static void join_on_bb_assign (basic_block bb, struct aop_pointcut *pc, + join_callback cb, void *callback_param) +{ + gimple_stmt_iterator gsi; + + for (gsi = gsi_start_bb (bb) ; !gsi_end_p (gsi) ; gsi_next (&gsi)) + { + gimple stmt = gsi_stmt (gsi); + + if (stmt_matches_pointcut (pc, stmt)) + { + struct aop_joinpoint jp; + init_joinpoint (&jp, &gsi, pc, stmt); + cb (&jp, callback_param); + } + } +} + static void op_join_on_assign (struct aop_pointcut *pc, join_callback cb, void *callback_param) @@ -311,19 +329,7 @@ op_join_on_assign (struct aop_pointcut *pc, join_callback cb, FOR_EACH_BB(bb) { - gimple_stmt_iterator gsi; - - for (gsi = gsi_start_bb (bb) ; !gsi_end_p (gsi) ; gsi_next (&gsi)) - { - gimple stmt = gsi_stmt (gsi); - - if (stmt_matches_pointcut (pc, stmt)) - { - struct aop_joinpoint jp; - init_joinpoint (&jp, &gsi, pc, stmt); - cb (&jp, callback_param); - } - } + join_on_bb_assign (bb, pc, cb, callback_param); } } @@ -331,8 +337,18 @@ static void op_join_on_copy_assign (struct aop_pointcut *pc, int copy, join_callback cb, void *callback_param) { - /* Not yet supported. */ - aop_assert(0); + unsigned int pair_index; + bb_pair *pair; + + aop_assert (is_current_func_duplicated ()); + aop_assert (pc->kind == ATP_ASSIGN); + + FOR_EACH_BB_PAIR (bb_pairs, pair_index, pair) + { + basic_block bb = (copy == 0) ? pair->old : pair->new; + + join_on_bb_assign (bb, pc, cb, callback_param); + } } /**