JVM Class Instrumentation via Analysis Fields
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing techniques for instrumenting Java Virtual Machine (JVM) environments face challenges in efficiently instrumenting bootstrap classes, as they are typically loaded before instrumentation can occur, leading to issues with ease of use and incomplete instrumentation of classes.
Innovation Solution
Declaring analysis fields in selected classes that extend bootstrap classes during the class loading process, allowing for the monitoring and instrumentation of fields without modifying the bootstrap classes themselves, thereby enabling effective dynamic analysis.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If bootstrap classes are instrumented before JVM startup, then instrumentation completeness is improved, but system complexity and ease of use deteriorate
Solution Approach 1:
The patent applies preliminary action by declaring analysis fields in selected classes during the class loading process, before the classes are fully initialized and used. This allows instrumentation to occur at an early stage (during loading) rather than requiring pre-instrumentation of bootstrap classes before JVM startup, thereby achieving complete instrumentation while avoiding the complexity of modifying the bootstrap class loading mechanism.
2Reliability
If bootstrap classes are modified for instrumentation, then instrumentation completeness is improved, but ease of operation worsens
Solution Approach 1:
The patent uses an intermediary approach by declaring analysis fields in selected classes that extend bootstrap classes, rather than directly modifying the bootstrap classes themselves. This intermediary mechanism allows instrumentation of the entire class hierarchy (including bootstrap classes) while maintaining the simplicity of the bootstrap class loading process and avoiding direct modification of core JVM components.
3Loss of time
If classes are instrumented during loading, then instrumentation timing is improved, but measurement precision of bootstrap class fields worsens
Solution Approach 1:
The patent applies segmentation by separating the instrumentation approach into two parts: (1) declaring analysis fields in selected classes during loading for timely instrumentation, and (2) using inheritance relationships to indirectly monitor bootstrap class fields. This segmentation allows both timely instrumentation and precise monitoring of bootstrap class fields without requiring direct modification of bootstrap classes.
Data Source
AI summary
A method to instrument program code for a virtual machine that comprises, in the course of loading a class to a virtual machine, adding code to the class to declare a field that corresponds to a field declared in a first bootstrap class.


