Le 13 oct. 08 à 02:08, Rémi Forax a écrit :

>
> Eugene Kuleshov a écrit :
>>  The structure and content of StackMapTable attribute is described in
>> the updated class fail format section of JVM specification. Though I
>> don't think it is published anywhere and Sun's page only has  
>> reference
>> to it. 
>> http://java.sun.com/docs/books/jvms/second_edition/jvms-proposed-changes.html
>>  So, I put a copy to Google docs at
>> http://docs.google.com/fileview?id=F.a3678bb5-b6d0-4b6b-89e6-980238426f13
>>
> Changes are under the umbrella of JSR202:
> http://jcp.org/aboutJava/communityprocess/final/jsr202/index.html
>
> You can download an updated version of  chapter 6 (class file format)
> from that page.

This is indeed the document I used to implement stack maps for my  
[dis]assembler.
To make things precise, I have no problem reading or writing stack maps.
My problem is to know at which offsets stack maps should be generated.
I mean, generating the information for each code offset would result in
a StackMapTable attribute as big as the bytecode !
Experiments with javac seem to indicate that the offsets of interest  
are those
at the possible destination of a jump (by IFxxx, GOTO, JSR, or  
exception catch).
I wondered if a document indicate these offsets of interest.

I understand that the document describing the class file is focused on  
the
format and its semantics. But regarding stack maps, it is not  
sufficient to know
how to generate correct maps, it is necessary to know how to generate  
useful
(and even "minimally" useful ones). Section 4.11 talks about basic  
blocks to
specify these offsets but I cannot find the definition for basic  
blocks (I just can
infer one).


>>  Bytecode frameworks, such as ASM [1] allow to recalculate stackmap
>> content from scratch, as well as create it incrementally.
>>
>>  Also, in bytecode version 50, you can omit stack map and verifier
>> will fall back to the old algorithm, unless you'll specify JVM  
>> options
>> -Xverify:all -XX:-FailOverToOldVerifier

Thanks, this is precisely the switches I was looking for.
I just forgot the existence of "XX" switches.

With these switches, the verifier rejects invalid stack maps and also  
complains
of missing stack maps with messages like the following one:
        Exception in thread "main" java.lang.VerifyError: Expecting a stackmap
        frame at branch target 9 in method pack.Test.f(ZIF)I at offset 1
Hence allowing to check both that maps are correct and that no one is  
missing.



Kind regards,

Xavier
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to jvm-languages@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to