summaryrefslogtreecommitdiff
path: root/source/compiler/asloperands.c
diff options
context:
space:
mode:
authorErik Schmauss <erik.schmauss@intel.com>2019-01-29 17:09:39 -0800
committerErik Schmauss <erik.schmauss@intel.com>2019-04-02 17:09:37 -0700
commit997f6ca123771073a6f62738734a561d2dd056ac (patch)
tree0e8b91e4f33a18c31d54ce0c0afa5f010ab811ab /source/compiler/asloperands.c
parentfbff97048d30e1932bd68a99556b16357e4a670b (diff)
downloadacpica-997f6ca123771073a6f62738734a561d2dd056ac.tar.gz
iASL: perform analysis and code generation after parsing all tables
Performing parse tree analysis on all definition blocks simultaneously results in more effective namespace cross-reference. This enables iASL static analysis to determine unresolved external declarations and namespace collisions during compilation. In order to take advantage of this, compile definition blocks with the following command: iasl dsdt.asl ssdt1.asl ssdt2.asl ... *** Changes related to multiple files: Keep track of all files in a global list that is persistent throughout compilation of both files. This is done in order to compile multiple ASL files in the same namespace and parse tree. This also resulted in moving the file handle assignment for the -vi option during file initialization rather than commandline processing. As each definition block is parsed, it is connected as a sibling node to the previous definiton block. *** Changes related to iASL error reporting: Also, more error messages were added by replacing the fprintf to stderr with AslError. By doing so, an error can be logged properly and AML output files will be cleaned if there is a compiler error. Adds the ability to print the correct source line by logging the .src filename in each error node. This is necessary for errors that point to an include file. New iASL error: emitting an error when compiling duplicate files. Ignore max error count when compiling with -f because compilation needs to continue. Fix parser error path to correctly abort compilation rather than trying to proceed with more compilation. *** Changes related to codegen behavior: Seek to the end of the AML output file after codegen in case multiple definition blocks need to be encoded in the same AML file. This makes other parts of the codebase a little more convinent since it doesn't have to seek to the correct place in the AML. *** Misc changes: Remove a call to ACPI_FREE. We should never be calling ACPI_FREE in memory allocated in caches. Display compilation summaries for multiple input files. Files that have parser errors are reported as having parser errors. The summary is based on the global file list. Encapsulate global variables in global file nodes used for summary reporting. Final cleanup functions for iASL has been consolidated to the main() function for simplicity. Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Diffstat (limited to 'source/compiler/asloperands.c')
-rw-r--r--source/compiler/asloperands.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source/compiler/asloperands.c b/source/compiler/asloperands.c
index 67e16fd58..4f4b636d5 100644
--- a/source/compiler/asloperands.c
+++ b/source/compiler/asloperands.c
@@ -1045,6 +1045,7 @@ OpnDoDefinitionBlock (
ACPI_SIZE Length;
UINT32 i;
char *Filename;
+ ACPI_STATUS Status;
/*
@@ -1063,6 +1064,12 @@ OpnDoDefinitionBlock (
(AslGbl_UseDefaultAmlFilename))
{
/*
+ * The walk may traverse multiple definition blocks. Switch files
+ * to ensure that the correct files are manipulated.
+ */
+ FlSwitchFileSet (Op->Asl.Filename);
+
+ /*
* We will use the AML filename that is embedded in the source file
* for the output filename.
*/
@@ -1076,6 +1083,22 @@ OpnDoDefinitionBlock (
AslGbl_OutputFilenamePrefix = Filename;
UtConvertBackslashes (AslGbl_OutputFilenamePrefix);
+
+ /*
+ * Use the definition block file parameter instead of the input
+ * filename. Since all files were opened previously, remove the
+ * existing file and open a new file with the name of this
+ * definiton block parameter. Since AML code generation has yet
+ * to happen, the previous file can be removed without any impacts.
+ */
+ FlCloseFile (ASL_FILE_AML_OUTPUT);
+ FlDeleteFile (ASL_FILE_AML_OUTPUT);
+ Status = FlOpenAmlOutputFile (AslGbl_OutputFilenamePrefix);
+ if (ACPI_FAILURE (Status))
+ {
+ AslError (ASL_ERROR, ASL_MSG_OUTPUT_FILE_OPEN, NULL, NULL);
+ return;
+ }
}
Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
@@ -1086,6 +1109,7 @@ OpnDoDefinitionBlock (
Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
if (Child->Asl.Value.String)
{
+ AslGbl_FilesList->TableSignature = Child->Asl.Value.String;
AslGbl_TableSignature = Child->Asl.Value.String;
if (strlen (AslGbl_TableSignature) != ACPI_NAMESEG_SIZE)
{
@@ -1138,6 +1162,7 @@ OpnDoDefinitionBlock (
AslGbl_TableId = UtLocalCacheCalloc (Length + 1);
strcpy (AslGbl_TableId, Child->Asl.Value.String);
+ AslGbl_FilesList->TableId = AslGbl_TableId;
/*
* Convert anything non-alphanumeric to an underscore. This