Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Conclusion
A Reference-Counting
Garbage Collection Algorithm
for Cyclical Functional Programming
Baltasar Trancón y Widemann
Universität Bayreuth, Germany
ISMM '08Tucson, Arizona2008�6�7/8
RCGC4CFP
Trancón
Introduction
RC
History CRC
Special Cases
CFP
Algorithm
ConclusionReference Counting
&
Cycles
RCGC4CFP
Trancón
Introduction
RC
History CRC
Special Cases
CFP
Algorithm
Conclusion
Reference Counting
In a Nutshell
I simple basic algorithmI count number of live references to a cellI reference count drops to zero =⇒ garbage
I often considered outdated, but not quite dead yet!
Famous Problem
I what about cycles?I reference count drops to zero ⇐= garbage
RCGC4CFP
Trancón
Introduction
RC
History CRC
Special Cases
CFP
Algorithm
Conclusion
History of Cyclic Reference CountingThe Algorithm of Brownbridge (1985�88)
Principle
I partition references into strong and weak subsetI no cycle entirely strongI weak edges irrelevant for reachability (maintain!)
I collection based on strong count only
Advantages
I intuitively appealing
Disadvantages
I hard to get right, complex code
I e�ciency issues
RCGC4CFP
Trancón
Introduction
RC
History CRC
Special Cases
CFP
Algorithm
Conclusion
History of Cyclic Reference CountingThe Algorithm of Lins, Martínez & Wachenchauzer (1990)
Principle
I detect cyclic garbage by �speculative deletion�
I revert if false positive
Advantages
I easy to understand & implement
I potential for optimization & heuristics
Disadvantages
I basic algorithm speculates too often, ine�cient
I thoroughly confounded by sharing
RCGC4CFP
Trancón
Introduction
RC
History CRC
Special Cases
CFP
Algorithm
Conclusion
Common Special CasesAcyclic Data
Acyclic Data
I some data may not have cycles at all
statically by typedynamically by usage
I plain reference counting preferred
Fixed Data
I global constants & let bindings
I reachable by root references
I lower bound for lifetime known
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
ConclusionFunctional Programming
&
Cycles
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
Conclusion
Cyclical Functional Programming
In Common With Other FP Paradigms
I purely functional; immutable data
I free data types & recursion
I strict; no in�nite data
Speciality: Cycles
detect by searching the call stack for recurring inputs
handle by special values & operations
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
Conclusion
Cyclical Functional ProgrammingCycle Handling
Cycle Handling & Unfold
I build result top-down (destination passing)
I upon cycle, just copy previous result (ditto)
I e�ective for all primitively corecursive functions
Cycle Handling & Search
I traverse recursively
I upon cycle, return truth value immediately
I �xed point semantics
false least �xed pointtrue greatest �xed point
either intermediate �xed points
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
Conclusion
Cyclical Functional ProgrammingExample: map
1
2
3
4
map (+5)
xs ys
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
Conclusion
Cyclical Functional ProgrammingExample: map
1
2
3
4
map (+5)
xs ys
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
Conclusion
Cyclical Functional ProgrammingExample: map
1
2
3
4
6
map (+5)
xs ys
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
Conclusion
Cyclical Functional ProgrammingExample: map
1
2
3
4
6
map (+5)
map (+5)
xs ys
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
Conclusion
Cyclical Functional ProgrammingExample: map
1
2
3
4
6
map (+5)
map (+5)
xs ys
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
Conclusion
Cyclical Functional ProgrammingExample: map
1
2
3
4
6
7
map (+5)
map (+5)
xs ys
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
Conclusion
Cyclical Functional ProgrammingExample: map
1
2
3
4
6
7
map (+5)
map (+5)
map (+5)
xs ys
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
Conclusion
Cyclical Functional ProgrammingExample: map
1
2
3
4
6
7
map (+5)
map (+5)
map (+5)
xs ys
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
Conclusion
Cyclical Functional ProgrammingExample: map
1
2
3
4
6
7
8
map (+5)
map (+5)
map (+5)
xs ys
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
Conclusion
Cyclical Functional ProgrammingExample: map
1
2
3
4
6
7
8
map (+5)
map (+5)
map (+5)
map (+5)
xs ys
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
Conclusion
Cyclical Functional ProgrammingExample: map
1
2
3
4
6
7
8
map (+5)
map (+5)
map (+5)
map (+5)
xs ys
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
Conclusion
Cyclical Functional ProgrammingExample: map
1
2
3
4
6
7
8
9
map (+5)
map (+5)
map (+5)
map (+5)
xs ys
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
Conclusion
Cyclical Functional ProgrammingExample: map
1
2
3
4
6
7
8
9
map (+5)
map (+5)
map (+5)
map (+5)
map (+5)
xs ys
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
Conclusion
Cyclical Functional ProgrammingExample: map
1
2
3
4
6
7
8
9
map (+5)
map (+5)
map (+5)
map (+5)
map (+5)
xs ys
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
Conclusion
Cyclical Functional ProgrammingExample: map
1
2
3
4
6
7
8
9
map (+5)
map (+5)
map (+5)
map (+5)
map (+5)
xs ys
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
Conclusion
Implementation of CFPProgramming System
The Malice System
I virtual machine, supportsI destination passing & higher-order functionsI cycle detection & handling (ditto)
I interpreter & aot compiler
RCGC4CFP
Trancón
Introduction
CFP
Theory
Implementation
Algorithm
Conclusion
Implementation of CFPApplications
Cyclic Lists generalization of familiar list algorithms
I insert, delete, lengthI map, �lter, quicksort
Rationals generalization of school math algorithms
I arithmetics, orderI period detection
Algebraic Subtyping vtable-like dynamic encoding
I static recursive subtype checkingI dynamic (duck typing) access
Real-World Applications
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Wanted:
Reference-Counting Algorithm
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
3 2
11 3
Initial Situation
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
3 2
11 3
Initial Situation
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
2 2
11 3
Delete #1: Reachable, sharing
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
2 1
10 3
Delete #1: Reachable, sharing
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
2 1
10 3
Delete #1: Reachable, sharing
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
2 1
00 2
Delete #1: Reachable, sharing
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
2 1
00 2
Delete #1: Reachable, sharing
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
1 1
00 1
Delete #1: Reachable, sharing
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
1 2
01 1
Delete #1: Reachable, sharing
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
1 2
01 1
Delete #1: Reachable, sharing
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
1 2
11 2
Delete #1: Reachable, sharing
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
1 2
11 2
Delete #1: Reachable, sharing
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
2 2
11 3
Delete #1: Reachable, sharing
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
1 2
11 3
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
1 1
10 3
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
1 1
10 3
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
1 1
00 2
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
1 1
00 2
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
0 1
00 1
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
0 1
00 1
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
0 1
00 1
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
0 1
10 2
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
0 1
10 2
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
1 1
10 3
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
1 2
11 3
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
1 2
11 3
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
1 1
11 3
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
1 1
01 2
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
1 1
01 2
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
0 1
01 1
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
0 0
00 1
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
0 0
00 1
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
0 0
00 1
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
0 0
00 1
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
0 0
00 1
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
0 0
00 1
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmMLW At Work
0 0
00 1
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmIdea #1
Idea #1 � Component Analysis
I consider strongly connected componentsI all cells in an SCC die togetherI only inter-SCC references count for reachability
I maintain separate inter/intra countsI inter count drops to zero =⇒ garbage
Problems
I inter-SCC references may point to distant members(#2)
I maintaining inter/intra classi�cation is hard
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmIdea #2
Idea #2 � Edge Coloring
I approximate inter/intra by maintained strong/weakpartition, à la Brownbridge
I strong ' inter
I choose invariants that are cheap to maintain
1. no cycle is entirely strong2. weak in + strong out =⇒ strong in
I maintain separate strong/weak countsI strong count drops to zero =⇒ garbage
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmInvariants
How To Maintain Invariant 1
I mutator creates references in three ways only
1. root =⇒ strong2. constructor argument =⇒ strong3. ditto =⇒ weak
How To Maintain Invariant 2
I deleting (strong) references may create violationsI weak in & no strong in & strong out
I rectify my making strong out references weakI propagate
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
2/1 2/0
1/01/0 3/0
Initial Situation
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
2/1 2/0
1/01/0 3/0
Initial Situation
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
1/1 2/0
1/01/0 3/0
Delete #1: Reachable, sharing
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
1/1 2/0
1/01/0 3/0
Delete #1: Reachable, sharing
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/1 2/0
1/01/0 3/0
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/1 1/0
1/00/0 3/0
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/1 1/0
1/00/0 3/0
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/1 1/0
0/00/0 2/0
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/1 1/0
0/00/0 2/0
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/0 1/0
0/00/0 1/0
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/0 1/0
0/00/0 1/0
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/0 1/0
0/00/0 1/0
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/0 1/0
0/00/0 1/0
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/0 1/0
0/00/0 1/0
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/0 1/0
1/00/0 2/0
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/0 1/0
1/00/0 2/0
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/1 1/0
1/00/0 3/0
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/1 1/1
1/00/1 3/0
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/1 1/1
1/00/1 3/0
Delete #2: Reachable, di�erent way
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/1 0/1
1/00/1 3/0
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/1 0/1
0/00/1 2/0
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/1 0/1
0/00/1 2/0
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/0 0/1
0/00/1 1/0
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/0 0/0
0/00/0 1/0
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/0 0/0
0/00/0 1/0
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/0 0/0
0/00/0 1/0
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/0 0/0
0/00/0 1/0
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/0 0/0
0/00/0 1/0
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/0 0/0
0/00/0 1/0
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/0 0/0
0/00/0 1/0
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/0 0/0
0/00/0 1/0
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmEC At Work
0/0 0/0
0/00/0 1/0
Delete #3: Unreachable
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
Deriving an AlgorithmIndependence
Independence Thesis
I edge coloring is independent of otheroptimizations/heuristics
I �push-out� should be possible
Case Study: Deletion Queue
I queue zero-count cell to defer speculation
I process one entry =⇒ others redundant
I combined with edge coloring in three hours
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
EvaluationMeasurement
What And How To Measure
I no real-world implementation/application exists
I cannot measure runtime
Extend Idea From Original MLW Paper
I simulate & count traversal operations
I single (cyclical) algorithm, varying amount of cycles
I without queue & with di�erent sizes
I additionally measure green�blue ratio (overkill)
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
EvaluationCharts: No Cycles in Input
0
5
10
15
20
25
0 1 2 5 10 20 50
KCal
ls
Queue Size
MLWEC
quicksort l where
l = [0..99]
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
EvaluationCharts: Small Cycles in Input
0
2
4
6
8
10
12
14
0 1 2 5 10 20 50
KCal
ls
Queue Size
MLWEC
quicksort l where
l = [0..9] ++ (cycle [8,9])
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
EvaluationCharts: Medium Cycles in Input
0
5
10
15
20
25
0 1 2 5 10 20 50
KCal
ls
Queue Size
MLWEC
quicksort l where
l = [0..9] ++ (cycle [5..9])
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
EvaluationCharts: Large Cycles in Input
0
5
10
15
20
25
30
35
40
45
0 1 2 5 10 20 50
KCal
ls
Queue Size
MLWEC
quicksort l where
l = cycle [0..14]
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
EvaluationCharts: Small Cycles in Input
0
5
10
15
20
25
0 1 2 5 10 20 50
Ove
rkill
Queue Size
MLWEC
quicksort l where
l = [0..9] ++ (cycle [8,9])
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
EvaluationCharts: Medium Cycles in Input
0
2
4
6
8
10
12
14
16
18
0 1 2 5 10 20 50
Ove
rkill
Queue Size
MLWEC
quicksort l where
l = [0..9] ++ (cycle [5..9])
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
EvaluationCharts: Large Cycles in Input
0 1 2 3 4 5 6 7 8 9
10
0 1 2 5 10 20 50
Ove
rkill
Queue Size
MLWEC
quicksort l where
l = cycle [0..14]
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Derivation
Evaluation
Conclusion
EvaluationSpecial Cases
Special Cases Come For Free!
Acyclic Input no weak references
Acyclic Types as above, statically
Global Data persistent strong references
I no speculation in either case
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Conclusion
Summary
Open Questions
Conclusions
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Conclusion
Summary
Open Questions
Conclusion
Summary
I CFP paradigm creates cycles in controlled way
I EC algorithm exploits control to speed up MLW
I 1�bit edge coloring, simple maintenance
I full algorithm & proof in paper
I combines with (some) other improvements
I applies where maintenance assumptions hold
RCGC4CFP
Trancón
Introduction
CFP
Algorithm
Conclusion
Summary
Open Questions
Conclusion
Open Questions
I undo strong�weak conversion?
I more independent optimizations/heuristics?
I applicable/e�cient beyond toy examples?I real-world applications of CFP?I other applications with same mutator behavior?
Answers Welcome
I speci�cation & proof in the paper
I Java demo implementation available