[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ooc-960312
After Frank's report that the symbol table data structure was
accumulating large amounts of heap I started to trace the pointers by
hand. I found lots of references to objects that were never used
later on. In short: the symbol table was leaking pointers like a
sieve. After plugging the leaks the internal table used less than
350K to hold the export information of _all_ modules of the compiler.
The symbol tables caches the data of symbol files to avoid reading
them multiple times, disabling it (to reduce memory usage) decreases
performance significantly.
Now a `make all' over the compiler with all optimizations enabled
lives within 3.7MB (under Linux, with conservative garbage collector),
a rather large step from the 5.8MB it used before. And it's an even
larger step from the >10MB it used _without_ optimizations. Simply
wiping the `info' fields of the GSA code when optimizations were
disabled fixed _that_ peculiar behaviour.
Most of the changes affected modules of the front-end, but the CodeGen
modules residing in the back-end directories also needed some
adjustments. Here are the changes for those of you that keep their
own `CodeGen' around (diffs are ugly, aren't they?):
------------------------------------------------------------------------
diff -u --recursive --new-file ooc-960304-norcs/backend/demo/CodeGen.Mod ooc/backend/demo/CodeGen.Mod
--- ooc-960304-norcs/backend/demo/CodeGen.Mod Fri Mar 1 18:08:00 1996
+++ ooc/backend/demo/CodeGen.Mod Mon Mar 11 22:48:46 1996
@@ -1,4 +1,4 @@
-(* $Id: CodeGen.Mod,v 1.7 1996/03/01 17:08:00 oberon1 Exp $ *)
+(* $Id: CodeGen.Mod,v 1.9 1996/03/11 21:48:46 acken Exp $ *)
MODULE CodeGen;
(* Code generation part of ood; runs optimizers and writes GSA code to
stdout.
@@ -23,7 +23,7 @@
IMPORT
Strings, Out, ParamOptions, E := Error, D := Data, Opc := Opcode, Statistics,
- Check, Sym := SymbolTable, GuardCond, GuardPropagation,
+ Scanner, Check, Sym := SymbolTable, GuardCond, GuardPropagation,
GateReduction, DependencyAnalysis, AlgebraicTransformation, ConstPropagation,
DeadCodeElimination, ValueNumbering, TopologicalOrder, WriteGSA;
@@ -230,7 +230,9 @@
(* final dead code elimination to get rid of disabled instructions *)
DeadCodeElimination.Eliminate (greg, TRUE)
END
- END
+ END;
+
+ D.ClearInfo (greg, 0) (* clear all info entries to free memory *)
END
END OptimizeBlock;
@@ -295,6 +297,7 @@
greg. bodyOf := NIL;
D.Delete (greg)
END;
+ obj. greg := NIL;
greg := NIL;
obj := NIL
END
@@ -525,10 +528,11 @@
current module; this is necessary for the gc to find collectable
blocks *)
WHILE (modData. procList # NIL) DO
- DeleteGreg (modData. procList. body, modData. obj, FALSE);
+ DeleteGreg (modData. procList. body, modData. procList. obj, FALSE);
modData. procList := modData. procList. nextProc
END;
- DeleteGreg (modData. body, modData. obj, FALSE)
+ DeleteGreg (modData. body, modData. obj, FALSE);
+ modData. structList := NIL
END
END CompleteModule;
@@ -564,7 +568,13 @@
VAR
str: ARRAY 1024 OF CHAR;
BEGIN
- IF E.noerr & writeStats. true THEN
+ IF E.noerr & writeStats. true THEN
+ (* write size of parsed input files *)
+ Out.String ("input: ");
+ Out.Int (Scanner.sourceTotal, 0); Out.String (" bytes / ");
+ Out.Int (Scanner.sourceLines, 0); Out.String (" lines");
+ Out.Ln;
+
(* write instruction statistics *)
IF stupidCodeGen. true OR (optimizers. value^ = "") THEN
Out.String ("counted objects"); Out.Ln;
------------------------------------------------------------------------
This release also includes Frank's ooc-m68k-960306 files.
ChangeLog from Mar 5 to Mar 12:
Mon Mar 11 21:48:46 1996 Michael van Acken <acken@informatik.uni-kl.de>
* backend/demo/CodeGen.Mod (EmitStatistics):
Write number of parsed bytes and lines.
Thu Mar 7 11:39:22 1996 Michael van Acken <acken@informatik.uni-kl.de>
* backend/ansi-c/CodeGen.Mod:
Cleared a few runaway pointers that kept unused objects alive for the
garbage collector.
* frontend/SymbolTable.Mod (IntegrateSymbols):
Clear `currValue' field of objects that are moved
into the import symbol tables. Fixed removing of not exported
objects.
* backend/demo/CodeGen.Mod:
Cleared a few runaway pointers that kept unused objects alive for the
garbage collector.
Wed Mar 6 16:11:10 1996 Michael van Acken <acken@informatik.uni-kl.de>
* frontend/ParseExpr.Mod (ConstExpr):
Be more thorough about deleting the dummy greg that holds
the code for the constant expression. Otherwise the gc won't discard
it.
Wed Mar 6 12:08:08 1996 Frank Copeland <fjc@wossname.apana.org.au>
* backend/m68k/SystemFlags.Mod: - Minor change to header.
* backend/m68k/OOCRev.Mod: *** empty log message ***
* backend/m68k/CodeGen.Mod: - Incorporated changes from ooc-960304.
* backend/m68k/Config.Mod, backend/m68k/StdTypes.Mod, backend/m68k/OOC.Mod:
- Minor change to header.
Wed Mar 6 11:13:09 1996 Michael van Acken <acken@informatik.uni-kl.de>
* frontend/WriteGSA.Mod, frontend/UndefVar.Mod:
Killed some pointers to prevent garbage collector from keeping dead
heap objects alive.
Tue Mar 5 22:46:12 1996 Frank Copeland <fjc@wossname.apana.org.au>
* backend/m68k/SystemFlags.Mod, backend/m68k/StdTypes.Mod, backend/m68k/OOC.Mod, backend/m68k/Config.Mod, backend/m68k/CodeGen.Mod:
- ooc-960304
* backend/m68k/SystemFlags.Mod, backend/m68k/StdTypes.Mod, backend/m68k/OOC.Mod, backend/m68k/Config.Mod, backend/m68k/CodeGen.Mod:
- ooc-960222
* backend/m68k/SystemFlags.Mod: Initial revision
* backend/m68k/OOCRev.Mod: *** empty log message ***
* backend/m68k/CodeGen.Mod:
- Added --gc parameter to call the garbage collector after
each procedure and module.
* backend/m68k/Config.Mod, backend/m68k/StdTypes.Mod:
- Minor changes in header.
* backend/m68k/OOC.Mod: - Complete rewrite to use module CodeGen.