mirror of
https://github.com/acpica/acpica/
synced 2025-03-10 16:21:40 +03:00
Performance enhancement: Local "cache" of parse nodes.
date 2001.05.11.17.22.00; author rmoore1; state Exp;
This commit is contained in:
parent
6d57bd4ae5
commit
612ad11edb
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: asltree - parse tree management
|
||||
* $Revision: 1.29 $
|
||||
* $Revision: 1.30 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -122,6 +122,36 @@
|
||||
#define _COMPONENT ACPI_COMPILER
|
||||
MODULE_NAME ("asltree")
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: TrGetNextNode
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: New parse node. Aborts on allocation failure
|
||||
*
|
||||
* DESCRIPTION: Allocate a new parse node for the parse tree. Bypass the local
|
||||
* dynamic memory manager for performance reasons (This has a
|
||||
* major impact on the speed of the compiler.)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ASL_PARSE_NODE *
|
||||
TrGetNextNode (void)
|
||||
{
|
||||
|
||||
if (Gbl_NodeCacheNext >= Gbl_NodeCacheLast)
|
||||
{
|
||||
Gbl_NodeCacheNext = UtLocalCalloc (sizeof (ASL_PARSE_NODE) * ASL_NODE_CACHE_SIZE);
|
||||
Gbl_NodeCacheLast = Gbl_NodeCacheNext + ASL_NODE_CACHE_SIZE;
|
||||
}
|
||||
|
||||
return (Gbl_NodeCacheNext++);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: TrAllocateNode
|
||||
@ -141,7 +171,7 @@ TrAllocateNode (
|
||||
ASL_PARSE_NODE *Node;
|
||||
|
||||
|
||||
Node = UtLocalCalloc (sizeof (ASL_PARSE_NODE));
|
||||
Node = TrGetNextNode ();
|
||||
|
||||
Node->ParseOpcode = (UINT16) ParseOpcode;
|
||||
Node->Filename = Gbl_Files[ASL_FILE_INPUT].Filename;
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aslutils -- compiler utilities
|
||||
* $Revision: 1.29 $
|
||||
* $Revision: 1.32 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -130,7 +130,6 @@ extern const char * const yytname[];
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: UtLocalCalloc
|
||||
@ -152,7 +151,7 @@ UtLocalCalloc (
|
||||
void *Allocated;
|
||||
|
||||
|
||||
Allocated = AcpiCmCallocate (Size);
|
||||
Allocated = AcpiUtCallocate (Size);
|
||||
if (!Allocated)
|
||||
{
|
||||
AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
|
||||
@ -162,6 +161,9 @@ UtLocalCalloc (
|
||||
exit (1);
|
||||
}
|
||||
|
||||
TotalAllocations++;
|
||||
TotalAllocated += Size;
|
||||
|
||||
return Allocated;
|
||||
}
|
||||
|
||||
@ -340,20 +342,20 @@ UtDisplaySummary (
|
||||
{
|
||||
|
||||
|
||||
FlPrintFile (FileId,
|
||||
FlPrintFile (FileId,
|
||||
"Compilation complete. %d Errors %d Warnings\n",
|
||||
Gbl_ExceptionCount[ASL_ERROR], Gbl_ExceptionCount[ASL_WARNING]);
|
||||
|
||||
FlPrintFile (FileId,
|
||||
FlPrintFile (FileId,
|
||||
"ASL Input: %s - %d lines, %d bytes, %d keywords\n",
|
||||
Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber,
|
||||
Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber,
|
||||
Gbl_InputByteCount, TotalKeywords);
|
||||
|
||||
if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors))
|
||||
{
|
||||
FlPrintFile (FileId,
|
||||
FlPrintFile (FileId,
|
||||
"AML Output: %s - %d bytes %d named objects %d executable opcodes\n\n",
|
||||
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength,
|
||||
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength,
|
||||
TotalNamedObjects, TotalExecutableOpcodes);
|
||||
}
|
||||
}
|
||||
@ -402,7 +404,7 @@ UtCheckIntegerRange (
|
||||
{
|
||||
sprintf (Buffer, "%s 0x%X-0x%X", ParseError, LowValue, HighValue);
|
||||
AslCompilererror (Buffer);
|
||||
AcpiCmFree (Node);
|
||||
AcpiUtFree (Node);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user