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