Inconsistence in calculated stack map info
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I have a question about calculated frames information. It seems to be an issue,
but I didn't file a bug yet to discuss it here at first.
Consider the following sample:
Object [] arr = new String[5];
try {
arr[0] = new Object();
} catch (ArrayStoreException e) {
}
The question is how this array local variable should be referenced in
StackMapTable?
My understanding is that it should be "[Ljava/lang/Object;". If we compile the
sample with Java 6 we get exactly as expected (javap output):
LocalVariableTable:
Start Length Slot Name Signature
0 20 0 this Ltest/TestObject;
5 15 1 arr [Ljava/lang/Object;
StackMapTable: number_of_entries = 2
frame_type = 255 /* full_frame */
offset_delta = 18
locals = [ class test/TestObject, class "[Ljava/lang/Object;" ]
stack = [ class java/lang/ArrayStoreException ]
frame_type = 0 /* same */
However if we use asm ClassWriter with COMPUTE_FRAMES option to convert this
sample, we get the following: LocalVariableTable:
Start Length Slot Name Signature
0 20 0 this Ltest/TestObject;
5 15 1 arr [Ljava/lang/Object;
StackMapTable: number_of_entries = 2
frame_type = 255 /* full_frame */
offset_delta = 18
locals = [ class test/TestObject, class "[Ljava/lang/String;" ]
stack = [ class java/lang/ArrayStoreException ]
frame_type = 0 /* same */
The corresponding local type is "[Ljava/lang/String;" here.
Moreover, if we use AnalyzerAdapter to check the stackmap info, the result will
be the same - array type is "Ljava/lang/String;", not "Ljava/lang/Object;".
I'm not quite sure whether this behavior is expected or nor.
But it's an issue for us because we can't get the declared local type for this
array during instrumentation. Is it possible to do something here with asm? I
understand that it's not so easy to resolve this inconsistency, but it would be
great to have this issue fixed.
Thanks,
Alexander
message-footer.txt
(text/plain, 238 B)
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws