Bug 109980 - [plan] Add support for StackMapTable attribute as per jsr-202
Summary: [plan] Add support for StackMapTable attribute as per jsr-202
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-20 05:59 EDT by Jerome Lanneluc CLA
Modified: 2006-02-15 08:25 EST (History)
4 users (show)

See Also:


Attachments
Patch to apply on HEAD (59.08 KB, application/octet-stream)
2005-12-13 11:30 EST, Olivier Thomann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jerome Lanneluc CLA 2005-09-20 05:59:11 EDT
I20050920

JSR-202 (http://jcp.org/en/jsr/detail?id=202) defines a StackMap attribute. This
new attribute should be supported at the JDT Core level.
Comment 1 Eugene Kuleshov CLA 2005-11-24 13:40:07 EST
It doesn't seem it is going to happend for 3.2M4. Any idea when?
Comment 2 Olivier Thomann CLA 2005-11-24 13:52:12 EST
I don't know if the code will be ready for M4. I am working on it, but it is more complicated than I thought initially.
If the work can be completed in time for M4, it will be released for M4.
Comment 3 Eugene Kuleshov CLA 2005-11-24 14:07:45 EST
Thanks Olivier. 

If it would help there is implementation of the StackMapTable attribure in ASM bytecode framework (BSD-like license). See http://cvs.forge.objectweb.org/cgi-bin/viewcvs.cgi/asm/asm/src/org/objectweb/asm/attrs/
Comment 4 Olivier Thomann CLA 2005-11-24 14:28:32 EST
Ok, I'll put it back for M4 and I will reassess later. Thanks for the pointers.
Comment 5 Eugene Kuleshov CLA 2005-11-24 15:25:47 EST
Great! 

Just to clarify. In ASM 2.x stream we have support for reading and writing StackMapTable attribute but does not have service to recalculate frames. However such service is already implemented in ASM 3 beta stream (which is MUSTANT_SUPPORT branch there) and it passed regression test based on rt.jar from Java 6 snapshots.
Comment 6 Olivier Thomann CLA 2005-12-12 19:12:05 EST
Will be released after M4. I still have some performance issue. Right the generation of stack map table attributes takes about 4-5% of the compilation process. This is too much. We would like to reduce it to 2-3%.
Most of the time is spent on collecting the data needed to generate the stack map frames.
I can provide a patch based on M4, if someone wants to give it a try.
Comment 7 Eugene Kuleshov CLA 2005-12-13 11:03:54 EST
(In reply to comment #6)
> Will be released after M4. I still have some performance issue. Right the
> generation of stack map table attributes takes about 4-5% of the compilation
> process. This is too much. We would like to reduce it to 2-3%.
> Most of the time is spent on collecting the data needed to generate the stack
> map frames.
> I can provide a patch based on M4, if someone wants to give it a try.

Thanks Oliver. Please provide a patch if it is not a big trouble for you. 

Comment 8 Olivier Thomann CLA 2005-12-13 11:30:22 EST
Created attachment 31648 [details]
Patch to apply on HEAD

This patch needs to be applied on HEAD.
There are still some issues with it:
- handling of chaining gotos needs to be improved. Right now it creates stack map frames for positions that are unreachable. I doubt this will verify.
- performance work: We would like to reduce the impact of this attribute to 2-3% instead of 4-5%.
Comment 9 Eugene Kuleshov CLA 2005-12-13 13:50:38 EST
(In reply to comment #8)
> Created an attachment (id=31648) [edit]
> Patch to apply on HEAD
> 
> This patch needs to be applied on HEAD.
> There are still some issues with it:
> - handling of chaining gotos needs to be improved. Right now it creates stack
> map frames for positions that are unreachable. I doubt this will verify.
> - performance work: We would like to reduce the impact of this attribute to
> 2-3% instead of 4-5%.

Thanks Oliver. It would be good to have a tag or something that I could use to apply this patch (or have patch for M4 tag).

Actually it is rather good thing that stack maps are generated for nonreaceable code because VM verifier will reject classes without stack maps at the branches (e.g. position after GOTO opcode) and it does no do any DFA analysys nor branch merging but just iterate trough all instructions sequentially checking resetting stackmaps at the branching points and checking stack states incrementally for the following instructions. So, the verifier itself is completely linear and that is what makes it much more efficient and less memory sensitive.

Also see Eclipse bug about dead code at  https://bugs.eclipse.org/bugs/show_bug.cgi?id=114894
Comment 10 Olivier Thomann CLA 2005-12-14 10:33:26 EST
I'll post a new patch once M4 is declared and the patch could be applied on the M4 tag of the jdt.core project.
Comment 11 Olivier Thomann CLA 2005-12-14 10:35:09 EST
For now, the patch can be applied successfully on top of version v_630 which should be the final jdt/core contribution for M4.
Comment 12 Eugene Kuleshov CLA 2005-12-14 12:03:13 EST
Thanks Oliver.
Comment 13 Olivier Thomann CLA 2006-01-13 11:38:20 EST
Fixed and released in HEAD.
Regression tests are added in org.eclipse.jdt.core.tests.compiler.regression.StackMapAttributeTest.
This cannot be activated in the UI yet since there is no compliance 6.0 available in the compiler preference page.
However the batch compiler now supports -1.6 to enable the 1.6/6.0 mode.
Comment 14 Maxime Daniel CLA 2006-02-14 07:18:37 EST
Some of the tests fail with v_639 (three out of seven). May be a problem of setup on my machine.
Comment 15 Olivier Thomann CLA 2006-02-14 09:31:37 EST
I got the same three failures.
Something has changed since I executed them last time.
I'll check it.
Comment 16 Olivier Thomann CLA 2006-02-14 09:42:59 EST
Fixed and released.
Maxime, could you please double-check once a build with this fix is available?
Comment 17 Maxime Daniel CLA 2006-02-14 11:22:49 EST
Will do.
Comment 18 Maxime Daniel CLA 2006-02-15 08:25:39 EST
Verified for 3.2 M5 using v_640, aka build I20060215-0800.