Browse Prior Art Database

Optimized Method Resolution through Method Sorting Disclosure Number: IPCOM000240400D
Publication Date: 2015-Jan-29
Document File: 3 page(s) / 65K

Publishing Venue

The Prior Art Database


Disclosed is a solution to sort class methods when loading the class from the byte codes in order to utilize a more efficient algorithm for method resolution.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 57% of the total text.

Page 01 of 3

Optimized Method Resolution through Method Sorting

Java* provides four invoke bytecodes (i.e. invokevirtual, invokespecial, invokestatic, invokeinterface) that resolve the method to be invoked at run-time on the first use of the constant pool entry. This resolution process needs to search for the method with the correct name and signature in the targeted class and its super classes. This resolution process must walk each method of the class until it finds a method with a matching name and signature.

The Java class file does not define an order to the methods ; methods are loaded in the order in which definitions are assigned in the class file.

The known solution is to use a linear search to search the unsorted methods . J9's current resolution strategy is a linear search of the methods of each class being searched, which is a very inefficient searching algorithm when there are a large number of methods.

The novel solution recognizes that if a class' methods are sorted, then more efficient searching algorithms, such as binary search, can be utilized. The novel contribution is a method to sort the methods when loading the class from the byte codes . This has several advantages:

It has no extra memory footprint.

It will not interfere with subsequent sharing of method indices between a Read-Only Memory (ROM) class and a related Random Access Memory (RAM) class
Sorting is only done once per class

For classes with few methods, the increased method resolutio...