Bug 247292

Summary: [compiler] Compiler should avoid allocating method bindings for receiver type change
Product: [Eclipse Project] JDT Reporter: Philipe Mulet <philippe_mulet>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3 Keywords: performance
Version: 3.5   
Target Milestone: 3.5 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed patch for 3.5
none
Better patch
none
Better patch /2
none
Better patch /3
none
Better patch /4
none
Additional patch for (2) none

Description Philipe Mulet CLA 2008-09-15 09:55:02 EDT
Build 3.5.M1

This issue has existed since day 1. The code generation relies on a method binding to tell its constant pool declaring class. This forces the compiler to instantiate a new binding each time the receiver type must be used instead of the target method declaring class.

1. This could be achieved by passing an extra argument to codeStream.invoke*(..) indicating the constantPool declaring class to use.

2. In the longer run, #codegenBinding slots may be discarded.

3. Same optimization could be applied to field bindings
Comment 1 Philipe Mulet CLA 2008-09-15 09:57:27 EDT
Created attachment 112545 [details]
Proposed patch for 3.5

it also contains fix for bug 128563
Comment 2 Philipe Mulet CLA 2008-09-15 10:00:37 EDT
Patch only covers (1)
Comment 3 Philipe Mulet CLA 2008-09-15 13:26:59 EDT
Created attachment 112568 [details]
Better patch
Comment 4 Philipe Mulet CLA 2008-09-15 17:19:31 EDT
Created attachment 112600 [details]
Better patch /2
Comment 5 Philipe Mulet CLA 2008-09-16 09:08:44 EDT
Created attachment 112663 [details]
Better patch /3

also removed ForeachStatement need for iterator() method binding creation
Comment 6 Philipe Mulet CLA 2008-09-16 18:04:35 EDT
Created attachment 112713 [details]
Better patch /4
Comment 7 Philipe Mulet CLA 2008-09-17 04:59:44 EDT
Forked (3) in separate bug 247612
Comment 8 Philipe Mulet CLA 2008-09-17 07:11:49 EDT
Created attachment 112752 [details]
Additional patch for (2)
Comment 9 Philipe Mulet CLA 2008-09-17 07:12:24 EDT
Released for 3.5M3.
Fixed
Comment 10 Philipe Mulet CLA 2008-09-26 06:40:35 EDT
Note to verifiers: it will be hard to assess this bug, since it is a rewrite of an existing functionality. Need to check source code, for the absence of SourceTypeBinding.getUpdateMethodBinding(...) to check we are no longer constructing these bindings.

Numbers from a performance run should also demonstrate the win.
Comment 11 Kent Johnson CLA 2008-10-28 13:06:28 EDT
Verified for 3.5M3 using I20081026-2000 build.