Improving HotSwap Is A Dead End Road
[ jonas ] 17:32, Tuesday, 1 November 2005

There has been a lot of discussions about the need for more dynamicity in Java, including the need to support scripting languages.

Most are around the suggestion of improving the HotSwap facility in Java.

For exampe:

* How badly do you want Hotswap to improve?

* PLEASE VOTE: the only JVM bug you'll ever really care about

* Gaining traction: HotSwap improvements,

etc.

I have to admit that a year ago I was probably one of the guys that were swearing the most over HotSwap's (and JVM(D/T)I's shortcomings when trying to stretch its (limited) boundries in AspectWerkz.

However, today I think that improving HotSwap and the APIs for bytecode instrumentation in general is a dead end road. It simply adds complexiety, memory overhead, performance overhead as well as introduces the multiple agents problem.

We need to raise the abstraction level and move away from bytecode instrumentation. There is a need for high level VM APIs similar to the one we have been working on in JRockit. For details on the problems with current approaches and how we solve this in a better way, read this article.

So, PLEASE, stop wasting time in discussing how to improve bytecode instrumentation (e.g. HotSwap, JVMTI etc.) and give us feedback on how to improve the high-level VM API in JRockit (the prototype is already available).

When on the subject on supporting scripting languages in Java is think that this proposal for adding a invokedynamic bytecode instruction is a step in the right direction.

TrackBack
Comments

I agree that it does not make any sence to use HotSwap for dynamic bytecode instrumentation. However it still would come handy for changing code when debugging. Current HotSwap implementation can survive very limited subset of changes that one could introduce into the class.

--eu, November 1, 2005 10:16 PM

The requests for Hotswap improvements are about speeding up development, not about bytecode instrumentation. For example, when I'm debugging a web application in my IDE, I want to be able to change a class and have all of it's instances updated, too, without my having to restart the server (which can take minutes in some applications). If I make an incompatible change, I want the JVM to do it's best to update existing instances. It doesn't have to be perfect as it's development time-only.

--Bob Lee, November 1, 2005 10:24 PM

Debugging is not only (potential) use-case for HotSwap since it is now part of JVMTI (redefineClass(..) does not require -Xdebug). When Java 5 is becoming more and more popular I think that the usage of Java Agents will raise and some agents (vendors) will for sure use redefineClass().

I understand that people want this badly, I am just worried that it will generate more problems than it solves and I think that we are heading down the wrong direction in JVMTI (in which there are parts that I think should be deprecated).

As soon as there are more than one single active agent then correctness and behavior of the application can not be garantueed. You might have more than one agent in development situations as well...

Besides, I do not see why patching code at runtime could not be done at a higher level than in the bytecode layer...(even when doing debugging). It has to de defined though.

--Jonas, November 2, 2005 08:06 AM

Hi Jonas,

you make a valid point about the multiple agents, but I don't see how JRockit's native AOP support would make Java development more interactive during development. I rarely use AOP, I just want the running JVM to use newly compiled classes without having to restart it. I also don't want to setup anything for this, I just want to press a 'hotswap' button and check the new version. Do you have a solution that would allow this without JVMTI redefineClass()?

Maybe a solution for the multiple agents problem can be found, without throwing away hotswap?

--Geert Bevin, November 2, 2005 10:07 AM

I am not saying that the end user should have to care at all which impl technique is used. You should just have to press 'debug' and then change the classes as you want. (And don't get me wrong, I want the same feature myself).

I just want drive the discussions away from bytecode munging (and that is what the debug agents are doing) to a more high-level, predictable, well-defined and performant API.

The work we have done in JRockit tries to have a wider scope than just AOP. We basically want to define an API rich enough for the user to not have to do bytecode manipulation (at least cover in 95% of the use-cases).

There has been a lot of discussions on the JVMTI expert group on how to take the spec further, and it seems that it in some ways is heading down a dead end road.

--Jonas Bonér , November 2, 2005 10:23 AM

Jonas,

I look at it from a development point of view. I am totally with Geert, no setups of anything. Why is the JVMTI road a dead end? And why isn't yours?

--dennis bekkering, November 10, 2005 02:39 AM
Post a comment









Remember personal info?