RoelTyper
Typing the Image in 1,5 minutes
Roel Wuyts
Université Libre de Bruxelles
ESUG’05, Brussels, 16/08/05
Ever Wondered...
• What the type was of the variable mapEntry in ProgramNode ?
2
Ever wanted...
• Some type feedback after accepting a method ?
3
Meet RoelTyper!
• Heuristics-based Type Reconstruction for VisualWorks and Squeak
• Fast
• To give feedback on types of in...
Core Idea
• Quite simple:
1. Use the messages being sent
• find out the interface used by an instance variable
• find out al...
Finding interface&assignments
• Byte-code interpreter:
• messages being sent to instance variables
• assignments
• sends a...
Core Classes
7
InstvarInterfaceExtractor
extractInterfaces:addTo:
Squeak
IVExtractor
doDup
doPop
jump:
...
VW
IVExtractor
...
Types from Interfaces
• Problem: Given a set of selectors, what are all the classes in the
image that understand this set ...
Let’s Try This...
• Interface for #x in Points: -, <, <=, >=, >, *, +, =, @, isZero, abs,
asLimitedPrecisionReal, abs, lit...
Assignments
• Regarding assignments, we support
• Literals and LiteralArray’s
• Class
• Class selector, where selector is ...
Applying RoelTyper
• Built utilities that use RoelTyper:
• The Source&Types Tab in the RB
• An editor to edit types for in...
VW versus Squeak
• 2 classes are different (as shown before)
• Rest of the (non-GUI!) code is the same
• Especially the un...
Helping Out
• Where is the code?
• Main Code is in VisualWorks (published in the Cincom Store)
• Using FileOut30, Squeak v...
http://decomp.ulb.ac.be/roelwuyts/smalltalk/roeltyper/
14
Upcoming SlideShare
Loading in …5
×

RoelTyper

864 views

Published on

RoelTyper. Typing the Image in 1,5 minutes
Roel Wuyts. ESUG 2005, Bruessels

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

  • Be the first to like this

No Downloads
Views
Total views
864
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

RoelTyper

  1. 1. RoelTyper Typing the Image in 1,5 minutes Roel Wuyts Université Libre de Bruxelles ESUG’05, Brussels, 16/08/05
  2. 2. Ever Wondered... • What the type was of the variable mapEntry in ProgramNode ? 2
  3. 3. Ever wanted... • Some type feedback after accepting a method ? 3
  4. 4. Meet RoelTyper! • Heuristics-based Type Reconstruction for VisualWorks and Squeak • Fast • To give feedback on types of instance variables • Not 100% exact • Heuristics-based so that it can be very fast • Works for about 80% of instance variables 4
  5. 5. Core Idea • Quite simple: 1. Use the messages being sent • find out the interface used by an instance variable • find out all classes that understand this interface • weed out any superfluous results 2. use the assignments to an instance variable • support certain right-hand side expressions • Already existed in SOUL, but now directly in Smalltalk 5
  6. 6. Finding interface&assignments • Byte-code interpreter: • messages being sent to instance variables • assignments • sends and assignments through accessor methods 6
  7. 7. Core Classes 7 InstvarInterfaceExtractor extractInterfaces:addTo: Squeak IVExtractor doDup doPop jump: ... VW IVExtractor dupLast dupNext jump: ... TypeCollector pushSendOf:to:args: assignmentTypeOf: languageSpecificPushSendOf:to: newExtractor Squeak TypeCollector assignmentTypeOf: languageSpecificPush SendOf:to: VW TypeCollector assignmentTypeOf: languageSpecificPush SendOf:to: InstructionClient ...
  8. 8. Types from Interfaces • Problem: Given a set of selectors, what are all the classes in the image that understand this set of selectors ? • Take first selector • Start from Object, do a depth-first search to find the subclasses that implement that selector • Take next selector • Start from these subclasses, find the ones that implement this selector to obtain a new set of classes • Repeat until all selectors are processed 8
  9. 9. Let’s Try This... • Interface for #x in Points: -, <, <=, >=, >, *, +, =, @, isZero, abs, asLimitedPrecisionReal, abs, literalArrayEncoding, printOn:, min:, max:, roundTo:, negated, floor, truncated, rounded, hash, ceiling, between:and: • Take -, start at Object • does not implement -, 3 classes do: ArithmeticValue, CPointer, Set • Take < • Do these three classes implement - ? • No! Only ArithmeticValue • Take <= • Does ArithmeticValue implement <= ? Yes! • repeat until the complete interface is checked. 9
  10. 10. Assignments • Regarding assignments, we support • Literals and LiteralArray’s • Class • Class selector, where selector is in protocol ‘instance creation’ • For example: x := 3 -> SmallInteger u := Point -> Point class v := RefactoringBrowser new -> RefactoringBrowser 10
  11. 11. Applying RoelTyper • Built utilities that use RoelTyper: • The Source&Types Tab in the RB • An editor to edit types for instance variables • A tool to explain the types found • So you can see all which is being sent or assigned • A Logging tool that logs Type Errors • Checks a class every time a method is acccepted 11
  12. 12. VW versus Squeak • 2 classes are different (as shown before) • Rest of the (non-GUI!) code is the same • Especially the unit tests • Not that much difference between the byte codes 12
  13. 13. Helping Out • Where is the code? • Main Code is in VisualWorks (published in the Cincom Store) • Using FileOut30, Squeak versions are generated • If you want to help: • VW: Use the Cincom Store • Squeak: • Only touch Squeak classes in Squeak • If you change ‘common’classes: check in VW and Squeak! • Results need to be published in Store eventually! 13
  14. 14. http://decomp.ulb.ac.be/roelwuyts/smalltalk/roeltyper/ 14

×