From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 1056F3858C52 for ; Thu, 11 Apr 2024 11:11:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1056F3858C52 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1056F3858C52 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1712833900; cv=pass; b=ILqs6hWOXBhm1WqkufoGhMx0r7c8z1e8vfDWHBv1JP7UykTRpiKbwdpuz8uBMz0Bt5uW1Ke2jj3MwpqgGfrj+G8C8QSym8i09iyJDP8lYDMdwgzm0b67pEU+u0JUBQgMOgI8NzINvUKCyxZ42gFzUBYIrd7YZiaT4kl3FvTYog4= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1712833900; c=relaxed/simple; bh=d9bsOFvazhdg0dgtngnVfJuUvIK4aHwQs/J+LZxdPrM=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-Id: MIME-Version; b=gxnWWfzIk1Oi3xSUyTazwXChrrsMZnlBziPxzmzeIHnLWnEmwpjEEeq9C1f1jYkSDUfeioWxcnzfd/kqIWon/7fhQoTaLJkRsEQvbQg7qqMWAtTngrY9GOHSF1VJ8aRSUTyRbR8RrvQXfJfMAw2AJ+oNi1X22XhKxv+wrsfqxAw= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43BAJAkY019837 for ; Thu, 11 Apr 2024 11:11:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=eYKa1wopoDr5FwoeXEz0Gsqz4uWzoF2zKYlFVkfh9QQ=; b=LaQtS6haUP36uBhhjNbbObGS+sW/TdHLgfNtcRA2Q3A+faZpeFJz3tnISRHI7+zkZ3Kl TM1Xd8JzfNbqewelyP3MFT6a6TbR+VxPy8t/8GEUlIsGqM5wlm7/gsqoYLdTi7B9hEjz rYVOfjd+dFaehMP+InZ3Him3y9UNOq+6pUkCoKb/3q+0JH9CljHxmHRkvRJTSZwy0g4t iZ96siiIwc8yQsRDHqb9Vl4LRTLH22L4IZ+Do8smd0qQQe7DdtDr4uHrdKt83flPDL4z uCBAiC/R9LSxQdVWABzXV4Qaa6km0doDgW+azeB9e+/DVUVXC3Mh+EFy42rAhQqrd7bp dw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xax0usbk9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 11 Apr 2024 11:11:37 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 43B9FPP4032369 for ; Thu, 11 Apr 2024 11:11:36 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3xavu9yr5a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 11 Apr 2024 11:11:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GAAF2LR+/RGG5cemUUioVbJrIUr9Vutetf0LvWpNVxYB1SCupa0q+QwZKWcG3duM3FAX6GffZ24jzy8veYJMY1MXavi4qCfDASyNAOqjrIwGkrNaz6DZYpgHgUY4BM6qXMZKKPO+X6r6wlXmkDNOfbVFpZM3jW3wwmk98/mNbtBveCw/mY93lPDwY1fuTxqgu3bTeT0SGSH0B03h2K9RpztfFXuhfHlcyLK7amQB7OeXDRE+RZMqPhCB/7uHTn3qVlBceSWzkCj1Q8lIorXvxDYaxjSgpFmVPYi51yJ0r6jVgc6RaOQDGr7aSWQQyuUwZbHYxcQFzoO3R9Z5i6Qqmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eYKa1wopoDr5FwoeXEz0Gsqz4uWzoF2zKYlFVkfh9QQ=; b=Wb10M0XsuSVSkB1dLqlTucs3dkpG1VJ//D8p7v4S5G8h6h9K8knZ5FrwFi9N9eD3pks/HHeQUvVZ1xb5uv+j5UaHkSawk2HhChLx4FhQWfZeBswsg7QhseYkDdlv229YHdY305/K7H6I3f/+YVc8zLP+OkIuecUhNvlzxiaQWIi8+8Df1t3cHJ+ombmKlZhcpbCOGVPBF334XxEcdcxOWzLpzO50Iwt75zjCbtHbpLkAf7CiSq43JuDGXo6vRJZCTO3HeBlHrDbMeR+fsd7YzTkn0VPWxIBY+GdQGBNOVNmcrECHmpOe+YchYLtomOKjebAOZDRVADfTvsGjKwC+4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eYKa1wopoDr5FwoeXEz0Gsqz4uWzoF2zKYlFVkfh9QQ=; b=xrElD49SpwEUBvmSfsbM4UKGmnoZ5l5Gyahkyq2OF+7l5Y2tr1H+5eiNa46sjY8wnOTT8Oxm8U/AgxgL36DlXXtj/Y2+wJU6i5kfzprG52ORR5anvXUaAautcb6sV3EhFhA92AcFHrn4PQ6iQDyenYfz0RBrQkMLoM7xyw8Ufrw= Received: from MN2PR10MB4382.namprd10.prod.outlook.com (2603:10b6:208:1d7::13) by PH0PR10MB5644.namprd10.prod.outlook.com (2603:10b6:510:fb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Thu, 11 Apr 2024 11:11:33 +0000 Received: from MN2PR10MB4382.namprd10.prod.outlook.com ([fe80::1e11:7917:d2c:e44c]) by MN2PR10MB4382.namprd10.prod.outlook.com ([fe80::1e11:7917:d2c:e44c%4]) with mapi id 15.20.7409.053; Thu, 11 Apr 2024 11:11:33 +0000 From: Cupertino Miranda To: gcc-patches@gcc.gnu.org Cc: jose.marchesi@oracle.com, david.faust@oracle.com, elena.zannoni@oracle.com, Cupertino Miranda Subject: [PATCH 2/3] bpf: remove huge memory waste with string allocation. Date: Thu, 11 Apr 2024 12:11:17 +0100 Message-Id: <20240411111118.215612-2-cupertino.miranda@oracle.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240411111118.215612-1-cupertino.miranda@oracle.com> References: <20240411111118.215612-1-cupertino.miranda@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: AS4P195CA0005.EURP195.PROD.OUTLOOK.COM (2603:10a6:20b:5e2::14) To MN2PR10MB4382.namprd10.prod.outlook.com (2603:10b6:208:1d7::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR10MB4382:EE_|PH0PR10MB5644:EE_ X-MS-Office365-Filtering-Correlation-Id: e1daa3db-9bdb-4676-92a5-08dc5a182507 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9eSXv+W1xv1/sf49MNTET3gqOZKh9CXBG7s+1IM/Qbs95wO2V1WRIgRplWedPTCkWijuguNPet2elKZiUohmRTdSceKrp059GhuueWGkOb213FvTSVoV2dQqBEjD1vcg9vFNx8aG5RClE/aEMyqnCD4ORSbyrN0K9zFAA6Hv26QU+UcBJBO3+tCc6oXoYtuyj4bxIAIZC9SSHd1ZrIsoIIAEoiwRYybtVG/FwD0nAPAtPbRj5Cjatt3S+PnISM02ESAzArgMGypjKjNW0xTc21rbxCw2XlqxFJoit55IOf/Trkd9ooXCiF7mn8D5kZxbha/4nhg0Z9gSFfmiSq+Pm8ymcOY3u16md3V7gjQIhCfN6Bzal5xC6uKeo7IyUuyG7J1Oy2QtEfEj/MOqYLymgok7wabDgrQhY0A9fv2sClEy743uqooWdn6xbP+vdDPvpm9hr5DkfvycLFHLddgQ9K1vnLf28uhKyzqHi2Zvj5iTOD2pHP2DAGwa4wqEmSqobg8qScfaK04hR0v/99p2j40AfOFOVSTgLGZ+p827PE+BEMYQXN347yu9lNUbmzW2U+jzENtBcaZ8tXuwKdCsiG9zKwHwl5ix0AB3zzzgLeQkmhwbuuyKuH2fh5xlNU4RbFnLd4omcucxkFIulca/FGiURf6FakJ98TrPQ9bcdhQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR10MB4382.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(366007)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?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kjLaZ3T24V4QO6Qv31xChHP9npy6hhNXS?= =?us-ascii?Q?xeKOpEopW9x2NREgSinuiY/oiJ5KIYN23YBNMYnSJA1SnSiY+j9+6K5yeVmB?= =?us-ascii?Q?eM92Wq7mz4iuwS4V/Ztp3rZM7vtRtmV7IKXYAafOagatUV1AAzLmsPfmsd6x?= =?us-ascii?Q?jTkGQCHsC0uLzXxXbSsecd5jx/HAuE7Cr8CKjKwlvs8WYj4VLYysssD9dxQi?= =?us-ascii?Q?ht0XsR42jF0S8NzA2k1FH4rbz7jffuPxsrh+96gddZODjH5/8GAuGXIFk75r?= =?us-ascii?Q?ae4NRfl7yGc72SIdsDiy8rNDQuLs2dtmvb1duC2K9Qr3FeIIgKKFoljqDgPT?= =?us-ascii?Q?VYfJeRzxZMV/aY8HH388ZIZAulUhZLqouqIFpMDuG6rEBO1ANqe90MweHan5?= =?us-ascii?Q?CzSP86oMZooOzUrHRUg68G5/0dWE6FWnRD90+poCxtL6krWE+E7lFAWXVqJZ?= =?us-ascii?Q?3SmcUQ5M76dLDB+uE1qagAQ4XM7Lkciy1oYAPRSpR7c/ekJR4vfhN1H9hVXl?= =?us-ascii?Q?bCWhLKm+UbvKscjmTLs525ACrFHKDYfDBGEwC/uXIGSwNqhQBOgwhD8j/zYn?= =?us-ascii?Q?Pm31ysIZAHAvk0yu4D888oh91N0/ax1OCPMMViBamPjemJLjXXQFp1Di/0GX?= =?us-ascii?Q?2SoxlOjwqTisdyFb6MaOloY+XNYqT8yAYx4m5F52mNExX1sCUQc4r38+m36Q?= =?us-ascii?Q?GaNOAlII1/FPEZ+xBDSobaaFM5s08C2eK1L/cRTsQ3ApHKR6TeaK9Wi9xV3k?= =?us-ascii?Q?toCwOrrXZ+PB/LCw4dGnULw=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 0/N+yi4UM3LgHy7o3WU0KeCYU6jL8ZdNd4MjqSd38oYjejg8++D78dNCGcsEocWtI1VKOD7u9B2rRbaE9PBTPAep0MejqOHAb7wXtjqD2/5K/3X2T9ycqtkfiblBJSaMw5InQHVtzCKZGQUAgWLUz8OwzpkV+jKg0qjWY9wtaOjnPlwT5AbKOQLDlon/oIas/uzmEWAJG7jjPjev9lfLICdpjP6rRepzorssXytQ6k9eDFzRRqi+4DIl1a4oEBwS7hPHzfARDBfuU4v6DfpaKXb/ewyyYKfimrqucJGj9CPXYYtuPy6Ns8wAvnCJNTsTslYDGhbMvCRTZXaB4Cv44fw7/JSZBI3VcYYbJi1pT9NOig4GVwKi+aQ/JmIaGV7zKT9SK+R2ezPedQ0RKX6SqwoRTffkPixc/rxTdy0DBMTf/fLPcWA8tk8K+Vdkc6tK17KbiXyA9ZQLZpA2OZacYMsmpdF/N6FnjRxl9AT6kzYmwet88W8g3VF9CmL0ImbtPQ041JkTBuxVUcLpsvVJGUnmX/7yid0usOv0zj+YBAuL+iRXXy+qVvecoxTFY9ebPxz8R4n6EEB4wWgU0rU+Ok1Ye7LlQkuaK6ZAVngnxlg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e1daa3db-9bdb-4676-92a5-08dc5a182507 X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB4382.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2024 11:11:33.5157 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: M9Epm8wJs0EjV8FbyVdUJ9tl/MZo5ZcC/QAwtLn/3O2V7T2qUCE4QQM9WZYlgZsHcVSlt4ja81N5isFLWe/hfjngFsngqJGvxtyx0ilnbXY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5644 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-11_04,2024-04-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404110080 X-Proofpoint-GUID: LCbgvi20cy-dFGLwvC65p6sd9JMvEXIn X-Proofpoint-ORIG-GUID: LCbgvi20cy-dFGLwvC65p6sd9JMvEXIn X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Code was allocating way too much space for the string. gcc/ChangeLog: * config/bpf/core-builtins.cc (process_enum_value): Corrected string allocation. --- gcc/config/bpf/core-builtins.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gcc/config/bpf/core-builtins.cc b/gcc/config/bpf/core-builtins.cc index e03e986e2c1..ead1777d465 100644 --- a/gcc/config/bpf/core-builtins.cc +++ b/gcc/config/bpf/core-builtins.cc @@ -872,10 +872,11 @@ process_enum_value (struct cr_builtins *data) { if (TREE_VALUE (l) == expr) { - char *tmp = (char *) ggc_alloc_atomic ((index / 10) + 1); + /* Array size is 21 = ceil(log_10(2^64)) + 1 to hold string + representations of 64 bit integers. */ + char tmp[21]; sprintf (tmp, "%d", index); - ret.str = (const char *) tmp; - + ret.str = CONST_CAST (char *, ggc_strdup(tmp)); break; } index++; -- 2.30.2