ObjMem.st
changeset 1768 19c806a25f26
parent 1767 d641ddf29273
child 1769 8692613186c4
--- a/ObjMem.st	Wed Oct 16 18:16:50 1996 +0200
+++ b/ObjMem.st	Wed Oct 16 19:00:44 1996 +0200
@@ -1461,28 +1461,40 @@
     |done limit|
 
     AbortSignal handle:[:ex |
-	"/ in case of abort (from the debugger),
-	"/ disable gcSteps.
-	done := true.
-	IncrementalGCLimit := FreeSpaceGCLimit := nil.
-	'OBJMEM: IGC aborted; turning off incremental GC' errorPrintNL
+        "/ in case of abort (from the debugger),
+        "/ disable gcSteps.
+        done := true.
+        IncrementalGCLimit := FreeSpaceGCLimit := nil.
+        'OBJMEM: IGC aborted; turning off incremental GC' errorPrintNL
     ] do:[
-	limit := IncrementalGCLimit.
-	(limit notNil and:[self oldSpaceAllocatedSinceLastGC > limit]) ifTrue:[
-	    done := ObjectMemory gcStep
-	] ifFalse:[
-	    limit := FreeSpaceGCLimit.
-	    (limit notNil and:[(self freeSpace + self freeListSpace) < limit]) ifTrue:[
-		done := ObjectMemory gcStep.
-		done ifTrue:[
-		    self moreOldSpaceIfUseful
-		].
-	    ] ifFalse:[
-		done := true
-	    ]
-	].
+        limit := IncrementalGCLimit.
+        (limit notNil and:[self oldSpaceAllocatedSinceLastGC > limit]) ifTrue:[
+            done := ObjectMemory gcStep
+        ] ifFalse:[
+            limit := FreeSpaceGCLimit.
+            (limit notNil and:[(self freeSpace + self freeListSpace) < limit]) ifTrue:[
+                done := ObjectMemory gcStep.
+                done ifTrue:[
+                    self moreOldSpaceIfUseful
+                ].
+            ] ifFalse:[
+                limit := DynamicCodeGCTrigger.
+                (limit notNil and:[self compiledCodeCounter > limit]) ifTrue:[
+                    done := ObjectMemory gcStep.
+                ] ifFalse:[
+                    limit := DynamicCodeLimit.
+                    (limit notNil and:[self compiledCodeSpaceUsed > limit]) ifTrue:[
+                        done := ObjectMemory gcStep.
+                    ] ifFalse:[
+                        done := true
+                    ]
+                ]
+            ]
+        ].
     ].
     ^ done not
+
+    "Modified: 16.10.1996 / 17:40:09 / cg"
 !
 
 incrementalGC
@@ -1811,6 +1823,68 @@
     ^ true
 !
 
+dynamicCodeGCTrigger
+    "return the dynamic code trigger limit for incremental GC activation.
+     The system will start doing incremental background GC, whenever this amount
+     of code was dynamically generated. 
+     The default is nil; which disables this trigger"
+
+    ^ DynamicCodeGCTrigger
+
+    "
+     ObjectMemory dynamicCodeGCTrigger
+    "
+
+    "Created: 16.10.1996 / 17:42:01 / cg"
+!
+
+dynamicCodeGCTrigger:numberOfBytesOrNil
+    "set the dynamic code trigger limit for incremental GC activation.
+     The system will start doing incremental background GC, whenever this amount
+     of code was dynamically generated. 
+     The default is nil; which disables this trigger"
+
+    DynamicCodeGCTrigger := numberOfBytesOrNil
+
+    "
+     ObjectMemory dynamicCodeGCTrigger:50000
+    "
+
+    "Created: 16.10.1996 / 17:42:29 / cg"
+!
+
+dynamicCodeLimit
+    "return the dynamic code limit.
+     The system will start doing incremental background GC, whenever this amount
+     of code has been generated (overall), and start to flush the code cache,
+     if (after the GC), more code is still allocated. 
+     The default is nil; which disables this trigger"
+
+    ^ DynamicCodeLimit
+
+    "
+     ObjectMemory dynamicCodeLimit
+    "
+
+    "Created: 16.10.1996 / 17:43:37 / cg"
+!
+
+dynamicCodeLimit:nBytesOrNil
+    "set the dynamic code limit.
+     The system will start doing incremental background GC, whenever this amount
+     of code has been generated (overall), and start to flush the code cache,
+     if (after the GC), more code is still allocated. 
+     The default is nil; which disables this trigger"
+
+    DynamicCodeLimit := nBytesOrNil
+
+    "
+     ObjectMemory dynamicCodeLimit:100000
+    "
+
+    "Created: 16.10.1996 / 17:43:58 / cg"
+!
+
 fastMoreOldSpaceAllocation:aBoolean
     "this method turns on/off fastMoreOldSpace allocation.
      By default, this is turned off (false), which means that in case of
@@ -3600,6 +3674,6 @@
 !ObjectMemory class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.113 1996-10-16 16:16:50 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.114 1996-10-16 17:00:44 cg Exp $'
 ! !
 ObjectMemory initialize!