• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Export Word
    • Attachments
    • Page Information

    Loading...
  1. Dashboard
  2. Multi-Language VM
  3. Main
  4. SubProjects
  5. HotSwap

HotSwap

  • Created by John Rose, last modified by Thomas Wuerthinger on Jan 06, 2011

The project website including binaries for download and a bugtracking system can be found at http://ssw.jku.at/dcevm/.

The class data structures of the Java HotSpot virtual machine are immutable during the execution of a program. While new classes can be loaded, it is not possible to change existing classes (e.g. add/remove methods or fields). This projects tries to relax this condition to allow arbitrary changes to existing Java classes (including changes to the class hierarchy) while running a Java program.

Prototype

Work in progress.

Latest patch update: December 17, 2010
Patch base: jdk7-b118
Full patch (advanced version): hotswap.patch
Patch with VM modifications only and limited feature set: hotswaplight.patch
Please send any comments or questions to: wuerthinger@ssw.jku.at

Implementation Notes

Initial implementation description (April 1, 2009): Thomas Wuerthinger, Dynamic Code Evolution for the Java HotSpotVirtual Machine
For more recent information, see the list of publications.

General Design Decisions

  • Arbitrary changes possible (including changes to subtype relationships)
  • No performance penalty before or after the change
  • No introduced indirections
  • Continued execution of old active methods
  • Only simple, comprehensible strategies for field matching or method transitions
  • Change possible at any point when the VM is suspended
  • Graceful handling of accesses to deleted fields or calls of deleted methods

Status

Type of Change

Supported?

Possible problems after resume

Swap Method Body

yes

 

Add Method

yes

 

Remove Method

yes

NoSuchMethodError / none in advanced version

Add Field

yes

 

Remove Field

yes

NoSuchFieldError / none for static fields in advanced version

Add Supertype

yes

 

Remove Supertype

no / yes in advanced version

none, but not always guaranteed to be possible

Transformer Methods

Classes can implement a method "void $transformer()".
This method is called on every object whose class was redefined and can therefore be used to initialize the new instances of a class.
Additionally, it is possible to implement a static method "void $staticTransformer()" that will be called on the class only.
Example code:

Initial version
class A {
  int x;
}
New version
class A' {
  int x;
  int doubleX;

  static void $staticTransformer() {
    System.out.println("Class A has a new version");
  }

  void $transformer() {
    doubleX = 2 * x;
  }
}

Future Work

  • NetBeans support for advanced features such as transformer methods and method forwarding.
Overview
Content Tools
ThemeBuilder
  • No labels
© 2025 Oracle Corporation and/or its affiliates
Terms of Use
• License: GPLv2
• Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Kolekti ThemeBuilder Powered by Atlassian Confluence 8.5.21
  • Kolekti ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Kolekti ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 176, "requestCorrelationId": "79eacced784c7373"}