From 49dec9f2b8e8f0b15f787544731fe34173de8c38 Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Wed, 24 Oct 2012 12:59:50 -0700 Subject: Performance enhancement for ACPI package objects. This change greatly increases the performance of package objects within the interpreter. It changes the processing of reference counts for packages by optimizing for the most common case where the package subobjects are either integers, strings, or buffers. Increases the performance of the ASLTS test suite by 1.5X. Chao Guan. ACPICA BZ 943. --- source/components/utilities/utdelete.c | 40 ++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/source/components/utilities/utdelete.c b/source/components/utilities/utdelete.c index 517f9c7bb..515ceebe4 100644 --- a/source/components/utilities/utdelete.c +++ b/source/components/utilities/utdelete.c @@ -649,17 +649,43 @@ AcpiUtUpdateObjectReference ( for (i = 0; i < Object->Package.Count; i++) { /* - * Push each element onto the stack for later processing. - * Note: There can be null elements within the package, - * these are simply ignored + * Null package elements are legal and can be simply + * ignored. */ - Status = AcpiUtCreateUpdateStateAndPush ( - Object->Package.Elements[i], Action, &StateList); - if (ACPI_FAILURE (Status)) + NextObject = Object->Package.Elements[i]; + if (!NextObject) { - goto ErrorExit; + continue; + } + + switch (NextObject->Common.Type) + { + case ACPI_TYPE_INTEGER: + case ACPI_TYPE_STRING: + case ACPI_TYPE_BUFFER: + /* + * For these very simple sub-objects, we can just + * update the reference count here and continue. + * Greatly increases performance of this operation. + */ + AcpiUtUpdateRefCount (NextObject, Action); + break; + + default: + /* + * For complex sub-objects, push them onto the stack + * for later processing (this eliminates recursion.) + */ + Status = AcpiUtCreateUpdateStateAndPush ( + NextObject, Action, &StateList); + if (ACPI_FAILURE (Status)) + { + goto ErrorExit; + } + break; } } + NextObject = NULL; break; case ACPI_TYPE_BUFFER_FIELD: -- cgit v1.2.1