inferring types by mining class usage frequency from inline caches
TRANSCRIPT
Inferring Types by Mining Class Usage Frequency
from Inline CachesNevena Milojković
SCGUniversity of Bern
1
Mohammad GhafariSCG
University of Bern
Oscar NierstraszSCG
University of Bern
Clément Béra RMOD - INRIA
Lille Nord Europe
ExampleGLMPane>>resetAnnouncer super resetAnnouncer. self presentations do:
[ :each | each resetAnnouncer]
resetAnnouncerupdate
2
resetAnnouncer
75 63 classes
75 classesGLMPane>>update ... self presentations do: [ :each | each update ]
Possible types for eachGTGenericStackDebugger GLMRoassal2Presentation … MooseFinder PPBrowser … GTPPDebugger PPVerticalParserInspector GLMPane … GTSimpleMethodsBrowser GLMRubricTextPresentation
3
63 classes
GTGenericStackDebugger GLMRoassal2Presentation … MooseFinder PPBrowser … GTPPDebugger PPVerticalParserInspector GLMPane… GTSimpleMethodsBrowser GLMRubricTextPresentation
DYNAMIC TYPE
Possible hierarchies for each
GLMPane GLMPresentation
4
Two hierarchies
GLMPaneGLMPresentation
Inline Caches
5
GLMPane>>resetAnnouncer super resetAnnouncer. self presentations do:
[ :each | each resetAnnouncer]
RECEIVER TYPE
21 <70> self 22 <85 00> superSend: resetAnnouncer 24 <87> pop 25 <70> self 26 <D1> send: presentations 27 <8F 01 00 03> closureNumCopied: 0 numArgs: 1 bytes 31 to 33 31 <10> pushTemp: 0 32 <D0> send: resetAnnouncer 33 <7D> blockReturn 34 <CB> send: do: 35 <87> pop 36 <78> returnSelf
BYTECODE
Inline Caches
6
22 2
0 6
0 0 112
3 13
GTGenericStackDebuggerGLMRoassal2Presentation…MooseFinder PPBrowser …
GTPPDebuggerPPVerticalParserInspectorGLMPane…GTSimpleMethodsBrowserGLMRubricTextPresentation
Inline Caches - Ordered Classes
7
11222
13 6
3 2 0
0 0
…
…
…
GTGenericStackDebugger
GLMRoassal2PresentationMooseFinder
PPBrowser
GTPPDebuggerPPVerticalParserInspector
GLMPane
GTSimpleMethodsBrowser
GLMRubricTextPresentation
Inline Caches - Ordered Hierarchies
8
GLMPane
GLMPresentation
112
564
Inline Caches - Ordered Hierarchies
9
GLMPresentation
GLMPane
564
112
RESULTS - classes
10
0%
25%
50%
75%
100%
Roassal2 Glamour Morphic Moose
37%40%34%34%
16%9%6%6%
47%51%60%60%
guessed variables - average 59% near-guessed variables - average 7%incorrectly guessed variables - average 34%
RESULTS - hierarchies
11
0%
25%
50%
75%
100%
Roassal2 Glamour Morphic Moose
26%11%
4%15%
9%12%
7%
13%
65%77%
89%72%
guessed variables - average 72%near-guessed variables - average 13% incorrectly guessed variables - average 15%
Comparison with EATI
12
0
1000
2000
3000
4000
Inline Caches EATI
748542
2'0803'090
# of guessed variables # of near-guessed variables
Summary
13
GLMPane>>resetAnnouncer super resetAnnouncer. self presentations do:
[ :each | each resetAnnouncer] GLMPane>>update
... self presentations do: [ :each | each update ]
GTGenericStackDebugger … MooseFinder PPBrowser … GTPPDebugger GLMPane … GTSimpleMethodsBrowser GLMRubricTextPresentation
GLMPane GLMTabulator GLMCompositePresentation GLMListPresentation … GLMImplicitBrowser OnMooseMetaPropertiesWithoutComments PPParserBrowser GLMSpecPresentation
INLINE CACHING
FREQUENCYDATA