From patchwork Wed Jul 2 14:23:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 366380 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 5FBED1400E8 for ; Thu, 3 Jul 2014 00:24:07 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=qozNqLCbjxb9juJFCmw3q1qw5O+bPOrzGGbZqy6zXHTEvkPMGYbi7 O+1kM4rfP1Fxz0xCrE6XRv2yrPHt/TDNLXkK8tSHXANSDHrkCTT9QtXkyK8oDqYO d3Xl2sjatn88AfqMGwIGimiNAq/HhZfdVLheekrW/cXVUnRQz69cjA= 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:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=yJh7RCqS9fThxo/WuRu8ABwXO5A=; b=w6NIAZvQcV/GZ1Jx57yy vcUIZg8l2pZnFnQynj0AhpYY/B8IB5ijSbaZTEEFG3BRQNFfXEvvZrUgSGe/fRF2 fwZRmIqNCLNUbTsAXJLid/KIh7r/LvhGNKoWlemhY+qZ61aHMEFNgMydwfG4lGs/ 3XeHJ04Qept92Y2dcAvZgM0= Received: (qmail 4788 invoked by alias); 2 Jul 2014 14:23:59 -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 4739 invoked by uid 89); 2 Jul 2014 14:23:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f171.google.com Received: from mail-pd0-f171.google.com (HELO mail-pd0-f171.google.com) (209.85.192.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 02 Jul 2014 14:23:51 +0000 Received: by mail-pd0-f171.google.com with SMTP id fp1so12044344pdb.2 for ; Wed, 02 Jul 2014 07:23:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version:content-type; bh=8zts5LVD/0RaVd755jSmXOBOC0KyrfSQaevoa+Xx88M=; b=FFyxYJESh/hxVjKYzFVB597aPhRKlyvZhiIlZ48dlFzv4HOusblPU6hjworYh3/ljh RZE0Gq9tfr/ENVsm/QR27tnSMqbxuhcZZ5s676+T3ShZ13oYwpYI8251r4grIudZaSsJ hnLARNPJcsMF/xoBS08IuzTwC24Q/JBPAfvNUfKZQrWuiaXnGtfvSu6eMTGSAWRSz6h/ ognro/Gv4mnqcuqvqKnuJPqlDpdzU6YuB/5GAs/ZqIJYe/LjRpXjFlCiqQNFZ9G9/9vE Ahnp1pEw6x7HsrPcQlHJZb9meRGK95jlvoNb+6Nr28hk2WVaO0vj/CZoyBTJqzrRpOpD D+tQ== X-Gm-Message-State: ALoCoQl+miq1u4gYC+w3qcRrILUQbhVbJYYvTYxhufCatNwutwtuizDw+N7XINasurXNR6dIiUMw X-Received: by 10.68.136.99 with SMTP id pz3mr71438238pbb.150.1404311029561; Wed, 02 Jul 2014 07:23:49 -0700 (PDT) Received: from iant-glaptop.roam.corp.google.com.google.com ([2620:0:1000:157d:4cef:de70:7fdb:2797]) by mx.google.com with ESMTPSA id io6sm130680034pac.44.2014.07.02.07.23.48 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 02 Jul 2014 07:23:48 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: libgo patch committed: Don't explicitly free tiny blocks Date: Wed, 02 Jul 2014 07:23:47 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes This patch fixes libgo to not explicitly free tiny blocks when deleting an entry from a map. The memory allocator now has a special case for tiny objects (less than 16 bytes), and they can not be explicitly freed, only garbage collected. This is PR go/61620. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r a45b1aa17901 libgo/runtime/go-map-delete.c --- a/libgo/runtime/go-map-delete.c Tue Jul 01 16:18:58 2014 -0700 +++ b/libgo/runtime/go-map-delete.c Wed Jul 02 07:20:02 2014 -0700 @@ -8,6 +8,7 @@ #include #include "runtime.h" +#include "malloc.h" #include "go-alloc.h" #include "go-assert.h" #include "map.h" @@ -47,7 +48,8 @@ if (equalfn (key, entry + key_offset, key_size)) { *pentry = *(void **) entry; - __go_free (entry); + if (descriptor->__entry_size >= TinySize) + __go_free (entry); map->__element_count -= 1; break; }