Aspect Mining for Large Systems

1,447 views

Published on

Demonstrated at OOPSLA 2006.

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,447
On SlideShare
0
From Embeds
0
Number of Embeds
39
Actions
Shares
0
Downloads
41
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Aspect Mining for Large Systems

  1. 1. HAM: Aspect Mining Silvia Breu University of Cambridge Thomas Zimmermann Saarland University Christian Lindig Saarland University
  2. 2. Aspects create() connect() close() serve() fork()
  3. 3. Aspects create() connect() close() serve() fork()
  4. 4. Aspects create() connect() lock() Typical Aspects enter()/leave() log() close() lock()/unlock() serve() fork()
  5. 5. Aspects create() connect() lock() Typical Aspects enter()/leave() log() close() AOP lock()/unlock() serve() fork()
  6. 6. Aspects create() connect() lock() Typical Aspects enter()/leave() log() close() AOP lock()/unlock() serve() fork() Aspect Mining: Identifying Aspects in Legacy Code
  7. 7. Research Hypothesis Cross-cutting concerns emerge over time.
  8. 8. Cross-cutting concerns emerge over time.
  9. 9. Demo #1
  10. 10. Modelling History Transactions 142
  11. 11. Modelling History Transactions 142 MODIFICATIONS
  12. 12. Modelling History Transactions 142 MODIFICATIONS DELETIONS
  13. 13. Modelling History Transactions 142 MODIFICATIONS DELETIONS ADDITIONS
  14. 14. Modelling History Transactions 142 143 MODIFICATIONS DELETIONS ADDITIONS
  15. 15. Code Additions Location: _aload_0 public void _aload_0(int pc) { dumpPcNumber(pc); buffer.append(OpcodeStringValues .BYTECODE_NAMES [IOpcodeMnemonics.ALOAD_0]); writeNewLine(); }
  16. 16. Code Additions Location: _aload_1 Location: println public void _aload_0(int pc) { Location: _aload_0 dumpPcNumber(pc); buffer.append(OpcodeStringValues public void _aload_0(int pc) .BYTECODE_NAMES { [IOpcodeMnemonics.ALOAD_0]); dumpPcNumber(pc); writeNewLine(); buffer.append(OpcodeStringValues } .BYTECODE_NAMES [IOpcodeMnemonics.ALOAD_0]); writeNewLine(); }
  17. 17. Co-Addition of Calls 141 142 143 config() connect() serve() close() init()
  18. 18. Co-Addition of Calls 141 142 143 config() connect() serve() close() init() lock()
  19. 19. Co-Addition of Calls 141 142 143 config() connect() serve() close() init() lock() unlock()
  20. 20. Co-Addition of Calls 141 142 143 config() connect() serve() close() init() lock() unlock() “fixed bug#1234 by adding proper locks” Cross-Cutting Change lock() unlock()
  21. 21. Transaction as a Table calls locations
  22. 22. Transaction as a Table t rA ha calls c runDFA This Tx added among others a call to charAt in location runDFA locations
  23. 23. Blocks = Aspect Candidates k lock nc ocun l sy calls d method sync is called from e locations d, e, f, g, h, i, k f g h i {sync} is an k aspect candidate locations
  24. 24. Computing all Blocks
  25. 25. Computing all Blocks
  26. 26. Concept Analysis calls locations Concept Analysis computes all blocks.
  27. 27. Concept Analysis calls locations Concept Analysis computes all blocks.
  28. 28. Concept Analysis calls locations Concept Analysis computes all blocks.
  29. 29. Concept Analysis calls locations Concept Analysis computes all blocks.
  30. 30. Example from Eclipse 2004-03-01
  31. 31. Example from Eclipse 2004-03-01 nodes reflect size of cross-cutting concern # locations # methods
  32. 32. Example from Eclipse 2004-03-01 nodes reflect size of cross-cutting concern # locations # methods 14 locations call unsupportedIn2()
  33. 33. Example from Eclipse 2004-03-01 nodes reflect size of cross-cutting concern # locations # methods 14 locations call unsupportedIn2() History contains cross-cutting changes.
  34. 34. Demo #2
  35. 35. Reinforcement Aspect Candidate Aspect Candidate METHOD: METHOD: lock() lock() LOCATIONS: connect() LOCATIONS: init() close() serve()
  36. 36. Reinforcement Aspect Candidate Aspect Candidate + METHOD: METHOD: lock() lock() LOCATIONS: connect() LOCATIONS: init() close() serve() Aspect Candidate METHOD: lock() LOCATIONS: connect() close() init() serve()
  37. 37. Locality
  38. 38. Locality chris chris tom chris silvi silvi chris 39 40 41 42 43 44 45
  39. 39. Locality chris chris tom chris silvi silvi chris 39 40 41 42 43 44 45
  40. 40. Locality chris chris tom chris silvi silvi chris 39 40 41 42 43 44 45 Temporal locality
  41. 41. Locality chris chris tom chris silvi silvi chris 39 40 41 42 43 44 45 Temporal locality
  42. 42. Locality chris chris tom chris silvi silvi chris 39 40 41 42 43 44 45 Temporal locality
  43. 43. Locality chris chris tom chris silvi silvi chris 39 40 41 42 43 44 45 Possessional Temporal locality locality
  44. 44. Locality chris chris tom chris silvi silvi chris 39 40 41 42 43 44 45 Possessional Temporal locality locality ➡ merging transactions and running concept analysis.
  45. 45. Results for Eclipse Transactions (43270) max avg The average transaction blocks 1235 3.7 is small. It adds 5 calls methods 1236 5.4 in 4 locations. locations 1287 3.8
  46. 46. Results for Eclipse Transactions (43270) max avg The average transaction blocks 1235 3.7 is small. It adds 5 calls methods 1236 5.4 in 4 locations. locations 1287 3.8 Aspect Candidates* 112 candidates add methods 1 2 3 ≥4 3 calls or more. candidates 1878 362 88 24 * selected from 159448 blocks
  47. 47. Locking Mechanism public static final native void _XFree(int address); public static final void XFree(int /*long*/ address) { lock.lock(); try { _XFree(address); } finally { lock.unlock(); } }
  48. 48. Locking Mechanism public static final native void _XFree(int address); public static final void XFree(int /*long*/ address) { 284 ts 1 lock.lock(); scu os cr try { ns _XFree(address); tio oca l } finally { lock.unlock(); } }
  49. 49. Future work • Evolution of cross-cutting concerns. Refactor only those that actually change. • Relation between cross-cutting concerns • Refactoring of concerns. • Package and ship HAM.
  50. 50. Conclusions • Cross-cutting concerns emerge over time. • Cross-cutting changes point to aspect candidates. • HAM scales to industrial-sized systems. • http://www.st.cs.uni-sb.de/softevo/

×