checkin from browser
authorClaus Gittinger <cg@exept.de>
Mon, 10 Aug 1998 15:06:53 +0200
changeset 3742 4bfc73e69cc2
parent 3741 ea6377e00e3a
child 3743 2a29f0c02432
checkin from browser
ObjMem.st
ObjectMemory.st
--- a/ObjMem.st	Mon Aug 10 12:01:05 1998 +0200
+++ b/ObjMem.st	Mon Aug 10 15:06:53 1998 +0200
@@ -2196,7 +2196,8 @@
         delay := Delay forMilliseconds:1
     ].
 
-    self gcStepIfUseful ifTrue:[
+    ((self incrementalGCPhaseSymbolic ~~ #idle)
+    or:[self gcStepIfUseful]) ifTrue:[
         [self gcStep] whileFalse:[
             delay notNil ifTrue:[delay wait]
         ]
@@ -2209,7 +2210,7 @@
      [ObjectMemory incrementalGC] forkAt:9 
     "
 
-    "Modified: / 12.11.1997 / 18:23:46 / cg"
+    "Modified: / 10.8.1998 / 15:03:07 / cg"
 !
 
 markAndSweep
@@ -2281,20 +2282,27 @@
     p :=
         [
             [
-                |myDelay timeOfLastGC|
+                |myDelay timeOfLastGC doGC|
 
                 myDelay := Delay forSeconds:5.
                 timeOfLastGC := AbsoluteTime now.
 
                 [true] whileTrue:[
-                    (self gcStepIfUseful 
-                    or:[BackgroundCollectMaximumInterval notNil
-                        and:[(AbsoluteTime now - timeOfLastGC) > BackgroundCollectMaximumInterval]]) 
-                    ifTrue:[
+                    doGC := self gcStepIfUseful.
+                    doGC ifFalse:[
+                        (BackgroundCollectMaximumInterval notNil
+                        and:[(AbsoluteTime now - timeOfLastGC) > BackgroundCollectMaximumInterval])
+                        ifTrue:[
+                            'ObjectMemory [info]: start time-triggered background collect.' infoPrintCR.
+                            doGC := true.
+                        ]
+                    ].
+
+                    doGC ifTrue:[
                         "
-                         perform a full cycle
+                         perform a full cycle (finish cycle)
                         "
-                        self incrementalGC.
+                        [self gcStep] whileFalse:[].
                         timeOfLastGC := AbsoluteTime now.
                     ].
                     "
@@ -2330,7 +2338,7 @@
      ObjectMemory startBackgroundCollectorAt:5.
     "
 
-    "Modified: / 5.8.1998 / 15:07:58 / cg"
+    "Modified: / 10.8.1998 / 15:06:28 / cg"
 !
 
 stopBackgroundCollector
@@ -3975,6 +3983,28 @@
 %}
 !
 
+incrementalGCPhaseSymbolic
+    "returns the internal state of the incremental GC
+     in a symbolic form.
+     (for the curious: (currently)
+      2 is idle, 3..11 are various mark phases,
+      12 is the sweep phase. 0 and 1 are cleanup phases when the
+      incr. GC gets interrupted by a full GC).
+     Do not depend on the values - there may be additional phases in
+     future versions (incremental compact ;-).
+     This is for debugging and monitoring only - and may change or vanish"
+
+    |phase|
+
+    phase := self incrementalGCPhase.
+    phase < 2 ifTrue:[^ #cleanup].
+    phase == 2 ifTrue:[^ #idle].
+    phase < 12 ifTrue:[^ #marking].
+    ^ #sweeping
+
+    "Created: / 10.8.1998 / 15:02:52 / cg"
+!
+
 lastScavengeReclamation
     "returns the number of bytes replacimed by the last scavenge.
      For statistic only - this may vanish."
@@ -4851,6 +4881,6 @@
 !ObjectMemory class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.167 1998-08-05 13:30:47 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.168 1998-08-10 13:06:53 cg Exp $'
 ! !
 ObjectMemory initialize!
--- a/ObjectMemory.st	Mon Aug 10 12:01:05 1998 +0200
+++ b/ObjectMemory.st	Mon Aug 10 15:06:53 1998 +0200
@@ -2196,7 +2196,8 @@
         delay := Delay forMilliseconds:1
     ].
 
-    self gcStepIfUseful ifTrue:[
+    ((self incrementalGCPhaseSymbolic ~~ #idle)
+    or:[self gcStepIfUseful]) ifTrue:[
         [self gcStep] whileFalse:[
             delay notNil ifTrue:[delay wait]
         ]
@@ -2209,7 +2210,7 @@
      [ObjectMemory incrementalGC] forkAt:9 
     "
 
-    "Modified: / 12.11.1997 / 18:23:46 / cg"
+    "Modified: / 10.8.1998 / 15:03:07 / cg"
 !
 
 markAndSweep
@@ -2281,20 +2282,27 @@
     p :=
         [
             [
-                |myDelay timeOfLastGC|
+                |myDelay timeOfLastGC doGC|
 
                 myDelay := Delay forSeconds:5.
                 timeOfLastGC := AbsoluteTime now.
 
                 [true] whileTrue:[
-                    (self gcStepIfUseful 
-                    or:[BackgroundCollectMaximumInterval notNil
-                        and:[(AbsoluteTime now - timeOfLastGC) > BackgroundCollectMaximumInterval]]) 
-                    ifTrue:[
+                    doGC := self gcStepIfUseful.
+                    doGC ifFalse:[
+                        (BackgroundCollectMaximumInterval notNil
+                        and:[(AbsoluteTime now - timeOfLastGC) > BackgroundCollectMaximumInterval])
+                        ifTrue:[
+                            'ObjectMemory [info]: start time-triggered background collect.' infoPrintCR.
+                            doGC := true.
+                        ]
+                    ].
+
+                    doGC ifTrue:[
                         "
-                         perform a full cycle
+                         perform a full cycle (finish cycle)
                         "
-                        self incrementalGC.
+                        [self gcStep] whileFalse:[].
                         timeOfLastGC := AbsoluteTime now.
                     ].
                     "
@@ -2330,7 +2338,7 @@
      ObjectMemory startBackgroundCollectorAt:5.
     "
 
-    "Modified: / 5.8.1998 / 15:07:58 / cg"
+    "Modified: / 10.8.1998 / 15:06:28 / cg"
 !
 
 stopBackgroundCollector
@@ -3975,6 +3983,28 @@
 %}
 !
 
+incrementalGCPhaseSymbolic
+    "returns the internal state of the incremental GC
+     in a symbolic form.
+     (for the curious: (currently)
+      2 is idle, 3..11 are various mark phases,
+      12 is the sweep phase. 0 and 1 are cleanup phases when the
+      incr. GC gets interrupted by a full GC).
+     Do not depend on the values - there may be additional phases in
+     future versions (incremental compact ;-).
+     This is for debugging and monitoring only - and may change or vanish"
+
+    |phase|
+
+    phase := self incrementalGCPhase.
+    phase < 2 ifTrue:[^ #cleanup].
+    phase == 2 ifTrue:[^ #idle].
+    phase < 12 ifTrue:[^ #marking].
+    ^ #sweeping
+
+    "Created: / 10.8.1998 / 15:02:52 / cg"
+!
+
 lastScavengeReclamation
     "returns the number of bytes replacimed by the last scavenge.
      For statistic only - this may vanish."
@@ -4851,6 +4881,6 @@
 !ObjectMemory class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.167 1998-08-05 13:30:47 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.168 1998-08-10 13:06:53 cg Exp $'
 ! !
 ObjectMemory initialize!