diff options
Diffstat (limited to 'source/compiler/asloperands.c')
-rw-r--r-- | source/compiler/asloperands.c | 57 |
1 files changed, 39 insertions, 18 deletions
diff --git a/source/compiler/asloperands.c b/source/compiler/asloperands.c index 1d1a1a94bfcb..d46d9ff22286 100644 --- a/source/compiler/asloperands.c +++ b/source/compiler/asloperands.c @@ -429,14 +429,35 @@ OpnDoFieldCommon ( Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; } - else if ((NewBitOffset == CurrentBitOffset) && Gbl_OptimizeTrivialParseNodes) + else if (NewBitOffset == CurrentBitOffset) { /* - * Offset is redundant; we don't need to output an - * offset opcode. Just set these nodes to default + * This Offset() operator is redundant and not needed, + * because the offset value is the same as the current + * offset. */ - Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; + AslError (ASL_REMARK, ASL_MSG_OFFSET, PkgLengthNode, NULL); + + if (AslGbl_OptimizeTrivialParseNodes) + { + /* + * Optimize this Offset() operator by removing/ignoring + * it. Set the related nodes to default. + */ + Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; + PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; + + AslError (ASL_OPTIMIZATION, ASL_MSG_OFFSET, PkgLengthNode, + "Optimizer has removed statement"); + } + else + { + /* Optimization is disabled, treat as a valid Offset */ + + PkgLengthNode->Asl.Value.Integer = + NewBitOffset - CurrentBitOffset; + CurrentBitOffset = NewBitOffset; + } } else { @@ -461,7 +482,7 @@ OpnDoFieldCommon ( if ((NewBitOffset == 0) && (Next->Asl.ParseOpcode == PARSEOP_RESERVED_BYTES) && - Gbl_OptimizeTrivialParseNodes) + AslGbl_OptimizeTrivialParseNodes) { /* * Unnamed field with a bit length of zero. We can @@ -1031,22 +1052,22 @@ OpnDoDefinitionBlock ( Child = Op->Asl.Child; if (Child->Asl.Value.Buffer && *Child->Asl.Value.Buffer && - (Gbl_UseDefaultAmlFilename)) + (AslGbl_UseDefaultAmlFilename)) { /* * We will use the AML filename that is embedded in the source file * for the output filename. */ - Filename = UtLocalCacheCalloc (strlen (Gbl_DirectoryPath) + + Filename = UtLocalCacheCalloc (strlen (AslGbl_DirectoryPath) + strlen ((char *) Child->Asl.Value.Buffer) + 1); /* Prepend the current directory path */ - strcpy (Filename, Gbl_DirectoryPath); + strcpy (Filename, AslGbl_DirectoryPath); strcat (Filename, (char *) Child->Asl.Value.Buffer); - Gbl_OutputFilenamePrefix = Filename; - UtConvertBackslashes (Gbl_OutputFilenamePrefix); + AslGbl_OutputFilenamePrefix = Filename; + UtConvertBackslashes (AslGbl_OutputFilenamePrefix); } Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; @@ -1057,8 +1078,8 @@ OpnDoDefinitionBlock ( Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; if (Child->Asl.Value.String) { - Gbl_TableSignature = Child->Asl.Value.String; - if (strlen (Gbl_TableSignature) != ACPI_NAME_SIZE) + AslGbl_TableSignature = Child->Asl.Value.String; + if (strlen (AslGbl_TableSignature) != ACPI_NAME_SIZE) { AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, "Length must be exactly 4 characters"); @@ -1066,7 +1087,7 @@ OpnDoDefinitionBlock ( for (i = 0; i < ACPI_NAME_SIZE; i++) { - if (!isalnum ((int) Gbl_TableSignature[i])) + if (!isalnum ((int) AslGbl_TableSignature[i])) { AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, "Contains non-alphanumeric characters"); @@ -1107,8 +1128,8 @@ OpnDoDefinitionBlock ( "Length cannot exceed 8 characters"); } - Gbl_TableId = UtLocalCacheCalloc (Length + 1); - strcpy (Gbl_TableId, Child->Asl.Value.String); + AslGbl_TableId = UtLocalCacheCalloc (Length + 1); + strcpy (AslGbl_TableId, Child->Asl.Value.String); /* * Convert anything non-alphanumeric to an underscore. This @@ -1116,9 +1137,9 @@ OpnDoDefinitionBlock ( */ for (i = 0; i < Length; i++) { - if (!isalnum ((int) Gbl_TableId[i])) + if (!isalnum ((int) AslGbl_TableId[i])) { - Gbl_TableId[i] = '_'; + AslGbl_TableId[i] = '_'; } } } |