Added common init function for joinpoint
authorKetan Dixit <ketan.dixit@gmail.com>
Thu, 15 Jul 2010 22:44:13 +0000 (18:44 -0400)
committerJustin Seyster <jseyster@cs.sunysb.edu>
Thu, 15 Jul 2010 23:26:01 +0000 (19:26 -0400)
src/aop-pc-assign.c
src/aop-pc-entry.c
src/aop-pc-exit.c
src/aop-pc-fun-call.c
src/aop-pointcut.c
src/aop-pointcut.h

index de05e0f635deb0d072c9dd3a8bfdd0373712d931..44f167fe7e77b2074cd22120d8cfe032d9aff4a2 100644 (file)
@@ -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);
            }
        }
index cd776d4be2331998f69eaabeb9eee252d3b311e5..33c985be5f6d979647a1f7b971b0421b15e01ce8 100644 (file)
@@ -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);
 }
 
index 3c9149c7b9e3afb9b4e34fbe124a4b0638275c8c..ca31b762370e8f26571a60b274c6a62d4fc55166 100644 (file)
@@ -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
index 9c8f7e9bb653d4bc262ed981fa026c19a2ab8731..5cc0da07da8c802cad46934502d6d9017297556d 100644 (file)
@@ -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);             
                }
            }
index 5dddc88b8c18fff23ba3bb9a5d18825f4914fd3f..cb72672123f2458d8d7576b25dbc583a23dfd34f 100644 (file)
@@ -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;  
+}
index f48d9ded14f4fcb00b530ff5b2f8865e5251c4fd..6c6ff8c51fb98911c2e3a3bc42a2546c44abb906 100644 (file)
@@ -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);