Formula-based Dispatch BDD-based Dispatch Assessment
Redundancy-free Residual Dispatch Using Ordered Binary Decision - - PowerPoint PPT Presentation
Redundancy-free Residual Dispatch Using Ordered Binary Decision - - PowerPoint PPT Presentation
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
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) !target(LocalConnection) args(PlainText)
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) args(PlainText) before(); connection.transmit(text);
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 φ = (x1 ∧ x2 ∧ x3) ∨ (x1 ∧ x2)
Formula-based Dispatch BDD-based Dispatch Assessment
From Formulas to Strategies
Example Formula φ = (x1 ∧ x2 ∧ x3) ∨ (x1 ∧ x2) ∨ ∧ ∧ x1 x2 x3 x1 x2
Formula-based Dispatch BDD-based Dispatch Assessment
From Formulas to Strategies
Example Formula φ = (x1 ∧ x2 ∧ x3) ∨ (x1 ∧ x2) ∨ ∧ ∧ x1 x2 x3 x1 x2 ⊤ ⊥
Formula-based Dispatch BDD-based Dispatch Assessment
From Formulas to Strategies
Example Formula φ = (x1 ∧ x2 ∧ x3) ∨ (x1 ∧ x2) x1 x2 x3 x1 x2 ⊤ ⊥
Formula-based Dispatch BDD-based Dispatch Assessment
Partial Redundancy Elimination
x1 x2 x3 x1 x1 x2 ⊤ ⊥
Formula-based Dispatch BDD-based Dispatch Assessment
Partial Redundancy Elimination
x1 x2 x3 x1 x1 x2 ⊤ ⊥
Formula-based Dispatch BDD-based Dispatch Assessment
Partial Redundancy Elimination
x1 x2 x3 x1 x1 x2 ⊤ ⊥
Formula-based Dispatch BDD-based Dispatch Assessment
Partial Redundancy Elimination
x1 x2 x3 x1 x1 x2 ⊤ ⊥ 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 x1, . . . , xn occurring in the residue φ.
Formula-based Dispatch BDD-based Dispatch Assessment
Two Assumptions on Advice Dispatch
1
Evaluation is side-effect free.
2
Binding of parameters is not a side-effect.
Formula-based Dispatch BDD-based Dispatch Assessment
From Formulas to BDDs to Strategies
Example Formula φ = (x1 ∧ x2 ∧ x3) ∨ (x1 ∧ x2) x1 x2 x2 x3 1
Formula-based Dispatch BDD-based Dispatch Assessment
Full Redundancy Elimination
x1 x2 x2 x3 1 Reduced ordered binary decision diagrams offer complete redundancy elimination.
Formula-based Dispatch BDD-based Dispatch Assessment
fφ1(x) advice1; fφ2(x) advice2; joinPointShadow;
1 1
Example before() : joinPointShadow && φ1 { advice1; } before() : joinPointShadow && φ2 { advice2; }
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
1
Evaluation is side-effect free.
2
Binding of parameters is not a side-effect.
3
Execution of an advice does not affect evaluation.
Formula-based Dispatch BDD-based Dispatch Assessment
f{φ1,φ2} joinPointShadow; advice1; joinPointShadow; advice2; joinPointShadow; advice1; advice2; joinPointShadow;
00 10 01 11
Example before() : joinPointShadow && φ1 { advice1; } before() : joinPointShadow && φ2 { advice2; }
Formula-based Dispatch BDD-based Dispatch Assessment
Example Formulas φ1 = (x1 ∧ x2 ∧ x3) ∨ (x1 ∧ x2) φ2 = x2 ∧ x4 x1 x2 x2 x3 1 x2 x4 1
Formula-based Dispatch BDD-based Dispatch Assessment
Example Formulas φ1 = (x1 ∧ x2 ∧ x3) ∨ (x1 ∧ x2) φ2 = x2 ∧ x4 x1 x2 x2 x3 10 00 x2 x4 00 01
Formula-based Dispatch BDD-based Dispatch Assessment
Example Formulas φ1 = (x1 ∧ x2 ∧ x3) ∨ (x1 ∧ x2) φ2 = x2 ∧ x4 x1 x2 x2 x3 x4 00 01 10
Formula-based Dispatch BDD-based Dispatch Assessment
Experimental Setup
∨ ∧ ∧ x1 x2 x3 x1 x2 Formulas of signature x1, . . . , x5 At most 6 propositional
- perators (∧, ∨, ¬)
Non-trivial, i.e., not equivalent to ⊥ or ⊤ Simple, i.e., the laws of idempotence or boundedness are not applicable
Formula-based Dispatch BDD-based Dispatch Assessment
Experimental Setup (cont’d)
x1 x2 x2 x3 1
target args cflow Evaluation Cost
Compared by average evaluation cost BDDs x1, . . . , x5-ordered
Formula-based Dispatch BDD-based Dispatch Assessment
Experimental Setup (cont’d)
x1 x2 x2 x3 1
x1 x2 x3 x4 x5 Evaluation Cost
Compared by average evaluation cost BDDs x1, . . . , x5-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
> 0.5% of formulas > 0.05% of formulas > 0.005% of formulas > 0.0005% of formulas Formulas better Ordered BDDs better Average Evaluation Cost (Ordered BDD) Average Evaluation Cost (Formula)
BDD-based dispatch functions outperform formula-based ones 80% of the time. (Further 7.7% are tied.)
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.
Appendix
Recommended Reading
- I. Wegener. Branching Programs and Binary Decision
Diagrams: Theory and Applications. Society for Industrial and Applied Mathematics, Philadelphia, PA, USA, 2000.
- R. E. Bryant. Graph-based algorithms for Boolean function
- manipulation. IEEE Transactions on Computers, 35(8),
1986.
- C. Chambers, W. Chen. Efficient multiple and predicated
- dispatching. ACM SIGPLAN Notices, 34(10), 1999.
Appendix
Further Results
> 0.05% of formulas > 0.005% of formulas > 0.0005% of formulas Average Evaluation Cost (DNF) Average Evaluation Cost (Formula)
Appendix
Further Results (cont’d)
> 0.5% of formulas > 0.05% of formulas > 0.005% of formulas > 0.0005% of formulas Average Evaluation Cost (Ordered BDD) Average Evaluation Cost (DNF)
Appendix
Further Results (cont’d)
> 5% of formulas > 0.5% of formulas > 0.05% of formulas > 0.005% of formulas > 0.0005% of formulas Average Evaluation Cost (Cost-only Heuristic) Average Evaluation Cost (DFS Heuristic)