Call-trail Dependent Inline Caching for a Scoping Mechanism of Class Extensions

We propose call-trail dependent inline caching to improve the method dispatch performance of Method Seals. Method Seals is a class extension mechanism that allows users to manually control the effective range of class extensions. It provides better safety than existing class extension mechanisms. However, the absence of inline method cache renders Method Seals’ runtime performance unsatisfactory. To enable inline caching on Method Seals, we added call-trail dependency to the conventional inline caching mechanism. To that end, we introduced the notion of call-trails which represent sets of classes along a call path. We use fixed-length bitsets for representing the current call-trail and a method definition’s unsealed package list. Also, we relaxed Method Seals’ semantic constraints accordingly in order to implement our proposal. We also implemented the proposed call-trail dependent inline caching on top of Method Seals and benchmarked its performance.