1 /****************************************************************************** 2 * 3 * Module Name: aslcompile - top level compile module 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2015, Intel Corp. 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions, and the following disclaimer, 16 * without modification. 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18 * substantially similar to the "NO WARRANTY" disclaimer below 19 * ("Disclaimer") and any redistribution must be conditioned upon 20 * including a substantially similar Disclaimer requirement for further 21 * binary redistribution. 22 * 3. Neither the names of the above-listed copyright holders nor the names 23 * of any contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * Alternatively, this software may be distributed under the terms of the 27 * GNU General Public License ("GPL") version 2 as published by the Free 28 * Software Foundation. 29 * 30 * NO WARRANTY 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 * POSSIBILITY OF SUCH DAMAGES. 42 */ 43 44 #include "aslcompiler.h" 45 #include "dtcompiler.h" 46 #include "acnamesp.h" 47 48 #include <stdio.h> 49 #include <time.h> 50 #include <acapps.h> 51 52 #define _COMPONENT ACPI_COMPILER 53 ACPI_MODULE_NAME ("aslcompile") 54 55 /* 56 * Main parser entry 57 * External is here in case the parser emits the same external in the 58 * generated header. (Newer versions of Bison) 59 */ 60 int 61 AslCompilerparse( 62 void); 63 64 /* Local prototypes */ 65 66 static void 67 CmFlushSourceCode ( 68 void); 69 70 static void 71 CmDumpAllEvents ( 72 void); 73 74 75 /******************************************************************************* 76 * 77 * FUNCTION: CmDoCompile 78 * 79 * PARAMETERS: None 80 * 81 * RETURN: Status (0 = OK) 82 * 83 * DESCRIPTION: This procedure performs the entire compile 84 * 85 ******************************************************************************/ 86 87 int 88 CmDoCompile ( 89 void) 90 { 91 ACPI_STATUS Status; 92 UINT8 FullCompile; 93 UINT8 Event; 94 95 96 FullCompile = UtBeginEvent ("*** Total Compile time ***"); 97 Event = UtBeginEvent ("Open input and output files"); 98 UtEndEvent (Event); 99 100 Event = UtBeginEvent ("Preprocess input file"); 101 if (Gbl_PreprocessFlag) 102 { 103 /* Preprocessor */ 104 105 PrDoPreprocess (); 106 Gbl_CurrentLineNumber = 1; 107 Gbl_LogicalLineNumber = 1; 108 109 if (Gbl_PreprocessOnly) 110 { 111 UtEndEvent (Event); 112 CmCleanupAndExit (); 113 return (0); 114 } 115 } 116 UtEndEvent (Event); 117 118 119 /* Build the parse tree */ 120 121 Event = UtBeginEvent ("Parse source code and build parse tree"); 122 AslCompilerparse(); 123 UtEndEvent (Event); 124 125 /* Check for parser-detected syntax errors */ 126 127 if (Gbl_SyntaxError) 128 { 129 fprintf (stderr, "Compiler aborting due to parser-detected syntax error(s)\n"); 130 LsDumpParseTree (); 131 goto ErrorExit; 132 } 133 134 /* Did the parse tree get successfully constructed? */ 135 136 if (!RootNode) 137 { 138 /* 139 * If there are no errors, then we have some sort of 140 * internal problem. 141 */ 142 AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, 143 NULL, "- Could not resolve parse tree root node"); 144 145 goto ErrorExit; 146 } 147 148 /* Flush out any remaining source after parse tree is complete */ 149 150 Event = UtBeginEvent ("Flush source input"); 151 CmFlushSourceCode (); 152 153 /* Prune the parse tree if requested (debug purposes only) */ 154 155 if (Gbl_PruneParseTree) 156 { 157 AslPruneParseTree (Gbl_PruneDepth, Gbl_PruneType); 158 } 159 160 /* Optional parse tree dump, compiler debug output only */ 161 162 LsDumpParseTree (); 163 164 OpcGetIntegerWidth (RootNode); 165 UtEndEvent (Event); 166 167 /* Pre-process parse tree for any operator transforms */ 168 169 Event = UtBeginEvent ("Parse tree transforms"); 170 DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n"); 171 TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, 172 TrAmlTransformWalk, NULL, NULL); 173 UtEndEvent (Event); 174 175 /* Generate AML opcodes corresponding to the parse tokens */ 176 177 Event = UtBeginEvent ("Generate AML opcodes"); 178 DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating AML opcodes\n\n"); 179 TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, 180 OpcAmlOpcodeWalk, NULL); 181 UtEndEvent (Event); 182 183 /* 184 * Now that the input is parsed, we can open the AML output file. 185 * Note: by default, the name of this file comes from the table descriptor 186 * within the input file. 187 */ 188 Event = UtBeginEvent ("Open AML output file"); 189 Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix); 190 UtEndEvent (Event); 191 if (ACPI_FAILURE (Status)) 192 { 193 AePrintErrorLog (ASL_FILE_STDERR); 194 return (-1); 195 } 196 197 /* Interpret and generate all compile-time constants */ 198 199 Event = UtBeginEvent ("Constant folding via AML interpreter"); 200 DbgPrint (ASL_DEBUG_OUTPUT, 201 "\nInterpreting compile-time constant expressions\n\n"); 202 203 if (Gbl_FoldConstants) 204 { 205 TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, 206 OpcAmlConstantWalk, NULL, NULL); 207 } 208 else 209 { 210 DbgPrint (ASL_PARSE_OUTPUT, " Optional folding disabled\n"); 211 } 212 UtEndEvent (Event); 213 214 /* Update AML opcodes if necessary, after constant folding */ 215 216 Event = UtBeginEvent ("Updating AML opcodes after constant folding"); 217 DbgPrint (ASL_DEBUG_OUTPUT, 218 "\nUpdating AML opcodes after constant folding\n\n"); 219 TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, 220 NULL, OpcAmlOpcodeUpdateWalk, NULL); 221 UtEndEvent (Event); 222 223 /* Calculate all AML package lengths */ 224 225 Event = UtBeginEvent ("Generate AML package lengths"); 226 DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n"); 227 TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, 228 LnPackageLengthWalk, NULL); 229 UtEndEvent (Event); 230 231 if (Gbl_ParseOnlyFlag) 232 { 233 AePrintErrorLog (ASL_FILE_STDERR); 234 UtDisplaySummary (ASL_FILE_STDERR); 235 if (Gbl_DebugFlag) 236 { 237 /* Print error summary to the stdout also */ 238 239 AePrintErrorLog (ASL_FILE_STDOUT); 240 UtDisplaySummary (ASL_FILE_STDOUT); 241 } 242 UtEndEvent (FullCompile); 243 return (0); 244 } 245 246 /* 247 * Create an internal namespace and use it as a symbol table 248 */ 249 250 /* Namespace loading */ 251 252 Event = UtBeginEvent ("Create ACPI Namespace"); 253 Status = LdLoadNamespace (RootNode); 254 UtEndEvent (Event); 255 if (ACPI_FAILURE (Status)) 256 { 257 goto ErrorExit; 258 } 259 260 /* Namespace cross-reference */ 261 262 AslGbl_NamespaceEvent = UtBeginEvent ("Cross reference parse tree and Namespace"); 263 Status = XfCrossReferenceNamespace (); 264 if (ACPI_FAILURE (Status)) 265 { 266 goto ErrorExit; 267 } 268 269 /* Namespace - Check for non-referenced objects */ 270 271 LkFindUnreferencedObjects (); 272 UtEndEvent (AslGbl_NamespaceEvent); 273 274 /* 275 * Semantic analysis. This can happen only after the 276 * namespace has been loaded and cross-referenced. 277 * 278 * part one - check control methods 279 */ 280 Event = UtBeginEvent ("Analyze control method return types"); 281 AnalysisWalkInfo.MethodStack = NULL; 282 283 DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method analysis\n\n"); 284 TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, 285 MtMethodAnalysisWalkBegin, 286 MtMethodAnalysisWalkEnd, &AnalysisWalkInfo); 287 UtEndEvent (Event); 288 289 /* Semantic error checking part two - typing of method returns */ 290 291 Event = UtBeginEvent ("Determine object types returned by methods"); 292 DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method typing\n\n"); 293 TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, 294 NULL, AnMethodTypingWalkEnd, NULL); 295 UtEndEvent (Event); 296 297 /* Semantic error checking part three - operand type checking */ 298 299 Event = UtBeginEvent ("Analyze AML operand types"); 300 DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Operand type checking\n\n"); 301 TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, 302 NULL, AnOperandTypecheckWalkEnd, &AnalysisWalkInfo); 303 UtEndEvent (Event); 304 305 /* Semantic error checking part four - other miscellaneous checks */ 306 307 Event = UtBeginEvent ("Miscellaneous analysis"); 308 DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - miscellaneous\n\n"); 309 TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, 310 AnOtherSemanticAnalysisWalkBegin, 311 NULL, &AnalysisWalkInfo); 312 UtEndEvent (Event); 313 314 /* Calculate all AML package lengths */ 315 316 Event = UtBeginEvent ("Finish AML package length generation"); 317 DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n"); 318 TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, 319 LnInitLengthsWalk, NULL); 320 TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, 321 LnPackageLengthWalk, NULL); 322 UtEndEvent (Event); 323 324 /* Code generation - emit the AML */ 325 326 Event = UtBeginEvent ("Generate AML code and write output files"); 327 CgGenerateAmlOutput (); 328 UtEndEvent (Event); 329 330 Event = UtBeginEvent ("Write optional output files"); 331 CmDoOutputFiles (); 332 UtEndEvent (Event); 333 334 UtEndEvent (FullCompile); 335 CmCleanupAndExit (); 336 return (0); 337 338 ErrorExit: 339 UtEndEvent (FullCompile); 340 CmCleanupAndExit (); 341 return (-1); 342 } 343 344 345 /******************************************************************************* 346 * 347 * FUNCTION: AslCompilerSignon 348 * 349 * PARAMETERS: FileId - ID of the output file 350 * 351 * RETURN: None 352 * 353 * DESCRIPTION: Display compiler signon 354 * 355 ******************************************************************************/ 356 357 void 358 AslCompilerSignon ( 359 UINT32 FileId) 360 { 361 char *Prefix = ""; 362 char *UtilityName; 363 364 365 /* Set line prefix depending on the destination file type */ 366 367 switch (FileId) 368 { 369 case ASL_FILE_ASM_SOURCE_OUTPUT: 370 case ASL_FILE_ASM_INCLUDE_OUTPUT: 371 372 Prefix = "; "; 373 break; 374 375 case ASL_FILE_HEX_OUTPUT: 376 377 if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM) 378 { 379 Prefix = "; "; 380 } 381 else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) || 382 (Gbl_HexOutputFlag == HEX_OUTPUT_ASL)) 383 { 384 FlPrintFile (ASL_FILE_HEX_OUTPUT, "/*\n"); 385 Prefix = " * "; 386 } 387 break; 388 389 case ASL_FILE_C_SOURCE_OUTPUT: 390 case ASL_FILE_C_OFFSET_OUTPUT: 391 case ASL_FILE_C_INCLUDE_OUTPUT: 392 393 Prefix = " * "; 394 break; 395 396 default: 397 398 /* No other output types supported */ 399 400 break; 401 } 402 403 /* Running compiler or disassembler? */ 404 405 if (Gbl_DisasmFlag) 406 { 407 UtilityName = AML_DISASSEMBLER_NAME; 408 } 409 else 410 { 411 UtilityName = ASL_COMPILER_NAME; 412 } 413 414 /* Compiler signon with copyright */ 415 416 FlPrintFile (FileId, "%s\n", Prefix); 417 FlPrintFile (FileId, ACPI_COMMON_HEADER (UtilityName, Prefix)); 418 } 419 420 421 /******************************************************************************* 422 * 423 * FUNCTION: AslCompilerFileHeader 424 * 425 * PARAMETERS: FileId - ID of the output file 426 * 427 * RETURN: None 428 * 429 * DESCRIPTION: Header used at the beginning of output files 430 * 431 ******************************************************************************/ 432 433 void 434 AslCompilerFileHeader ( 435 UINT32 FileId) 436 { 437 struct tm *NewTime; 438 time_t Aclock; 439 char *Prefix = ""; 440 441 442 /* Set line prefix depending on the destination file type */ 443 444 switch (FileId) 445 { 446 case ASL_FILE_ASM_SOURCE_OUTPUT: 447 case ASL_FILE_ASM_INCLUDE_OUTPUT: 448 449 Prefix = "; "; 450 break; 451 452 case ASL_FILE_HEX_OUTPUT: 453 454 if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM) 455 { 456 Prefix = "; "; 457 } 458 else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) || 459 (Gbl_HexOutputFlag == HEX_OUTPUT_ASL)) 460 { 461 Prefix = " * "; 462 } 463 break; 464 465 case ASL_FILE_C_SOURCE_OUTPUT: 466 case ASL_FILE_C_OFFSET_OUTPUT: 467 case ASL_FILE_C_INCLUDE_OUTPUT: 468 469 Prefix = " * "; 470 break; 471 472 default: 473 474 /* No other output types supported */ 475 476 break; 477 } 478 479 /* Compilation header with timestamp */ 480 481 (void) time (&Aclock); 482 NewTime = localtime (&Aclock); 483 484 FlPrintFile (FileId, 485 "%sCompilation of \"%s\" - %s%s\n", 486 Prefix, Gbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime), 487 Prefix); 488 489 switch (FileId) 490 { 491 case ASL_FILE_C_SOURCE_OUTPUT: 492 case ASL_FILE_C_OFFSET_OUTPUT: 493 case ASL_FILE_C_INCLUDE_OUTPUT: 494 495 FlPrintFile (FileId, " */\n"); 496 break; 497 498 default: 499 500 /* Nothing to do for other output types */ 501 502 break; 503 } 504 } 505 506 507 /******************************************************************************* 508 * 509 * FUNCTION: CmFlushSourceCode 510 * 511 * PARAMETERS: None 512 * 513 * RETURN: None 514 * 515 * DESCRIPTION: Read in any remaining source code after the parse tree 516 * has been constructed. 517 * 518 ******************************************************************************/ 519 520 static void 521 CmFlushSourceCode ( 522 void) 523 { 524 char Buffer; 525 526 527 while (FlReadFile (ASL_FILE_INPUT, &Buffer, 1) != AE_ERROR) 528 { 529 AslInsertLineBuffer ((int) Buffer); 530 } 531 532 AslResetCurrentLineBuffer (); 533 } 534 535 536 /******************************************************************************* 537 * 538 * FUNCTION: CmDoOutputFiles 539 * 540 * PARAMETERS: None 541 * 542 * RETURN: None. 543 * 544 * DESCRIPTION: Create all "listing" type files 545 * 546 ******************************************************************************/ 547 548 void 549 CmDoOutputFiles ( 550 void) 551 { 552 553 /* Create listings and hex files */ 554 555 LsDoListings (); 556 HxDoHexOutput (); 557 558 /* Dump the namespace to the .nsp file if requested */ 559 560 (void) NsDisplayNamespace (); 561 562 /* Dump the device mapping file */ 563 564 MpEmitMappingInfo (); 565 } 566 567 568 /******************************************************************************* 569 * 570 * FUNCTION: CmDumpAllEvents 571 * 572 * PARAMETERS: None 573 * 574 * RETURN: None. 575 * 576 * DESCRIPTION: Dump all compiler events 577 * 578 ******************************************************************************/ 579 580 static void 581 CmDumpAllEvents ( 582 void) 583 { 584 ASL_EVENT_INFO *Event; 585 UINT32 Delta; 586 UINT32 USec; 587 UINT32 MSec; 588 UINT32 i; 589 590 591 Event = AslGbl_Events; 592 593 DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n"); 594 if (Gbl_CompileTimesFlag) 595 { 596 printf ("\nElapsed time for major events\n\n"); 597 } 598 599 for (i = 0; i < AslGbl_NextEvent; i++) 600 { 601 if (Event->Valid) 602 { 603 /* Delta will be in 100-nanosecond units */ 604 605 Delta = (UINT32) (Event->EndTime - Event->StartTime); 606 607 USec = Delta / ACPI_100NSEC_PER_USEC; 608 MSec = Delta / ACPI_100NSEC_PER_MSEC; 609 610 /* Round milliseconds up */ 611 612 if ((USec - (MSec * ACPI_USEC_PER_MSEC)) >= 500) 613 { 614 MSec++; 615 } 616 617 DbgPrint (ASL_DEBUG_OUTPUT, "%8u usec %8u msec - %s\n", 618 USec, MSec, Event->EventName); 619 620 if (Gbl_CompileTimesFlag) 621 { 622 printf ("%8u usec %8u msec - %s\n", 623 USec, MSec, Event->EventName); 624 } 625 } 626 627 Event++; 628 } 629 } 630 631 632 /******************************************************************************* 633 * 634 * FUNCTION: CmCleanupAndExit 635 * 636 * PARAMETERS: None 637 * 638 * RETURN: None. 639 * 640 * DESCRIPTION: Close all open files and exit the compiler 641 * 642 ******************************************************************************/ 643 644 void 645 CmCleanupAndExit ( 646 void) 647 { 648 UINT32 i; 649 BOOLEAN DeleteAmlFile = FALSE; 650 651 652 AePrintErrorLog (ASL_FILE_STDERR); 653 if (Gbl_DebugFlag) 654 { 655 /* Print error summary to stdout also */ 656 657 AePrintErrorLog (ASL_FILE_STDOUT); 658 } 659 660 /* Emit compile times if enabled */ 661 662 CmDumpAllEvents (); 663 664 if (Gbl_CompileTimesFlag) 665 { 666 printf ("\nMiscellaneous compile statistics\n\n"); 667 printf ("%11u : %s\n", TotalParseNodes, "Parse nodes"); 668 printf ("%11u : %s\n", Gbl_NsLookupCount, "Namespace searches"); 669 printf ("%11u : %s\n", TotalNamedObjects, "Named objects"); 670 printf ("%11u : %s\n", TotalMethods, "Control methods"); 671 printf ("%11u : %s\n", TotalAllocations, "Memory Allocations"); 672 printf ("%11u : %s\n", TotalAllocated, "Total allocated memory"); 673 printf ("%11u : %s\n", TotalFolds, "Constant subtrees folded"); 674 printf ("\n"); 675 } 676 677 if (Gbl_NsLookupCount) 678 { 679 DbgPrint (ASL_DEBUG_OUTPUT, 680 "\n\nMiscellaneous compile statistics\n\n"); 681 682 DbgPrint (ASL_DEBUG_OUTPUT, 683 "%32s : %u\n", "Total Namespace searches", 684 Gbl_NsLookupCount); 685 686 DbgPrint (ASL_DEBUG_OUTPUT, 687 "%32s : %u usec\n", "Time per search", ((UINT32) 688 (AslGbl_Events[AslGbl_NamespaceEvent].EndTime - 689 AslGbl_Events[AslGbl_NamespaceEvent].StartTime) / 10) / 690 Gbl_NsLookupCount); 691 } 692 693 if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) 694 { 695 printf ("\nMaximum error count (%u) exceeded\n", 696 ASL_MAX_ERROR_COUNT); 697 } 698 699 UtDisplaySummary (ASL_FILE_STDOUT); 700 701 /* 702 * We will delete the AML file if there are errors and the 703 * force AML output option has not been used. 704 */ 705 if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && 706 (!Gbl_IgnoreErrors) && 707 Gbl_Files[ASL_FILE_AML_OUTPUT].Handle) 708 { 709 DeleteAmlFile = TRUE; 710 } 711 712 /* Close all open files */ 713 714 /* 715 * Take care with the preprocessor file (.pre), it might be the same 716 * as the "input" file, depending on where the compiler has terminated 717 * or aborted. Prevent attempt to close the same file twice in 718 * loop below. 719 */ 720 if (Gbl_Files[ASL_FILE_PREPROCESSOR].Handle == 721 Gbl_Files[ASL_FILE_INPUT].Handle) 722 { 723 Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; 724 } 725 726 /* Close the standard I/O files */ 727 728 for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) 729 { 730 FlCloseFile (i); 731 } 732 733 /* Delete AML file if there are errors */ 734 735 if (DeleteAmlFile) 736 { 737 FlDeleteFile (ASL_FILE_AML_OUTPUT); 738 } 739 740 /* Delete the preprocessor temp file unless full debug was specified */ 741 742 if (Gbl_PreprocessFlag && !Gbl_KeepPreprocessorTempFile) 743 { 744 FlDeleteFile (ASL_FILE_PREPROCESSOR); 745 } 746 747 /* 748 * Delete intermediate ("combined") source file (if -ls flag not set) 749 * This file is created during normal ASL/AML compiles. It is not 750 * created by the data table compiler. 751 * 752 * If the -ls flag is set, then the .SRC file should not be deleted. 753 * In this case, Gbl_SourceOutputFlag is set to TRUE. 754 * 755 * Note: Handles are cleared by FlCloseFile above, so we look at the 756 * filename instead, to determine if the .SRC file was actually 757 * created. 758 */ 759 if (!Gbl_SourceOutputFlag) 760 { 761 FlDeleteFile (ASL_FILE_SOURCE_OUTPUT); 762 } 763 764 /* Final cleanup after compiling one file */ 765 766 CmDeleteCaches (); 767 } 768 769 770 /******************************************************************************* 771 * 772 * FUNCTION: CmDeleteCaches 773 * 774 * PARAMETERS: None 775 * 776 * RETURN: None 777 * 778 * DESCRIPTION: Delete all local cache buffer blocks 779 * 780 ******************************************************************************/ 781 782 void 783 CmDeleteCaches ( 784 void) 785 { 786 UINT32 BufferCount; 787 ASL_CACHE_INFO *Next; 788 789 790 /* Parse Op cache */ 791 792 BufferCount = 0; 793 while (Gbl_ParseOpCacheList) 794 { 795 Next = Gbl_ParseOpCacheList->Next; 796 ACPI_FREE (Gbl_ParseOpCacheList); 797 Gbl_ParseOpCacheList = Next; 798 BufferCount++; 799 } 800 801 DbgPrint (ASL_DEBUG_OUTPUT, 802 "%u ParseOps, Buffer size: %u ops (%u bytes), %u Buffers\n", 803 Gbl_ParseOpCount, ASL_PARSEOP_CACHE_SIZE, 804 (sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE), BufferCount); 805 806 Gbl_ParseOpCount = 0; 807 Gbl_ParseOpCacheNext = NULL; 808 Gbl_ParseOpCacheLast = NULL; 809 RootNode = NULL; 810 811 /* Generic string cache */ 812 813 BufferCount = 0; 814 while (Gbl_StringCacheList) 815 { 816 Next = Gbl_StringCacheList->Next; 817 ACPI_FREE (Gbl_StringCacheList); 818 Gbl_StringCacheList = Next; 819 BufferCount++; 820 } 821 822 DbgPrint (ASL_DEBUG_OUTPUT, 823 "%u Strings (%u bytes), Buffer size: %u bytes, %u Buffers\n", 824 Gbl_StringCount, Gbl_StringSize, ASL_STRING_CACHE_SIZE, BufferCount); 825 826 Gbl_StringSize = 0; 827 Gbl_StringCount = 0; 828 Gbl_StringCacheNext = NULL; 829 Gbl_StringCacheLast = NULL; 830 } 831