ON THE COST OF TYPE-TAG SOUNDNESS
Zeina Migeed Ben Greenman
ON THE COST OF TYPE-TAG SOUNDNESS Ben Greenman Zeina Migeed ON - - PowerPoint PPT Presentation
ON THE COST OF TYPE-TAG SOUNDNESS Ben Greenman Zeina Migeed ON THE COST OF TYPE-TAG SOUNDNESS 1. Tag soundness 2. Performance cost of soundness 3. Evaluation method 4. Conclusions TYPE-TAG SOUNDNESS Type Soundness e : If
Zeina Migeed Ben Greenman
No undefined behavior Type-based reasoning If then either:
⊢ e : τ ⊢ v : τ e v * e Error * e
If then either:
⊢ e : τ e v * e Error * e ⊢ v : τ
If then either:
⊢ e : τ e v * e Error * e ⊢ v : ⌊τ⌋
If then either:
⊢ e : τ e v * e Error * e ⊢ v : ⌊τ⌋ ⌊Int⌋ = Int ⌊τ × τ'⌋ = Pair ⌊τ → τ'⌋ = Fun ... ⌊τ⌋ = K
No undefined behavior Tag-based reasoning
⌊Int⌋ = Int ⌊τ × τ'⌋ = Pair ⌊τ → τ'⌋ = Fun ... ⌊τ⌋ = K
If then either:
⊢ v : ⌊τ⌋ e v * e Error * e
If and then might be:
⊢ e : Int × Int e v *
Type Soundness Tag Soundness
(0, 0) (3, 2) (-7, 9) (0, 0) (3, 2) (-7, 9) ("A", 0) (0, (1, 2)) v
If and then might be:
⊢ e : Int × Int
Type Soundness Tag Soundness
(0, 0) (3, 2) (-7, 9) (0, 0) (3, 2) (-7, 9) ("A", 0) (0, (1, 2)) v e v *
* fast * slow
Type Sound? Tag Sound?
* fast * slow
e e e ?
τ τ τ
eτ
e e e
τ τ τ
eτ
read()
Enter a value: >
e *
τ τ τ
unzip()
e *
τ τ τ
0110 1110 1011
v + v E[v,v] ... v'
e *
Int Int Int
e
Enter a value: >
0110 1110 1011
E[•] ?
τ
eτ
e v ?
τ τ
e ?
τ
vτ ... vτ
e ?
τ
vτ ...
vτ
?
Int × Int
(6,1)
Int × Int
(6,1)
Int × Int
(6,1)
Int × Int
(6,1) * slow
?
Int × Int
(6,1)
Int × Int
(6,1) * fast
e e e
τ τ τ
eτ
def dist(pt : Tuple(Int,Int)) -> Int: x = pt[0] y = pt[1] return abs(x + y)
def dist(pt : Tuple(Int,Int)) -> Int: x = pt[0] y = pt[1] return abs(x + y) dist((0, 0)) *
def dist(pt : Tuple(Int,Int)) -> Int: x = pt[0] y = pt[1] return abs(x + y) dist("NaN") Expected Tuple *
def dist(pt : Tuple(Int,Int)) -> Int: x = pt[0] y = pt[1] return abs(x + y) dist((0, "NaN")) Expected Int *
7s 11s 5s 4s 9s 2s 5s 24s 9s 14s 5s 21s 9s 6s 9s 8s
7s 11s 5s 4s 9s 2s 5s 24s 9s 14s 5s 21s 9s 6s 9s 8s
What % have at most Dx overhead? D = 4, vs.
What % have at most Dx overhead? D = 4, vs.
O(2)
2
2
DLS 2014 POPL 2017 PEPM 2018 futen call_method espionage http2 call_simple pythonflow slowSHA chaos take5 aespython fannkuch sample_fsm stats go meteor nbody nqueens pidigits pystone spectralnorm
DLS 2014 POPL 2017 PEPM 2018 15 7 12 4 6 12 17 15 16 34 * 1 19 * 79 * 7 8 5 2 5 14 5
What % of configurations have at most 4x overhead?
100% 50%
4x
What % of configurations have at most Dx overhead?
100% 50%
4x 2x 6x 8x 1x
What % of configurations have at most Dx overhead?
100% 50%
4x 2x 6x 8x 1x
What % of configurations have at most 4x overhead, based on R samples of S configurations each?
100% 50%
4x
What % of configurations have at most Dx overhead, based on R samples of S configurations each?
100% 50%
4x 2x 6x 8x 1x
What % of configurations have at most Dx overhead, based on R samples of S configurations each?
100% 50%
4x 2x 6x 8x 1x
100% 50%
4x 2x 6x 8x
100% 50%
4x 2x 6x 8x
espionage 4,096 configurations aespython 10 samples
1x 1x
Type Soundness Tag Soundness 1x 1x 1x 1x 1x 1x 2x 2x 2x 3x 3x 3x 3x 5x 7x 8x 7x 7x 6x 6x 2x 43x 27x 1527x 233x 292x 1x 1x 10x 1x 29x 5x 32x 1x 34x 47x 5x 2x 139x 4x This is an APPLES to ORANGES comparison!
read-only values (tuples)
calls
Runtime: Open-World Soundness and Collaborative Blame for Gradual Type Systems. POPL 2017
Is Sound Gradual Typing Dead? POPL 2016.
⊢ e : τ ⊢ e' : τ' ???