From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-relay-2.sys.kth.se (smtp-relay-2.sys.kth.se [IPv6:2001:6b0:1:1200:250:56ff:fead:963e]) by sourceware.org (Postfix) with ESMTPS id B2D3C385800A; Thu, 30 Dec 2021 08:14:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B2D3C385800A Received: from exdb4.ug.kth.se (exdb4.ug.kth.se [192.168.32.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp-relay-2.sys.kth.se (Postfix) with ESMTPS id 4JPgzP2nmWzNnkT; Thu, 30 Dec 2021 09:14:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp-relay-2.sys.kth.se 4JPgzP2nmWzNnkT Received: from exdb6.ug.kth.se (192.168.32.61) by exdb4.ug.kth.se (192.168.32.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Thu, 30 Dec 2021 09:14:24 +0100 Received: from exdb6.ug.kth.se ([192.168.32.61]) by exdb6.ug.kth.se ([192.168.32.61]) with mapi id 15.02.0986.014; Thu, 30 Dec 2021 09:14:24 +0100 From: Petter Tomner To: Antoni Boucher , David Malcolm , "jit@gcc.gnu.org" , "gcc-patches@gcc.gnu.org" Subject: SV: SV: [commited] jit: Support for global rvalue initialization and constructors Thread-Topic: SV: [commited] jit: Support for global rvalue initialization and constructors Thread-Index: AQHX8Q7ixdlNbnBpSk+COz6SqDTZPqwziq0AgABe4HuAFi9DgIAAL2MWgAABZwCAABENxA== Date: Thu, 30 Dec 2021 08:14:24 +0000 Message-ID: References: <8c135550d44f43b9b80c2a3a50939128@kth.se> ,<95b9504a2c0f8d255105a278b04a3dcb6cb5dc4e.camel@zoho.com> <54a63e2ec8954573939d4dcad7d3ae12@kth.se> , , <29d9c05526f72bcb53c55ef84f92e2bc9424c045.camel@zoho.com> In-Reply-To: <29d9c05526f72bcb53c55ef84f92e2bc9424c045.camel@zoho.com> Accept-Language: sv-SE, en-US Content-Language: sv-SE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.168.32.250] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: jit@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Jit mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Dec 2021 08:14:35 -0000 Oh ye no it is probably terrible missuse trying to write into the construct= or. =3D) Maybe I should look into barring that entrypoint for constructors. Kinda ov= erlooked that rvalue arrays could be used as lvalues. /Petter Fr=E5n: Antoni Boucher Skickat: den 30 december 2021 02:40 Till: Petter Tomner; David Malcolm; jit@gcc.gnu.org; gcc-patches@gcc.gnu.or= g =C4mne: Re: SV: [commited] jit: Support for global rvalue initialization an= d constructors =A0 =20 Oh, sorry, I meant when you have an array not in a local variable, and you try to assign to an index of this array. Something like: =A0=A0=A0 gcc_jit_rvalue *ctor =3D gcc_jit_context_new_array_constructor (ctxt,0,int50arr_type,6,values); =A0=A0=A0 gcc_jit_block_add_assignment (block, 0, gcc_jit_context_new_array_access(NULL, ctor, gcc_jit_context_zero(int_type)), some_value); Le jeudi 30 d=E9cembre 2021 =E0 01:16 +0000, Petter Tomner a =E9crit=A0: > Could you be more specific? I tried the equivalent of: >=20 > /*=A0=A0=A0 int [50] foobar =3D {1,2,3,4}; > =A0=A0=A0=A0=A0 int [50] foo() { int arr[50]; > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 arr = =3D (int [50]){-1,-2,-3,-4,-5,-6}; > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 arr = =3D foobar; > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 arr = =3D (int [50]){1,2,3,4,5,6}; > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 arr[6]= =3D 1234; > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return= arr;} >=20 > =A0=A0=A0=A0=A0=A0 N.B: Not a typo, returning an array. > */ >=20 > in test-local-init-rvalue.c with a global and local "arr" and it ran > fine. (See attachment). >=20 > Regards, Petter >=20 >=20 > Fr=E5n: Antoni Boucher > Skickat: den 29 december 2021 23:45 > Till: Petter Tomner; David Malcolm; jit@gcc.gnu.org; > gcc-patches@gcc.gnu.org > =C4mne: Re: [commited] jit: Support for global rvalue initialization > and constructors > =A0=A0=A0=20 > I realized that trying to do an assignment to an array created by the > new array constructor API will result in a "gimplification failed" > error: >=20 > libgccjit.so: error: gimplification failed > 0x7fa3a441e5d3 gimplify_expr(tree_node**, gimple**, gimple**, bool > (*)(tree_node*), int) > =A0=A0=A0=A0=A0=A0=A0 ../../../gcc/gcc/gimplify.c:15964 > 0x7fa3a442b1ab gimplify_modify_expr > =A0=A0=A0=A0=A0=A0=A0 ../../../gcc/gcc/gimplify.c:5975 > 0x7fa3a441ac4c gimplify_expr(tree_node**, gimple**, gimple**, bool > (*)(tree_node*), int) > =A0=A0=A0=A0=A0=A0=A0 ../../../gcc/gcc/gimplify.c:14951 > 0x7fa3a441e63c gimplify_stmt(tree_node**, gimple**) > =A0=A0=A0=A0=A0=A0=A0 ../../../gcc/gcc/gimplify.c:7026 > 0x7fa3a441bca3 gimplify_statement_list > =A0=A0=A0=A0=A0=A0=A0 ../../../gcc/gcc/gimplify.c:2014 > 0x7fa3a441bca3 gimplify_expr(tree_node**, gimple**, gimple**, bool > (*)(tree_node*), int) > =A0=A0=A0=A0=A0=A0=A0 ../../../gcc/gcc/gimplify.c:15396 > 0x7fa3a441e63c gimplify_stmt(tree_node**, gimple**) > =A0=A0=A0=A0=A0=A0=A0 ../../../gcc/gcc/gimplify.c:7026 > 0x7fa3a441f000 gimplify_bind_expr > =A0=A0=A0=A0=A0=A0=A0 ../../../gcc/gcc/gimplify.c:1427 > 0x7fa3a441adc6 gimplify_expr(tree_node**, gimple**, gimple**, bool > (*)(tree_node*), int) > =A0=A0=A0=A0=A0=A0=A0 ../../../gcc/gcc/gimplify.c:15152 > 0x7fa3a441e63c gimplify_stmt(tree_node**, gimple**) > =A0=A0=A0=A0=A0=A0=A0 ../../../gcc/gcc/gimplify.c:7026 > 0x7fa3a4420671 gimplify_body(tree_node*, bool) > =A0=A0=A0=A0=A0=A0=A0 ../../../gcc/gcc/gimplify.c:16197 > 0x7fa3a4420b3c gimplify_function_tree(tree_node*) > =A0=A0=A0=A0=A0=A0=A0 ../../../gcc/gcc/gimplify.c:16351 > 0x7fa3a419fe5e gcc::jit::playback::function::postprocess() > =A0=A0=A0=A0=A0=A0=A0 ../../../gcc/gcc/jit/jit-playback.c:1909 > 0x7fa3a41a13dc gcc::jit::playback::context::replay() > =A0=A0=A0=A0=A0=A0=A0 ../../../gcc/gcc/jit/jit-playback.c:3250 >=20 >=20 > Should an assignment to such a value be supported? >=20 > Le mercredi 15 d=E9cembre 2021 =E0 19:19 +0000, Petter Tomner a =E9crit= =A0: > > Oh ye I accidentally dropped that in the merge thank you. > >=20 > > I believe there is an implicit "global:" in the top of each version > > scope, so it shouldn't > > matter other than looking a bit deviant. > >=20 > > Regards, > > Petter > >=20 > > Fr=E5n: Antoni Boucher > > Skickat: den 15 december 2021 15:19 > > Till: Petter Tomner; David Malcolm; jit@gcc.gnu.org; > > gcc-patches@gcc.gnu.org > > =C4mne: Re: [commited] jit: Support for global rvalue initialization > > and constructors > > =A0=A0=A0=20 > > Hi Petter. > > I believe you have forgotten the line `global:` in the file > > `gcc/jit/libgccjit.map`. > > I'm not sure what this line does, but it is there for all other > > ABI. > > David: What do you think? > > Regards. > >=20 > > Le mardi 14 d=E9cembre 2021 =E0 17:22 +0000, Petter Tomner via Jit a > > =E9crit=A0: > > > Hi! > > >=20 > > > I have pushed the patch for rvalue initialization and ctors for > > > libgccjit, for ABI 19. > > >=20 > > > Please see attached patch. > > >=20 > > > Regards, > > > Petter > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=20 > >=20 > > =A0=A0=A0=20 >=20 > =A0=A0=A0=20 =