From patchwork Fri Feb 10 15:52:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 140678 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]) by ozlabs.org (Postfix) with SMTP id EA567B6EEC for ; Sat, 11 Feb 2012 02:53:04 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1329493985; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:From:To:Subject:Date:Message-ID:User-Agent: MIME-Version:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=na1euHzKlybycqHUSzRZ5xbuc0c=; b=GE179/evVSGzipa NAsrD8T6T1BNsL9aAamvBd7n0OexNGgW9RQYagm8fRoIyTuNHbFUWyk2gAzTejwi Us9GUB15Oo9NsKH+/TMVP8aml4077YBXiSyz2iredqbMlJhLITFEpEYMsRlMrA9z pTDRcKTOh5WVOMsyqXJzgeEMpy04= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=oEeCzepLn98MbFVFAsYiiKHdnARC7bNZuuOOjoaxvhfU+rmKt0oJwbiIkDEwzC zcN5sG/OuM4+5bFKBf28HWtZv1LmsKTndhUfihfvHBLzpLAG52/pReMuWSLP8Ry7 s7EfeL6/21c+vgp9iHcQJVeHNiz+ShH+mGyC/lujO8MZ0=; Received: (qmail 18138 invoked by alias); 10 Feb 2012 15:52:59 -0000 Received: (qmail 18128 invoked by uid 22791); 10 Feb 2012 15:52:58 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mail-pz0-f47.google.com (HELO mail-pz0-f47.google.com) (209.85.210.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 10 Feb 2012 15:52:42 +0000 Received: by daln34 with SMTP id n34so2304838dal.20 for ; Fri, 10 Feb 2012 07:52:42 -0800 (PST) Received: by 10.68.222.72 with SMTP id qk8mr17620334pbc.1.1328889161974; Fri, 10 Feb 2012 07:52:41 -0800 (PST) Received: by 10.68.222.72 with SMTP id qk8mr17620308pbc.1.1328889161852; Fri, 10 Feb 2012 07:52:41 -0800 (PST) Received: from coign.google.com ([2620:0:1000:2301:f2de:f1ff:fe40:72a8]) by mx.google.com with ESMTPS id x8sm14576247pbr.11.2012.02.10.07.52.40 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 10 Feb 2012 07:52:41 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: libgo patch committed: Save all registers on stack for GC scan Date: Fri, 10 Feb 2012 07:52:39 -0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQlk4nwB0EAXw6rP7cpZUV4LBu1rVF+RWEuL0mvzOTOAcv7zpTj21OBnyi1yuaaKlu22K4tO9McBmtsfsOx1S+RVqdQ4NhO1IHv7IlPGuIkuJpi4xY8yat5+dlnfInrMBfOzgv2XXqCjzu1w3q7sDTfdT6A0GwQEraJFuPuAq8xJk3Rd+uk= X-IsSubscribed: yes 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 This patch to the libgo garbage collector ensures that we save all the registers on the stack when starting a GC. Otherwise we could sometimes miss a value held in a register while scanning the stack of the goroutine running the GC. This never happened on x86, but it did happen on SPARC. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r 1f6696441eeb libgo/runtime/mgc0.c --- a/libgo/runtime/mgc0.c Fri Feb 10 06:07:07 2012 -0800 +++ b/libgo/runtime/mgc0.c Fri Feb 10 07:50:20 2012 -0800 @@ -936,6 +936,10 @@ const byte *p; bool extra; + // Make sure all registers are saved on stack so that + // scanstack sees them. + __builtin_unwind_init(); + // The gc is turned off (via enablegc) until // the bootstrap has completed. // Also, malloc gets called in the guts