Formula-based Dispatch BDD-based Dispatch Assessment Redundancy-free Residual Dispatch Using Ordered Binary Decision Diagrams for Efficient Dispatch Andreas Sewe Christoph Bockisch Mira Mezini Seventh International Workshop on Foundations of Aspect-Oriented Languages, 2008
Formula-based Dispatch BDD-based Dispatch Assessment Example Aspect aspect SecurityMonitoring { before (): call ( void Connection.transmit(Text)) && (( target (LocalConnection) && args (PlainText) && ! cflow ( call ( void Log.debug()))) || (! target (LocalConnection) && args (PlainText))) { throw new PolicyViolation("Cipher text required."); } }
Formula-based Dispatch BDD-based Dispatch Assessment Example Pointcut call ( void Connection.transmit(Text)) && (( target (LocalConnection) && args (PlainText) && ! cflow ( call ( void Log.debug()))) || (! target (LocalConnection) && args (PlainText))) . . . Connection connection = new RemoteConnection("www.st.informatik.tu − darmstadt.de"); Text text = new PlainText("Encrypt me!"); connection.transmit(text); . . .
Formula-based Dispatch BDD-based Dispatch Assessment Example Pointcut call ( void Connection.transmit(Text)) && (( target (LocalConnection) && args (PlainText) && ! cflow ( call ( void Log.debug()))) || (! target (LocalConnection) && args (PlainText))) . . . Connection connection = new RemoteConnection("www.st.informatik.tu − darmstadt.de"); Text text = new PlainText("Encrypt me!"); connection.transmit(text); . . .
Formula-based Dispatch BDD-based Dispatch Assessment Example Pointcut call ( void Connection.transmit(Text)) && (( target (LocalConnection) && args (PlainText) && ! cflow ( call ( void Log.debug()))) || (! target (LocalConnection) && args (PlainText))) target (LocalConnection)
Formula-based Dispatch BDD-based Dispatch Assessment Example Pointcut call ( void Connection.transmit(Text)) && (( target (LocalConnection) && args (PlainText) && ! cflow ( call ( void Log.debug()))) || (! target (LocalConnection) && args (PlainText))) target (LocalConnection) ! target (LocalConnection)
Formula-based Dispatch BDD-based Dispatch Assessment Example Pointcut call ( void Connection.transmit(Text)) && (( target (LocalConnection) && args (PlainText) && ! cflow ( call ( void Log.debug()))) || (! target (LocalConnection) && args (PlainText))) target (LocalConnection) args (PlainText) ! target (LocalConnection)
Formula-based Dispatch BDD-based Dispatch Assessment Example Pointcut call ( void Connection.transmit(Text)) && (( target (LocalConnection) && args (PlainText) && ! cflow ( call ( void Log.debug()))) || (! target (LocalConnection) && args (PlainText))) before (); connection.transmit(text); target (LocalConnection) args (PlainText) ! target (LocalConnection)
Formula-based Dispatch BDD-based Dispatch Assessment From Pointcuts to Formulas Example Pointcut call ( void Connection.transmit(Text)) && (( target (LocalConnection) && args (PlainText) && ! cflow ( call ( void Log.debug()))) || (! target (LocalConnection) && args (PlainText)))
Formula-based Dispatch BDD-based Dispatch Assessment From Pointcuts to Formulas Example Pointcut call ( void Connection.transmit(Text)) && (( target (LocalConnection) && args (PlainText) && ! cflow ( call ( void Log.debug()))) || (! target (LocalConnection) && args (PlainText)))
Formula-based Dispatch BDD-based Dispatch Assessment From Pointcuts to Formulas Example Pointcut call ( void Connection.transmit(Text)) && (( target (LocalConnection) && args (PlainText) && ! cflow ( call ( void Log.debug()))) || (! target (LocalConnection) && args (PlainText))) Example Formula φ = ( x 1 ∧ x 2 ∧ x 3 ) ∨ ( x 1 ∧ x 2 )
Formula-based Dispatch BDD-based Dispatch Assessment From Formulas to Strategies Example Formula φ = ( x 1 ∧ x 2 ∧ x 3 ) ∨ ( x 1 ∧ x 2 ) ∨ ∧ ∧ x 1 x 2 x 3 x 1 x 2
Formula-based Dispatch BDD-based Dispatch Assessment From Formulas to Strategies Example Formula φ = ( x 1 ∧ x 2 ∧ x 3 ) ∨ ( x 1 ∧ x 2 ) ∨ ∧ ∧ x 1 x 2 x 3 x 1 x 2 ⊤ ⊥
Formula-based Dispatch BDD-based Dispatch Assessment From Formulas to Strategies Example Formula φ = ( x 1 ∧ x 2 ∧ x 3 ) ∨ ( x 1 ∧ x 2 ) x 1 x 2 x 3 x 1 x 2 ⊤ ⊥
Formula-based Dispatch BDD-based Dispatch Assessment Partial Redundancy Elimination x 1 x 2 x 3 x 1 x 1 x 2 ⊤ ⊥
Formula-based Dispatch BDD-based Dispatch Assessment Partial Redundancy Elimination x 1 x 2 x 3 x 1 x 1 x 2 ⊤ ⊥
Formula-based Dispatch BDD-based Dispatch Assessment Partial Redundancy Elimination x 1 x 2 x 3 x 1 x 1 x 2 ⊤ ⊥
Formula-based Dispatch BDD-based Dispatch Assessment Partial Redundancy Elimination x 1 x 2 x 3 x 1 x 1 x 2 ⊤ ⊥ Formulas may prevent complete redundancy elimination.
Formula-based Dispatch BDD-based Dispatch Assessment Dispatch Functions Residual dispatch at a join point shadow can be viewed as the evaluation of a Boolean function. f φ : { 0 , 1 } n → { 0 , 1 } Whether the advice is applicable depends on the n atomic pointcuts x 1 , . . . , x n occurring in the residue φ .
Formula-based Dispatch BDD-based Dispatch Assessment Two Assumptions on Advice Dispatch Evaluation is side-effect free. 1 Binding of parameters is not a side-effect. 2
Formula-based Dispatch BDD-based Dispatch Assessment From Formulas to BDDs to Strategies Example Formula φ = ( x 1 ∧ x 2 ∧ x 3 ) ∨ ( x 1 ∧ x 2 ) x 2 1 x 1 x 2 x 3 0
Formula-based Dispatch BDD-based Dispatch Assessment Full Redundancy Elimination x 2 1 x 1 x 2 x 3 0 Reduced ordered binary decision diagrams offer complete redundancy elimination.
Formula-based Dispatch BDD-based Dispatch Assessment f φ 1 ( x ) 1 Example advice 1 ; 0 before () : joinPointShadow && φ 1 { advice 1 ; } f φ 2 ( x ) before () : joinPointShadow 1 && φ 2 { advice 2 ; } advice 2 ; 0 joinPointShadow;
Formula-based Dispatch BDD-based Dispatch Assessment Extended Dispatch Functions Residual dispatch at a shared shadow can be viewed as the evaluation of an extended Boolean function. f Φ : { 0 , 1 } n → { 0 , 1 } m Which combination of the m advice is applicable depends on the n atomic pointcuts jointly occurring in the residues φ 1 , . . . , φ m .
Formula-based Dispatch BDD-based Dispatch Assessment Three Assumptions on Advice Dispatch Evaluation is side-effect free. 1 Binding of parameters is not a side-effect. 2 Execution of an advice does not affect evaluation. 3
Formula-based Dispatch BDD-based Dispatch Assessment f { φ 1 ,φ 2 } 00 joinPointShadow; Example 10 advice 1 ; before () : joinPointShadow 01 joinPointShadow; && φ 1 { advice 1 ; } before () : joinPointShadow advice 2 ; && φ 2 { advice 2 ; } 11 joinPointShadow; advice 1 ; advice 2 ; joinPointShadow;
Formula-based Dispatch BDD-based Dispatch Assessment Example Formulas φ 1 = ( x 1 ∧ x 2 ∧ x 3 ) ∨ ( x 1 ∧ x 2 ) φ 2 = x 2 ∧ x 4 x 2 1 x 1 x 2 x 3 0 x 4 1 x 2 0
Formula-based Dispatch BDD-based Dispatch Assessment Example Formulas φ 1 = ( x 1 ∧ x 2 ∧ x 3 ) ∨ ( x 1 ∧ x 2 ) φ 2 = x 2 ∧ x 4 x 2 10 x 1 x 2 x 3 00 x 4 01 x 2 00
Formula-based Dispatch BDD-based Dispatch Assessment Example Formulas φ 1 = ( x 1 ∧ x 2 ∧ x 3 ) ∨ ( x 1 ∧ x 2 ) φ 2 = x 2 ∧ x 4 x 3 00 x 2 x 1 x 4 01 x 2 10
Formula-based Dispatch BDD-based Dispatch Assessment Experimental Setup Formulas of signature � x 1 , . . . , x 5 � ∨ At most 6 propositional operators ( ∧ , ∨ , ¬ ) Non-trivial, i.e., not ∧ ∧ equivalent to ⊥ or ⊤ Simple, i.e., the laws of x 1 x 2 x 2 x 3 x 1 idempotence or boundedness are not applicable
Formula-based Dispatch BDD-based Dispatch Assessment Experimental Setup (cont’d) Evaluation Cost x 2 1 x 1 args target cflow x 2 x 3 0 Compared by average evaluation cost BDDs � x 1 , . . . , x 5 � -ordered
Formula-based Dispatch BDD-based Dispatch Assessment Experimental Setup (cont’d) Evaluation Cost x 2 1 x 1 x 1 x 2 x 3 x 4 x 5 x 2 x 3 0 Compared by average evaluation cost BDDs � x 1 , . . . , x 5 � -ordered
Formula-based Dispatch BDD-based Dispatch Assessment Results Formulas better Ordered BDDs better Average Evaluation Cost (Ordered BDD) Average Evaluation Cost (Formula)
Formula-based Dispatch BDD-based Dispatch Assessment Results Formulas better Ordered BDDs better > 0 . 5 % of formulas > 0 . 05 % of formulas > 0 . 005 % of formulas > 0 . 0005 % of formulas Average Evaluation Cost (Ordered BDD) BDD-based dispatch functions outperform formula-based ones 80% of the time. (Further 7.7% are tied.) Average Evaluation Cost (Formula)
Formula-based Dispatch BDD-based Dispatch Assessment Conclusion Extended dispatch functions are a useful concept. BDD-based dispatch functions offer complete redundancy elimination. They clearly outperform formula-based dispatch functions.
Recommend
More recommend