Redundancy-free Residual Dispatch Using Ordered Binary Decision - - PowerPoint PPT Presentation

redundancy free residual dispatch
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

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

slide-2
SLIDE 2

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."); } }

slide-3
SLIDE 3

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); . . .

slide-4
SLIDE 4

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); . . .

slide-5
SLIDE 5

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)

slide-6
SLIDE 6

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)

slide-7
SLIDE 7

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)

slide-8
SLIDE 8

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);

slide-9
SLIDE 9

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)))

slide-10
SLIDE 10

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)))

slide-11
SLIDE 11

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)

slide-12
SLIDE 12

Formula-based Dispatch BDD-based Dispatch Assessment

From Formulas to Strategies

Example Formula φ = (x1 ∧ x2 ∧ x3) ∨ (x1 ∧ x2) ∨ ∧ ∧ x1 x2 x3 x1 x2

slide-13
SLIDE 13

Formula-based Dispatch BDD-based Dispatch Assessment

From Formulas to Strategies

Example Formula φ = (x1 ∧ x2 ∧ x3) ∨ (x1 ∧ x2) ∨ ∧ ∧ x1 x2 x3 x1 x2 ⊤ ⊥

slide-14
SLIDE 14

Formula-based Dispatch BDD-based Dispatch Assessment

From Formulas to Strategies

Example Formula φ = (x1 ∧ x2 ∧ x3) ∨ (x1 ∧ x2) x1 x2 x3 x1 x2 ⊤ ⊥

slide-15
SLIDE 15

Formula-based Dispatch BDD-based Dispatch Assessment

Partial Redundancy Elimination

x1 x2 x3 x1 x1 x2 ⊤ ⊥

slide-16
SLIDE 16

Formula-based Dispatch BDD-based Dispatch Assessment

Partial Redundancy Elimination

x1 x2 x3 x1 x1 x2 ⊤ ⊥

slide-17
SLIDE 17

Formula-based Dispatch BDD-based Dispatch Assessment

Partial Redundancy Elimination

x1 x2 x3 x1 x1 x2 ⊤ ⊥

slide-18
SLIDE 18

Formula-based Dispatch BDD-based Dispatch Assessment

Partial Redundancy Elimination

x1 x2 x3 x1 x1 x2 ⊤ ⊥ Formulas may prevent complete redundancy elimination.

slide-19
SLIDE 19

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 φ.

slide-20
SLIDE 20

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.

slide-21
SLIDE 21

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

slide-22
SLIDE 22

Formula-based Dispatch BDD-based Dispatch Assessment

Full Redundancy Elimination

x1 x2 x2 x3 1 Reduced ordered binary decision diagrams offer complete redundancy elimination.

slide-23
SLIDE 23

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; }

slide-24
SLIDE 24

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.

slide-25
SLIDE 25

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.

slide-26
SLIDE 26

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; }

slide-27
SLIDE 27

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

slide-28
SLIDE 28

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

slide-29
SLIDE 29

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

slide-30
SLIDE 30

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

slide-31
SLIDE 31

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

slide-32
SLIDE 32

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

slide-33
SLIDE 33

Formula-based Dispatch BDD-based Dispatch Assessment

Results

Formulas better Ordered BDDs better Average Evaluation Cost (Ordered BDD) Average Evaluation Cost (Formula)

slide-34
SLIDE 34

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.)

slide-35
SLIDE 35

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.

slide-36
SLIDE 36

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.
slide-37
SLIDE 37

Appendix

Further Results

> 0.05% of formulas > 0.005% of formulas > 0.0005% of formulas Average Evaluation Cost (DNF) Average Evaluation Cost (Formula)

slide-38
SLIDE 38

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)

slide-39
SLIDE 39

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)