> -----Original Message----- > From: Jason Merrill [mailto:ja...@redhat.com] > Sent: Wednesday, November 27, 2013 12:43 PM > To: Iyer, Balaji V; gcc-patches@gcc.gnu.org > Cc: Jeff Law > Subject: Re: _Cilk_spawn and _Cilk_sync for C++ > > On 11/25/2013 10:50 AM, Iyer, Balaji V wrote: > > I have fixed this issue. My function to map the variable's context from the > spawner to the spawn helper function was going into the lambda function. I > made it stop by adding a language specific copy_tree_body (basically stop > going into the lambda function's body for C++ and for the rest of the times > just use copy_tree_body_r, no code duplicating is done between the two) > that and it works fine now. > > I doubt it was walking from the enclosing function into the body of the > lambda function. Looking at the patch, it seems that what you're avoiding is > walking into the closure object itself, and adding an entire new langhook > seems like overkill for that. > > I think a better approach would be to add a cp_build_cilk_spawn that uses > stabilize_call to pre-evaluate the arguments of the call.
I really can't pre-evaluate the calls before I move into the nested function because all those parts must be in the nested function. Adding another hook seem to be straightforward for me. One advantage I can think of having a separate node for that when new features get added in, we have a place to separately evaluate them and copy them as necessary. If it is not too much of a hazzle, I would like to keep them. I don't add anything more in the structure, just 1 more for _Cilk_for. Or, another thing I could do is to pass a function pointer and pass the copy_tree_body function into it. Is that acceptable by you? > > Jason