From patchwork Wed Jan 10 05:28:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 857954 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-470638-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="NUN07nJj"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zGd0C1wB9z9s7n for ; Wed, 10 Jan 2018 16:31:05 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=FylAsyD82z0NpA0fYprTdTNhn1xotj8wErPyRKFOSW4QYJ OmXQUApZg44wQuer/+c7THczgqnuhQgEHF3oFatC3J5t0XzcVeoR19IYENT88XdP OdGPUUJVry+dvaVp1mgW73397crgU+qPQe4baJRkDjIV6bGkRzUNGZHa6XxBw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=mgt6ke5JaZOhoj4ip8IEbhM6MGE=; b=NUN07nJjoS7L5Ykmkcfs 3/oGqMISrgWIhB97crTwbf8H8gALlzNQhC7aVRuGcOW4WWfyvEtKo4SRWXX2v6JR fn0qqWK2fU4Rqa4XzVIXoBxLEjvw840MAYcegY02zpBuSbqmvChiAmYRGUnZCT/Z 6OA34L5whN/+E5nqE5BX6FI= Received: (qmail 99356 invoked by alias); 10 Jan 2018 05:29:53 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 98649 invoked by uid 89); 10 Jan 2018 05:28:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2313 X-HELO: mail-wm0-f50.google.com Received: from mail-wm0-f50.google.com (HELO mail-wm0-f50.google.com) (74.125.82.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 10 Jan 2018 05:28:17 +0000 Received: by mail-wm0-f50.google.com with SMTP id 141so7758946wme.3 for ; Tue, 09 Jan 2018 21:28:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=66CryZoks4iRmKDF4G4p4WE9Cfeh/8znb2i4duN8h0g=; b=q8ZJzQrhQmt0M5KgeUcMn2Zo+B4iJboi8Y+MRdUoG+XUoYjUShqHpeK17Gl19LIuMe Itau3rrc052tjR1hf1j2xS+8X4Zysg/j6we3eHwnm+RuDpyvpRCW36WaGRu4abfEVcGa ZThtDvViCcXpO8HPl9V/j/O3B5j68X9vr+PouRPxqkLRNRPf0l+WDGCQ4FwNFQGA1JSu pFu9FmNTFKYUVgy1jBq0PhGGYCyrmgIrbLqfCJ8n+CeMiig3ogLCAH6EkXX6lmHPaiYs 812xlV1dqszWvtxBI4Rq8uKAmdUNBlBjsVOlpwCZf6HgBdJoQbgcQnnF7IQSCcBTGL4+ E09Q== X-Gm-Message-State: AKGB3mLZdE9m9WtPca1tNhawfP21HEzrwimUaWcOTqOwRfuKJ8ogCf7t 5l/dZ9KLrFk2bGWLv8g20qP+EgeOquphErLdqXYeNHQQ X-Google-Smtp-Source: ACJfBotKURlJEu014wrmSZU/1biPH3mILJCNIhwyPNX8pUSkZ8NMFk1l1mcUXSPb+BIInmSHirUqUfy4x/vr+cRXsv0= X-Received: by 10.80.132.5 with SMTP id 5mr24484175edp.208.1515562095368; Tue, 09 Jan 2018 21:28:15 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.179.221 with HTTP; Tue, 9 Jan 2018 21:28:14 -0800 (PST) From: Ian Lance Taylor Date: Tue, 9 Jan 2018 21:28:14 -0800 Message-ID: Subject: libgo patch committed: Work around escaping closure in runtime/export_test.go To: gcc-patches , gofrontend-dev@googlegroups.com This libgo patch by Cherry Zhang works around some escaping code in runtime/export_test.go. When compiling the runtime, local variables and closures may not be heap allocated. In one test, there is a go statement with a closure. In the gc compiler, it distinguishes capturing variable by value vs. by address, and rewrites it to passing the captured values as arguments. Currently we don't have this in gccgo, and the escape analysis decides to heap allocate the closure and also the captured variables, which is not allowed. Work around it by passing the variables explicitly. This is in preparation of turning on escape analysis for the runtime. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 256418) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -5cae6a4e0849a3586ee7ce9c915c1520a17db982 +c18c6bd80e0995827ad3396eb1c2401451de88fd The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: libgo/go/runtime/export_test.go =================================================================== --- libgo/go/runtime/export_test.go (revision 256366) +++ libgo/go/runtime/export_test.go (working copy) @@ -123,15 +123,15 @@ func RunSchedLocalQueueEmptyTest(iters i // can lead to underutilization (both runnable Gs and idle Ps coexist // for arbitrary long time). done := make(chan bool, 1) - p := new(p) + _p_ := new(p) gs := make([]g, 2) ready := new(uint32) for i := 0; i < iters; i++ { *ready = 0 next0 := (i & 1) == 0 next1 := (i & 2) == 0 - runqput(p, &gs[0], next0) - go func() { + runqput(_p_, &gs[0], next0) + go func(done chan bool, p *p, ready *uint32, next0, next1 bool) { for atomic.Xadd(ready, 1); atomic.Load(ready) != 2; { } if runqempty(p) { @@ -139,13 +139,13 @@ func RunSchedLocalQueueEmptyTest(iters i throw("queue is empty") } done <- true - }() + }(done, _p_, ready, next0, next1) for atomic.Xadd(ready, 1); atomic.Load(ready) != 2; { } - runqput(p, &gs[1], next1) - runqget(p) + runqput(_p_, &gs[1], next1) + runqget(_p_) <-done - runqget(p) + runqget(_p_) } }