Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 412453 - [1.8][compiler] Stackoverflow when compiling LazySeq
Summary: [1.8][compiler] Stackoverflow when compiling LazySeq
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.4   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: BETA J8   Edit
Assignee: Manoj N Palat CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-06 16:52 EDT by Robin Rosenberg CLA
Modified: 2013-07-18 00:20 EDT (History)
2 users (show)

See Also:
srikanth_sankaran: review+


Attachments
Small Test case reproducing the problem (428 bytes, text/plain)
2013-07-09 05:36 EDT, Manoj N Palat CLA
no flags Details
Proposed Patch (3.30 KB, patch)
2013-07-10 04:50 EDT, Manoj N Palat CLA
no flags Details | Diff
Proposed Patch (3.25 KB, patch)
2013-07-16 12:45 EDT, Manoj N Palat CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Rosenberg CLA 2013-07-06 16:52:46 EDT
Get git://git.eclipse.org/gitroot/jdt/eclipse.jdt.core.git BETA_JAVA8 and
git://git.eclipse.org/gitroot/jdt/eclipse.jdt.ui.git master into Eclipse

Open new workspace
Clone https://github.com/nurkiewicz/LazySeq. I used the CLI as I did not
have then maven plugin at this time.

run mvn eclipse:eclipse compile (with the Java 8 EA)
Create the library M2_REPO, point to ~/.m2/repository

Here is the tail of the stack trace

	at org.eclipse.jdt.internal.compiler.lookup.TypeBindingVisitor.visit(TypeBindingVisitor.java:140)
	at org.eclipse.jdt.internal.compiler.lookup.TypeBindingVisitor.visit(TypeBindingVisitor.java:85)
	at org.eclipse.jdt.internal.compiler.lookup.TypeBindingVisitor.visit(TypeBindingVisitor.java:75)
	at org.eclipse.jdt.internal.compiler.lookup.TypeBindingVisitor.visit(TypeBindingVisitor.java:100)
	at org.eclipse.jdt.internal.compiler.lookup.TypeBindingVisitor.visit(TypeBindingVisitor.java:140)
	at org.eclipse.jdt.internal.compiler.lookup.TypeBindingVisitor.visit(TypeBindingVisitor.java:85)
	at org.eclipse.jdt.internal.compiler.lookup.TypeBindingVisitor.visit(TypeBindingVisitor.java:75)
	at org.eclipse.jdt.internal.compiler.lookup.TypeBindingVisitor.visit(TypeBindingVisitor.java:100)
	at org.eclipse.jdt.internal.compiler.lookup.TypeBindingVisitor.visit(TypeBindingVisitor.java:140)
	at org.eclipse.jdt.internal.compiler.lookup.TypeBindingVisitor.visit(TypeBindingVisitor.java:85)
Comment 1 Srikanth Sankaran CLA 2013-07-08 01:27:21 EDT
Manoj, please extract a small test case please. TIA.
Comment 2 Manoj N Palat CLA 2013-07-09 05:36:43 EDT
Created attachment 233265 [details]
Small Test case reproducing the problem
Comment 3 Srikanth Sankaran CLA 2013-07-09 06:55:18 EDT
See Stephan's comment in https://bugs.eclipse.org/bugs/show_bug.cgi?id=378674#c19
Comment 4 Manoj N Palat CLA 2013-07-10 04:50:08 EDT
Created attachment 233308 [details]
Proposed Patch

This solves the stack overflow issue mentioned in the bug; however, there is another build issue that comes while compiling the project which is tracked as bug  412650
Comment 5 Srikanth Sankaran CLA 2013-07-16 04:35:39 EDT
(In reply to comment #4)
> Created attachment 233308 [details]
> Proposed Patch
> 
> This solves the stack overflow issue mentioned in the bug; however, there is
> another build issue that comes while compiling the project which is tracked
> as bug  412650

Patch looks good. I would make one change though. Instead of adding the boolean
visited as a field of TypeBinding, we could associate with the TypeBindingVisitor some data structure that tracks visited objects. That would (a) minimize the 
memory pressure (b) eliminate the need to clear the visited flag as done in
the present patch. Please make this change and release. Thanks.
Comment 6 Manoj N Palat CLA 2013-07-16 12:45:48 EDT
Created attachment 233529 [details]
Proposed Patch

Modified as per the review comment.
Comment 8 Stephan Herrmann CLA 2013-07-17 15:35:20 EDT
It's a pity my work in branch sherrmann/NewTypeInference is getting stale.
As mentioned in the linked bug 378674 comment 19 I got away with a flag in only
TypeVariableBinding and WildcardBinding. Even folding this into tagBits should
be possible. Just mentioning that I still believe the SimpleSet is avoidable here.
May not be a big issue, though :)
Comment 9 Manoj N Palat CLA 2013-07-18 00:20:46 EDT
(In reply to comment #8)
>Even folding this into tagBits should
> be possible. Just mentioning that I still believe the SimpleSet is avoidable
> here.
> May not be a big issue, though :)

Srikanth did discuss this as an alternative and we had noted that we would have to clear the flag (as was done in the earlier patch) while a set based structure would be tied to TypeBindingVisitor rather than the type and gets initialized for every TypeBindingVisitor. If it helps in anyway, we can move to the tagbits solution as well.