From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16354 invoked by alias); 11 Dec 2014 09:06:36 -0000 Mailing-List: contact libffi-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libffi-discuss-owner@sourceware.org Received: (qmail 16332 invoked by uid 89); 11 Dec 2014 09:06:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp15.uk.ibm.com Received: from e06smtp15.uk.ibm.com (HELO e06smtp15.uk.ibm.com) (195.75.94.111) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 11 Dec 2014 09:06:34 +0000 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 11 Dec 2014 09:06:31 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 11 Dec 2014 09:06:28 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id E89001B08040 for ; Thu, 11 Dec 2014 09:06:48 +0000 (GMT) Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id sBB96RQi30867630 for ; Thu, 11 Dec 2014 09:06:27 GMT Received: from d06av12.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id sBB96PRo018919 for ; Thu, 11 Dec 2014 02:06:27 -0700 Received: from bl3ahm9f.de.ibm.com (dyn-9-152-212-213.boeblingen.de.ibm.com [9.152.212.213]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id sBB96PhW018880 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Thu, 11 Dec 2014 02:06:25 -0700 Received: from dvogt by bl3ahm9f.de.ibm.com with local (Exim 4.76) (envelope-from ) id 1XyzhY-000160-99; Thu, 11 Dec 2014 10:06:24 +0100 Date: Thu, 11 Dec 2014 09:06:00 -0000 From: Dominik Vogt To: libffi-discuss@sourceware.org, gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Cc: Andreas Krebbel Subject: Re: [PATCH 00/13] Go closures, libffi, and the static chain Message-ID: <20141211090623.GA30484@linux.vnet.ibm.com> Reply-To: libffi-discuss@sourceware.org Mail-Followup-To: libffi-discuss@sourceware.org, gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com, Andreas Krebbel References: <1412973773-3942-1-git-send-email-rth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1412973773-3942-1-git-send-email-rth@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14121109-0021-0000-0000-000002190ADB X-IsSubscribed: yes X-SW-Source: 2014/txt/msg00252.txt.bz2 On Fri, Oct 10, 2014 at 01:42:40PM -0700, Richard Henderson wrote: > The background here is my thread from last week[1], and Ian's reply[2], > wherein he rightly points out that not needing to play games with > mmap in order to implement closures for Go is a strong reason to > continue using custom code within libgo. > > While that thread did have a go at implementing that custom code for > aarch64, I still think that replicating libffi's calling convention > knowledge for every interesting target is a mistake. > > So instead I thought about how I'd add some support for Go directly > into libffi. ... > But the comment immediately before __go_set_closure itself says > that it would be better to use the static chain register. ... > Before I go too much farther down this road, I wanted to get some > feedback. FWIW, a complete tree can be found at [4]. ... > [4] git://github.com/rth7680/gcc.git rth/go-closure 1) On s390x, the static chain register cannot be used for passing the Go closure pointer to a function: According to the Abi, the dynamic linker is allowed to destroy the contents of r0 (static chain register) eventually causing a crash if libgo is linked dynamically. The assumption that the static chain register can be used to pass information to a function is wrong for s390x. 2) With this branch, the reflection tests on amd64 crash: $ cd /build # build gcc $ cd /libgo $ make reflect/check --> -- snip -- Aborted reflect.call ../../../libgo/runtime/go-reflect-call.c:216 reflect.call.N13_reflect.Value GCCDIR/build-go-closure/x86_64-unknown-linux-gnu/libgo/gotest30365/test/value.go:579 reflect.Call.N13_reflect.Value GCCDIR/build-go-closure/x86_64-unknown-linux-gnu/libgo/gotest30365/test/value.go:412 reflect_test.TestCallWithStruct GCCDIR/build-go-closure/x86_64-unknown-linux-gnu/libgo/gotest30365/test/all_test.go:1490 testing.tRunner ../../../libgo/go/testing/testing.go:422 goroutine 16 [chan receive]: testing.RunTests ../../../libgo/go/testing/testing.go:505 testing.Main ../../../libgo/go/testing/testing.go:435 main.main GCCDIR/build-go-closure/x86_64-unknown-linux-gnu/libgo/gotest30365/test/_testmain.go:124 created by main ../../../libgo/runtime/go-main.c:42 goroutine 18 [finalizer wait]: created by runtime_createfing ../../../libgo/runtime/mgc0.c:2572 goroutine 53 [sleep]: reflect_test.selectWatcher GCCDIR/build-go-closure/x86_64-unknown-linux-gnu/libgo/gotest30365/test/all_test.go:1377 created by reflect_test.$nested2 GCCDIR/build-go-closure/x86_64-unknown-linux-gnu/libgo/gotest30365/test/all_test.go:1107 FAIL: reflect make: *** [reflect/check] Error 1 -- snip -- Ciao Dominik ^_^ ^_^ -- Dominik Vogt IBM Germany