From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 95580 invoked by alias); 18 Dec 2018 14:02:49 -0000 Mailing-List: contact jit-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: Sender: jit-owner@gcc.gnu.org Received: (qmail 95486 invoked by uid 89); 18 Dec 2018 14:02:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=PS, p.s, P.S, UD:P.S X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Dec 2018 14:02:45 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF1B19B309; Tue, 18 Dec 2018 14:02:43 +0000 (UTC) Received: from ovpn-117-98.phx2.redhat.com (ovpn-117-98.phx2.redhat.com [10.3.117.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id 38A9066D53; Tue, 18 Dec 2018 14:02:42 +0000 (UTC) Message-ID: <1545141762.4619.244.camel@redhat.com> Subject: Re: alloca and labels as values From: David Malcolm To: Marc =?ISO-8859-1?Q?Nieper-Wi=DFkirchen?= , jit@gcc.gnu.org Date: Mon, 01 Jan 2018 00:00:00 -0000 In-Reply-To: <9bf4ad79-88dd-cac9-babf-c83d59acf7c5@nieper-wisskirchen.de> References: <9bf4ad79-88dd-cac9-babf-c83d59acf7c5@nieper-wisskirchen.de> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 18 Dec 2018 14:02:44 +0000 (UTC) X-IsSubscribed: yes X-SW-Source: 2018-q4/txt/msg00005.txt.bz2 On Tue, 2018-12-18 at 08:12 +0100, Marc Nieper-Wißkirchen wrote: > > > Is `alloca' currently possible with libgccjit? I haven't found > > > > anything > > > about it in the documentation. If it isn't possible at the > moment, > > > I'd > > > love to see it added to libgccjit very soon. (One use case would > be > > > a > > > compiler like the Chicken Scheme compiler that employs Cheney- > on-the- > > > MTA > > > where the youngest heap generation is allocated on the stack.) > > > > I haven't tested this, but I believe you ought to be able to > access it > > via the "__builtin_alloca" builtin, via something like: > > > > > > gcc_jit_function *fn_alloca > > = gcc_jit_context_get_builtin_function (ctxt, > "__builtin_alloca"); > > > > > > gcc_jit_rvalue *call = > > gcc_jit_context_new_call (ctxt, > > loc, > > fn_alloc_a, > > 1, &size_t_arg); > > > > gcc_jit_block_add_assignment (block, loc, > > dst_lvalue, > > call); > > > > ...or something like that. > > > That was helpful; thank you very much. I overlooked the procedure > `gcc_jit_context_get_builtin_function' in the documentation. Is there > a > way to determine which builtins are supported by a specific version > of > the library or would I have to add a few scripts to my project's > `configure.ac ' myself? I think you'd need a configure check. > -- Marc > > P.S.: Another thing I wasn't able to find so far was how to declare > variables as thread local (i.e. GCC's __thread or C11's > thread_local). There isn't currently a way to do thread local variables. I suspect that something like a variant of gcc_jit_context_new_global could do it, e.g. "gcc_jit_context_new_thread_local" or somesuch. Or maybe a way to mark the result of gcc_jit_context_new_global as being thread- local. Dave