From patchwork Tue Apr 21 11:06:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Starikovskiy X-Patchwork-Id: 19157 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3LB6J80013846 for ; Tue, 21 Apr 2009 11:06:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752064AbZDULGS (ORCPT ); Tue, 21 Apr 2009 07:06:18 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752754AbZDULGS (ORCPT ); Tue, 21 Apr 2009 07:06:18 -0400 Received: from mail-fx0-f158.google.com ([209.85.220.158]:40751 "EHLO mail-fx0-f158.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752064AbZDULGR (ORCPT ); Tue, 21 Apr 2009 07:06:17 -0400 Received: by fxm2 with SMTP id 2so2451089fxm.37 for ; Tue, 21 Apr 2009 04:06:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type; bh=UHHy1wAxcP8IABaDk0PKo1K3FoPDhK/KS1Zy/vp/kog=; b=MUsa0+5YmDn3jfAceSbdd0aUQf9OaCgp6LC/xjxFjl+HR6+ITvxnJ4lxXfoP6oZkS3 u2iRhVA4DHh8bqyCjAcaAX14v/0UeXzQizsTZ20+62eJCazQ/I9avpMVq44uk+uQ0cKa 1eLNqU7/37YgXFJlU7ECUWO50lrIQn4D8cBRI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; b=YjYAyHG4UoAPsm0tKJVdKfsv5RWssEKvojpwjeo/pyvzfLas1pMOEpo0s5C3jHg14r mmLDJHWXev7Xw5ZRXJp04zN0mwP1A0TmbcfN0E3WC+KEkxymSpxik8qTgOIi4IaJJsn0 +bkADVDENmC2pEPkL6l0vupaLVS3rPOjlcaxw= Received: by 10.103.119.19 with SMTP id w19mr3706408mum.80.1240311975798; Tue, 21 Apr 2009 04:06:15 -0700 (PDT) Received: from ?192.168.101.190? ([81.5.108.170]) by mx.google.com with ESMTPS id 23sm16583641mum.23.2009.04.21.04.06.13 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 21 Apr 2009 04:06:14 -0700 (PDT) Message-ID: <49EDA8A4.4000206@gmail.com> Date: Tue, 21 Apr 2009 15:06:12 +0400 From: Alexey Starikovskiy User-Agent: Thunderbird 2.0.0.21 (X11/20090409) MIME-Version: 1.0 To: "Moore, Robert" , Len Brown , ACPI Devel Maling List Subject: [RFC][PATCH] Delete NextObject from OperandObject common Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Hi, Here is one more optimization of OperandObject made possible by previous patch. Size of Integer shrinks by 1/3 Regards, Alex. ACPICA: Delete NextObject pointer From: Alexey Starikovskiy NextObject field was used for double objects (removed by prev patch) and for data objects. Data object size is now untangled from all other object sizes, so we can save size of pointer in all object allocations. Signed-off-by: Alexey Starikovskiy --- source/components/namespace/nsobject.c | 38 ++++++-------------------------- source/components/utilities/utcopy.c | 13 ++++++++--- source/include/aclocal.h | 4 ++- source/include/acobject.h | 3 +-- 4 files changed, 19 insertions(+), 39 deletions(-) diff --git a/source/components/namespace/nsobject.c b/source/components/namespace/nsobject.c index 9191e79..10e1b4d 100644 --- a/source/components/namespace/nsobject.c +++ b/source/components/namespace/nsobject.c @@ -154,7 +154,6 @@ AcpiNsAttachObject ( ACPI_OBJECT_TYPE Type) { ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *LastObjDesc; ACPI_OBJECT_TYPE ObjectType = ACPI_TYPE_ANY; @@ -255,19 +254,6 @@ AcpiNsAttachObject ( */ AcpiUtAddReference (ObjDesc); - /* - * Handle objects with multiple descriptors - walk - * to the end of the descriptor list - */ - LastObjDesc = ObjDesc; - while (LastObjDesc->Common.NextObject) - { - LastObjDesc = LastObjDesc->Common.NextObject; - } - - /* Install the object at the front of the object list */ - - LastObjDesc->Common.NextObject = Node->Object; } Node->Type = (UINT8) ObjectType; @@ -312,15 +298,6 @@ AcpiNsDetachObject ( /* Clear the entry in all cases */ Node->Object = NULL; - if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) - { - Node->Object = ObjDesc->Common.NextObject; - if (Node->Object && - ((Node->Object)->Common.Type != ACPI_TYPE_LOCAL_DATA)) - { - Node->Object = Node->Object->Common.NextObject; - } - } /* Reset the node type to untyped */ @@ -404,14 +381,13 @@ AcpiNsAttachData ( ObjDesc = Node->Object; while (ObjDesc) { - if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) && - (ObjDesc->Data.Handler == Handler)) + if (ObjDesc->Data.Handler == Handler) { return (AE_ALREADY_EXISTS); } PrevObjDesc = ObjDesc; - ObjDesc = ObjDesc->Common.NextObject; + ObjDesc = ObjDesc->Data.Next; } /* Create an internal object for the data */ @@ -429,7 +405,7 @@ AcpiNsAttachData ( if (PrevObjDesc) { - PrevObjDesc->Common.NextObject = DataDesc; + PrevObjDesc->Data.Next = DataDesc; } else { @@ -472,11 +448,11 @@ AcpiNsDetachData ( { if (PrevObjDesc) { - PrevObjDesc->Common.NextObject = ObjDesc->Common.NextObject; + PrevObjDesc->Data.Next = ObjDesc->Data.Next; } else { - Node->Object = ObjDesc->Common.NextObject; + Node->Object = ObjDesc->Data.Next; } AcpiUtRemoveReference (ObjDesc); @@ -484,7 +460,7 @@ AcpiNsDetachData ( } PrevObjDesc = ObjDesc; - ObjDesc = ObjDesc->Common.NextObject; + ObjDesc = ObjDesc->Data.Next; } return (AE_NOT_FOUND); @@ -525,7 +501,7 @@ AcpiNsGetAttachedData ( return (AE_OK); } - ObjDesc = ObjDesc->Common.NextObject; + ObjDesc = ObjDesc->Data.Next; } return (AE_NOT_FOUND); diff --git a/source/components/utilities/utcopy.c b/source/components/utilities/utcopy.c index 785c313..192db88 100644 --- a/source/components/utilities/utcopy.c +++ b/source/components/utilities/utcopy.c @@ -795,14 +795,17 @@ AcpiUtCopySimpleObject ( ACPI_OPERAND_OBJECT *DestDesc) { UINT16 ReferenceCount; - ACPI_OPERAND_OBJECT *NextObject; + ACPI_OPERAND_OBJECT *NextObject = NULL; ACPI_STATUS Status; /* Save fields from destination that we don't want to overwrite */ ReferenceCount = DestDesc->Common.ReferenceCount; - NextObject = DestDesc->Common.NextObject; + if (DestDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) + { + NextObject = DestDesc->Data.Next; + } /* Copy the entire source object over the destination object*/ @@ -812,8 +815,10 @@ AcpiUtCopySimpleObject ( /* Restore the saved fields */ DestDesc->Common.ReferenceCount = ReferenceCount; - DestDesc->Common.NextObject = NextObject; - + if (DestDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) + { + DestDesc->Data.Next = NextObject; + } /* New object is not static, regardless of source */ DestDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER; diff --git a/source/include/aclocal.h b/source/include/aclocal.h index 94c8d69..e7e9c7b 100644 --- a/source/include/aclocal.h +++ b/source/include/aclocal.h @@ -269,7 +269,6 @@ typedef enum */ typedef struct acpi_namespace_node { - union acpi_operand_object *Object; /* Interpreter object */ UINT8 DescriptorType; /* Differentiate object descriptor types */ UINT8 Type; /* ACPI Type associated with this name */ UINT8 Flags; /* Miscellaneous flags */ @@ -277,6 +276,7 @@ typedef struct acpi_namespace_node ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */ struct acpi_namespace_node *Child; /* First child */ struct acpi_namespace_node *Peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */ + union acpi_operand_object *Object; /* Interpreter object */ /* * The following fields are used by the ASL compiler and disassembler only @@ -852,11 +852,11 @@ typedef union acpi_parse_value #endif #define ACPI_PARSE_COMMON \ - union acpi_parse_object *Parent; /* Parent op */\ UINT8 DescriptorType; /* To differentiate various internal objs */\ UINT8 Flags; /* Type of Op */\ UINT16 AmlOpcode; /* AML opcode */\ UINT32 AmlOffset; /* Offset of declaration in AML */\ + union acpi_parse_object *Parent; /* Parent op */\ union acpi_parse_object *Next; /* Next op */\ ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\ ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\ diff --git a/source/include/acobject.h b/source/include/acobject.h index b9ec463..737935c 100644 --- a/source/include/acobject.h +++ b/source/include/acobject.h @@ -152,7 +152,6 @@ * structures. */ #define ACPI_OBJECT_COMMON_HEADER \ - union acpi_operand_object *NextObject; /* Objects linked to parent NS node */\ UINT8 DescriptorType; /* To differentiate various internal objs */\ UINT8 Type; /* ACPI_OBJECT_TYPE */\ UINT16 ReferenceCount; /* For object deletion management */\ @@ -524,6 +523,7 @@ typedef enum typedef struct acpi_object_data { ACPI_OBJECT_COMMON_HEADER + union acpi_operand_object *Next; /* Objects linked to parent NS node */ ACPI_OBJECT_HANDLER Handler; void *Pointer; @@ -610,7 +610,6 @@ typedef union acpi_operand_object typedef struct acpi_common_descriptor { - void *CommonPointer; UINT8 DescriptorType; /* To differentiate various internal objs */ } ACPI_COMMON_DESCRIPTOR;