Browse Prior Art Database

Method equivalence tracking through replaced class chaining Disclosure Number: IPCOM000250406D
Publication Date: 2017-Jul-11
Document File: 5 page(s) / 58K

Publishing Venue

The Prior Art Database

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

Method Equivalence Tracking through Replaced Class Chaining The Java* Virtual Machine Tool Interface (JVMTI) is a programming interface that enables the development of debugging and monitoring applications for the Java Virtual Machine (JVM). JVMTI provides a way to inspect the state of the JVM and control the execution of an application. This disclosure addresses the set of functions that modify existing classes - RedefineClasses (and Retransform) - and the set of functions required for debugging - SetBreakpoint and GetStackTrace functions. RedefineClasses: This function can replace the definition of a class with a new definition. It can create new versions of methods, making the old versions obsolete. In some cases, not all methods are modified. It is possible to redefine a class where some of the methods are not replaced with new bytecodes, but with identical bytecodes. In this case there is a method equivalence. Figure 1: Redefine classes

SetBreakpoint: jvmtiError SetBreakpoint(jvmtiEnv* env, jmethodID method, jlocation location) This function sets a breakpoint at a specific location in a given method. A breakpoint must also be set in other equivalent versions of the method. GetStackTrace jvmtiError GetStackTrace(jvmtiEnv* env, jthread thread, jint start_depth, jint max_frame_count, jvmtiFrameInfo* frame_buffer, jint* count_ptr)

typedef struct { jmethodID method; jlocation location; } jvmtiFrameInfo; This function returns the threads stack information. For each frame, it returns a methodID and the current bytecode location. If there is an obsolete method in a thread’s stack, then the methodID must be different than the methodID for the most current method. The Java Native Interface (JNI) is a programming interface that enables Java programmers to interop with native languages. JNI offers many native functions to call Java methods, load classes, etc. For this disclosure, the GetMethodID native call is important. The GetMethodID is a native method that returns an ID that represents a Java method. The ID returned is always the same, even if the method has been redefined multiple times. The methodID returned always represents the most current version of the method. Requirements:

1. Redefining A. When a method is redefined, the redefined (new) method always retains

the existing methodID B. If the redefined method is equivalent, then both the new and the former

methods have the same methodID C. If the redefined method is not equivalent, then the former (obsolete)

method gets a new methodID 2. A breakpoint can be set in an obsolete method 3. A breakpoint is set in all equivalent versions of the method 4. Re-ordering methods does not change the methodID

To support the functionality above, the JVM needs to keep track of all method equivalences. Given a methodID, a process must be able to find all equivalent versions of the method. This must be done in a scalable way, as some classes may have many methods and some applications redefine the same clas...