java - Bytecode changes over time in undocumented manner -


today exploring classes of huge applications (like jboss server apps) javaagent , instrumentation on openjdk 7. called retransform on classes every 10 seconds, bytecode got in classfiletransformer implementation.

my implementation keeps track of how bytecode of classes changes on time. first of all, surprised, order of fields , methods, method access modifiers, contents of constant pool , other such things vary 1 check other. but, still, documented.

what not documented - items may created in class'es constant pool , injected methods. noticed happen numeric values (longs, doubles, floats , such).

this how looks in javap; before:

pool: ... #17 float nanf method: #1 fload #17 //nanf ... 

after changed class during runtime:

pool: ... #17 float nanf #18 float nanf method: #1 fload #18 //nanf <- look, loads #18 

i double checked, no other transformers or agents attached.

why can't jvm leave bytecode same? can read such optimisations/transformations (or else it)? read jvm sources, these confused me more.

i'm trying create kind of realtime bytecode verificator - security tool.

what not documented - items may created in class'es constant pool , injected methods.

well, article have linked says:

the constant pool may have more or fewer entries. constant pool entries may in different order; however, constant pool indices in bytecodes of methods correspond.

so is documented. reason is not useful remember each classes’ bytecode repeating constant pool entries same on lots of classes. jvms typically have internal format differs ordinary class files , generate class file once needed, e.g. when calling transformer.


Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -