Re: _Cilk_spawn and _Cilk_sync for C++

2013-12-12 Thread Andreas Schwab
"Iyer, Balaji V" writes: > diff --git a/gcc/testsuite/g++.dg/cilk-plus/cilk-plus.exp > b/gcc/testsuite/g++.dg/cilk-plus/cilk-plus.exp > index 707d17e..36c8111 100644 > --- a/gcc/testsuite/g++.dg/cilk-plus/cilk-plus.exp > +++ b/gcc/testsuite/g++.dg/cilk-plus/cilk-plus.exp > @@ -22,6 +22,14 @@ if

Re: _Cilk_spawn and _Cilk_sync for C++

2013-12-11 Thread Jason Merrill
On 12/10/2013 06:03 PM, Iyer, Balaji V wrote: Fixed patch and ChangeLog entries are attached. Is it Ok to install? OK. Jason

Re: _Cilk_spawn and _Cilk_sync for C++

2013-12-09 Thread Jason Merrill
On 12/05/2013 11:38 PM, Iyer, Balaji V wrote: used the init_p value that comes out of stabilize_expr I guess you didn't look at the patch I sent you... Since you've fixed extract_free_variables, you don't need call_to_lambda_fn_p at all, or to call stabilize_expr. Why do you need to move a

RE: _Cilk_spawn and _Cilk_sync for C++

2013-12-05 Thread Iyer, Balaji V
> -Original Message- > From: Jason Merrill [mailto:ja...@redhat.com] > Sent: Thursday, December 5, 2013 4:00 PM > To: Iyer, Balaji V; gcc-patches@gcc.gnu.org > Cc: Jeff Law > Subject: Re: _Cilk_spawn and _Cilk_sync for C++ > > On 12/04/2013 02:45

Re: _Cilk_spawn and _Cilk_sync for C++

2013-12-05 Thread Jason Merrill
On 12/04/2013 02:45 PM, Jason Merrill wrote: + error_at (input_location, "_Cilk_sync cannot be used without enabling" + "Cilk Plus"); + cp_lexer_consume_token (parser->lexer); + if (parser->in_statement & IN_CILK_SPAWN) + parser->in_statement = parser->in_sta

Re: _Cilk_spawn and _Cilk_sync for C++

2013-12-04 Thread Jason Merrill
On 12/04/2013 05:42 PM, Iyer, Balaji V wrote: I had in mind that the declaration would be in c-common.h, but each front end would have a different definition in the front end directory, kind of like how all front ends need to define "convert". I didn't know it was an OK thing to do. I think i

RE: _Cilk_spawn and _Cilk_sync for C++

2013-12-04 Thread Iyer, Balaji V
> -Original Message- > From: Jason Merrill [mailto:ja...@redhat.com] > Sent: Wednesday, December 4, 2013 5:39 PM > To: Iyer, Balaji V; gcc-patches@gcc.gnu.org > Cc: Jeff Law > Subject: Re: _Cilk_spawn and _Cilk_sync for C++ > > On 12/03/2013 07:08 PM, Iyer

Re: _Cilk_spawn and _Cilk_sync for C++

2013-12-04 Thread Jason Merrill
On 12/03/2013 07:08 PM, Iyer, Balaji V wrote: In install_body_with_frame_cleanup for C++, I am using trees such as TRY_CATCH_EXPR and am using a function from the cp/except.c. I didn't know how to bring them to c-family. I had in mind that the declaration would be in c-common.h, but each fro

Re: _Cilk_spawn and _Cilk_sync for C++

2013-12-04 Thread Jason Merrill
On 12/03/2013 02:48 PM, Iyer, Balaji V wrote: Now, after all that I must admit that cilk_spawn could only ever see VEC_INIT_EXPR in the context of a lambda closure initialization, and the default behavior should always be correct for a lambda closure initialization, so I guess I'm willing to allo

Re: _Cilk_spawn and _Cilk_sync for C++

2013-12-03 Thread Jason Merrill
On 12/03/2013 10:22 AM, Iyer, Balaji V wrote: Please remove these langhooks and instead add handling of CILK_SPAWN_STMT to c_gimplify_expr and cp_gimplify_expr. I really cannot do this because if the spawned function returns a value, the whole expression must be pushed into the spawn

RE: _Cilk_spawn and _Cilk_sync for C++

2013-12-03 Thread Iyer, Balaji V
> > > case CILK_SPAWN_STMT: > > gcc_assert > > (fn_contains_cilk_spawn_p (cfun) > > && lang_hooks.cilkplus.cilk_detect_spawn_and_unwrap (expr_p)); > > if (!seen_error ()) > > { > > ret = (enum gimplify_status) > >

Re: _Cilk_spawn and _Cilk_sync for C++

2013-12-02 Thread Jason Merrill
On 11/28/2013 11:40 AM, Iyer, Balaji V wrote: Consider the following test case. I took this from the lambda_spawns.cc line #203. as you can tell, it is clobbering the lambda closure at the end of the lambda calling and then it is catching value of A from main2 as it is supposed to. Yep, your

RE: _Cilk_spawn and _Cilk_sync for C++

2013-11-28 Thread Iyer, Balaji V
> -Original Message- > From: Jason Merrill [mailto:ja...@redhat.com] > Sent: Thursday, November 28, 2013 9:11 AM > To: Iyer, Balaji V; gcc-patches@gcc.gnu.org > Cc: Jeff Law > Subject: Re: _Cilk_spawn and _Cilk_sync for C++ > > On 11/27/2013 11:05 PM, Iyer, Balaj

RE: _Cilk_spawn and _Cilk_sync for C++

2013-11-28 Thread Iyer, Balaji V
> -Original Message- > From: Jason Merrill [mailto:ja...@redhat.com] > Sent: Thursday, November 28, 2013 9:11 AM > To: Iyer, Balaji V; gcc-patches@gcc.gnu.org > Cc: Jeff Law > Subject: Re: _Cilk_spawn and _Cilk_sync for C++ > > On 11/27/2013 11:05 PM, Iyer, Balaj

Re: _Cilk_spawn and _Cilk_sync for C++

2013-11-28 Thread Jason Merrill
On 11/27/2013 11:05 PM, Iyer, Balaji V wrote: Found the bug. I was not utilizing the stabilize_expr's output correctly. Unfortunately, I think I was misleading you with talk of stabilize; like you said, you want to evaluate the whole expression in the spawned function rather than in the calle

RE: _Cilk_spawn and _Cilk_sync for C++

2013-11-27 Thread Iyer, Balaji V
> -Original Message- > From: Jason Merrill [mailto:ja...@redhat.com] > Sent: Wednesday, November 27, 2013 8:24 PM > To: Iyer, Balaji V; gcc-patches@gcc.gnu.org > Cc: Jeff Law > Subject: Re: _Cilk_spawn and _Cilk_sync for C++ > > On 11/27/2013 05:59 PM, Iyer, Bala

Re: _Cilk_spawn and _Cilk_sync for C++

2013-11-27 Thread Jason Merrill
On 11/27/2013 05:59 PM, Iyer, Balaji V wrote: Well, if I use copy_tree_body_r for C and C++, in lambda functions, it asserts in varasm.c. The main reason I see that, the copy_tree_body_r walks into the closure and then maps the variables from the lambda function from the spawner to the helper

Re: _Cilk_spawn and _Cilk_sync for C++

2013-11-27 Thread Jason Merrill
On 11/27/2013 01:25 PM, Iyer, Balaji V wrote: 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

RE: _Cilk_spawn and _Cilk_sync for C++

2013-11-27 Thread Iyer, Balaji V
> -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, Ba

Re: _Cilk_spawn and _Cilk_sync for C++

2013-11-27 Thread Jason Merrill
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

RE: _Cilk_spawn and _Cilk_sync for C++

2013-11-25 Thread Iyer, Balaji V
Hi Jason, Please see my responses below > -Original Message- > From: Jason Merrill [mailto:ja...@redhat.com] > Sent: Friday, November 22, 2013 10:51 AM > To: Iyer, Balaji V; gcc-patches@gcc.gnu.org > Cc: Jeff Law > Subject: Re: _Cilk_spawn and _Cilk_sync for C++ >

Re: _Cilk_spawn and _Cilk_sync for C++

2013-11-22 Thread Jason Merrill
On 11/21/2013 05:40 PM, Iyer, Balaji V wrote: +/* Returns a TRY_CATCH_EXPR that will encapsulate BODY, EXCEPT_DATA and + EXCEPT_FLAG. */ + +tree +create_cilk_try_catch (tree except_flag, tree except_data, tree body) +{ + tree catch_list = alloc_stmt_list (); + append_to_statement_list (excep

RE: _Cilk_spawn and _Cilk_sync for C++

2013-11-21 Thread Iyer, Balaji V
gcc-patches@gcc.gnu.org > Cc: Jeff Law > Subject: Re: _Cilk_spawn and _Cilk_sync for C++ > > On 11/17/2013 10:19 PM, Iyer, Balaji V wrote: > >cp/cp-cilkplus.o \ > > - cp/cp-gimplify.o cp/cp-array-notation.o cp/lambda.o \ > > + cp/cp-gimplify.o cp/cp-array-notation.

Re: _Cilk_spawn and _Cilk_sync for C++

2013-11-21 Thread Jason Merrill
On 11/17/2013 10:19 PM, Iyer, Balaji V wrote: cp/cp-cilkplus.o \ - cp/cp-gimplify.o cp/cp-array-notation.o cp/lambda.o \ + cp/cp-gimplify.o cp/cp-array-notation.o cp/lambda.o cp/cp-cilk.o \ It seems unnecessary to have both cp-cilk.c and cp-cilkplus.c. Please combine them. + extern tre