View
528
Download
1
Category
Preview:
DESCRIPTION
Smalltalk Metaprogramming supports Probabilistic Program Analysis by Dave Mason. ESUG09, Brest, France
Citation preview
Smalltalk Metaprogramming
supports Probabilistic Program Analysis
Dave MasonRyerson University
1Monday, 2009 August 31
Why Path Discovery?
Testing/coverage
Program Comprehension/Visualization
Software Reliability
2Monday, 2009 August 31
Domain/Path Discovery
Depth-first
Breadth-first
Heuristic
Probabilistic
3Monday, 2009 August 31
Operational Profile
probability of each point in the input domain
histogram or continuous probabilistic density function
derived from real world / “expert”
we will use to drive program analysis
4Monday, 2009 August 31
Continuation-Based
all parameters are variables of the PDF
at any decision point (loop/if) involving those parameters take a snapshot
snapshot placed twice in priority queue
true case
false case
5Monday, 2009 August 31
Continuation-Based (cont)
take first from priority queue to proceed
when any path completes, take first from q
q ordered by integral of domain over PDF
many paths may be in partial execution
by construction, paths complete in frequency order
6Monday, 2009 August 31
Monte Carlo
generate a random point in the input space
check that not in a domain already found
execute, when loop/if add to path, returning with correct true/false
7Monday, 2009 August 31
Metaprogramming
Smalltalk supports 4 key technologies:
Dynamic types
First-class booleans
Continuation capture
Dynamic code generation
8Monday, 2009 August 31
Dynamic Types
because there are no “native” types can pass parameter types in place of e.g. numbers
no change whatsoever required to source
can trace deeply into library classes/methods
9Monday, 2009 August 31
First-class Booleans
conceptually true/false are not special, they are simply objects
Maybe can extend Boolean so that use in loop/if can capture information
in practice, use sends #mustBeBoolean which can capture information
10Monday, 2009 August 31
Continuation Capture
continuation is the information necessary to execute the rest of the program
derived from Seaside continuation capture
walks stack saving local variables
first-class
11Monday, 2009 August 31
Dynamic Code Generation
need to check complex predicates for inclusion
could interpret the predicates
not essential, but generating code for the check can speed up the implementation
12Monday, 2009 August 31
Conclusion
Smalltalk provides the metaprogramming necessary to implement this analysis seamlessly
may be the only one with all these features
questions?
13Monday, 2009 August 31
Recommended