Bug 400875 - [1.8][compiler] Code generation for lambda/reference expressions
Summary: [1.8][compiler] Code generation for lambda/reference expressions
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.3   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: BETA J8   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 405066 405067 405068 405069 405070 405071 405104 405889 406175 406178 406181 406319 406388 406392 406584 406586 406588 406589 406627 406641 406744 406760 406773 406847
Blocks: 380188
  Show dependency tree
 
Reported: 2013-02-14 22:49 EST by Srikanth Sankaran CLA
Modified: 2014-01-06 09:43 EST (History)
2 users (show)

See Also:


Attachments
Work in progress (24.36 KB, patch)
2013-03-28 13:45 EDT, Jesper Moller CLA
no flags Details | Diff
Improved work in progress (48.04 KB, patch)
2013-03-31 03:24 EDT, Jesper Moller CLA
no flags Details | Diff
Patch with functioning constructor references and generics (63.24 KB, patch)
2013-04-02 04:53 EDT, Jesper Moller CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Srikanth Sankaran CLA 2013-02-14 22:49:44 EST
This will be the master bug for this project.
Comment 1 Jesper Moller CLA 2013-03-28 13:45:06 EDT
Created attachment 229162 [details]
Work in progress

Working, but a bit rough:
 - ConstantPool sections for MethodHandles, MethodType, InvokeDynamic (but lacks caching)
  - Attribute section for BootStrapMethods
  - Adding of InnerClass reference for MethodHandles.Lookup
  - Implementation generateCode for ReferenceExpression
And it actually runs, as shown in the supplied test.

Yes, I know it lacks comment/disclaimer work.
Also lacks performance/polish in putting together InvokeDynamic constants from code generation.
Comment 2 Jesper Moller CLA 2013-03-31 03:24:41 EDT
Created attachment 229192 [details]
Improved work in progress

Should cover all cases of reference expressions, static/non-static, with/without receiver.
Comment 3 Jesper Moller CLA 2013-04-02 04:53:05 EDT
Created attachment 229224 [details]
Patch with functioning constructor references and generics

I'll leave this for now, as plumbing for lambda is needed anyway, and the design needs review.
Comment 4 Srikanth Sankaran CLA 2013-04-06 06:07:53 EDT
After being mystified and wasting quite a few hours tearing my hair out,
I learnt that javap does not show the lambda method bodies unless invoked
with -private. It truly looked like magic that things would work at all
without the lambda method bodies being there in the class file :)
Comment 5 Jesper Moller CLA 2013-04-06 07:08:49 EDT
(In reply to comment #4)
> After being mystified and wasting quite a few hours tearing my hair out,
> I learnt that javap does not show the lambda method bodies unless invoked
> with -private. It truly looked like magic that things would work at all
> without the lambda method bodies being there in the class file :)

Magic it is - I had to read up on invokedynamic a lot, too. You also need -v to get the BootStrapMethod attribute from javap.
Comment 6 Srikanth Sankaran CLA 2013-04-17 09:37:49 EDT
Please do not post patches here anymore. Let us use this as the umbrella
bug for tracking code generation project and to hold high level discussions.
Patches should be attached to individual leaf level bugs that are blockers
for the current bug.
Comment 7 Srikanth Sankaran CLA 2013-04-29 17:57:46 EDT
This is mostly cooked except for varargs and serialization support.
Jesper, if I prepare a cumulative patch, are you willing to review
and do some white box testing ? TIA,
Comment 8 Srikanth Sankaran CLA 2014-01-06 09:43:41 EST
This umbrella bug has served its purpose. Resolving even though a couple
of work items are still open - they are tracked on their own ticket.