Back to overview

Inferring Types by Mining Class Usage Frequency from Inline Caches

Type of publication Peer-reviewed
Publikationsform Proceedings (peer-reviewed)
Author Milojković Nevena, Béra Clément, Ghafari Mohammad, Nierstrasz Oscar,
Project Agile Software Analysis
Show all

Proceedings (peer-reviewed)

Title of proceedings Proceedings of International Workshop on Smalltalk Technologies (IWST 2016)
DOI 10.1145/2991041.2991047

Open Access

Type of Open Access Website


Dynamically typed languages allow developers to write more expressive source code, but their lack of static information about types of variables is one of the main obstacles during program comprehension and maintenance. Static type information reduces the complexity of a program. Most of the type inference algorithms suffer from the problem of false positives or negatives. Complex approaches are required to avoid this problem. We propose a simple heuristic that uses easily accessible run-time information about the usage of each class as a receiver type for a message send. This frequency serves as a proxy for the likelihood that a variable belongs to that class at run time and is used to promote the correct type towards the top of the list of possible types for a variable. Our evaluation of a proof-of-concept prototype implemented in Pharo Smalltalk shows that our heuristic is reason- ably precise to detect both library and project-related types on average in 65.92% to 82.83% of cases.