That comment is from the original version of the file committed in 2009.
None of the original members from that time are still on the project. So
here's an educated guess.

As John Tamplin said, repeated string concatenation will make some part of
the AST tree particularly deep and since our visitor passes (which we use
for optimization and java->javascript semantic transformation) work by
walking the AST tree with recursive function calls. Getting to the tip of
that long string concatenation  chain will require a lot of recursion, and
it might be enough to run out of stack space.

Most JVMs will run out of stack space after about 1000 recursions. I
believe each AST node traversal costs us 2-3 function calls of stack depth
(some combination of accept(), traverse() and visit()) and each extra
concatenation is 2 AST nodes (1 for the "+" and one for the "string") so
somewhere around 166-250 consecutive string concatenations will be enough
to overflow the stack.

So yes, it's probably still a good idea for your generator to go out of
it's way to limit consecutive string concatenations in its output.



On Thu, Oct 31, 2013 at 1:59 AM, Julien Dramaix <julien.dram...@gmail.com>wrote:

> Yep sorry it is in CssResourceGenerator line 266
> And there is a TODO at line 347 : TODO: Fix the compiler to better handle
> arbitrarily long concatenation expressions.
>
> So I was just wondering if something was done or not.
>
>
> On Wednesday, October 30, 2013 9:23:02 PM UTC+1, John Stalcup wrote:
>
>> oh you mean in CssResourceGenerator.java
>>
>> found it, taking a look
>>
>>
>> On Wed, Oct 30, 2013 at 1:22 PM, John Stalcup <sta...@google.com> wrote:
>>
>>> can you link me to that comment? i'm unfamiliar.
>>>
>>>
>>> On Wed, Oct 30, 2013 at 1:10 PM, Julien Dramaix <julien....@gmail.com>wrote:
>>>
>>>> Dear GWT lovers,
>>>>
>>>> I have a question for the compiler guys : in the CssResource I see a
>>>> comment mentioning that very large string concatenation expressions using
>>>> '+' cause the GWT compiler to overflow the stack due to deep AST nesting.
>>>> So it's preferable to use intermediate concatenation groupings in order to
>>>> force the AST to be more balanced.
>>>>
>>>> I'm just wondering if this issue is still present with the actual
>>>> version of the compiler or if it was fixed to better handle large
>>>> concatenation ?
>>>>
>>>> Thanks,
>>>>
>>>> Julien
>>>>
>>>> --
>>>> http://groups.google.com/**group/Google-Web-Toolkit-**Contributors<http://groups.google.com/group/Google-Web-Toolkit-Contributors>
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "GWT Contributors" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to google-web-toolkit-**contributors+unsubscribe@**
>>>> googlegroups.com.
>>>> For more options, visit 
>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>>> .
>>>>
>>>
>>>
>>  --
> http://groups.google.com/group/Google-Web-Toolkit-Contributors
> ---
> You received this message because you are subscribed to the Google Groups
> "GWT Contributors" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to