We would need a considerably more complicated check that needs to ensure not only that no methods with the same name were added to the target class, but also to all it's superclasses. Here's the punchline: the moment we can add methods to classes this "simple check" is not enough. A simple check is inserted to ensure that the target object is indeed what we think it is. JREBEL REVIEW CODEMost of the method calls in your application hot spots are eliminated and the code is copied to the calling method. This enables the JIT to perform the main optimization that the JVM does - inlining. But consider this: the moment after a class has been loaded it is essentially is frozen forever. This would not likely require a relocation of the class structure as the method tables should be separate from the class structure. The JVM will also need to be suspended for the time of relocation, so doing GC at the same time makes sense.Īdding a method does not require updating the object structure, but it does require updating the class structure, which is also present on the heap. The actual layout of memory depends on the garbage collector that is currently active and, to be compatible with all of them, the relocation should probably be delegated to the active garbage collector. The problem is that the abstraction of one "heap" is just that, an abstraction. In itself this would not be hard to achieve - Java garbage collectors already relocate objects all the time. Now, since we're actually updating a class (and not just a single object) we would have to do this to every object of that class. JREBEL REVIEW FREEIn order to add a field, we would need to resize that structure, but since nearby regions may already be occupied, we would need to relocate the whole structure to a different region where there is enough free space to fit it in. JREBEL REVIEW PLUSWhen loaded into the JVM, an object is represented by a structure in memory, occupying a continuous region of memory with a specific size (its fields plus metadata). To understand why, we need to look a little closer as to what exactly is necessary to support adding methods and fields (and even more advanced, changing the inheritance hierarchy). These features make evolving the class schema a considerable challenge.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |