From patchwork Tue Sep 10 02:48:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 1159988 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-508743-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=golang.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Up5aX38r"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=golang-org.20150623.gappssmtp.com header.i=@golang-org.20150623.gappssmtp.com header.b="DTGlWq3a"; 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 46S8cV1SKYz9sCJ for ; Tue, 10 Sep 2019 12:48:55 +1000 (AEST) 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=xIAQExjyhyC6JJBz1XsK3mBOAAJx5j9mJ3inpscfzPievA v1l147V1/uWagOlxUvWKzHicKFoFbaugAUjmPTlNhQo+6XPxa4GoYtHZRwAoctCh FHoUQBlcCrOAjLWQ5wu0IIiu1sVL0DR8e7Ysx+b4Bx9yxH+9bvv9UxC3d0VsM= 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=Jnz/J1UuA88sp2r9Diysrf1V7tI=; b=Up5aX38rUpchbr2uRQEB BAWhPHVksEXw2iF5oPet1NH9MQRbFuDn8QC/Ku6JVNprGnXioLhWH6IaYVMttAVA 9fDtWqBqOCawT9mjxqyfYzEDXq3skZMxsMtdmLu862fBOI5OiIxKc7VfvV6RZ1G8 kyuwcUFH5Lb5VgYZUvsZ8nA= Received: (qmail 44509 invoked by alias); 10 Sep 2019 02:48:48 -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 44397 invoked by uid 89); 10 Sep 2019 02:48:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.8 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.1 spammy=HX-Received:b582 X-HELO: mail-ed1-f43.google.com Received: from mail-ed1-f43.google.com (HELO mail-ed1-f43.google.com) (209.85.208.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Sep 2019 02:48:40 +0000 Received: by mail-ed1-f43.google.com with SMTP id i1so15408576edv.4 for ; Mon, 09 Sep 2019 19:48:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golang-org.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=ftTNDDItR7gnxoeyG7LqxDwEdz1MyP/MQ5nl7DqS/eo=; b=DTGlWq3aa92XIXN8SenOqLTQEgC4NVNy+MDs0We9jg0fFljDjMkeAEJTZ8YOtuw43Q cbuWUKsQJOEUQlqthGMfDU8vPo3UjpXRQwOULv+iX2/AW6kSbaprwY6mJFaoZFDUzfEg IqgPIhgoalfMv4FtX8Ugl0bxQqhG8VgeriujKh3T/cN2ZQ8PdDmuDqH+mXAWTb1Bwm7v 5tTQBiJEKIv8/EGUD2lKphh07n+00MPWuVg2jX5KsOGkHCT0NpoJMkdUoyrG63xD7aIs Xcmmrx5lMvdPc9AuU5dYEGXMGeViCV/m9B6JcZTHl9iah9I5oytwTrihrhA0Pt4bn4JW v3qg== MIME-Version: 1.0 From: Ian Lance Taylor Date: Mon, 9 Sep 2019 19:48:27 -0700 Message-ID: Subject: Go patch committed: Look for tool build ID before hashing entire file To: gcc-patches , gofrontend-dev This libgo patch changes the go tool to look for a tool build ID before hashing the entire file It also fixes the key used to store the ID. This is a significant speedup in go tool run time. 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 275558) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -5c3f52ffbae7a9bb59bce63cd2cffdd8af8f4a92 +68038b4fdf1456482af986cb05dcf3121bd43ffc The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: libgo/go/cmd/go/internal/work/buildid.go =================================================================== --- libgo/go/cmd/go/internal/work/buildid.go (revision 275473) +++ libgo/go/cmd/go/internal/work/buildid.go (working copy) @@ -291,14 +291,19 @@ func (b *Builder) gccgoToolID(name, lang exe = lp } } - if _, err := os.Stat(exe); err != nil { - return "", fmt.Errorf("%s: can not find compiler %q: %v; output %q", name, exe, err, out) + id, err = buildid.ReadFile(exe) + if err != nil { + return "", err + } + + // If we can't find a build ID, use a hash. + if id == "" { + id = b.fileHash(exe) } - id = b.fileHash(exe) } b.id.Lock() - b.toolIDCache[name] = id + b.toolIDCache[key] = id b.id.Unlock() return id, nil