Added cache buffer for namestrings

date	2001.05.14.15.51.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 16:15:00 +00:00
parent 79c10ca9c5
commit e8d8118555

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslutils -- compiler utilities
* $Revision: 1.31 $
* $Revision: 1.33 $
*
*****************************************************************************/
@ -161,6 +161,9 @@ UtLocalCalloc (
exit (1);
}
TotalAllocations++;
TotalAllocated += Size;
return Allocated;
}
@ -409,6 +412,93 @@ UtCheckIntegerRange (
}
/*******************************************************************************
*
* FUNCTION: UtGetStringBuffer
*
* PARAMETERS: None
*
* RETURN: Pointer to the buffer. Aborts on allocation failure
*
* DESCRIPTION: Allocate a string buffer. Bypass the local
* dynamic memory manager for performance reasons (This has a
* major impact on the speed of the compiler.)
*
******************************************************************************/
NATIVE_CHAR *
UtGetStringBuffer (
UINT32 Length)
{
NATIVE_CHAR *Buffer;
if ((Gbl_StringCacheNext + Length) >= Gbl_StringCacheLast)
{
Gbl_StringCacheNext = UtLocalCalloc (ASL_STRING_CACHE_SIZE + Length);
Gbl_StringCacheLast = Gbl_StringCacheNext + ASL_STRING_CACHE_SIZE + Length;
}
Buffer = Gbl_StringCacheNext;
Gbl_StringCacheNext += Length;
return (Buffer);
}
/*******************************************************************************
*
* FUNCTION: UtInternalizeName
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Convert an external (ASL) name to an internal (AML) name
*
******************************************************************************/
ACPI_STATUS
UtInternalizeName (
NATIVE_CHAR *ExternalName,
NATIVE_CHAR **ConvertedName)
{
ACPI_NAMESTRING_INFO Info;
ACPI_STATUS Status;
if (!ExternalName)
{
return (AE_OK);
}
/* Get the length of the new internal name */
Info.ExternalName = ExternalName;
AcpiNsGetInternalNameLength (&Info);
/* We need a segment to store the internal name */
Info.InternalName = UtGetStringBuffer (Info.Length);
if (!Info.InternalName)
{
return (AE_NO_MEMORY);
}
/* Build the name */
Status = AcpiNsBuildInternalName (&Info);
if (ACPI_FAILURE (Status))
{
return (Status);
}
*ConvertedName = Info.InternalName;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: UtAttachNamepathToOwner
@ -434,7 +524,7 @@ UtAttachNamepathToOwner (
Node->ExternalName = NameNode->Value.String;
Status = AcpiNsInternalizeName (NameNode->Value.String, &Node->Namepath);
Status = UtInternalizeName (NameNode->Value.String, &Node->Namepath);
if (ACPI_FAILURE (Status))
{
/* TBD: abort on no memory */