From patchwork Mon Jan 19 18:11:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 430637 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 A0ED714017D for ; Tue, 20 Jan 2015 05:12:04 +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:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=XdT88FhtsCnBNVwP5Z 4pexhuy5fbGqw8HuTAon2PIMYqcBN3nUnXIFeUDncFDyUSEv4TzLLGbavsBplClR 5BDghgLRzviWyONGkxGyJI93PjqkMnpZIohy23Fp1TiPGgJvKo2iR68vMKr6h2+f PsC9jy/zeVJYWx6wdUeSYds2k= 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:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=ZgODBRSuI1PdYSR8/ble93or h1w=; b=BRxlisNcLFWdeV4jAFc14t6+AeyMJZcXOU+pwCO9APvfVYTabP1dRPH/ 8ROLU8mRstlnVJI0vJ6WnZi2AwIaTJMt1bh4/l4/Wma2c5ZS5DR596xafZSi5pxz fsqivwdZq6Ph2PbyPnvTUmTPCvkmewBmogIj3XGY2TdqT/VvzPk= Received: (qmail 22205 invoked by alias); 19 Jan 2015 18:11:56 -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 22193 invoked by uid 89); 19 Jan 2015 18:11:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f174.google.com Received: from mail-ob0-f174.google.com (HELO mail-ob0-f174.google.com) (209.85.214.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 19 Jan 2015 18:11:52 +0000 Received: by mail-ob0-f174.google.com with SMTP id wo20so20226230obc.5 for ; Mon, 19 Jan 2015 10:11:50 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.202.226.70 with SMTP id z67mr18171956oig.95.1421691110469; Mon, 19 Jan 2015 10:11:50 -0800 (PST) Received: by 10.60.159.166 with HTTP; Mon, 19 Jan 2015 10:11:50 -0800 (PST) In-Reply-To: References: Date: Mon, 19 Jan 2015 19:11:50 +0100 Message-ID: Subject: Re: Use static chain and libffi for Go closures From: Uros Bizjak To: Ian Lance Taylor Cc: "gcc-patches@gcc.gnu.org" , Richard Henderson , "gofrontend-dev@googlegroups.com" On Sat, Jan 17, 2015 at 7:34 PM, Uros Bizjak wrote: > On Sat, Jan 17, 2015 at 12:19 AM, Ian Lance Taylor wrote: > >>> You should also revert alpha specific change to >>> libgo/go/testing/quick/quick_test.go, please see [1] and [2]. >>> >>> [1] https://gcc.gnu.org/ml/gcc-patches/2013-03/msg00038.html >>> [2] https://gcc.gnu.org/ml/gcc-patches/2013-03/msg00038/foo.patch >> >> Done like so. Committed to mainline. > > Thanks! > > There is another part in runtime/go-ffi.c that looks like it is not > necessary anymore with FFI_TARGET_HAS_COMPLEX_TYPE. Attached is a more conservative v2 patch that conditionally enables fixup code when FFI_TARGET_HAS_COMPLEX_TYPE is not defined. Tested on x86_64-linux-gnu {-m32} without regressions. Uros. Index: runtime/go-ffi.c =================================================================== --- runtime/go-ffi.c (revision 219832) +++ runtime/go-ffi.c (working copy) @@ -290,8 +290,8 @@ go_func_return_ffi (const struct __go_func_type *f if (count == 1) { - -#if defined (__i386__) && !defined (__x86_64__) +#ifndef FFI_TARGET_HAS_COMPLEX_TYPE +# if defined (__i386__) && !defined (__x86_64__) /* FFI does not support complex types. On 32-bit x86, a complex64 will be returned in %eax/%edx. We normally tell FFI that a complex64 is a struct of two floats. On 32-bit @@ -300,6 +300,7 @@ go_func_return_ffi (const struct __go_func_type *f by pretending that complex64 is int64. */ if ((types[0]->__code & GO_CODE_MASK) == GO_COMPLEX64) return &ffi_type_sint64; +# endif #endif return go_type_to_ffi (types[0]);