From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id 065003858020 for ; Thu, 22 Sep 2022 12:35:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 065003858020 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x62b.google.com with SMTP id u9so20769723ejy.5 for ; Thu, 22 Sep 2022 05:35:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=UI8lUHD8/i6Hr5MA/oqWMmWngM7dCjjw8n2n4Kmu6u8=; b=caSmKLLOxQaw0o/MFFhLKIGikd7D0zNs0YielvF4eWL8VX9Bj188pQiAa5kKX/pNp0 xakKzEHL5ABqDxxHZku9twOlse6WmpKsDClrFrXiZv4LlLVsjQcY9UJyd3pAvdqTdfrC JxaKf2+KMzAoSomgwD4O1P2dPGeJSAVtEeeh1Joi+L9GxG+n0SUJfY4q9jIDX3bHXjFZ pRr2UlyKDHnGFGpfMRU522W0olu1Y3YrizTCgEZvDg6X5qKWbGn3BRvZqAopruEWW+lJ MHShbDn71Pb43/uHDE64GLkOZ+eNcXMsP93kKeHn9XY3XUQGVxpfbhKofM7qVsieCxHw mhgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=UI8lUHD8/i6Hr5MA/oqWMmWngM7dCjjw8n2n4Kmu6u8=; b=hOvSBpSzTIe+U+4c41zQjnU9q21K5+je8vE6Br8f3hf+B6alTkHqgbJf8//u3+X579 qqR/EKATzPQ3Dind3zr5mVkOnn34EfryTlcJNzC+pno1k/wlGcyIw/6/R4vm9BrRDVIc Z3X2oBBpPHl68A4eY+rWE+M36LJYAWzcZswOWIoTrRnWkfXGhacwO0788+hEo2j7OlOF F7gg4sZ0BCVmOoHtXpS9z82No5bNE68TCRLNsZJ+QPq5CqGfFXEQuZBDW3mVCdf5yERD szvJxvMCAaOuhys2nXDGdsj2hWZ5xQREmUShQGZyboh1z7VAY9M6+1h57MIbj8IyhCXT h/xA== X-Gm-Message-State: ACrzQf2tfcBSrx6FwBseRZQpKwxnqNX1ZgpDa2L4PCb3M3gbT1XPY/L6 mjBhv/WAuAd0TH0h2JRjozChwBtCNR9jajpYZEA= X-Google-Smtp-Source: AMsMyM5dDX42ksjPQ5MJD276/zIbqtgvuIn90lSa1ex4jt9ItqYHrbrBaEzOPe+fXQVqPbl0Pxu5W78mwu/Uxy5G0yA= X-Received: by 2002:a17:907:7f1c:b0:77d:248:c1c3 with SMTP id qf28-20020a1709077f1c00b0077d0248c1c3mr2491430ejc.416.1663850107693; Thu, 22 Sep 2022 05:35:07 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Thu, 22 Sep 2022 13:34:56 +0100 Message-ID: Subject: Re: Use coroutines for avr-gcc To: Wilhelm Meier Cc: gcc-help@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, 22 Sept 2022 at 13:29, Wilhelm Meier wrote: > > According to the standard, an implementation can avoid the > heap-allocation, if > - the lifetime of the coroutine is strictly within the lifetime of the > caller > - the size of coroutine state can be determined at compile time > > Looks like this optimization is not yet available because new/delete-ops > are required. > > Is there any work on this topic? The so-called HALO optimizations are much more difficult than was originally thought when the wording in the standard was written. https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2477r3.html#background-and-motivation describes some of the problems. > Thanks! > Wilhelm > > On 21.09.22 15:38, Wilhelm Meier wrote: > > I tried to use coroutines with avr-gcc (13.0.0) for the AVR target. I > > managed to include the coroutine-header and to write a very simple > > generator using the example from cppreference. > > > > It compiles well, but then I get undefined symbols: > > > > 1) new and delete operator-functions > > 2) f(f()::f().Frame*) > > > > Therefore two question arise here: > > > > a) is it possible to use coroutines without head-allocation? E.g. define > > some global storage for the state of the coroutine? > > b) if a) can be fullfilled, what is 2) supposed to do? > > > > Thanks for any hints, > > Wilhelm