ObjectMemory.st
author Claus Gittinger <cg@exept.de>
Tue, 29 Sep 1998 12:44:05 +0200
changeset 3858 4be800f88b8e
parent 3781 d35bce118ed1
child 3859 9b422cede70d
permissions -rw-r--r--
added interface to incrementalSweeping()
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1992 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 133
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
a27a279701f8 Initial revision
claus
parents:
diff changeset
    13
Object subclass:#ObjectMemory
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 797
diff changeset
    14
	instanceVariableNames:''
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 797
diff changeset
    15
	classVariableNames:'InternalErrorHandler UserInterruptHandler TimerInterruptHandler
759
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    16
		SpyInterruptHandler StepInterruptHandler
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    17
		ExceptionInterruptHandler ErrorInterruptHandler
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    18
		MemoryInterruptHandler SignalInterruptHandler
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    19
		ChildSignalInterruptHandler DisposeInterruptHandler
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    20
		RecursionInterruptHandler IOInterruptHandler
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    21
		CustomInterruptHandler RegisteredErrorInterruptHandlers
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    22
		InterruptLatencyMonitor AllocationFailureSignal
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    23
		MallocFailureSignal LowSpaceSemaphore IncrementalGCLimit
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    24
		FreeSpaceGCLimit FreeSpaceGCAmount BackgroundCollectProcess
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    25
		BackgroundFinalizationProcess FinalizationSemaphore Dependents
1108
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
    26
		ImageName ImageSaveTime ChangeFileName MaxInterruptLatency
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
    27
		InterruptLatencyGoal VMSelectors DynamicCodeGCTrigger
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
    28
		DynamicCodeLimit JustInTimeCompilationEnabled
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
    29
		BackgroundCollectMaximumInterval'
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 797
diff changeset
    30
	poolDictionaries:''
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 797
diff changeset
    31
	category:'System-Support'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    32
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    33
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
    34
Object subclass:#BinaryModuleDescriptor
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
    35
	instanceVariableNames:'name type id dynamic classNames pathName libraryName timeStamp'
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
    36
	classVariableNames:''
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
    37
	poolDictionaries:''
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
    38
	privateIn:ObjectMemory
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
    39
!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
    40
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
    41
!ObjectMemory class methodsFor:'documentation'!
2
claus
parents: 1
diff changeset
    42
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    43
caching
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    44
"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    45
    The system uses various caches to speed up method-lookup.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    46
    Currently, there is a three-level cache hierarchy:
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    47
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
    48
        inline-cache            keeps the target of the last send at the caller-
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
    49
                                side (i.e. every send goes through its private 
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
    50
                                1-slot inline-cache, where the address of the last
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
    51
                                called function at this call location is kept.)
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
    52
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
    53
        polymorph-inline-cache  keeps a limited list of all targets ever reached 
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
    54
                                at this call location. The list is automatically 
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
    55
                                flushed if it grows too large, or the overall number
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
    56
                                of poly-chache entries exceeds a limit.
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
    57
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
    58
        method-lookup-cache     a global cache. Hashes on class-selector pairs,
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
    59
                                returning the target method.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    60
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    61
    Whenever methods are added or removed from the system, or the inheritance 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    62
    hierarchy changes, some or all caches have to be flushed.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    63
    The flushXXX methods perform the task of flushing various caches.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    64
    All standard methods in Behavior call for cache flushing, when things change;
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    65
    however, if you use the low level access methods in Behavior
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    66
    (for example: #setSuperclass:) special care has to be taken.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    67
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    68
    In some situations, not all caches need flushing, for example a change
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    69
    in an interpreted method (currently) needs no flushing of the inline caches.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    70
    Also, flushing can be limited to entries for a specific class for most changes.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    71
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    72
    To be 'on the brigth side of live', use ObjectMemory>>flushCaches (which
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    73
    flushes all of them), when in doubt of which caches should be flushed. 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    74
    It is better flush too much - otherwise you may end up in a wrong method after 
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
    75
    a send (you wont really see a difference in speed after the flush, anyway).
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    76
"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    77
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    78
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    79
copyright
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    80
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    81
 COPYRIGHT (c) 1992 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 133
diff changeset
    82
	      All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    83
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    84
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    85
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    86
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    87
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    88
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    89
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    90
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    91
!
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    92
2
claus
parents: 1
diff changeset
    93
documentation
claus
parents: 1
diff changeset
    94
"
403
claus
parents: 384
diff changeset
    95
    This class contains access methods to the system memory and the VM.
claus
parents: 384
diff changeset
    96
claus
parents: 384
diff changeset
    97
    In previous ST/X versions, this stuff used to be in the Smalltalk class.
claus
parents: 384
diff changeset
    98
    It has been separated for better overall class structure and modularisation.
229
210ee6865aa3 commenting
claus
parents: 216
diff changeset
    99
    There are no instances of ObjectMemory - all is done in class methods.
403
claus
parents: 384
diff changeset
   100
    (this is a functional interface).
claus
parents: 384
diff changeset
   101
claus
parents: 384
diff changeset
   102
    Many methods here are for debuging purposes, for developers
claus
parents: 384
diff changeset
   103
    or experimental, and therefore not standard.
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   104
    Do not depend on them being there - some may vanish ...
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   105
    (especially those, that depend on a specific GC implementation)
403
claus
parents: 384
diff changeset
   106
    Most of the stuff found here is not available, or different or called
claus
parents: 384
diff changeset
   107
    different in other smalltalk implementations. Be aware, that using these
claus
parents: 384
diff changeset
   108
    interfaces (especially: depending on them) may make your application
claus
parents: 384
diff changeset
   109
    non portable.
claus
parents: 384
diff changeset
   110
claus
parents: 384
diff changeset
   111
    See more documentation in -> caching
1160
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   112
                              -> interrupts
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   113
                              -> garbageCollection
2
claus
parents: 1
diff changeset
   114
1300
2cfff4cac72f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   115
    [Class variables:]
2
claus
parents: 1
diff changeset
   116
1160
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   117
        InternalErrorHandler            gets informed (by VM), when some runtime
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   118
                                        error occurs (usually fatal)
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   119
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   120
        UserInterruptHandler            gets informed (by VM) when CNTL-C is pressed
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   121
        TimerInterruptHandler           gets alarm timer interrupts (from VM)
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   122
        SpyInterruptHandler             another alarm timer (from VM)
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   123
        StepInterruptHandler            gets single step interrupts (from VM)
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   124
        ExceptionInterruptHandler       gets floating point exceptions (from VM)
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   125
        ErrorInterruptHandler           gets primitive errors (from VM)
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   126
        MemoryInterruptHandler          gets soon-out-of-memory conditions (from VM)
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   127
        SignalInterruptHandler          gets unix signals (from VM)
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   128
        ChildSignalInterruptHandler     gets child death signals (from VM)
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   129
        DisposeInterruptHandler         gets informed, when an object is disposed from 
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   130
                                        a shadowArray (from VM)
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   131
        RecursionInterruptHandler       gets recursion limit violations (from VM)
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   132
        IOInterruptHandler              gets SIGIO unix signals (from VM)
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   133
        CustomInterruptHandler          gets custom interrupts (from VM)
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   134
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   135
        InterruptLatencyMonitor         if nonNil, that one will be notified (by the VM)
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   136
                                        with an interruptLatency:millis message for every 
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   137
                                        interrupt and gets the delay time
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   138
                                        (between the time when the signal arrived and
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   139
                                         when it was really delivered) as argument.
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   140
                                        This can be used to create a statistic for
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   141
                                        realtime systems.
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   142
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   143
        RegisteredErrorInterruptHandlers
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   144
                                        associates errorID (as passed from primitive
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   145
                                        to the __errorInterruptWithID() function)
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   146
                                        with handlers.
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   147
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   148
        IncrementalGCLimit              number of bytes, that must be allocated since
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   149
                                        last full garbage collect to turn the incremental
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   150
                                        collector on (at idle time).
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   151
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   152
        FreeSpaceGCLimit                low limit on freeSpace, at which incremental
1160
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   153
                                        gc starts to run at idle time.
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   154
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   155
        FreeSpaceGCAmount               amount to allocate, once freeSpace drops
1160
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   156
                                        below FreeSpaceGCLimit
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   157
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   158
        DynamicCodeGCTrigger            amount of generated dynamically compiled code 
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   159
                                        to trigger the incremental garbage collector
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   160
                                        nil means: no trigger
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   161
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   162
        DynamicCodeLimit                max. amount of space allocated for dynamically compiled code
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   163
                                        nil means: unlimited.
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   164
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   165
        JustInTimeCompilationEnabled    boolean - enables/disables JIT-compilation of
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   166
                                        bytecode to machine code.
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   167
                                        (this has nothing to do with stc-compilation)
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
   168
1160
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   169
        Dependents                      keep my dependents locally (its faster) for
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   170
                                        all those registries
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   171
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   172
        LowSpaceSemaphore               a semaphore signalled whenever the system is
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   173
                                        running in low memory (i.e. the memory manager
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   174
                                        ran into memory shortage and feels that it
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   175
                                        may soon no longer be able to grant allocation requests).
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   176
                                        You can have a process waiting on this semaphore
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   177
                                        which starts to remove (i.e. nil-out) objects
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   178
                                        or preform other cleanup actions.
213
3b56a17534fd *** empty log message ***
claus
parents: 211
diff changeset
   179
                                        
1160
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   180
        AllocationFailureSignal         signal raised when a new fails (see Behavior)
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   181
                                        When this signal is raised, the memory manager
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   182
                                        is really in trouble (i.e. above low-mem feelings 
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   183
                                        were correct)
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   184
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   185
        MallocFailureSignal             signal raised when a malloc fails
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   186
                                        mallocs are used internally in the VM and/or
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   187
                                        by some classes (ExternalBytes)
1160
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   188
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   189
        BackgroundCollectProcess        created by startBackgroundCollectorAt:
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   190
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   191
        BackgroundFinalizationProcess   created by startBackgroundFinalizationAt:
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   192
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   193
        BackgroundCollectMaximumInterval
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   194
                                        number of seconds after which an incremental background
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   195
                                        collection is started - regardless of the allocation
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   196
                                        rate or freeSpace situation. If nil, IGC is only done
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   197
                                        when the space situation makes it feasable.
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   198
                                        Can be set to (say) 3600, to have the memory cleaned
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   199
                                        at least once an hour.
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   200
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   201
        FinalizationSemaphore           triggered by the VM, when any weak pointer is
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   202
                                        lost. Been waited upon by the backgroundFinalizer.
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   203
1160
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   204
        ImageName                       name of the current image (or nil)
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   205
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   206
        ImageSaveTime   <AbsoluteTime>  timestamp when this image was saved
1096
d88b93ce1194 remember image save time
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
   207
d88b93ce1194 remember image save time
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
   208
403
claus
parents: 384
diff changeset
   209
    Warning:
claus
parents: 384
diff changeset
   210
      The InterruptHandler variables are known by the runtime system -
claus
parents: 384
diff changeset
   211
      they are the objects that get an interrupt message when the event
claus
parents: 384
diff changeset
   212
      occurs. You may not remove any of them.
1300
2cfff4cac72f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   213
2cfff4cac72f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   214
    [author:]
2cfff4cac72f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   215
        Claus Gittinger
2
claus
parents: 1
diff changeset
   216
"
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   217
!
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   218
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   219
garbageCollection
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   220
"
403
claus
parents: 384
diff changeset
   221
    Currently, Smalltalk/X uses a two-level memory hierachy (actually, there
claus
parents: 384
diff changeset
   222
    are more memory regions used for stack, permanent objects, symbols etc.
759
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
   223
    but for the following discussion, these are not of interest).
403
claus
parents: 384
diff changeset
   224
claus
parents: 384
diff changeset
   225
  newSpace:
claus
parents: 384
diff changeset
   226
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   227
    Objects are created in a so-called newSpace, which is relatively small.
403
claus
parents: 384
diff changeset
   228
    This newSpace is cleaned by a so called ``scavenge''-operation, whenever 
claus
parents: 384
diff changeset
   229
    becoming full. Scavenging means, that all still-live objects (i.e. referenced
claus
parents: 384
diff changeset
   230
    by some other) are copied over to another memory area, leaving all unreachable
claus
parents: 384
diff changeset
   231
    objects as garbage behind. Thus, the newSpace actually consists of two semispaces,
claus
parents: 384
diff changeset
   232
    of whih only one is active - the other being used only while objects are
claus
parents: 384
diff changeset
   233
    copied.
claus
parents: 384
diff changeset
   234
    After this copying, these two semispaces exchange their roles - i.e. reachable
claus
parents: 384
diff changeset
   235
    objects are copied ping-pong like between these semispaces.
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   236
    Once an object survives enough of these copying operations, the next scavenge 
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   237
    will move it into the so called oldSpace, which is much larger, and not
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   238
    processed by the scavenger. 
403
claus
parents: 384
diff changeset
   239
    This movement of an object from newSpace to oldSpace is called ``tenure''.
claus
parents: 384
diff changeset
   240
    (this avoids objects being copied around forever).
claus
parents: 384
diff changeset
   241
    Once tenured, an object is no longer contained in the newSpace, and
claus
parents: 384
diff changeset
   242
    thus ceases to create any scavenging overhead after that.
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
   243
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   244
    Scavenging occurs automatically, and is usually done fast enough to go 
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   245
    unnoticed (typically, it takes some 5 to 40ms to perform a scavenge, 
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   246
    depending on how many live objects are in the newspace).
403
claus
parents: 384
diff changeset
   247
759
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
   248
    Interestingly, the scavenger performs better, if many garbage objects
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   249
    are to be reclaimed, since less object-copying has to be done. Therefore,
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   250
    the best-case scavenge time is almost zero, if there is only garbage in
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   251
    the newSpace. In contrast, the worst-case is when all newSpace objects are still
403
claus
parents: 384
diff changeset
   252
    living. Thus, from a newSpace collectors viewPoint, it makes sense to get
claus
parents: 384
diff changeset
   253
    objects out of the way as fast as possible. However the oldSpace is
claus
parents: 384
diff changeset
   254
    collected much less frequently and the cost to reclaim an oldspace object
claus
parents: 384
diff changeset
   255
    is much higher (actually, the cost to reclaim a newspace object is zero -
claus
parents: 384
diff changeset
   256
    its the survival of objects which we have to pay for).
claus
parents: 384
diff changeset
   257
    Therefore, from an oldSpace collectors point of view, its preferable to
claus
parents: 384
diff changeset
   258
    keep objects in the newSpace as long as possible.
claus
parents: 384
diff changeset
   259
claus
parents: 384
diff changeset
   260
    To honor this conflicting situation, the system uses an adaptive tenure-count,
207
claus
parents: 202
diff changeset
   261
    which adjusts the number of scavenges required for tenure (the so called 
claus
parents: 202
diff changeset
   262
    'tenureAge') according to the fill-grade of the newSpace.
403
claus
parents: 384
diff changeset
   263
    If the newSpace is relatively empty, it tries to keep objects longer there.
claus
parents: 384
diff changeset
   264
    The controlling parameters of the tenure age can be changed dynamically,
claus
parents: 384
diff changeset
   265
    detailed information is available upon request.
claus
parents: 384
diff changeset
   266
claus
parents: 384
diff changeset
   267
    The exact speed of the scavenger depends mostly on the speed of your memory
claus
parents: 384
diff changeset
   268
    interface (and, since most of todays memories have access times in the order
claus
parents: 384
diff changeset
   269
    of 50-100ns, the raw CPU speed does not correlate linear with the GC speed).
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   270
    Measurements give roughly 40ms for a full 400k newSpace 
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   271
    (i.e. all objects survive) on a 486/50 - this only drops to some 20-30ms on a P5.
3647
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   272
    Big caches help - i.e. a 1Mb cache machine performs better than a 256k cache machine.
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   273
    Also, a good memory interface (small number of wait cycles and burst modes)
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   274
    help a lot.
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   275
403
claus
parents: 384
diff changeset
   276
    The upper bounds of the scavenge blocking time can be controlled by changing
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   277
    the size of the newSpace - either via a command line argument, or even dynamically
403
claus
parents: 384
diff changeset
   278
    by Objectmemory>>newSpaceSize:. Smaller sizes lead to shorter blocking periods,
claus
parents: 384
diff changeset
   279
    but greater absolute GC overhead. The default (400k) seems to be a good compromise.
claus
parents: 384
diff changeset
   280
    (if you are not happy with it, try playing around with the settings)
claus
parents: 384
diff changeset
   281
claus
parents: 384
diff changeset
   282
  oldSpace:
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   283
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   284
    To reclaim oldspace, the system uses three algorithms: mark&sweep, a copying
3647
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   285
    (and compressing) baker-type collector and an incremental mark&sweep, augmented
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   286
    by an inplace compress algorithm.
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   287
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   288
    The mark&sweep runs whenever the oldspace becomes full, putting dead objects
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   289
    onto a free list. If a memory request cannot be served from this freelist,
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   290
    and the total size of objects on the freelist exceeds a threshold, the system
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   291
    will compress the oldspace to make the free-space into one big area.
3647
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   292
    This compress is either done by a 1-pass semispace copy algorithm, or
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   293
    a 2pass inplace compress - depending on the setting of the compress limit.
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   294
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   295
    The 1pass algorithm copies all live objects into a newly allocated
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   296
    area, and frees the previous memory afterwards (a baker style copying collector).
3647
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   297
    The 2pass algorithm moves objects inPlace, and adjusts the pointers in
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   298
    a second pass.
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   299
    The 1pass algorithm requires twice the amount of memory (virtually) and is
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   300
    slightly faster, if enough real memory is available.
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   301
    In memory limited systems, the 2pass algorithm generally performs better,
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   302
    since it is less affected by paging.
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   303
    To honor this situation, the compressLimit should be set to enforce the
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   304
    2-pass algorithm if the oldSpace size exceeds a certain threshold.
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   305
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   306
    We recommend setting the compressLimit to roughly 1/4th of the physical
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   307
    memory size of the machine, if other programs are to run beside ST/X
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   308
    (i.e. an XServer, some xterms etc.).
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   309
    If ST/X is running almost alone (i.e. using an XTerminal), the compressLimit
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   310
    can be set to 1/3rd of the physical memory.
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   311
    This is only a rough estimate - you may want to play around with this
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   312
    parameter, to find a value which avoids paging due to a 1pass compress.
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   313
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   314
    Since a compressing oldspace collect leads to a noticable pause of the system,
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   315
    the memory manager tries hard to avoid oldspace compression.
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   316
    (well, if enough real memory is available to hold both spaces in physical
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   317
     memory, the compress algorithms are actually pretty fast).
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   318
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   319
    The incremental mark&sweep runs in the background, whenever the system is idle
403
claus
parents: 384
diff changeset
   320
    (see ProcessorSceduler>>waitForEventOrTimeout), or alternatively as a low or high
claus
parents: 384
diff changeset
   321
    priority background process (see ObjectMemory>>startBackgroundCollector). 
362
claus
parents: 360
diff changeset
   322
    Like the normal mark&sweep, this incremental collector follows object references 
claus
parents: 360
diff changeset
   323
    and marks reachable objects on its way. However, this is done 'a few objects-at-a-time',
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   324
    to not disrupt the system noticably. 
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   325
    Currently, there are some (theoretical) and in practice never occurring situations,
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   326
    in which the incremental GC still creates noticable delays.
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   327
    A current project is involved with this and a future version of ST/X (ST/X-RT)
403
claus
parents: 384
diff changeset
   328
    will be available which shows deterministic worst case behavior in its GC pauses 
claus
parents: 384
diff changeset
   329
    (this will be provided as an additional add-on option - certainly not for free ;-).
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   330
403
claus
parents: 384
diff changeset
   331
    Currently, incremental GC blockings are in the order of 10-70ms.
claus
parents: 384
diff changeset
   332
    There is one catch with low priority background IGC: if there is never any idle
claus
parents: 384
diff changeset
   333
    time available (i.e. all processes run all the time), it would never get a chance
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   334
    to do any collection work. 
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   335
    To handle this case, a background IGC can either be started as a high priority
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   336
    process, which gives up the cpu (by delaying on the time) after every IGC step,
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   337
    or it can be gicen a dynamic priority, where the max-prio is above UserSchedulingPriority.
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   338
    A high priority background collector will always make progress and eventually finish
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   339
    a GC cycle. However, it may have more of an influence on the other processes.
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   340
     So, its up to you, to decide ...
362
claus
parents: 360
diff changeset
   341
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   342
362
claus
parents: 360
diff changeset
   343
    Incremental garbage collection is controlled by the variables 
claus
parents: 360
diff changeset
   344
    'IncrementalGCLimit', 'FreeSpaceGCLimit' and 'FreeSpaceGCAmount':
310
fbfb977ae1bd *** empty log message ***
claus
parents: 308
diff changeset
   345
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
   346
      the ProcessorScheduler will perform incremental GC steps at idle time, 
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
   347
      if the total space allocated since the last full collect exceeds 
362
claus
parents: 360
diff changeset
   348
      'IncrementalGCLimit',
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
   349
      or if there are less than 'FreeSpaceGCLimit' bytes available in free store.
362
claus
parents: 360
diff changeset
   350
      If after the incrementalGC, less than 'FreeSpaceGCLimi't bytes are available,
310
fbfb977ae1bd *** empty log message ***
claus
parents: 308
diff changeset
   351
      'FreeSpaceGCAmount' more bytes are requested from the memory manager.
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
   352
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
   353
    The defaults are set in ObjectMemory>>initialize and can be changed in your 
403
claus
parents: 384
diff changeset
   354
    startup 'smalltalk.rc'-file. Setting them to nil turns incremental GC off.
270
f036aaa9a836 *** empty log message ***
claus
parents: 253
diff changeset
   355
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   356
362
claus
parents: 360
diff changeset
   357
    For example, setting 'IncrementalGCLimit' to 500000 will start the background collector
207
claus
parents: 202
diff changeset
   358
    whenever 500k bytes have been allocated - usually very seldom. Setting it to some
claus
parents: 202
diff changeset
   359
    small number (say 10000) will have it run very often.
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
   360
362
claus
parents: 360
diff changeset
   361
    Setting 'FreeSpaceGCAmount' to (say) 1meg lets the system try to always keep
403
claus
parents: 384
diff changeset
   362
    1meg of freeSpace. If less memory is available, more oldSpace will be allocated.
claus
parents: 384
diff changeset
   363
    Keeping some memory in the pocket may prevent the system from running into a blocking
claus
parents: 384
diff changeset
   364
    GC if memory is allocated in peaks (but only, if the incremental GC can keep up with 
claus
parents: 384
diff changeset
   365
    allocation rate). The trigger level 'FreeSpaceGCLimit' should be below that amount;
310
fbfb977ae1bd *** empty log message ***
claus
parents: 308
diff changeset
   366
    to avoid excessive incremental GC activity (say 1/4 if the amount).
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
   367
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
   368
    Having the background GC running often should not hurt the performance of your 
362
claus
parents: 360
diff changeset
   369
    smalltalk processes, since the IGC only runs at times when no ST processes are runnable. 
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
   370
    (there are some short delays in event processing, since the IGC's steps may take 
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
   371
    some XX ms.) 
270
f036aaa9a836 *** empty log message ***
claus
parents: 253
diff changeset
   372
    However, if you are not alone on your machine (i.e. a timesharing system) or 
f036aaa9a836 *** empty log message ***
claus
parents: 253
diff changeset
   373
    you have other Unix processes to run, you should not run the IGC too often, 
362
claus
parents: 360
diff changeset
   374
    since it may hurt OTHER users/unix processes.
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   375
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   376
    Since this collector only runs at idle times, even a low priority background 
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   377
    process will prevent it from doing its work. You may want to start a somewhat
207
claus
parents: 202
diff changeset
   378
    higher priority background collect (say at prio 4), which also preempts these
claus
parents: 202
diff changeset
   379
    background processes. (see ObjectMemory>>startBackgroundCollectorAt:).
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   380
325
claus
parents: 324
diff changeset
   381
    Beginning with 2.10.4, a third space, called symSpace has been added.
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   382
    Objects in this space are never moved or garbage collected.
3648
a6da5ea8a7df fallBack to 2pass compress in #verboseGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3647
diff changeset
   383
    This space is (currently) used for symbols only.
325
claus
parents: 324
diff changeset
   384
claus
parents: 324
diff changeset
   385
    Beginning with 2.10.5, a fourth space, called fixSpace has been added.
claus
parents: 324
diff changeset
   386
    Objects in this space are never moved or garbage collected.
claus
parents: 324
diff changeset
   387
    This space is used for constant objects (true, false, some basic classes etc.).
229
210ee6865aa3 commenting
claus
parents: 216
diff changeset
   388
210ee6865aa3 commenting
claus
parents: 216
diff changeset
   389
    A plan for 2.11 is to offer an arbitrary number of spaces, which can be
210ee6865aa3 commenting
claus
parents: 216
diff changeset
   390
    attached and detached at runtime. This will allow easy share of object
210ee6865aa3 commenting
claus
parents: 216
diff changeset
   391
    with remote systems and separating objects into a per application/package
210ee6865aa3 commenting
claus
parents: 216
diff changeset
   392
    space. (be prepared for changes in the future and make your application
210ee6865aa3 commenting
claus
parents: 216
diff changeset
   393
    independ of the VM internals)
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   394
403
claus
parents: 384
diff changeset
   395
  default setup:
claus
parents: 384
diff changeset
   396
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   397
    The following table lists some default settings and means for changing them;
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   398
    Notice, that the defaults below are those of the VM and or ObjectMemory class.
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   399
    These may already be changed by a smalltalk.rc or private.rc startup file.
403
claus
parents: 384
diff changeset
   400
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   401
            what        default     change by           
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   402
                                    command line arg    dynamically
403
claus
parents: 384
diff changeset
   403
    -----------------------------------------------------------------------
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   404
        newSpace size     400k      -Mnew nnn           newSpaceSize:nnn
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   405
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   406
        oldSpace size    3000k      -Mold nnn           moreOldSpace:
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   407
                                                        announceSpaceNeed:
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   408
                                                        collectGarbage
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   409
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   410
        max tenure age     29                           lockTenure:
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   411
                                                        avoidTenure:
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   412
                                                        (sets it to infinity)
403
claus
parents: 384
diff changeset
   413
        
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   414
        adaptive tenure     -       -                   tenureParameters
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   415
3652
Claus Gittinger <cg@exept.de>
parents: 3649
diff changeset
   416
        2pass oldSpace
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   417
        compressor      enabled     -Msingle            -
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   418
3647
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   419
        limit for 1pass
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   420
        old-compress     8000k      -                   oldSpaceCompressLimit:
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   421
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   422
        chunk size
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   423
        to increase
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   424
        oldSpace          256k      -                   oldSpaceIncrement:
403
claus
parents: 384
diff changeset
   425
        
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   426
        prefer moreOld
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   427
        to doing GC      false      -                   fastMoreOldSpaceAllocation:
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   428
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   429
        limit for
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   430
        above                -      -                   fastMoreOldSpaceLimit:
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   431
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   432
        keep size for        -      -                   freeSpaceGCAmount:
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   433
        IGC
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   434
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   435
        low water
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   436
        trigger for IGC      -      -                   freeSpaceGCLimit:
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   437
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   438
        allocated
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   439
        trigger for IGC   500k      -                   incrementalGCLimit
403
claus
parents: 384
diff changeset
   440
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   441
        maximum time
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   442
        interval between
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   443
        IGC's                -      -                   BackgroundCollectMaximumInterval
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   444
3652
Claus Gittinger <cg@exept.de>
parents: 3649
diff changeset
   445
        JIT codeCache
Claus Gittinger <cg@exept.de>
parents: 3649
diff changeset
   446
        size            unlimited   -                   dynamicCodeLimit:
Claus Gittinger <cg@exept.de>
parents: 3649
diff changeset
   447
Claus Gittinger <cg@exept.de>
parents: 3649
diff changeset
   448
        new JIT code
Claus Gittinger <cg@exept.de>
parents: 3649
diff changeset
   449
        trigger for IGC   none      -                   dynamicCodeGCTrigger:
Claus Gittinger <cg@exept.de>
parents: 3649
diff changeset
   450
Claus Gittinger <cg@exept.de>
parents: 3649
diff changeset
   451
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   452
    By default, no incremental GC is started by the system; however,
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   453
    the standard startup script starts a low prio background incremental GC process.
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   454
    You have to edit your startup files to change this. 
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   455
    A suggested configuration (used by the author and the default) is:
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   456
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   457
        ' keep 1meg in the pocket '
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   458
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   459
        ObjectMemory freeSpaceGCAmount:1000000. 
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   460
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   461
        ' start incrementalGC when freespace drops below 250k '
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   462
        ' or 500k of oldSpace has been allocated              '
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   463
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   464
        ObjectMemory freeSpaceGCLimit:250000.                 '
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   465
        ObjectMemory incrementalGCLimit:500000.               '
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   466
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   467
        ' collect as a background process (the default is: at idle times)
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   468
        ' this means that running cubes or other demo processes are suspended
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   469
        ' for the collect; change the prio to below 4 if you want them to continue
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   470
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   471
        ObjectMemory startBackgroundCollectorAt:5.            '
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   472
        ObjectMemory startBackgroundFinalizationAt:5.         '
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   473
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   474
        ' quickly allocate more space (i.e. avoid blocking collects)
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   475
        ' up to 8meg - then start to collect if more memory is needed.
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   476
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   477
        ObjectMemory fastMoreOldSpaceLimit:8*1024*1024.       '
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   478
        ObjectMemory fastMoreOldSpaceAllocation:true.         '
403
claus
parents: 384
diff changeset
   479
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   480
  hints & tricks:
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   481
213
3b56a17534fd *** empty log message ***
claus
parents: 211
diff changeset
   482
    normally, there is no need to call for an explicit garbage collection, or
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   483
    modify the default parameters.
213
3b56a17534fd *** empty log message ***
claus
parents: 211
diff changeset
   484
    The memory system should adapt reasonable and provide good performance 
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   485
    for a wide range of allocation patterns (see Example3 below for an exception).
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   486
207
claus
parents: 202
diff changeset
   487
    However, there may be situations, in which hints and/or explicit
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   488
    control over allocation can speedup your programs; but please:
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   489
207
claus
parents: 202
diff changeset
   490
      - if you think you have to play around with the memory policies,
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   491
        first check your program - you may find useless allocations
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   492
        or bad uses of collections. A typical error that is made is to
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   493
        create large collections using the #, (comma) concatenation method,
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   494
        which shows square behavior, since it allocates many, many temporary
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   495
        collections. Also, watch out for #copyWith:, #add: etc.
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   496
        All of these create a new collection. Remember, that most collections
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   497
        offer methods to preallocate some space; for example, 'Set new:' creates
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   498
        an empty set, but preallocates space to avoid resizing over and over.
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   499
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   500
        An especially bad performace dog is to use #add: on fix-size collection
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   501
        objects (such as Strings or Arrays), since in addition to allocating
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   502
        lots of garbage, a #become: operation is required for EACH element
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   503
        added. NEVER use Arrays for growing/shrinking data - use OrderedCollection
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   504
        instead. (if you really need an array, use asArray afterwards)
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   505
207
claus
parents: 202
diff changeset
   506
      - if you are going to allocate huge data structures, think about
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   507
        optimizing space. For example, if you allocate a million instances of
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   508
        some object, each added instance variable makes up 4Mb of additional 
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   509
        memory need.
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   510
        Also, for Byte-valued, Integer-valued and Float like objects, special
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   511
        collections are provided, which store their values directly inside (instead
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   512
        of a reference to the object). A FloatArray consisting of 1 million floats
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   513
        requires about 4mb of memory, while an Array of Floats requires 4mb for the
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   514
        references to the floats, PLUS 20Mb for the floats themself.
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   515
207
claus
parents: 202
diff changeset
   516
      - check if you really need fast access to all of these objects; you may
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   517
        try to only keep some subset in memory, and use binary storage or
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   518
        (if this is too slow) optimized store/retrieve methods and keep the bigger
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   519
        part in a file. 
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   520
        (How about a DiskArray class, which does this transparently ?
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   521
         See the FileText class for some ideas and something to start with ...)
207
claus
parents: 202
diff changeset
   522
claus
parents: 202
diff changeset
   523
claus
parents: 202
diff changeset
   524
    Hint / Example 1: 
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   525
      you are about to allocate a huge data structure, which is known to
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   526
      survive long. In this case, it is better to have these objects move into the
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   527
      oldspace sooner, to avoid the copying overhead during scavenges.
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   528
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   529
      To do this, you can call ObjectMemory>>tenure after allocation, which
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   530
      forces all new-objects immediately into the oldspace. 
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   531
      Make certain, that not to many (ideally no) short-living objects are in the
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   532
      newspace when doing this.
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   533
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   534
      Another alternative is to tell the system that all allocation should be
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   535
      done directly in the oldspace. This completely avoids the scavenging overhead
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   536
      for these objects. To do so, use ObjectMemory>>turnGarbageCollectorOff
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   537
      before the allocation, and ObjectMemory>>turnGarbageCollectorOn afterwards.
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   538
      Keep in mind, that do-loops may allocate block-objects and other temporaries,
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   539
      so there is a danger of making things worse due to having all those temporaries
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   540
      in the oldspace afterwards. (which is not a fatal situation, but will
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   541
      force the system to do an oldspace collect earlier, which may not be your
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   542
      intention).
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   543
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   544
207
claus
parents: 202
diff changeset
   545
   Hint / Example 2:
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   546
      you know in advance, that a certain (big) amount of memory will be needed.
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   547
      For example, the fileBrowser wants to show a huge file in its text-view.
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
   548
      In this case, it is better to tell the memory system in advance, how much
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   549
      memory will be needed, since otherwise many compresses and reallocations will
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
   550
      occur (the memory system will allocate additional memory in chunks of smaller
433d44af1630 more GC control
claus
parents: 93
diff changeset
   551
      256k pieces, if a compress failes. Thus, if you are going to allocate (say) 1Mb of 
433d44af1630 more GC control
claus
parents: 93
diff changeset
   552
      strings, it will perform 5 compressing GC's).
433d44af1630 more GC control
claus
parents: 93
diff changeset
   553
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   554
      This is done using ObjectMemory>>moreOldSpace: or ObjectMemory announceSpaceNeed:.
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   555
      In the above example, you would do 'ObjectMemory announceSpaceNeed:500000', which 
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
   556
      avoids those annoying 5 compressing GC's.
207
claus
parents: 202
diff changeset
   557
      BTW: if you have other smalltalk processes (threads) running which should not be
claus
parents: 202
diff changeset
   558
      paused if possible, it is better to use #announceSpaceNeed. This tries to avoid 
claus
parents: 202
diff changeset
   559
      pausing in other processes and sometimes succeeds, while moreOldSpace will always 
claus
parents: 202
diff changeset
   560
      block the whole system for a while. However, there is no 'no-pause' guarantee.
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
   561
433d44af1630 more GC control
claus
parents: 93
diff changeset
   562
      The amount of automatic increase (in case the oldSpace becomes full) is 256k by
433d44af1630 more GC control
claus
parents: 93
diff changeset
   563
      default. This number can be changed with ObjectMemory>>oldSpaceIncrement:.
433d44af1630 more GC control
claus
parents: 93
diff changeset
   564
207
claus
parents: 202
diff changeset
   565
claus
parents: 202
diff changeset
   566
    Hint / Example3:
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   567
      There are rare cases, when an explicit GC makes a difference: since
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   568
      object finalization is done at GC time, objects which keep operatingSystem
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   569
      resources may be finalized late. This is normally no problem, except if
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   570
      the system is running out of resources. For example, allocating new colors
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   571
      may fail if many colors have already been allocated in the past - even
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   572
      though these colors are actually free. The Depth8Image calls for an
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   573
      explicit GC, whenever it fails to allocate a color for a bitmap, to force
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   574
      finalization of free, but not yet finalized colors.
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   575
      The same is true for things like file descriptors, if fileStreams are not closed
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   576
      correctly.
207
claus
parents: 202
diff changeset
   577
claus
parents: 202
diff changeset
   578
    Hint 4:
claus
parents: 202
diff changeset
   579
      If you run in too small of physical memory, the incremental GC may have a
claus
parents: 202
diff changeset
   580
      bad effect on your working set: since it touches pages (which may otherwise
claus
parents: 202
diff changeset
   581
      not be needed at the moment, the operating system is forced to steal other
claus
parents: 202
diff changeset
   582
      (possibly more useful) pages from your set of incore pages.
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   583
      Although ST/X would be willing to fix this behavior (by telling the OS about
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   584
      its page requirements, many OS's do not listen. The SGI-Iris, For example ignores
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   585
      the madvice system calls - other systems do not implement it.
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   586
      The trouble is that the standard LRU paging strategy is exactly the worst for
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   587
      a program which sequentially scans its memory once in a single direction ...
207
claus
parents: 202
diff changeset
   588
      You may get better performance, if you turn off the incremental GC while
claus
parents: 202
diff changeset
   589
      processing a big data structure.
claus
parents: 202
diff changeset
   590
claus
parents: 202
diff changeset
   591
229
210ee6865aa3 commenting
claus
parents: 216
diff changeset
   592
    Warning: many of the methods found here are not standard and may not even be available in
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
   593
    future versions of ST/X. Use them only in very special situations or experiments.
229
210ee6865aa3 commenting
claus
parents: 216
diff changeset
   594
207
claus
parents: 202
diff changeset
   595
    Let me know about additional special features you think are useful, and about
claus
parents: 202
diff changeset
   596
    special features you are using - this provides the feedback required to decide
403
claus
parents: 384
diff changeset
   597
    which methods are to be removed, kept or enhanced in future versions.
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   598
"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   599
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   600
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   601
interrupts
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   602
"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   603
    Handling of interrupts (i.e. unix-signals) is done via handler objects, which
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   604
    get a #XXXInterrupt-message sent. This is more flexible than (say) signalling
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   605
    a semaphore, since the handler-object may do anything to react on the signal
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   606
    (of course, it can also signal a semaphore to emulate the above behavior).
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   607
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   608
    Another reason for having handler objects is that they allow interrupt handling
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   609
    without any context switch, for high speed interrupt response.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   610
    However, if you do this, special care is needed, since it is not defined, 
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   611
    which (smalltalk-)process gets the interrupt and will do the processing 
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   612
    (therefore, the default setup installs handlers which simply signal a semaphore 
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   613
     and continue the current process).
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   614
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   615
    Typically, the handlers are set during early initialization of the system
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   616
    by sending 'ObjectMemory XXXInterruptHandler:aHandler' and not changed later.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   617
    (see Smalltalk>>initialize or ProcessorScheduler>>initialize).
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   618
    To setup your own handler, create some object which responds to #xxxInterrupt,
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   619
    and make it the handler using the above method.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   620
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   621
    Interrupt messages sent to handlers are:
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   622
        internalError:<someString>      - internal interpreter/GC errors
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   623
        userInterrupt                   - ^C interrupt
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   624
        customInterrupt                 - custom interrupt
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   625
        ioInterrupt                     - SIGIO interrupt
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   626
        timerInterrupt                  - alarm timer (SIGALRM)
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   627
        errorInterrupt:<id>             - errors from other primitives/subsystems
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   628
                                          (DisplayError)
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   629
        spyInterrupt                    - spy timer interrupt (SIGVTALARM)
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   630
        stepInterrupt                   - single step interrupt
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   631
        disposeInterrupt                - finalization required
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   632
        recursionInterrupt              - recursion (stack) overflow
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   633
        memoryInterrupt                 - soon running out of memory
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   634
        fpExceptionInterrupt            - floating point exception (SIGFPE)
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   635
        childSignalInterrupt            - death of a child process (SIGCHILD)
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   636
        signalInterrupt:<number>        - unix signal (if other than above signals)
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   637
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   638
    To avoid frustration in case of badly set handlers, these messages
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   639
    are also implemented in the Object class - thus anything can be defined
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   640
    as interrupt handler. However, the VM will not send any
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   641
    interrupt message, if the corresonding handler object is nil
759
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
   642
    (which means that nil is a bad choice, if you are interested in the event).
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   643
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   644
    Interrupt processing is not done immediately after the event arrives: 
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   645
    there are certain ``save-places'' at which this handling is performed
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   646
    (message send, method return and loop-heads).
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   647
    If not explicitely enabled, primitive code is never interrupted.
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   648
    However, if you do enable interrupts in your primitive (see ExternalStream as example),
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   649
    be prepared for your objects to move around ... therefore, these have to
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   650
    be coded very carefully.
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   651
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   652
    Interrupts may be disabled completely (OperatingSystem blockInterrupts) and 
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   653
    reenabled (unblockInterrupts) to allow for critical data to be manipulated.
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   654
    The above are low-level primitive entries - you better use #valueUninterruptably,
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   655
    which cares for unwinds, long returns and restores the blocking state.
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   656
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   657
    Every process has its own interrupt-enable state which is switched
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   658
    when processes switch control (i.e. you cannot block interrupts across
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   659
    a suspend, delay etc.). 
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   660
    However, the state will be restored after a resume.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   661
"
2
claus
parents: 1
diff changeset
   662
! !
claus
parents: 1
diff changeset
   663
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
   664
!ObjectMemory class methodsFor:'initialization'!
2
claus
parents: 1
diff changeset
   665
claus
parents: 1
diff changeset
   666
initialize
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   667
    "initialize the class"
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   668
2
claus
parents: 1
diff changeset
   669
    AllocationFailureSignal isNil ifTrue:[
1926
eda492a4e179 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
   670
        AllocationFailureSignal := ErrorSignal newSignalMayProceed:true.
eda492a4e179 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
   671
        AllocationFailureSignal nameClass:self message:#allocationFailureSignal.
eda492a4e179 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
   672
        AllocationFailureSignal notifierString:'allocation failure'.
eda492a4e179 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
   673
eda492a4e179 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
   674
        MallocFailureSignal := AllocationFailureSignal newSignalMayProceed:true.
eda492a4e179 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
   675
        MallocFailureSignal nameClass:self message:#mallocFailureSignal.
eda492a4e179 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
   676
        MallocFailureSignal notifierString:'(malloc) allocation failure'.
eda492a4e179 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
   677
2262
4c4d810f006f semaphore names
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
   678
        LowSpaceSemaphore := Semaphore new name:'LowSpaceSemaphore'
2
claus
parents: 1
diff changeset
   679
    ].
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
   680
    DisposeInterruptHandler := self.
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   681
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   682
    "/ BackgroundCollectMaximumInterval := 3600.     "/ run it at least once an hour
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   683
    BackgroundCollectMaximumInterval := nil.      "/ only run when space situation makes it feasable
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   684
    IncrementalGCLimit := 500000.                 "/ run it whenever 500k have been allocated
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   685
    FreeSpaceGCLimit := FreeSpaceGCAmount := nil. "/ no minumum-freeSpace trigger.
1729
48196b43bb18 added a reference to some VM symbols (in case libwidg/libtool is not
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
   686
    MemoryInterruptHandler := self.
1926
eda492a4e179 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
   687
    ExceptionInterruptHandler := self.
1729
48196b43bb18 added a reference to some VM symbols (in case libwidg/libtool is not
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
   688
48196b43bb18 added a reference to some VM symbols (in case libwidg/libtool is not
Claus Gittinger <cg@exept.de>
parents: 1704
diff changeset
   689
    VMSelectors := #( #noByteCode #invalidCodeObject #invalidByteCode #invalidInstruction
1926
eda492a4e179 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
   690
                      #tooManyArguments #badLiteralTable #receiverNotBoolean: #typeCheckError
eda492a4e179 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
   691
                      #integerCheckError #wrongNumberOfArguments: #privateMethodCalled
eda492a4e179 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
   692
                      #doesNotUnderstand: #invalidReturn: #invalidReturnOrRestart:
eda492a4e179 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
   693
                      #userInterrupt #internalError: #spyInterrupt #timerInterrupt #stepInterrupt
eda492a4e179 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
   694
                      #errorInterrupt:with: #disposeInterrupt #recursionInterrupt
eda492a4e179 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
   695
                      #memoryInterrupt #fpExceptionInterrupt #signalInterrupt: #childSignalInterrupt
eda492a4e179 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
   696
                      #ioInterrupt #customInterrupt #schedulerInterrupt #contextInterrupt
eda492a4e179 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
   697
                      #interruptLatency:receiver:class:selector:vmActivity:id:).
eda492a4e179 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
   698
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   699
    "Modified: / 5.8.1998 / 15:30:12 / cg"
2
claus
parents: 1
diff changeset
   700
! !
claus
parents: 1
diff changeset
   701
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
   702
!ObjectMemory class methodsFor:'ST-80 compatibility'!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   703
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   704
availableFreeBytes
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   705
    "return the amount of free memory
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   706
     (both in the compact free area and in the free lists)"
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   707
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   708
    ^ self freeSpace + self freeListSpace
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   709
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   710
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   711
     ObjectMemory availableFreeBytes 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   712
    "
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   713
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   714
    "Modified: 29.1.1997 / 23:43:05 / cg"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   715
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   716
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   717
bytesPerOOP
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   718
    "return the number of bytes an object reference (for example: an instvar)
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   719
     takes"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   720
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   721
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   722
    RETURN(__MKSMALLINT(sizeof(OBJ)));
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   723
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   724
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   725
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   726
     ObjectMemory bytesPerOOP 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   727
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   728
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   729
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   730
bytesPerOTE
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   731
    "return the number of overhead bytes of an object.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   732
     i.e. the number of bytes in every objects header."
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   733
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   734
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   735
    RETURN(__MKSMALLINT(OHDR_SIZE));
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   736
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   737
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   738
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   739
     ObjectMemory bytesPerOTE 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   740
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   741
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   742
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   743
compactingGC
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   744
    "perform a compacting garbage collect"
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   745
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   746
    self garbageCollect
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   747
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   748
    "Modified: 29.1.1997 / 23:43:25 / cg"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   749
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   750
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   751
current
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   752
    "the 'current' ObjectMemory - thats myself"
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   753
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   754
    ^ self
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   755
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   756
    "Modified: 29.1.1997 / 23:43:39 / cg"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   757
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   758
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   759
globalCompactingGC
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   760
    "perform a compacting garbage collect"
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   761
3605
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   762
    self reclaimSymbols.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   763
    self garbageCollect
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   764
3605
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   765
    "Modified: / 18.6.1998 / 15:00:52 / cg"
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   766
!
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   767
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   768
globalGarbageCollect
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   769
    "perform a compacting garbage collect"
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   770
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   771
    self reclaimSymbols.
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   772
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   773
    "Created: / 18.6.1998 / 15:00:05 / cg"
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   774
    "Modified: / 18.6.1998 / 15:00:47 / cg"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   775
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   776
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   777
growMemoryBy:numberOfBytes
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   778
    "allocate more memory"
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   779
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   780
    ^ self moreOldSpace:numberOfBytes
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   781
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   782
    "Modified: 29.1.1997 / 23:44:01 / cg"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   783
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   784
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   785
numOopsNumBytes
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   786
    "return an array filled with the number of objects
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   787
     and the number of used bytes."
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   788
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   789
    ^ Array with:(self numberOfObjects)
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   790
            with:(self bytesUsed)
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   791
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   792
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   793
     ObjectMemory numOopsNumBytes 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   794
    "
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   795
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   796
    "Modified: 29.1.1997 / 23:44:24 / cg"
3057
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   797
!
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   798
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   799
versionId
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   800
    "return this systems version.
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   801
     For ST80 compatibility."
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   802
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   803
    ^ Smalltalk versionString
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   804
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   805
    "Created: / 27.10.1997 / 13:51:59 / cg"
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   806
    "Modified: / 28.10.1997 / 20:06:14 / cg"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   807
! !
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   808
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
   809
!ObjectMemory class methodsFor:'Signal constants'!
2
claus
parents: 1
diff changeset
   810
claus
parents: 1
diff changeset
   811
allocationFailureSignal
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   812
    "return the signal raised when an object allocation failed"
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   813
2
claus
parents: 1
diff changeset
   814
    ^ AllocationFailureSignal
464
83af924c8cff differenciate between object-allocation-failure and malloc-allocation-failure
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   815
!
83af924c8cff differenciate between object-allocation-failure and malloc-allocation-failure
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   816
83af924c8cff differenciate between object-allocation-failure and malloc-allocation-failure
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   817
mallocFailureSignal
83af924c8cff differenciate between object-allocation-failure and malloc-allocation-failure
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   818
    "return the signal raised when malloc memory allocation failed.
83af924c8cff differenciate between object-allocation-failure and malloc-allocation-failure
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   819
     (usually, this kind of memory is used with I/O buffers or other temporary
83af924c8cff differenciate between object-allocation-failure and malloc-allocation-failure
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   820
      non-Object storage)"
83af924c8cff differenciate between object-allocation-failure and malloc-allocation-failure
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   821
83af924c8cff differenciate between object-allocation-failure and malloc-allocation-failure
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   822
    ^ MallocFailureSignal
2
claus
parents: 1
diff changeset
   823
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   824
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
   825
!ObjectMemory class methodsFor:'VM messages'!
375
claus
parents: 370
diff changeset
   826
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   827
debugPrinting
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   828
    "return true, if various debug printouts in the VM
375
claus
parents: 370
diff changeset
   829
     are turned on, false of off."
claus
parents: 370
diff changeset
   830
claus
parents: 370
diff changeset
   831
%{  /* NOCONTEXT */
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
   832
    extern int __getDebugPrinting();
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
   833
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
   834
    RETURN (__getDebugPrinting() ? true : false);
375
claus
parents: 370
diff changeset
   835
%}
claus
parents: 370
diff changeset
   836
!
claus
parents: 370
diff changeset
   837
claus
parents: 370
diff changeset
   838
debugPrinting:aBoolean
claus
parents: 370
diff changeset
   839
    "turn on/off various debug printouts in the VM
claus
parents: 370
diff changeset
   840
     in case of an error. For example, a double-notUnderstood
claus
parents: 370
diff changeset
   841
     leads to a VM context dump if debugPrinting is on.
claus
parents: 370
diff changeset
   842
     If off, those messages are suppressed.
claus
parents: 370
diff changeset
   843
     The default is on, since these messages are only printed for
claus
parents: 370
diff changeset
   844
     severe errors."
claus
parents: 370
diff changeset
   845
claus
parents: 370
diff changeset
   846
%{  /* NOCONTEXT */
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
   847
    __setDebugPrinting( (aBoolean == true) );
375
claus
parents: 370
diff changeset
   848
%}
claus
parents: 370
diff changeset
   849
!
claus
parents: 370
diff changeset
   850
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   851
infoPrinting
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   852
    "return true, if various informational printouts in the VM
375
claus
parents: 370
diff changeset
   853
     are turned on, false of off."
claus
parents: 370
diff changeset
   854
claus
parents: 370
diff changeset
   855
%{  /* NOCONTEXT */
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
   856
    extern int __getInfoPrinting();
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
   857
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
   858
    RETURN (__getInfoPrinting() ? true : false);
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   859
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   860
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   861
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   862
infoPrinting:aBoolean
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   863
    "turn on/off various informational printouts in the VM.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   864
     For example, the GC activity messages are controlled by
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   865
     this flags setting.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   866
     The default is true, since (currently) those messages
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   867
     are useful for ST/X developers."
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   868
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   869
%{  /* NOCONTEXT */
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
   870
    __setInfoPrinting( (aBoolean == true) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   871
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   872
! !
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   873
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
   874
!ObjectMemory class methodsFor:'access debugging'!
703
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   875
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   876
setTrapOnAccessFor:anObject
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   877
    "install an access trap for anObject;
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   878
     An accessSignal will be raised, whenever any instvar of anObject is either read or written.
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   879
     This is not supported on all architectures, therefore the return value
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   880
     (true of trap was installed ok, false if failed) should be checked."
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   881
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   882
%{  /* NOCONTEXT */
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
   883
    RETURN (__addTrapOnAccess(anObject, 2) ? true : false);
703
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   884
%}
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   885
!
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   886
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   887
setTrapOnReadFor:anObject
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   888
    "install a read trap for anObject;
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   889
     An accessSignal will be raised, whenever any access into anObject occurrs.
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   890
     This is not supported on all architectures, therefore the return value
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   891
     (true of trap was installed ok, false if failed) should be checked."
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   892
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   893
%{  /* NOCONTEXT */
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
   894
    RETURN (__addTrapOnAccess(anObject, 0) ? true : false);
703
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   895
%}
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   896
!
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   897
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   898
setTrapOnWriteFor:anObject
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   899
    "install a write trap for anObject;
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   900
     An accessSignal will be raised, whenever any instvar of anObject is written to.
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   901
     This is not supported on all architectures, therefore the return value
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   902
     (true of trap was installed ok, false if failed) should be checked."
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   903
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   904
%{  /* NOCONTEXT */
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
   905
    RETURN (__addTrapOnAccess(anObject, 1) ? true : false);
703
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   906
%}
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   907
!
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   908
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   909
unsetAllTraps
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   910
    "remove all access traps"
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   911
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   912
%{  /* NOCONTEXT */
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
   913
    __removeAllAccessTraps();
703
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   914
%} 
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   915
!
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   916
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   917
unsetTrapFor:anObject
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   918
    "remove any access trap for anObject."
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   919
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   920
%{  /* NOCONTEXT */
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
   921
    __removeTrapOnAccess(anObject);
703
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   922
%}
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   923
! !
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
   924
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
   925
!ObjectMemory class methodsFor:'cache management'!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   926
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   927
flushCaches
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   928
    "flush method and inline caches for all classes"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   929
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   930
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   931
    __flushMethodCache();
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   932
    __flushAllInlineCaches();
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   933
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   934
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   935
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   936
flushCachesFor:aClass
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   937
    "flush method and inline caches for aClass"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   938
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   939
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   940
    __flushMethodCacheFor(aClass);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   941
    __flushInlineCachesFor(aClass);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   942
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   943
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   944
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   945
flushCachesForSelector:aSelector
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   946
    "flush method and inline caches for aSelector"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   947
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   948
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   949
    __flushMethodCacheForSelector(aSelector);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   950
    __flushInlineCachesForSelector(aSelector);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   951
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   952
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   953
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   954
flushInlineCaches
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   955
    "flush all inlinecaches"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   956
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   957
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   958
    __flushAllInlineCaches();
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   959
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   960
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   961
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   962
flushInlineCachesFor:aClass withArgs:nargs
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   963
    "flush inlinecaches for calls to aClass with nargs arguments"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   964
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   965
%{  /* NOCONTEXT */
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
   966
    __flushInlineCachesForAndNargs(aClass, __intVal(nargs));
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   967
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   968
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   969
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   970
flushInlineCachesForClass:aClass
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   971
    "flush inlinecaches for calls to aClass."
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   972
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   973
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   974
    __flushInlineCachesFor(aClass);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   975
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   976
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   977
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   978
flushInlineCachesForSelector:aSelector
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   979
    "flush inlinecaches for sends of aSelector"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   980
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   981
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   982
    __flushInlineCachesForSelector(aSelector);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   983
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   984
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   985
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   986
flushInlineCachesWithArgs:nargs
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   987
    "flush inlinecaches for calls with nargs arguments"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   988
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   989
%{  /* NOCONTEXT */
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
   990
    __flushInlineCaches(__intVal(nargs));
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   991
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   992
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   993
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   994
flushMethodCache
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   995
    "flush the method cache"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   996
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   997
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   998
    __flushMethodCache();
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   999
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1000
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1001
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1002
flushMethodCacheFor:aClass
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1003
    "flush the method cache for sends to aClass"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1004
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1005
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1006
    __flushMethodCacheFor(aClass);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1007
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1008
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1009
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1010
flushMethodCacheForSelector:aSelector
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1011
    "flush the method cache for sends of aSelector"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1012
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1013
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1014
    __flushMethodCacheForSelector(aSelector);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1015
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1016
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1017
1108
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1018
incrementSnapshotID
2526
d600b7b0c13e comments
Claus Gittinger <cg@exept.de>
parents: 2525
diff changeset
  1019
    "obsolete - do not use"
d600b7b0c13e comments
Claus Gittinger <cg@exept.de>
parents: 2525
diff changeset
  1020
1108
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1021
%{  /* NOCONTEXT */
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1022
    __bumpSnapshotID();
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1023
%}
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1024
!
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1025
876
2fb0b80d8731 added entries to manipulate snapshotIDs
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1026
snapshotID
918
05c16023099c commentary
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
  1027
    "return the internal snapshotID number.
05c16023099c commentary
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
  1028
     This is incremented when an image is restarted, and
05c16023099c commentary
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
  1029
     stored with the image.
05c16023099c commentary
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
  1030
     Not for normal users, this is used by the VM to invalidate
05c16023099c commentary
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
  1031
     caches which are stored with the image"
05c16023099c commentary
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
  1032
876
2fb0b80d8731 added entries to manipulate snapshotIDs
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1033
%{  /* NOCONTEXT */
2fb0b80d8731 added entries to manipulate snapshotIDs
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1034
    RETURN ( __MKSMALLINT( __snapshotID() ));
2fb0b80d8731 added entries to manipulate snapshotIDs
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1035
%}
918
05c16023099c commentary
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
  1036
    "
05c16023099c commentary
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
  1037
     ObjectMemory snapshotID     
05c16023099c commentary
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
  1038
    "
876
2fb0b80d8731 added entries to manipulate snapshotIDs
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1039
!
2fb0b80d8731 added entries to manipulate snapshotIDs
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1040
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1041
trapRestrictedMethods:trap
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1042
    "Allow/Deny execution of restricted Methods (see Method>>>restricted:)
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1043
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1044
     Notice: method restriction is a nonstandard feature, not supported
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1045
     by other smalltalk implementations and not specified in the ANSI spec.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1046
     This is EXPERIMENTAL - and being evaluated for usability.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1047
     It may change or even vanish (if it shows to be not useful)."
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1048
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1049
    |oldTrap|
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1050
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1051
%{ 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1052
	if (__setTrapRestrictedMethods(trap == true))
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1053
	    oldTrap = true;
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1054
	else
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1055
	    oldTrap = false;
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1056
%}.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1057
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1058
    (trap and:[oldTrap not]) ifTrue:[
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1059
	self flushCaches
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1060
    ].
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1061
    ^ oldTrap
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1062
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1063
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1064
	ObjectMemory trapRestrictedMethods:true
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1065
	ObjectMemory trapRestrictedMethods:false
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1066
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1067
! !
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1068
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  1069
!ObjectMemory class methodsFor:'debug queries'!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1070
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1071
addressOf:anObject
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1072
    "return the core address of anObject as an integer
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1073
     - since objects may move around, the returned value is invalid after the
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1074
     next scavenge/collect.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1075
     WARNING: this method is for ST/X debugging only 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1076
	      it will be removed without notice"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1077
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1078
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1079
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1080
    if (! __isNonNilObject(anObject)) {
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1081
	RETURN ( nil );
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1082
    }
2783
172c91b94aff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
  1083
    if ((unsigned INT)anObject <= _MAX_INT) {
2769
2fd416e4b589 alpha64 changes
Claus Gittinger <cg@exept.de>
parents: 2638
diff changeset
  1084
	RETURN ( __MKSMALLINT((INT)anObject) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1085
    }
2769
2fd416e4b589 alpha64 changes
Claus Gittinger <cg@exept.de>
parents: 2638
diff changeset
  1086
    RETURN ( __MKUINT((INT)anObject) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1087
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1088
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1089
    |p|
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1090
    p := Point new.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1091
    ((ObjectMemory addressOf:p) printStringRadix:16) printNL.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1092
    ObjectMemory scavenge.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1093
    ((ObjectMemory addressOf:p) printStringRadix:16) printNL.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1094
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1095
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1096
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1097
ageOf:anObject
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1098
    "return the number of scavenges, an object has survived
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1099
     in new space. 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1100
     For old objects and living contexts, the returned number is invalid.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1101
     WARNING: this method is for ST/X debugging only 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1102
	      it will be removed without notice"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1103
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1104
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1105
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1106
    if (! __isNonNilObject(anObject)) {
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1107
	RETURN ( 0 );
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1108
    }
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  1109
    RETURN ( __MKSMALLINT( _GET_AGE(anObject) ) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1110
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1111
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1112
    |p|
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1113
    p := Point new.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1114
    (ObjectMemory ageOf:p) printNL.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1115
    ObjectMemory tenuringScavenge.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1116
    (ObjectMemory spaceOf:p) printNL.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1117
    ObjectMemory tenuringScavenge.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1118
    (ObjectMemory spaceOf:p) printNL.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1119
    ObjectMemory tenuringScavenge.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1120
    (ObjectMemory spaceOf:p) printNL.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1121
    ObjectMemory tenuringScavenge.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1122
    (ObjectMemory spaceOf:p) printNL.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1123
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1124
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1125
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1126
displayRefChainTo:anObject
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1127
    self displayRefChainToAny:(Array with:anObject).
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1128
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1129
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1130
      self displayRefChainTo:Point new
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1131
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1132
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1133
      Smalltalk at:#foo put:Point new.
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1134
      self displayRefChainTo:(Smalltalk at:#foo)
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1135
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1136
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1137
      |p|
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1138
      p := Point new.
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1139
      Smalltalk at:#foo put:(#x -> p).
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1140
      self displayRefChainTo:p
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1141
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1142
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1143
      |a|
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1144
      a := Array new:1. a at:1 put:a.
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1145
      Smalltalk at:#foo put:(#x -> a).
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1146
      self displayRefChainTo:a 
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1147
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1148
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1149
      |a|
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1150
      a := Array new:1. a at:1 put:a.
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1151
      Smalltalk at:#foo put:(#x -> (Array with:a)).
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1152
      self displayRefChainTo:a 
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1153
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1154
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1155
      |a|
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1156
      a := Array new:1. a at:1 put:a.
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1157
      Smalltalk at:#foo put:(#x -> (Array with:a with:(#y -> a))).
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1158
      self displayRefChainTo:a 
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1159
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1160
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1161
      |p|
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1162
      p := Point new.
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1163
      Smalltalk at:#foo put:(WeakArray with:(#x -> (#y -> p))).
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1164
      self displayRefChainTo:p
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1165
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1166
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1167
      self displayRefChainTo:Transcript topView
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1168
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1169
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1170
    "Created: / 2.2.1998 / 19:23:55 / cg"
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1171
    "Modified: / 3.2.1998 / 00:30:14 / cg"
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1172
!
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1173
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1174
displayRefChainToAny:aCollection
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1175
    |levels objects done showMore stop userStop chain
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1176
     top progress lbl h nDone nAll panel listV stopButton 
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1177
     moreButton owners objectArray numObjects numObjectsDone
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1178
     found moreChainsOnThisLevel temporaryRemoved chains chainObjs
3643
d2625b6d95b3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3642
diff changeset
  1179
     anyShown anyShownInAnyLevel list tLevels firstRound|
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1180
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1181
    top := StandardSystemView new.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1182
    top extent:350@250.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1183
    top label:'Object reference finder'.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1184
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1185
    lbl := Label label:'compressing garbage ...' in:top.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1186
    lbl adjust:#left.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1187
    lbl origin:(0.0@0.0) corner:(1.0@0.0).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1188
    h := lbl preferredExtent y.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1189
    lbl
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1190
        topInset:5;
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1191
        bottomInset:(h+5) negated;
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1192
        leftInset:5;
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1193
        rightInset:5.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1194
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1195
    progress := ProgressIndicator in:top.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1196
    progress origin:(0.0@45) corner:(1.0@45).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1197
    progress level:-1.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1198
    h := progress preferredExtent y.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1199
    progress 
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1200
        topInset:(h // 2) negated; 
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1201
        bottomInset:(h // 2) negated;
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1202
        leftInset:5;
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1203
        rightInset:5.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1204
    progress beInvisible.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1205
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1206
    listV := HVScrollableView for:SelectionInListView in:top.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1207
    listV origin:(0.0@55) corner:(1.0@1.0).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1208
    listV 
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1209
        topInset:(h // 2); 
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1210
        bottomInset:40;
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1211
        leftInset:5;
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1212
        rightInset:5.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1213
    listV beInvisible.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1214
    
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1215
    panel := HorizontalPanelView in:top.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1216
    panel origin:(0.0@1.0) corner:(1.0@1.0).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1217
    panel topInset:-40.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1218
    panel horizontalLayout:#left.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1219
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1220
    panel add:(Button label:'stop' action:[stop := userStop := true]).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1221
    panel add:(moreButton := Button label:'more' action:[showMore := true]).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1222
    panel ignoreInvisibleComponents:false.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1223
    moreButton beInvisible.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1224
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1225
    top openWithPriority:(Processor activePriority + 1).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1226
    top waitUntilVisible.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1227
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1228
    lbl label:'compressing garbage ...'.
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1229
    self compressingGarbageCollect.
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1230
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1231
    progress beVisible.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1232
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1233
    levels := OrderedCollection new.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1234
    objects := WeakIdentitySet withAll:aCollection.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1235
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1236
    done := (objects includesIdentical:Smalltalk).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1237
    stop := userStop := false.
3643
d2625b6d95b3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3642
diff changeset
  1238
    anyShown := anyShownInAnyLevel := false.
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1239
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1240
    "/ consider this a kludge:
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1241
    "/ the processes are not held in any global; they are (currently)
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1242
    "/ only known to the VM.
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1243
    "/ In order to find a global ref, temporarily create one here.
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1244
    "/ These are released later.
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1245
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1246
    Smalltalk at:#'__VMProcesses__' put:(self processesKnownInVM).
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1247
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1248
    firstRound := true.
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1249
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1250
    [done] whileFalse:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1251
        anyShown := false.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1252
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1253
        progress percentage:0.
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1254
        firstRound ifTrue:[
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1255
            firstRound := false.
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1256
        ] ifFalse:[
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1257
            lbl label:'compressing garbage ...'.
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1258
            self garbageCollect.
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1259
        ].
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1260
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1261
        lbl label:('searching level ' 
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1262
                   , levels size printString 
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1263
                   , ' (' , objects size printString , ' refs) ...').
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1264
        nAll := objects size.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1265
        nDone := 0.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1267
        objectArray := objects asArray.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1268
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1269
        owners := "Weak"IdentitySet new.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1270
        
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1271
        numObjectsDone := 0.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1272
        found := false.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1273
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1274
        [self allObjectsDo:[:o |
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1275
            |inPrevLevel|
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1276
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1277
            stop ifFalse:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1278
                (o referencesAny:objectArray) ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1279
                    o isBehavior ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1280
                        o == Smalltalk ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1281
                            found := true.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1282
                        ] ifFalse:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1283
                            "/ only add it if it has classInstVars
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1284
                            o instSize ~~ Class instSize ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1285
                                (objects includesIdentical:o) ifFalse:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1286
                                    inPrevLevel := false.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1287
                                    levels do:[:lColl | 
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1288
                                                        lColl == o ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1289
                                                            inPrevLevel := true
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1290
                                                        ] ifFalse:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1291
                                                            (lColl includesIdentical:o) ifTrue:[inPrevLevel := true].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1292
                                                        ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1293
                                              ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1294
                                    inPrevLevel ifFalse:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1295
                                        owners add:o.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1296
                                    ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1297
                                ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1298
                            ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1299
                        ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1300
                    ] ifFalse:[    
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1301
                        o class ~~ WeakArray ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1302
                            (objects includesIdentical:o) ifFalse:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1303
                                inPrevLevel := false.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1304
                                levels do:[:lColl | 
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1305
                                                    lColl == o ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1306
                                                        inPrevLevel := true
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1307
                                                    ] ifFalse:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1308
                                                        (lColl includesIdentical:o) ifTrue:[inPrevLevel := true].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1309
                                                    ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1310
                                          ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1311
                                inPrevLevel ifFalse:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1312
                                    owners add:o.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1313
                                ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1314
                            ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1315
                        ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1316
                    ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1317
                ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1318
                numObjectsDone := numObjectsDone + 1.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1319
                numObjects notNil ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1320
                    numObjectsDone \\ 1000 == 0 ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1321
                        progress percentage:(numObjectsDone / numObjects * 100).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1322
                        Processor yield.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1323
                    ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1324
                ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1325
            ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1326
        ]] whileFalse.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1327
        progress percentage:100.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1328
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1329
        numObjects isNil ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1330
            numObjects := numObjectsDone.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1331
        ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1332
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1333
        owners remove:aCollection ifAbsent:nil.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1334
        owners remove:thisContext ifAbsent:nil.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1335
        owners remove:objectArray ifAbsent:nil.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1336
        owners remove:objects keyArray ifAbsent:nil.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1337
        owners remove:owners keyArray ifAbsent:nil.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1338
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1339
"/ 'done with level: ' print. levels size print. ' found ' print. owners size print. ' refs' printCR.
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1340
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1341
        owners isEmpty ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1342
            found ifFalse:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1343
                stop := true.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1344
            ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1345
        ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1346
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1347
        stop ifFalse:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1348
            done := found or:[(owners includesIdentical:Smalltalk)].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1349
            done ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1350
                moreChainsOnThisLevel := true.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1351
                temporaryRemoved := IdentitySet new.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1352
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1353
                levels size > 0 ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1354
                    "/ show what we found so far.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1355
                    levels last add:Smalltalk.    
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1356
                    levels reverse.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1357
                ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1358
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1359
                chains := OrderedCollection new.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1360
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1361
                tLevels := levels collect:[:lColl | lColl copy].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1362
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1363
                lbl label:('building refchains ...').
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1364
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1365
                nAll := aCollection size.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1366
                nDone := 0.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1367
                aCollection do:[:anObject | |theseChains|
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1368
                    stop ifFalse:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1369
                        theseChains := self 
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1370
                                refChainsFrom:Smalltalk
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1371
                                to:anObject 
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1372
                                inRefSets:tLevels
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1373
                                startingAt:1.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1374
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1375
                        theseChains size > 0 ifTrue:[
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1376
                            chains addAll:theseChains
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1377
                        ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1378
                        nDone := nDone + 1.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1379
                        progress percentage:(nDone / nAll * 100).        
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1380
                    ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1381
                ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1382
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1383
                tLevels := nil.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1384
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1385
                levels size > 0 ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1386
                    levels reverse.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1387
                    levels last remove:Smalltalk.    
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1388
                ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1389
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1390
                [stop not 
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1391
                 and:[chains size > 0]] whileTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1392
                    chain := chains first.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1393
                    chains removeFirst.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1394
                        
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1395
                    lbl label:('found a reference chain.').
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1396
                    progress beInvisible.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1397
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1398
                    chain addFirst:Smalltalk.
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1399
                    list := OrderedCollection new grow:chain size.    
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1400
                    1 to:chain size-1 do:[:i |
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1401
                        list 
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1402
                            at:i 
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1403
                            put:(self refNameFor:(chain at:i+1) in:(chain at:i))
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1404
                    ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1405
                    list at:list size put:(chain last classNameWithArticle).
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1406
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1407
                    "/ hide the VMProcesses stuff from the user ...
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1408
                    (list at:1) string = 'Smalltalk:__VMProcesses__' ifTrue:[
3642
9f7a90ca149c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3605
diff changeset
  1409
                        list at:1 put:'__VMProcesses__ (a hidden VM reference)'.
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1410
                        list removeIndex:2.
3643
d2625b6d95b3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3642
diff changeset
  1411
                        chain at:1 put:nil.       
d2625b6d95b3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3642
diff changeset
  1412
                        chain removeIndex:2.
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1413
                    ].
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1414
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1415
                    listV list:list.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1416
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1417
                    listV beVisible.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1418
                    listV doubleClickAction:[:idx | |o|
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1419
                                                (o := chain at:idx) notNil ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1420
                                                    o inspect.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1421
                                                ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1422
                                            ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1423
                    moreButton beVisible.
3643
d2625b6d95b3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3642
diff changeset
  1424
                    anyShown := anyShownInAnyLevel := true.
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1425
                    showMore := false.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1426
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1427
                    "/ kludge - wait for some user action
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1428
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1429
                    [showMore or:[stop or:[top realized not]]] whileFalse:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1430
                        Delay waitForSeconds:0.1
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1431
                    ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1432
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1433
                    listV doubleClickAction:nil.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1434
                    chain := nil.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1435
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1436
                    top realized not ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1437
                        stop := true
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1438
                    ] ifFalse:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1439
                        showMore ifFalse:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1440
                            stop := true.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1441
                        ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1442
                    ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1443
                    done := false.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1444
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1445
                    stop ifFalse:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1446
                        progress beVisible.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1447
                        listV beInvisible.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1448
                        moreButton beInvisible.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1449
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1450
                        chain := nil.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1451
                    ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1452
                ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1453
                levels size > 0 ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1454
                    levels last addAll:temporaryRemoved.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1455
                ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1456
            ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1457
        ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1458
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1459
        owners remove:Smalltalk ifAbsent:nil.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1460
        owners remove:(owners keyArray) ifAbsent:nil.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1461
        owners remove:objectArray ifAbsent:nil.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1462
        levels do:[:lColl |
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1463
            owners remove:lColl ifAbsent:nil
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1464
        ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1465
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1466
        levels add:owners.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1467
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1468
        objects := owners.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1469
        
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1470
        objects size == 0 ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1471
            stop := true
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1472
        ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1473
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1474
        stop ifTrue:[
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1475
            Smalltalk at:#'__VMProcesses__' put:nil.
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1476
            top destroy.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1477
            anyShown ifFalse:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1478
                userStop ifFalse:[
3643
d2625b6d95b3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3642
diff changeset
  1479
                    self information:(anyShownInAnyLevel ifTrue:['no more references'] ifFalse:['no references']).
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1480
                ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1481
            ].
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1482
           ^ self.
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1483
        ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1484
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1485
    ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1486
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1487
    anyShown ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1488
        userStop ifFalse:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1489
            self information:'no more references'.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1490
        ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1491
    ].
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1492
    Smalltalk at:#'__VMProcesses__' put:nil.
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1493
    ^ self
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1494
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1495
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1496
      self displayRefChainTo:Point new
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1497
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1498
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1499
      Smalltalk at:#foo put:Point new.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1500
      self displayRefChainTo:(Smalltalk at:#foo)
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1501
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1502
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1503
      |p|
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1504
      p := Point new.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1505
      Smalltalk at:#foo put:(#x -> p).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1506
      self displayRefChainTo:p
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1507
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1508
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1509
      |a|
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1510
      a := Array new:1. a at:1 put:a.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1511
      Smalltalk at:#foo put:(#x -> a).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1512
      Smalltalk at:#bar put:(Array with:(#y -> a)).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1513
      self displayRefChainTo:a 
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1514
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1515
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1516
      |a|
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1517
      a := Array new:1. a at:1 put:a.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1518
      Smalltalk at:#foo put:(#x -> (Array with:a)).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1519
      self displayRefChainTo:a 
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1520
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1521
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1522
      |a|
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1523
      a := Array new:1. a at:1 put:a.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1524
      Smalltalk at:#foo put:(#x -> (Array with:a with:(#y -> a))).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1525
      self displayRefChainTo:a 
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1526
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1527
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1528
      |p|
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1529
      p := Point new.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1530
      Smalltalk at:#foo put:(WeakArray with:(#x -> (#y -> p))).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1531
      self displayRefChainTo:p
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1532
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1533
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1534
      self displayRefChainTo:Transcript topView
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1535
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1536
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1537
    "Created: / 2.2.1998 / 23:58:04 / cg"
3643
d2625b6d95b3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3642
diff changeset
  1538
    "Modified: / 10.7.1998 / 17:22:06 / cg"
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1539
!
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1540
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1541
dumpObject:someObject
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1542
    "low level dump an object.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1543
     WARNING: this method is for ST/X debugging only 
794
d713b6c04379 more __xx__ renames (dumpObject)
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1544
	      it may be removed (or replaced by a noop) without notice"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1545
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1546
%{
794
d713b6c04379 more __xx__ renames (dumpObject)
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1547
    __dumpObject__(someObject);
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1548
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1549
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1550
     ObjectMemory dumpObject:true
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1551
     ObjectMemory dumpObject:(Array new:10) 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1552
     ObjectMemory dumpObject:(10@20 corner:30@40) 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1553
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1554
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1555
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1556
flagsOf:anObject
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1557
    "For debugging only.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1558
     WARNING: this method is for ST/X debugging only 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1559
	      it will be removed without notice"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1560
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1561
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1562
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1563
    if (! __isNonNilObject(anObject)) {
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1564
	RETURN ( nil );
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1565
    }
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  1566
    RETURN ( __MKSMALLINT( anObject->o_flags ) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1567
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1568
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1569
F_ISREMEMBERED  1       /* a new-space thing being refd by some oldSpace thing */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1570
F_ISFORWARDED   2       /* a forwarded object (you will never see this here) */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1571
F_DEREFERENCED  4       /* a collection after grow (not currently used) */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1572
F_ISONLIFOLIST  8       /* a non-lifo-context-referencing-obj already on list */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1573
F_MARK          16      /* mark bit for background collector */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1574
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1575
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1576
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1577
     |arr|
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1578
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1579
     arr := Array new.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1580
     arr at:1 put:([thisContext] value).
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1581
     (ObjectMemory flagsOf:anObject) printNL
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1582
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1583
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1584
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1585
objectAt:anAddress
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1586
    "return whatever anAddress points to as object.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1587
     BIG BIG DANGER ALERT: 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1588
	this method is only to be used for debugging ST/X itself 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1589
	- you can easily (and badly) crash the system.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1590
     WARNING: this method is for ST/X debugging only 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1591
	      it will be removed without notice"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1592
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1593
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1594
    int addr = __longIntVal(anAddress);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1595
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1596
    if (addr) {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1597
	RETURN ((OBJ)(addr));
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1598
    }
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1599
    RETURN (nil);
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1600
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1601
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1602
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1603
printReferences:anObject
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1604
    "for debugging: print referents to anObject.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1605
     WARNING: this method is for ST/X debugging only 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1606
	      it will be removed without notice
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1607
	use ObjectMemory>>whoReferences: or anObject>>allOwners."
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1608
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1609
%{
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1610
    __printRefChain(__context, anObject);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1611
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1612
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1613
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1614
refChainFrom:start to:anObject inRefSets:levels startingAt:index
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1615
     |chain|
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1616
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1617
     index > levels size ifTrue:[
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1618
        (start references:anObject) ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1619
            ^ OrderedCollection with:anObject. "/ (self refNameFor:anObject in:start)
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1620
        ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1621
        ^ nil.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1622
     ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1623
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1624
     (levels at:index) do:[:el |
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1625
el ~~ start ifTrue:[
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1626
        (start references:el) ifTrue:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1627
            chain := self 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1628
                        refChainFrom:el 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1629
                        to:anObject 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1630
                        inRefSets:levels 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1631
                        startingAt:(index+1).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1632
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1633
            chain notNil ifTrue:[
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1634
                (levels at:index) saveRemove:el.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1635
                chain addFirst:el. "/ (self refNameFor:el in:start).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1636
                ^ chain.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1637
            ]
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1638
        ].
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1639
].
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1640
     ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1641
     ^ nil
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1642
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1643
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1644
     "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1645
      |o a1 a2|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1646
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1647
      o := Object new.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1648
      a1 := Array with:o with:nil with:nil.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1649
      a2 := Array with:a1 with:nil with:nil.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1650
      a2 references:a1
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1651
     "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1652
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1653
     "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1654
      |o a1 a2 a3 a4 levels|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1655
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1656
      o := Object new.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1657
      a1 := Array with:o.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1658
      a2 := Array with:a1.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1659
      a3 := Array with:a2.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1660
      a4 := Array with:a3.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1661
      levels := Array with:(Array with:a3)
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1662
                      with:(Array with:a2)
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1663
                      with:(Array with:a1).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1664
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1665
      self refChainFrom:a4 to:o inRefSets:levels startingAt:1. 
1108
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1666
     "
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1667
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1668
    "Modified: / 3.2.1998 / 02:38:27 / cg"
1108
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1669
!
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1670
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1671
refChainsFrom:start to:anObject inRefSets:levels startingAt:index
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1672
     |chains chain c|
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1673
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1674
     chains := OrderedCollection new.
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1675
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1676
     index > levels size ifTrue:[
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1677
        (start references:anObject) ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1678
            chains add:(OrderedCollection with:anObject "(self refNameFor:anObject in:start)").
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1679
        ].
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1680
        ^ chains
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1681
     ].
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1682
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1683
     (levels at:index) do:[:el |
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1684
el ~~ start ifTrue:[
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1685
        (start references:el) ifTrue:[
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1686
            chain := self 
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1687
                        refChainFrom:el 
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1688
                        to:anObject 
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1689
                        inRefSets:levels 
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1690
                        startingAt:(index+1).
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1691
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1692
            chain size > 0 ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1693
                (levels at:index) saveRemove:el.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1694
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1695
                c := chain copy.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1696
                c addFirst:el "(self refNameFor:el in:start)".
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1697
                chains add:c.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1698
            ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1699
].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1700
        ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1701
     ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1702
     ^ chains
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1703
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1704
    "Created: / 2.2.1998 / 19:09:22 / cg"
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1705
    "Modified: / 3.2.1998 / 02:38:17 / cg"
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1706
!
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1707
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1708
refNameFor:anObject in:referent
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1709
    |names oClass|
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1710
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1711
    referent == Smalltalk ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1712
        referent keysAndValuesDo:[:key :val |
3275
0ecdf7a69acf better refName (see memoryUsage - ref chain menu action)
Claus Gittinger <cg@exept.de>
parents: 3266
diff changeset
  1713
            |idx|
0ecdf7a69acf better refName (see memoryUsage - ref chain menu action)
Claus Gittinger <cg@exept.de>
parents: 3266
diff changeset
  1714
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1715
            (anObject == val) ifTrue:[
3275
0ecdf7a69acf better refName (see memoryUsage - ref chain menu action)
Claus Gittinger <cg@exept.de>
parents: 3266
diff changeset
  1716
                "/ for our convenience - if its a nameSpace, cut off Smalltalk.
0ecdf7a69acf better refName (see memoryUsage - ref chain menu action)
Claus Gittinger <cg@exept.de>
parents: 3266
diff changeset
  1717
                idx := key string indexOf:$:.
0ecdf7a69acf better refName (see memoryUsage - ref chain menu action)
Claus Gittinger <cg@exept.de>
parents: 3266
diff changeset
  1718
                (idx ~~ 0 
0ecdf7a69acf better refName (see memoryUsage - ref chain menu action)
Claus Gittinger <cg@exept.de>
parents: 3266
diff changeset
  1719
                and:[idx < key string size
0ecdf7a69acf better refName (see memoryUsage - ref chain menu action)
Claus Gittinger <cg@exept.de>
parents: 3266
diff changeset
  1720
                and:[(key string at:(idx+1)) == $:]]) ifTrue:[
0ecdf7a69acf better refName (see memoryUsage - ref chain menu action)
Claus Gittinger <cg@exept.de>
parents: 3266
diff changeset
  1721
                    ^ (key copyFrom:(idx+2)) asText allBold
0ecdf7a69acf better refName (see memoryUsage - ref chain menu action)
Claus Gittinger <cg@exept.de>
parents: 3266
diff changeset
  1722
                ].
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1723
                ^ 'Smalltalk:' , (key asText allBold).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1724
            ]
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1725
        ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1726
    ] ifFalse:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1727
        names := referent class allInstVarNames.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1728
        oClass := referent class.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1729
        1 to:oClass instSize do:[:i |
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1730
            ((referent instVarAt:i) == anObject) ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1731
                ^ (referent classNameWithArticle , ' [' , (names at:i) asText allBold, ']').
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1732
            ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1733
        ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1734
        oClass isVariable ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1735
            oClass isPointers ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1736
                1 to:referent basicSize do:[:i |
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1737
                    ((referent basicAt:i) == anObject) ifTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1738
                        ^ (referent classNameWithArticle , ' [' , i printString asText allBold, ']').
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1739
                    ]
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1740
                ]
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1741
            ]
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1742
        ].
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1743
    ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1744
    self halt:'no reference'.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1745
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1746
    "Created: / 2.2.1998 / 23:46:12 / cg"
3275
0ecdf7a69acf better refName (see memoryUsage - ref chain menu action)
Claus Gittinger <cg@exept.de>
parents: 3266
diff changeset
  1747
    "Modified: / 4.2.1998 / 22:03:36 / cg"
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1748
!
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1749
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1750
sizeOf:anObject
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1751
    "return the size of anObject in bytes.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1752
     (this is not the same as 'anObject size').
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1753
     WARNING: this method is for ST/X debugging only 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1754
	      it will be removed without notice"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1755
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1756
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1757
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1758
    RETURN ( __isNonNilObject(anObject) ? __MKSMALLINT(__qSize(anObject)) : __MKSMALLINT(0) )
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1759
%}
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1760
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1761
     |hist big nw|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1762
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1763
     hist := Array new:100 withAll:0.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1764
     big := 0.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1765
     ObjectMemory allObjectsDo:[:o |
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1766
	 nw := (ObjectMemory sizeOf:o) // 4 + 1.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1767
	 nw > 100 ifTrue:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1768
	    big := big + 1
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1769
	 ] ifFalse:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1770
	    hist at:nw put:(hist at:nw) + 1
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1771
	 ].
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1772
     ].
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1773
     hist printNL.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1774
     big printNL
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1775
    "
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1776
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1777
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1778
spaceOf:anObject
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1779
    "return the memory space, in which anObject is.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1780
     - since objects may move between spaces, 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1781
       the returned value may be invalid after the next scavenge/collect.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1782
     WARNING: this method is for ST/X debugging only 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1783
	      it will be removed without notice"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1784
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1785
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1786
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1787
    if (! __isNonNilObject(anObject)) {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1788
	RETURN ( nil );
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1789
    }
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1790
    RETURN ( __MKSMALLINT( __qSpace(anObject) ) );
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1791
%}
375
claus
parents: 370
diff changeset
  1792
! !
claus
parents: 370
diff changeset
  1793
3699
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1794
!ObjectMemory class methodsFor:'debugging ST/X'!
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1795
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1796
printPolyCaches
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1797
    "{ Pragma: +optSpace }"
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1798
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1799
    "dump poly caches.
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1800
     WARNING: this method is for debugging only
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1801
              it will be removed without notice"
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1802
%{
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1803
    __dumpILCCaches();
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1804
%}
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1805
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1806
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1807
     ObjectMemory printPolyCaches
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1808
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1809
!
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1810
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1811
printStackBacktrace
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1812
    "{ Pragma: +optSpace }"
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1813
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1814
    "print a stack backtrace - then continue.
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1815
     (You may turn off the stack print with debugPrinting:false)
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1816
     WARNING: this method is for debugging only 
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1817
              it will be removed without notice"
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1818
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1819
%{
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1820
    __printStack(__context);
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1821
%}
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1822
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1823
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1824
     ObjectMemory printStackBacktrace
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1825
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1826
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1827
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1828
!
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1829
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1830
printStackBacktraceFrom:aContext
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1831
    "{ Pragma: +optSpace }"
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1832
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1833
    "print a stack backtrace - then continue.
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1834
     (You may turn off the stack print with debugPrinting:false)
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1835
     WARNING: this method is for debugging only 
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1836
              it will be removed without notice"
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1837
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1838
%{
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1839
    __printStack(aContext);
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1840
%}
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1841
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1842
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1843
     ObjectMemory printStackBacktraceFrom:thisContext sender sender
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1844
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1845
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1846
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1847
!
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1848
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1849
printSymbols
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1850
    "{ Pragma: +optSpace }"
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1851
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1852
    "dump the internal symbol table.
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1853
     WARNING: this method is for debugging only
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1854
              it will be removed without notice"
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1855
%{
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1856
#ifdef DEBUG
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1857
    __dumpSymbols();
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1858
#endif
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1859
%}
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1860
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1861
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1862
     ObjectMemory printSymbols
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1863
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1864
!
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1865
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1866
sendTraceOff
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1867
    "{ Pragma: +optSpace }"
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1868
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1869
    "turns tracing of message sends off.
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1870
     WARNING: this method is for debugging only 
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1871
              it may be removed without notice"
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1872
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1873
%{  /* NOCONTEXT */
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1874
    __setMessageTrace__(0);
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1875
%}
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1876
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1877
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1878
     ObjectMemory sendTraceOff
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1879
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1880
!
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1881
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1882
sendTraceOn
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1883
    "{ Pragma: +optSpace }"
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1884
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1885
    "turns tracing of message sends on.
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1886
     WARNING: this method is for debugging only 
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1887
              it may be removed without notice"
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1888
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1889
%{  /* NOCONTEXT */
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1890
    __setMessageTrace__(1);
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1891
%}
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1892
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1893
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1894
     ObjectMemory sendTraceOn
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1895
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1896
! !
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  1897
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  1898
!ObjectMemory class methodsFor:'dependents access'!
10
claus
parents: 5
diff changeset
  1899
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1900
dependents
3223
ccdfe7ceb88e comment
Claus Gittinger <cg@exept.de>
parents: 3181
diff changeset
  1901
    "return the collection of my dependents"
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1902
3057
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
  1903
    ^ Dependents ? #()
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
  1904
3223
ccdfe7ceb88e comment
Claus Gittinger <cg@exept.de>
parents: 3181
diff changeset
  1905
    "Modified: / 26.1.1998 / 11:17:59 / cg"
10
claus
parents: 5
diff changeset
  1906
!
claus
parents: 5
diff changeset
  1907
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1908
dependents:aCollection
10
claus
parents: 5
diff changeset
  1909
    "set the dependents collection"
claus
parents: 5
diff changeset
  1910
claus
parents: 5
diff changeset
  1911
    Dependents := aCollection
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1912
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1913
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1914
dependentsDo:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1915
    "evaluate aBlock for all of my dependents.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1916
     Since this is performed at startup time (under the scheduler),
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1917
     this is redefined here to catch abort signals.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1918
     Thus, if any error occurs in a #returnFromSnapshot,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1919
     the user can press abort to continue."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1920
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1921
    |deps|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1922
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1923
    deps := Dependents.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1924
    deps notNil ifTrue:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1925
	deps do:[:each |
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1926
	    AbortSignal handle:[:ex |
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1927
		ex return       
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1928
	    ] do:[
282
94f5c3a6230d *** empty log message ***
claus
parents: 270
diff changeset
  1929
		aBlock value:each
94f5c3a6230d *** empty log message ***
claus
parents: 270
diff changeset
  1930
	    ]
94f5c3a6230d *** empty log message ***
claus
parents: 270
diff changeset
  1931
	]
94f5c3a6230d *** empty log message ***
claus
parents: 270
diff changeset
  1932
    ]
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1933
! !
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1934
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  1935
!ObjectMemory class methodsFor:'enumerating'!
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1936
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1937
allInstancesOf:aClass do:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1938
    "evaluate the argument, aBlock for all instances of aClass in the system.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1939
     There is one caveat: if a compressing oldSpace collect
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1940
     occurs while looping over the objects, the loop cannot be
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1941
     continued (for some internal reasons). In this case, false
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1942
     is returned."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1943
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1944
    |work|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1945
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1946
%{  /* NOREGISTER - work may not be placed into a register here */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1947
    __nonTenuringScavenge(__context);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1948
    /*
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1949
     * allInstancesDo needs a temporary to hold newSpace objects
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1950
     */
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  1951
    if (__allInstancesOfDo(&aClass, &aBlock, &work) < 0) {
159
514c749165c3 *** empty log message ***
claus
parents: 133
diff changeset
  1952
	RETURN (false);
85
claus
parents: 77
diff changeset
  1953
    }
claus
parents: 77
diff changeset
  1954
%}.
claus
parents: 77
diff changeset
  1955
    ^ true
2
claus
parents: 1
diff changeset
  1956
!
claus
parents: 1
diff changeset
  1957
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1958
allObjectsDo:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1959
    "evaluate the argument, aBlock for all objects in the system.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1960
     There is one caveat: if a compressing oldSpace collect
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1961
     occurs while looping over the objects, the loop cannot be
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1962
     continued (for some internal reasons). In this case, false
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1963
     is returned."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1964
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1965
    |work|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1966
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1967
%{  /* NOREGISTER - work may not be placed into a register here */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1968
    __nonTenuringScavenge(__context);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1969
    /*
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1970
     * allObjectsDo needs a temporary to hold newSpace objects
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1971
     */
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  1972
    if (__allInstancesOfDo((OBJ *)0, &aBlock, &work) < 0) {
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1973
	RETURN (false);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1974
    }
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1975
%}.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1976
    ^ true
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1977
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1978
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1979
allObjectsIncludingContextsDo:aBlock
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1980
    "like allObjectsDo, but also walks over all contexts
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1981
     of living processes"
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1982
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1983
    self allObjectsDo:aBlock.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1984
    ProcessorScheduler knownProcesses do:[:p |
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1985
        |con|
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1986
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1987
        con := p suspendedContext.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1988
        [con notNil] whileTrue:[
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1989
            aBlock value:con.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1990
            con := con sender.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1991
        ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1992
    ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1993
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1994
    "Created: / 3.2.1998 / 11:32:08 / cg"
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1995
!
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1996
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1997
allOldObjectsDo:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1998
    "evaluate the argument, aBlock for all old objects in the system.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1999
     For debugging and tests only - do not use"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2000
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  2001
    if (__allInstancesOfDo((OBJ *)0, &aBlock, (OBJ *)0) < 0) {
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2002
	RETURN (false);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2003
    }
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2004
%}. 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2005
    ^ true
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2006
!
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2007
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2008
processesKnownInVM
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2009
    "debug query: return a collection of processObjects as known
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2010
     in the VM. For ST/X internal use only."
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2011
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2012
%{
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2013
    extern OBJ __processesKnownInVM();
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2014
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2015
    RETURN (__processesKnownInVM());
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2016
%}
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2017
    "
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2018
     ObjectMemory processesKnownInVM
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2019
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2020
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2021
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  2022
!ObjectMemory class methodsFor:'garbage collection'!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2023
3725
b50bfa6fdbca added accessors for BackgroundCollectProcess and
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
  2024
backgroundCollectProcess
b50bfa6fdbca added accessors for BackgroundCollectProcess and
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
  2025
    "return the backgroundCollectProcess (or nil, if noone is running)"
b50bfa6fdbca added accessors for BackgroundCollectProcess and
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
  2026
b50bfa6fdbca added accessors for BackgroundCollectProcess and
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
  2027
    ^ BackgroundCollectProcess
b50bfa6fdbca added accessors for BackgroundCollectProcess and
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
  2028
b50bfa6fdbca added accessors for BackgroundCollectProcess and
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
  2029
    "Created: / 4.8.1998 / 01:54:16 / cg"
b50bfa6fdbca added accessors for BackgroundCollectProcess and
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
  2030
!
b50bfa6fdbca added accessors for BackgroundCollectProcess and
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
  2031
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2032
backgroundCollectorRunning
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2033
    "return true, if a backgroundCollector is running"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2034
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2035
    ^ BackgroundCollectProcess notNil
500
e5fd4f3c9f37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2036
e5fd4f3c9f37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2037
    "
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2038
     ObjectMemory backgroundCollectorRunning
375
claus
parents: 370
diff changeset
  2039
    "
claus
parents: 370
diff changeset
  2040
!
claus
parents: 370
diff changeset
  2041
3646
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2042
compressOldSpace
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2043
    "COMPRESS the oldSpace memory area.
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2044
     This uses an inplace 2-pass compress algorithm, which may
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2045
     be slightly slower than the semispace compress if lots of real memory
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2046
     is available. 
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2047
     In memory limited systems, this inplace compress is usually preferable. 
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2048
     Inplace compression can be enforced by setting the compress-limit to a
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2049
     small number.
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2050
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2051
     This can take a long time."
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2052
%{
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2053
    __compressOldSpace(__context);
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2054
%}
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2055
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2056
    "
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2057
     ObjectMemory compressOldSpace
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2058
    "
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2059
    "
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2060
     Transcript showCR:(Time millisecondsToRun:[
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2061
         ObjectMemory markAndSweep.
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2062
         ObjectMemory compressOldSpace.
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2063
     ]).
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2064
    "
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2065
    "
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2066
     Transcript showCR:(Time millisecondsToRun:[
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2067
         ObjectMemory compressingGarbageCollect.
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2068
     ]).
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2069
    "
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2070
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2071
!
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2072
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2073
compressingGarbageCollect
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2074
    "search for and free garbage in the oldSpace (newSpace is cleaned automatically) 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2075
     performing a COMPRESSING garbage collect.
3646
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2076
     This uses a 1-pass copying semispace algorithm, which may
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2077
     be slightly faster than the 2-pass in-place compress if enough real memory
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2078
     is available. In memory limited systems, an inplace compress is
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2079
     preferable, which is enforced by setting the compress-limit to a
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2080
     small number.
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2081
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2082
     This can take a long time - especially, if paging is involved
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2083
     (when no paging is involved, its faster than I thought :-).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2084
     If no memory is available for the compress, or the system has been started with
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2085
     the -Msingle option, this does a non-COMPRESSING collect."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2086
%{
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2087
    if (! __garbageCollect(__context)) {
3646
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2088
        __markAndSweep(__context);
3648
a6da5ea8a7df fallBack to 2pass compress in #verboseGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3647
diff changeset
  2089
        RETURN (false);
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  2090
    }
3648
a6da5ea8a7df fallBack to 2pass compress in #verboseGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3647
diff changeset
  2091
    RETURN (true);
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2092
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2093
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  2094
    "
375
claus
parents: 370
diff changeset
  2095
     ObjectMemory compressingGarbageCollect
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  2096
    "
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  2097
!
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  2098
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2099
garbageCollect
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2100
    "search for and free garbage in the oldSpace.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2101
     This can take a long time - especially, if paging is involved."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2102
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2103
    "/ used to be 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2104
    "/    self compressingGarbageCollect 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2105
    "/ here; changed to default to markAndSweep
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2106
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2107
    self markAndSweep
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2108
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  2109
    "
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2110
     ObjectMemory garbageCollect
375
claus
parents: 370
diff changeset
  2111
    "
claus
parents: 370
diff changeset
  2112
!
claus
parents: 370
diff changeset
  2113
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2114
gcStep
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2115
    "one incremental garbage collect step.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2116
     Mark or sweep some small number of objects. This
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2117
     method will return after a reasonable (short) time.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2118
     This is used by the ProcessorScheduler at idle times.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2119
     Returns true, if an incremental GC cycle has finished."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2120
%{
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2121
    extern int __incrGCstep();
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2122
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2123
    RETURN (__incrGCstep(__context) ? true : false);
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2124
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2125
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2126
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2127
gcStepIfUseful
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2128
    "If either the IncrementalGCLimit or the FreeSpaceGCLimits have been
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2129
     reached, perform one incremental garbage collect step.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2130
     Return true, if more gcSteps are required to finish the cycle,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2131
     false if done with a gc round.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2132
     If no limit has been reached yet, do nothing and return false.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2133
     This is called by the ProcessorScheduler at idle times or by the 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2134
     backgroundCollector."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2135
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2136
    |done limit|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2137
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2138
    AbortSignal handle:[:ex |
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2139
        "/ in case of abort (from the debugger),
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2140
        "/ disable gcSteps.
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2141
        done := true.
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2142
        IncrementalGCLimit := FreeSpaceGCLimit := nil.
2131
1eeb310e109a newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
  2143
        'ObjectMemory [error]: IGC aborted; turning off incremental GC' errorPrintCR
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2144
    ] do:[
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2145
        limit := IncrementalGCLimit.
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2146
        (limit notNil and:[self oldSpaceAllocatedSinceLastGC > limit]) ifTrue:[
3761
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2147
"/            'IGC [info]: start since allocatedSinceLastGC > IncrementalGCLimit' infoPrintCR.
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2148
            done := ObjectMemory gcStep
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2149
        ] ifFalse:[
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2150
            limit := FreeSpaceGCLimit.
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2151
            (limit notNil and:[(self freeSpace + self freeListSpace) < limit]) ifTrue:[
3761
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2152
"/            'IGC [info]: start since freeSpace < FreeSpaceGCLimit' infoPrintCR.
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2153
                done := ObjectMemory gcStep.
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2154
                done ifTrue:[
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2155
                    self moreOldSpaceIfUseful
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2156
                ].
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2157
            ] ifFalse:[
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2158
                limit := DynamicCodeGCTrigger.
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2159
                (limit notNil and:[self compiledCodeCounter > limit]) ifTrue:[
3761
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2160
"/                    'IGC [info]: start since compiledCodeCounter > DynamicCodeGCTrigger' infoPrintCR.
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2161
                    done := ObjectMemory gcStep.
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2162
                ] ifFalse:[
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2163
                    limit := DynamicCodeLimit.
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2164
                    (limit notNil and:[self compiledCodeSpaceUsed > limit]) ifTrue:[
3761
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2165
"/                    'IGC [info]: start since compiledCodeSpaceUsed > DynamicCodeLimit' infoPrintCR.
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2166
                        done := ObjectMemory gcStep.
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2167
                    ] ifFalse:[
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2168
                        done := true
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2169
                    ]
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2170
                ]
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2171
            ]
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2172
        ].
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2173
    ].
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2174
    ^ done not
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2175
3761
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2176
    "Modified: / 14.8.1998 / 13:08:15 / cg"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2177
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2178
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2179
incrementalGC
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2180
    "perform one round of incremental GC steps.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2181
     The overall effect of this method is (almost) the same as calling 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2182
     markAndSweep. However, #incrementalGC is interruptable while #markAndSweep
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2183
     is atomic and blocks for a while. The code here performs incremental
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2184
     GC steps, until one complete gc-cycle is completed. If running at a higher
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2185
     than userBackground priority, it will give up the CPU after every such
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2186
     step for a while.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2187
     Thus this method can be called either from a low prio (background) process 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2188
     or from a high prio process.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2189
     (however, if you have nothing else to do, its better to call for markAndSweep,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2190
      since it is faster)
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2191
     For example, someone allocating huge amounts of memory could
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2192
     ask for the possibility of a quick allocation using
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2193
     #checkForFastNew: and try a #incrementalGC if not. In many
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2194
     cases, this can avoid a pause (in the higher prio processes) due to 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2195
     a blocking GC."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2196
1669
4951596746f7 comments & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2197
    |delay|
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2198
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2199
    Processor activeProcess priority > Processor userBackgroundPriority ifTrue:[
3108
52cecf074ee5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
  2200
        delay := Delay forMilliseconds:1
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2201
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2202
3742
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2203
    ((self incrementalGCPhaseSymbolic ~~ #idle)
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2204
    or:[self gcStepIfUseful]) ifTrue:[
3108
52cecf074ee5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
  2205
        [self gcStep] whileFalse:[
52cecf074ee5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
  2206
            delay notNil ifTrue:[delay wait]
52cecf074ee5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
  2207
        ]
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2208
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2209
    self moreOldSpaceIfUseful
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2210
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2211
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2212
     ObjectMemory incrementalGC
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2213
     [ObjectMemory incrementalGC] forkAt:3
403
claus
parents: 384
diff changeset
  2214
     [ObjectMemory incrementalGC] forkAt:9 
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2215
    "
3108
52cecf074ee5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
  2216
3742
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2217
    "Modified: / 10.8.1998 / 15:03:07 / cg"
194
197c209e61f4 fine tuning tenure
claus
parents: 178
diff changeset
  2218
!
197c209e61f4 fine tuning tenure
claus
parents: 178
diff changeset
  2219
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2220
markAndSweep
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2221
    "mark/sweep garbage collector.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2222
     perform a full mark&sweep collect.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2223
     Warning: this may take some time and it is NOT interruptable.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2224
     If you want to do a collect from a background process, or have
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2225
     other things to do, better use #incrementalGC which is interruptable."
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2226
%{
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2227
    __markAndSweep(__context);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2228
%}
194
197c209e61f4 fine tuning tenure
claus
parents: 178
diff changeset
  2229
197c209e61f4 fine tuning tenure
claus
parents: 178
diff changeset
  2230
    "
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2231
     ObjectMemory markAndSweep
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2232
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2233
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2234
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2235
reclaimSymbols
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2236
    "reclaim unused symbols;
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2237
     Unused symbols are (currently) not reclaimed automatically,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2238
     but only upon request with this method. 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2239
     It takes some time to do this ... and it is NOT interruptable.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2240
     Future versions may do this automatically, while garbage collecting."
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2241
%{
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2242
    __reclaimSymbols(__context);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2243
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2244
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2245
     ObjectMemory reclaimSymbols
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2246
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2247
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2248
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2249
scavenge
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2250
    "collect young objects, without aging (i.e. no tenure).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2251
     Can be used to quickly get rid of shortly before allocated
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2252
     stuff. This is relatively fast (compared to oldspace collect).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2253
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2254
     An example where a non-tenuring scavenge makes sense is when
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2255
     allocating some OperatingSystem resource (a Color, File or View) 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2256
     and the OS runs out of resources. In this case, the scavenge may
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2257
     free some ST-objects and therefore (by signalling the WeakArrays
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2258
     or Registries) free the OS resources too.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2259
     Of course, only recently allocated resources will be freed this
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2260
     way. If none was freed, a full collect will be needed."
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2261
%{
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2262
    __nonTenuringScavenge(__context);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2263
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2264
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2265
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2266
     ObjectMemory scavenge
194
197c209e61f4 fine tuning tenure
claus
parents: 178
diff changeset
  2267
    "
207
claus
parents: 202
diff changeset
  2268
!
claus
parents: 202
diff changeset
  2269
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2270
startBackgroundCollectorAt:aPriority
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2271
    "start a process doing incremental GC in the background.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2272
     Use this, if you have suspendable background processes which
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2273
     run all the time, and therefore would prevent the idle-collector
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2274
     from running. See documentation in this class for more details."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2275
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2276
    |p|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2277
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2278
    "/
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2279
    "/ its not useful, to run it more than once
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2280
    "/
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2281
    BackgroundCollectProcess notNil ifTrue:[
2258
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2282
        BackgroundCollectProcess priority:aPriority.
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2283
        ^ self
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2284
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2285
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2286
    p :=
2258
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2287
        [
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2288
            [
3742
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2289
                |myDelay timeOfLastGC doGC|
2258
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2290
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2291
                myDelay := Delay forSeconds:5.
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  2292
                timeOfLastGC := AbsoluteTime now.
2258
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2293
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2294
                [true] whileTrue:[
3742
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2295
                    doGC := self gcStepIfUseful.
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2296
                    doGC ifFalse:[
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2297
                        (BackgroundCollectMaximumInterval notNil
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2298
                        and:[(AbsoluteTime now - timeOfLastGC) > BackgroundCollectMaximumInterval])
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2299
                        ifTrue:[
3743
2a29f0c02432 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
  2300
"/                            'ObjectMemory [info]: start time-triggered background collect.' infoPrintCR.
3742
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2301
                            doGC := true.
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2302
                        ]
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2303
                    ].
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2304
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2305
                    doGC ifTrue:[
3761
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2306
                        "/
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2307
                        "/ perform a full cycle (finish cycle)
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2308
                        "/
3742
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2309
                        [self gcStep] whileFalse:[].
3761
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2310
                        "/
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2311
                        "/ increase oldSpace, if freeSpace is below limits.
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2312
                        "/
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2313
                        self moreOldSpaceIfUseful.
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  2314
                        timeOfLastGC := AbsoluteTime now.
2258
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2315
                    ].
3761
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2316
                    "/
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2317
                    "/ wait a bit
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2318
                    "/
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  2319
                    myDelay wait.
2258
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2320
                ]
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2321
            ] valueOnUnwindDo:[
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2322
                BackgroundCollectProcess := nil
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2323
            ]
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2324
        ] newProcess.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2325
    p name:'background collector'.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2326
    p priority:aPriority.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2327
    p restartable:true.
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  2328
    p beGroupLeader.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2329
    p resume.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2330
    BackgroundCollectProcess := p
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2331
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2332
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2333
     the following lets the backgroundCollector run at prio 5
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2334
     whenever 100000 bytes have been allocated, OR freeSpace drops
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2335
     below 1meg. Having the system keep 1meg as reserve for peak allocation.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2336
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2337
     Doing this may reduce pauses due to inevitable collects when running
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2338
     out of freeSpace, if the collector can keep up with allocation rate.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2339
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2340
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2341
    "
2258
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2342
     ObjectMemory stopBackgroundCollector.
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2343
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2344
     ObjectMemory incrementalGCLimit:100000.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2345
     ObjectMemory freeSpaceGCLimit:1000000.
2258
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2346
     ObjectMemory startBackgroundCollectorAt:5.
211
58bb873aa83c *** empty log message ***
claus
parents: 207
diff changeset
  2347
    "
2258
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2348
3761
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2349
    "Modified: / 14.8.1998 / 13:09:19 / cg"
207
claus
parents: 202
diff changeset
  2350
!
claus
parents: 202
diff changeset
  2351
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2352
stopBackgroundCollector
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2353
    "stop the background collector"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2354
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2355
    BackgroundCollectProcess notNil ifTrue:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2356
	BackgroundCollectProcess terminate.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2357
	BackgroundCollectProcess := nil
207
claus
parents: 202
diff changeset
  2358
    ]
293
31df3850e98c *** empty log message ***
claus
parents: 291
diff changeset
  2359
211
58bb873aa83c *** empty log message ***
claus
parents: 207
diff changeset
  2360
    "
58bb873aa83c *** empty log message ***
claus
parents: 207
diff changeset
  2361
     ObjectMemory stopBackgroundCollector
58bb873aa83c *** empty log message ***
claus
parents: 207
diff changeset
  2362
    "
362
claus
parents: 360
diff changeset
  2363
!
claus
parents: 360
diff changeset
  2364
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2365
tenure
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2366
    "force all living new stuff into old-space - effectively making
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2367
     all living young objects become old objects immediately.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2368
     This is relatively fast (compared to oldspace collect).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2369
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2370
     This method should only be used in very special situations:
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2371
     for example, when building up some long-living data structure
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2372
     in a time critical application.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2373
     To do so, you have to do a scavenge followed by a tenure after the
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2374
     objects are created. Be careful, to not reference any other chunk-
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2375
     data when calling for a tenure (this will lead to lots of garbage in
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2376
     the oldspace).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2377
     In normal situations, explicit tenures are not needed."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2378
%{
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2379
    __tenure(__context);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2380
%}
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2381
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2382
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2383
     ObjectMemory tenure
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2384
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2385
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2386
     ... build up long living objects ...
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2387
     ObjectMemory scavenge.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2388
     ObjectMemory tenure
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2389
     ... continue - objects created above are now in oldSpace ...
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2390
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2391
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2392
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2393
tenuringScavenge
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2394
    "collect newspace stuff, with aging (i.e. objects old enough
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2395
     will be moved into the oldSpace).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2396
     Use this for debugging and testing only - the system performs
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2397
     this automatically when the newspace fills up.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2398
     This is relatively fast (compared to oldspace collect)"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2399
%{
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2400
    __scavenge(__context);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2401
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2402
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2403
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2404
     ObjectMemory tenuringScavenge
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2405
    "
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2406
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2407
2403
d4e67b8ac3bb ST80 stuff
ca
parents: 2339
diff changeset
  2408
verboseCompactingGC
d4e67b8ac3bb ST80 stuff
ca
parents: 2339
diff changeset
  2409
    "ST80 compatibility; same as verboseGarbageCollect"
d4e67b8ac3bb ST80 stuff
ca
parents: 2339
diff changeset
  2410
d4e67b8ac3bb ST80 stuff
ca
parents: 2339
diff changeset
  2411
    self verboseGarbageCollect
d4e67b8ac3bb ST80 stuff
ca
parents: 2339
diff changeset
  2412
!
d4e67b8ac3bb ST80 stuff
ca
parents: 2339
diff changeset
  2413
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2414
verboseGarbageCollect
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2415
    "perform a compressing garbage collect and show some informational
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2416
     output on the Transcript"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2417
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2418
    |nBytesBefore nReclaimed value unit|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2419
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2420
    nBytesBefore := self oldSpaceUsed.
3648
a6da5ea8a7df fallBack to 2pass compress in #verboseGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3647
diff changeset
  2421
a6da5ea8a7df fallBack to 2pass compress in #verboseGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3647
diff changeset
  2422
    "/ try 1pass baker collect first.
a6da5ea8a7df fallBack to 2pass compress in #verboseGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3647
diff changeset
  2423
    "/ this will fail if oldSpace size is above compressLimit
a6da5ea8a7df fallBack to 2pass compress in #verboseGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3647
diff changeset
  2424
    (self compressingGarbageCollect) ifFalse:[
a6da5ea8a7df fallBack to 2pass compress in #verboseGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3647
diff changeset
  2425
        "/ fallBack - use 2pass inplace compress
a6da5ea8a7df fallBack to 2pass compress in #verboseGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3647
diff changeset
  2426
        self compressOldSpace
a6da5ea8a7df fallBack to 2pass compress in #verboseGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3647
diff changeset
  2427
    ].
3649
30a8ecdc6b5c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2428
30a8ecdc6b5c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2429
    "/ show what we reclaimed
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2430
    nReclaimed := nBytesBefore - self oldSpaceUsed.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2431
    nReclaimed > 0 ifTrue:[
1418
23df6a323b69 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2432
        nReclaimed > 1024 ifTrue:[
23df6a323b69 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2433
            nReclaimed > (1024 * 1024) ifTrue:[
3649
30a8ecdc6b5c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2434
                value := nReclaimed * 10 // (1024 * 1024) / 10.0.
1418
23df6a323b69 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2435
                unit := ' Mb.'
23df6a323b69 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2436
            ] ifFalse:[
23df6a323b69 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2437
                value := nReclaimed // 1024.
23df6a323b69 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2438
                unit := ' Kb.'
23df6a323b69 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2439
            ]
23df6a323b69 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2440
        ] ifFalse:[
23df6a323b69 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2441
            value := nReclaimed.
23df6a323b69 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2442
            unit := ' bytes.'
23df6a323b69 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2443
        ].
3649
30a8ecdc6b5c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2444
        Transcript show:'reclaimed '; show:value.
1418
23df6a323b69 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2445
        Transcript showCR:unit
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2446
    ]
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2447
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2448
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2449
     ObjectMemory verboseGarbageCollect
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2450
    "
1418
23df6a323b69 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2451
3649
30a8ecdc6b5c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2452
    "Modified: / 15.7.1998 / 13:28:05 / cg"
2403
d4e67b8ac3bb ST80 stuff
ca
parents: 2339
diff changeset
  2453
!
d4e67b8ac3bb ST80 stuff
ca
parents: 2339
diff changeset
  2454
d4e67b8ac3bb ST80 stuff
ca
parents: 2339
diff changeset
  2455
verboseGlobalCompactingGC
d4e67b8ac3bb ST80 stuff
ca
parents: 2339
diff changeset
  2456
    "ST80 compatibility; same as verboseGarbageCollect"
d4e67b8ac3bb ST80 stuff
ca
parents: 2339
diff changeset
  2457
d4e67b8ac3bb ST80 stuff
ca
parents: 2339
diff changeset
  2458
    self verboseGarbageCollect
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  2459
! !
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  2460
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  2461
!ObjectMemory class methodsFor:'garbage collector control'!
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2462
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2463
announceOldSpaceNeed:howMuch
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2464
    "announce to the memory system, that howMuch bytes of memory will be needed
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2465
     soon, which is going to live longer (whatever that means). 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2466
     It first checks if the memory can be allocated without forcing a compressing
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2467
     GC. If not, the oldSpace is increased. This may also lead to a slow compressing
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2468
     collect. However, many smaller increases are avoided afterwards. Calling this
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2469
     method before allocating huge chunks of data may provide better overall performance.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2470
     Notice: this is a nonstandard interface - use only in special situations."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2471
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2472
    (self checkForFastNew:howMuch) ifFalse:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2473
	self incrementalGC.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2474
	(self checkForFastNew:howMuch) ifFalse:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2475
	    self moreOldSpace:howMuch
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2476
	]
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2477
    ]
310
fbfb977ae1bd *** empty log message ***
claus
parents: 308
diff changeset
  2478
fbfb977ae1bd *** empty log message ***
claus
parents: 308
diff changeset
  2479
    "
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2480
     ObjectMemory announceOldSpaceNeed:1000000
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2481
    "
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2482
!
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2483
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2484
announceSpaceNeed:howMuch
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2485
    "announce to the memory system, that howMuch bytes of memory will be needed
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2486
     soon. The VM tries to prepare itself for this allocation to be performed
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2487
     with less overhead. For example, it could preallocate some memory in one
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2488
     big chunk (instead of doing many smaller reallocations later).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2489
     Notice: this is a nonstandard interface - use only in special situations.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2490
     Also, this does a background collect before the big chunk of memory is
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2491
     allocated, not locking other processes while doing so."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2492
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2493
    (howMuch < (self newSpaceSize // 2)) ifTrue:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2494
	self scavenge.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2495
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2496
    (self checkForFastNew:howMuch) ifFalse:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2497
	(howMuch > (self newSpaceSize // 2)) ifFalse:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2498
	    self scavenge.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2499
	].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2500
	self incrementalGC.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2501
	(self checkForFastNew:howMuch) ifFalse:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2502
	    self moreOldSpace:howMuch
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
  2503
	]
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
  2504
    ]
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
  2505
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
  2506
    "
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
  2507
     ObjectMemory announceSpaceNeed:100000
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
  2508
    "
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
  2509
!
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
  2510
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2511
avoidTenure:flag
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2512
    "set/clear the avoidTenure flag. If set, aging of newSpace is turned off
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2513
     as long as the newSpace fill-grade stays below some magic high-water mark.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2514
     If off (the default), aging is done as usual.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2515
     If the flag is turned on, scavenge may be a bit slower, due to more
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2516
     objects being copied around. However, chances are high that in an idle
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2517
     or (almost idle) system, less objects are moved into oldSpace.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2518
     Therefore, this helps to avoid oldSpace colelcts, in systems which go into
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2519
     some standby mode and are reactivated by some external event.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2520
     (the avoid-flag should be turned off there, and set again once the idle loop
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2521
     is reentered).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2522
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2523
    This is an EXPERIMENTAL interface."
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  2524
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  2525
%{  /* NOCONTEXT */
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2526
    __avoidTenure(flag == true ? 1 : 0);
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2527
%}
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2528
!
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2529
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2530
checkForFastNew:amount
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2531
    "this method returns true, if amount bytes could be allocated
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2532
     quickly (i.e. without forcing a full GC or compress).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2533
     This can be used for smart background processes, which want to
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2534
     allocate big chunks of data without disturbing foreground processes
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2535
     too much. Such a process would check for fast-allocation, and perform
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2536
     incremental GC-steps if required. Thus, avoiding the long blocking pause 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2537
     due to a forced (non-incremental) GC. 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2538
     Especially: doing so will not block higher priority foreground processes.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2539
     See an example use in Behavior>>niceBasicNew:.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2540
     This is experimental and not guaranteed to be in future versions."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2541
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2542
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2543
    extern int __checkForFastNew();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2544
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2545
    if (__isSmallInteger(amount)) {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2546
	if (! __checkForFastNew(__intVal(amount))) {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2547
	    RETURN (false);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2548
	}
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2549
    }
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2550
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2551
%}.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2552
    ^ true
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  2553
!
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  2554
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2555
dynamicCodeGCTrigger
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2556
    "return the dynamic code trigger limit for incremental GC activation.
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2557
     The system will start doing incremental background GC, whenever this amount
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2558
     of code was dynamically generated. 
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2559
     The default is nil; which disables this trigger"
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2560
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2561
    ^ DynamicCodeGCTrigger
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2562
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2563
    "
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2564
     ObjectMemory dynamicCodeGCTrigger
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2565
    "
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2566
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2567
    "Created: 16.10.1996 / 17:42:01 / cg"
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2568
!
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2569
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2570
dynamicCodeGCTrigger:numberOfBytesOrNil
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2571
    "set the dynamic code trigger limit for incremental GC activation.
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2572
     The system will start doing incremental background GC, whenever this amount
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2573
     of code was dynamically generated. 
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2574
     The default is nil; which disables this trigger"
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2575
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2576
    DynamicCodeGCTrigger := numberOfBytesOrNil
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2577
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2578
    "
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2579
     ObjectMemory dynamicCodeGCTrigger:50000
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2580
    "
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2581
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2582
    "Created: 16.10.1996 / 17:42:29 / cg"
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2583
!
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2584
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2585
dynamicCodeLimit
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2586
    "return the dynamic code limit.
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2587
     The system will start doing incremental background GC, whenever this amount
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2588
     of code has been generated (overall), and start to flush the code cache,
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2589
     if (after the GC), more code is still allocated. 
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2590
     The default is nil; which disables this trigger"
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2591
1781
da1b4cf13ad4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1770
diff changeset
  2592
    DynamicCodeLimit := self getCompiledCodeLimit.
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2593
    ^ DynamicCodeLimit
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2594
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2595
    "
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2596
     ObjectMemory dynamicCodeLimit
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2597
    "
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2598
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2599
    "Created: 16.10.1996 / 17:43:37 / cg"
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2600
!
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2601
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2602
dynamicCodeLimit:nBytesOrNil
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2603
    "set the dynamic code limit.
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2604
     The system will start doing incremental background GC, whenever this amount
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2605
     of code has been generated (overall), and start to flush the code cache,
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2606
     if (after the GC), more code is still allocated. 
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2607
     The default is nil; which disables this trigger"
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2608
1770
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  2609
    DynamicCodeLimit := nBytesOrNil.
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  2610
    self setCompiledCodeLimit:nBytesOrNil.
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2611
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2612
    "
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2613
     ObjectMemory dynamicCodeLimit:100000
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2614
    "
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2615
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2616
    "Created: 16.10.1996 / 17:43:58 / cg"
1770
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  2617
    "Modified: 16.10.1996 / 19:30:46 / cg"
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2618
!
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2619
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2620
fastMoreOldSpaceAllocation:aBoolean
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2621
    "this method turns on/off fastMoreOldSpace allocation.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2622
     By default, this is turned off (false), which means that in case of
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2623
     a filled-up oldSpace, a GC is tried first before more oldSpace is allocated. 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2624
     This strategy is ok for the normal operation of the system,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2625
     but behaves badly, if the program allocates huge data structures (say a
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2626
     game tree of 30Mb in size) which survives and therefore will not be reclaimed
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2627
     by a GC.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2628
     Of course while building this tree, and the memory becomes full, the system 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2629
     would not know in advance, that the GC will not reclaim anything.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2630
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2631
     Setting fastOldSpaceIncrement to true will avoid this, by forcing the
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2632
     memory system to allocate more memory right away, without doing a GC first.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2633
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2634
     WARNING: make certain that this flag is turned off, after your huge data
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2635
     is allocated, since otherwise the system may continue to increase its
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2636
     virtual memory without ever checking for garbage.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2637
     This method returns the previous value of the flag; typically this return
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2638
     value should be used to switch back."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2639
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2640
%{   /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2641
     extern int __fastMoreOldSpaceAllocation();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2642
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2643
     RETURN (__fastMoreOldSpaceAllocation(aBoolean == true ? 1 : 0) ? true : false);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2644
%}
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2645
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2646
     |previousSetting|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2647
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2648
     previousSetting := ObjectMemory fastMoreOldSpaceAllocation:true.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2649
     [
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2650
	...
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2651
	allocate your huge data
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2652
	...
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2653
     ] valueNoOrOnUnwindDo:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2654
	ObjectMemory fastMoreOldSpaceAllocation:previousSetting
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2655
     ]
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2656
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2657
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2658
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2659
     |prev this|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2660
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2661
     prev := ObjectMemory fastMoreOldSpaceAllocation:true.
370
claus
parents: 369
diff changeset
  2662
     ObjectMemory fastMoreOldSpaceAllocation:prev.
claus
parents: 369
diff changeset
  2663
     ^ prev
claus
parents: 369
diff changeset
  2664
    "
claus
parents: 369
diff changeset
  2665
!
claus
parents: 369
diff changeset
  2666
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2667
fastMoreOldSpaceLimit:aNumber
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2668
    "this method sets and returns the fastMoreOldSpace limit.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2669
     If fastMoreOldSpaceAllocation is true, and the current oldSpace size is
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2670
     below this limit, the memory manager will NOT do a GC when running out of
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2671
     oldSpace, but instead quickly go ahead increasing the size of the oldSpace.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2672
     Setting the limit to 0 turns off any limit (i.e. it will continue to
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2673
     increase the oldSpace forwever - actually, until the OS refuses to give us
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2674
     more memory). The returned value is the previous setting of the limit."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2675
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2676
%{   /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2677
     extern int __fastMoreOldSpaceLimit();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2678
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2679
     if (__isSmallInteger(aNumber)) {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2680
	 RETURN ( __MKSMALLINT( __fastMoreOldSpaceLimit(__intVal(aNumber))));
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2681
     }
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2682
%}.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2683
     self primitiveFailed
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2684
    
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2685
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2686
     |prev this|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2687
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2688
     prev := ObjectMemory fastMoreOldSpaceLimit:10*1024*1024.
370
claus
parents: 369
diff changeset
  2689
     ObjectMemory fastMoreOldSpaceLimit:prev.
claus
parents: 369
diff changeset
  2690
     ^ prev
claus
parents: 369
diff changeset
  2691
    "
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2692
!
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2693
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2694
freeSpaceGCAmount
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2695
    "return the amount to be allocated if, after an incrementalGC,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2696
     not at least FreeSpaceGCLimit bytes are available for allocation.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2697
     The default is nil, which lets the system compute an abbpropriate value"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2698
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2699
    ^ FreeSpaceGCAmount
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2700
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2701
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2702
     ObjectMemory freeSpaceGCAmount
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2703
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2704
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2705
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2706
freeSpaceGCAmount:aNumber
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2707
    "set the amount to be allocated if, after an incrementalGC,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2708
     not at least FreeSpaceGCLimit bytes are available for allocation.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2709
     The amount should be greater than the limit, otherwise the incremental
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2710
     GC may try over and over to get the memory (actually waisting time)."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2711
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2712
    FreeSpaceGCAmount := aNumber
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2713
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2714
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2715
     the following will try to always keep at least 1meg of free space
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2716
     (in the background) and start to do so, whenever the freeSpace drops
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2717
     below 250k.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2718
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2719
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2720
     ObjectMemory freeSpaceGCLimit:250000.  
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2721
     ObjectMemory freeSpaceGCAmount:1000000.  
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2722
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2723
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2724
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2725
     turn it off (i.e. let the system  compute an appropriate amount ...)
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2726
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2727
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2728
     ObjectMemory freeSpaceGCAmount:nil.     
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2729
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2730
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2731
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2732
freeSpaceGCLimit
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2733
    "return the freeSpace limit for incremental GC activation.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2734
     The system will start doing incremental background GC, once less than this number 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2735
     of bytes are available in the compact free space.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2736
     The default is 100000; setting it to nil will turn this trigger off."
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2737
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2738
    ^ FreeSpaceGCLimit
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2739
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2740
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2741
     ObjectMemory freeSpaceGCLimit
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2742
    "
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2743
!
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2744
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2745
freeSpaceGCLimit:aNumber
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2746
    "set the freeSpace limit for incremental GC activation.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2747
     The system will start doing incremental background GC, once less than this number 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2748
     of bytes are available for allocation.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2749
     The default is nil; setting it to nil will turn this trigger off."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2750
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2751
    FreeSpaceGCLimit := aNumber
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2752
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2753
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2754
     the following will start the incrementalGC (in the background)
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2755
     whenever the freeSpace drops below 1meg of free space
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2756
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2757
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2758
     ObjectMemory freeSpaceGCLimit:1000000.  
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2759
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2760
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2761
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2762
     turn it off (i.e. let the system hit the wall ...)
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2763
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2764
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2765
     ObjectMemory freeSpaceGCLimit:nil.     
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2766
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2767
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2768
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2769
incrementalGCLimit
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2770
    "return the  allocatedSinceLastGC limit for incremental GC activation.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2771
     The system will start doing incremental background GC, once more than this number 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2772
     of bytes have been allocated since the last GC. 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2773
     The default is 500000; setting it to nil will turn this trigger off."
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2774
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2775
    ^ IncrementalGCLimit
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2776
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2777
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2778
     ObjectMemory incrementalGCLimit
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2779
    "
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  2780
!
85
claus
parents: 77
diff changeset
  2781
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2782
incrementalGCLimit:aNumber
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2783
    "set the allocatedSinceLastGC limit for incremental GC activation.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2784
     The system will start doing incremental background GC, once more than this number 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2785
     of bytes have been allocated since the last GC. 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2786
     The default is 500000; setting it to nil will turn this trigger off."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2787
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2788
    IncrementalGCLimit := aNumber
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2789
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2790
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2791
     ObjectMemory incrementalGCLimit:500000.  'do incr. GC very seldom'
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2792
     ObjectMemory incrementalGCLimit:100000.  'medium'
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2793
     ObjectMemory incrementalGCLimit:10000.   'do incr. GC very often'
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2794
     ObjectMemory incrementalGCLimit:nil.     'never'
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2795
    "
370
claus
parents: 369
diff changeset
  2796
!
claus
parents: 369
diff changeset
  2797
3858
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2798
incrementalSweeping:aBoolean
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2799
    "ineable/disable incremental sweeps during background GC.
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2800
     This entry is provided as a test interface and should not be
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2801
     used by applications - it may vanish without notice"
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2802
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2803
%{
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2804
     int rslt;
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2805
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2806
     rslt = __incrementalSweeping((aBoolean == true) ? 1 : 0);
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2807
     RETURN (rslt ? true : false);
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2808
%}
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2809
    "
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2810
     ObjectMemory incrementalSweeping:false.
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2811
     ObjectMemory incrementalSweeping:true
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2812
    "
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2813
!
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  2814
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2815
lockTenure:flag
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2816
    "set/clear the tenureLock. If the lock is set, the system
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2817
     completely turns off tenuring, and objects remain in newSpace (forever).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2818
     Once this lock is set, the system operates only in the newSpace and no memory 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2819
     allocations from oldSpace are allowed (except for explicit tenure calls). 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2820
     If any allocation request cannot be resoved, the VM raises a memory interrupt,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2821
     clears the lockTenure-flag and returns nil. Thus, it automatically falls back into
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2822
     the normal mode of operation, to avoid big trouble 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2823
     (fail to allocate memory when handling the exception).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2824
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2825
     This interface can be used in applications, which are guaranteed to have their
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2826
     working set completely in the newSpace AND want to limit the worst case
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2827
     pause times to the worst case scavenge time 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2828
     (which itself is limitd by the size of the newSpace). 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2829
     I.e. systems which go into some event loop after initial startup,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2830
     may turn on the tenureLock to make certain that no oldSpace memory is 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2831
     allocated in the future; thereby limiting any GC activity to newSpace scavenges only.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2832
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2833
     This is an EXPERIMENTAL interface.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2834
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2835
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2836
%{
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2837
    if (flag == true) {
370
claus
parents: 369
diff changeset
  2838
	__tenure(__context);
claus
parents: 369
diff changeset
  2839
    }
379
5b5a130ccd09 revision added
claus
parents: 375
diff changeset
  2840
    __lockTenure(flag == true ? 1 : 0);
5b5a130ccd09 revision added
claus
parents: 375
diff changeset
  2841
%}
5b5a130ccd09 revision added
claus
parents: 375
diff changeset
  2842
!
5b5a130ccd09 revision added
claus
parents: 375
diff changeset
  2843
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2844
makeOld:anObject
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2845
    "move anObject into oldSpace.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2846
     This method is for internal & debugging purposes only -
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2847
     it may vanish. Dont use it."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2848
%{
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2849
    if (__moveToOldSpace(anObject, __context) < 0) {
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2850
	RETURN (false);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2851
    }
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2852
%}.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2853
    ^ true
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2854
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2855
2337
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2856
maxOldSpace
2339
cf9acb06a903 comments
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  2857
    "return the maxOldSpace value. If non-zero, thats the limit for which the
cf9acb06a903 comments
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  2858
     VM will try hard to not allocate more oldSpace memory. (its not a hard limit)
2337
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2859
     If zero, it will allocate forever (until the OS wont hand out more).
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2860
     The default is zero."
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2861
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2862
%{  /* NOCONTEXT */
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2863
    extern unsigned __maxOldSpace();
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2864
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2865
    RETURN (__MKSMALLINT( __maxOldSpace(-1) )); 
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2866
%}
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2867
    "
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2868
     ObjectMemory maxOldSpace
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2869
    "
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2870
!
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2871
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2872
maxOldSpace:amount
2339
cf9acb06a903 comments
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  2873
    "set the maxOldSpace value. If non-zero, thats the limit for which the
cf9acb06a903 comments
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  2874
     VM will try hard to not allocate more oldSpace memory. (its not a hard limit)
2337
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2875
     If zero, it will allocate forever (until the OS wont hand out more).
2338
9a5c55920585 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2337
diff changeset
  2876
     The default is zero.
9a5c55920585 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2337
diff changeset
  2877
     WARNING: 
2339
cf9acb06a903 comments
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  2878
        an oldSpace limit may lead to trashing due to exorbitant GC activity;
cf9acb06a903 comments
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  2879
        its usually better to let it allocate more and page in/page out.
cf9acb06a903 comments
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  2880
        Usually, the background GC will catch up sooner or later and reclaim
cf9acb06a903 comments
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  2881
        the memory without blocking the system"
2337
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2882
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2883
%{  /* NOCONTEXT */
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2884
    extern unsigned __maxOldSpace();
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2885
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2886
    if (__isSmallInteger(amount)) {
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2887
        RETURN (__MKSMALLINT( __maxOldSpace(__intVal(amount)) )); 
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2888
    }
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2889
%}
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2890
    "to change maximum to 4Megs:"
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2891
    "
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2892
     ObjectMemory maxOldSpace:4*1024*1024
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2893
    "
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2894
!
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  2895
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2896
moreOldSpace:howMuch
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2897
    "allocate howMuch bytes more for old objects; return true if this worked,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2898
     false if that failed.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2899
     This is done automatically, when running out of space, but makes
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2900
     sense, if its known in advance that a lot of memory is needed to
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2901
     avoid multiple reallocations and compresses.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2902
     On systems which do not support the mmap (or equivalent) system call,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2903
     this (currently) implies a compressing garbage collect - so its slow.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2904
     Notice: this is a nonstandard interface - use only in special situations."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2905
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2906
%{  
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2907
    if (__isSmallInteger(howMuch)) {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2908
	RETURN( __moreOldSpace(__context, __intVal(howMuch)) ? true : false );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2909
    }
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2910
    RETURN (false);
379
5b5a130ccd09 revision added
claus
parents: 375
diff changeset
  2911
%}
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2912
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2913
     ObjectMemory moreOldSpace:1000000
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2914
    "
379
5b5a130ccd09 revision added
claus
parents: 375
diff changeset
  2915
!
5b5a130ccd09 revision added
claus
parents: 375
diff changeset
  2916
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2917
moreOldSpaceIfUseful
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2918
    "to be called after an incremental GC cycle;
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2919
     if freeSpace is still below limit, allocate more oldSpace"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2920
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2921
    |limit free amount|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2922
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2923
    limit := FreeSpaceGCLimit.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2924
    limit notNil ifTrue:[
2122
3d1cb9312f2c new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  2925
        "/ if reclaimed space is below limit, we have to allocate more
3d1cb9312f2c new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  2926
        "/ oldSpace, to avoid excessive gcSteps (due to freeSpaceLimit 
3d1cb9312f2c new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  2927
        "/ still not reached)
3d1cb9312f2c new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  2928
        "/
3d1cb9312f2c new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  2929
        free := self freeSpace + self freeListSpace.
3d1cb9312f2c new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  2930
        free < (limit * 3 // 2) ifTrue:[
3d1cb9312f2c new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  2931
            amount := FreeSpaceGCAmount.
3d1cb9312f2c new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  2932
            amount isNil ifTrue:[
3d1cb9312f2c new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  2933
                amount := limit * 3 // 2.
3d1cb9312f2c new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  2934
            ].
2131
1eeb310e109a newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
  2935
            'ObjectMemory [info]: moreOldSpace to satisfy free-limit' infoPrintCR.
2122
3d1cb9312f2c new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  2936
            (self moreOldSpace:(amount - free + (64*1024))) ifFalse:[
3d1cb9312f2c new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  2937
                "/
3d1cb9312f2c new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  2938
                "/ could not increase oldspace; reset FreeSpaceGCLimit to avoid
3d1cb9312f2c new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  2939
                "/ useless retries
2131
1eeb310e109a newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
  2940
                'ObjectMemory [warning]: could not increase oldSpace - reset limit' errorPrintCR.
2122
3d1cb9312f2c new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  2941
                FreeSpaceGCLimit := nil
3d1cb9312f2c new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  2942
            ]
3d1cb9312f2c new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  2943
        ].
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2944
    ].
2122
3d1cb9312f2c new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  2945
2131
1eeb310e109a newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
  2946
    "Modified: 10.1.1997 / 17:59:48 / cg"
370
claus
parents: 369
diff changeset
  2947
!
claus
parents: 369
diff changeset
  2948
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2949
newSpaceSize:newSize
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2950
    "change the size of the newSpace. To do this, the current contents
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2951
     of the newSpace may have to be tenured (if size is smaller).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2952
     Returns false, if it failed for any reason.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2953
     Experimental: this interface may valish without notice.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2954
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2955
     DANGER ALERT:
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2956
	be careful too big of a size may lead to longer scavenge pauses.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2957
	Too small of a newSpace may lead to more CPU overhead, due to
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2958
	excessive scavenges. You have been warned."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2959
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2960
%{  
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2961
    extern int __setNewSpaceSize();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2962
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2963
    if (__isSmallInteger(newSize)) {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2964
	RETURN (__setNewSpaceSize(__intVal(newSize)) ? true : false);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2965
    }
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2966
%}.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2967
    self primitiveFailed
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2968
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2969
    " less absolute CPU overhead (but longer pauses):
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2970
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2971
     ObjectMemory newSpaceSize:800*1024
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2972
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2973
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2974
    " smaller pauses, but more overall CPU overhead:
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2975
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2976
     ObjectMemory newSpaceSize:200*1024
370
claus
parents: 369
diff changeset
  2977
    "
claus
parents: 369
diff changeset
  2978
claus
parents: 369
diff changeset
  2979
    " the default:
claus
parents: 369
diff changeset
  2980
claus
parents: 369
diff changeset
  2981
     ObjectMemory newSpaceSize:400*1024
claus
parents: 369
diff changeset
  2982
    "
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2983
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2984
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2985
oldSpaceCompressLimit
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2986
    "return the limit for oldSpace compression. If more memory than this
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2987
     limit is in use, the system will not perform compresses on the oldspace,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2988
     but instead do a mark&sweep GC followed by an oldSpace increase if not enough
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2989
     could be reclaimed. The default is currently some 8Mb, which is ok for workstations
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2990
     with 16..32Mb of physical memory. If your system has much more physical RAM,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2991
     you may want to increase this limit."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2992
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2993
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2994
    extern unsigned __compressingGCLimit();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2995
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2996
    RETURN (__MKSMALLINT( __compressingGCLimit(-1) ));
1105
fe3a6359e13b added access to oldSpaceCompressLimit
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
  2997
%}
fe3a6359e13b added access to oldSpaceCompressLimit
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
  2998
    "
fe3a6359e13b added access to oldSpaceCompressLimit
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
  2999
     ObjectMemory oldSpaceCompressLimit
fe3a6359e13b added access to oldSpaceCompressLimit
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
  3000
    "
fe3a6359e13b added access to oldSpaceCompressLimit
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
  3001
!
fe3a6359e13b added access to oldSpaceCompressLimit
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
  3002
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3003
oldSpaceCompressLimit:amount
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3004
    "set the limit for oldSpace compression. If more memory than this
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3005
     limit is in use, the system will not perform compresses on the oldspace,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3006
     but instead do a mark&sweep GC followed by an oldSpace increase if not enough
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3007
     could be reclaimed. The default is currently some 8Mb, which is ok for workstations
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3008
     with 16..32Mb of physical memory. If your system has much more physical RAM,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3009
     you may want to increase this limit.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3010
     This method returns the previous increment value."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3011
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3012
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3013
    extern unsigned __compressingGCLimit();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3014
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3015
    if (__isSmallInteger(amount)) {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3016
	RETURN (__MKSMALLINT( __compressingGCLimit(__intVal(amount)) ));
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3017
    }
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3018
%}
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3019
    "to change the limit to 12Mb:"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3020
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3021
     ObjectMemory oldSpaceCompressLimit:12*1024*1024
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3022
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3023
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3024
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3025
oldSpaceIncrement
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3026
    "return the oldSpaceIncrement value. Thats the amount by which
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3027
     more memory is allocated in case the oldSpace gets filled up.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3028
     In normal situations, the default value used in the VM is fine
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3029
     and there is no need to change it."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3030
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3031
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3032
    extern unsigned __oldSpaceIncrement();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3033
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3034
    RETURN (__MKSMALLINT( __oldSpaceIncrement(-1) )); 
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3035
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3036
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3037
     ObjectMemory oldSpaceIncrement
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3038
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3039
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3040
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3041
oldSpaceIncrement:amount
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3042
    "set the oldSpaceIncrement value. Thats the amount by which
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3043
     more memory is allocated in case the oldSpace gets filled up.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3044
     In normal situations, the default value used in the VM is fine
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3045
     and there is no need to change it. This method returns the 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3046
     previous increment value."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3047
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3048
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3049
    extern unsigned __oldSpaceIncrement();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3050
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3051
    if (__isSmallInteger(amount)) {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3052
	RETURN (__MKSMALLINT( __oldSpaceIncrement(__intVal(amount)) )); 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3053
    }
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3054
%}
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3055
    "to change increment to 1Meg:"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3056
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3057
     ObjectMemory oldSpaceIncrement:1024*1024
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3058
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3059
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3060
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3061
tenureParameters:magic
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3062
    "this is pure magic and not for public eyes ...
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3063
     This method allows fine tuning the scavenger internals,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3064
     in cooperation to some statistic & test programs.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3065
     It is undocumented, secret and may vanish. 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3066
     If you play around here, the system may behave very strange."
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3067
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3068
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3069
    __tenureParams(magic);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3070
%}.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3071
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3072
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3073
turnGarbageCollectorOff
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3074
    "turn off the generational garbage collector by forcing new objects to be
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3075
     allocated directly in oldSpace (instead of newSpace)
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3076
     WARNING:
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3077
     This is somewhat dangerous: if collector is turned off,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3078
     and too many objects are created, the system may run into trouble
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3079
     (i.e. oldSpace becomes full) and be forced to perform a full mark&sweep
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3080
     or even a compressing collect - making the overall realtime behavior worse.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3081
     Use this only for special purposes or when realtime behavior
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3082
     is required for a limited time period.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3083
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3084
     OBSOLETE: this is no longer supported 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3085
	       - it may be a no-operation by the time you read this."
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3086
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3087
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3088
    __allocForceSpace(OLDSPACE);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3089
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3090
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3091
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3092
turnGarbageCollectorOn
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3093
    "turn garbage collector on again (see ObjectMemory>>turnGarbageCollectorOff)"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3094
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3095
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3096
    __allocForceSpace(9999);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3097
%}
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3098
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3099
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3100
watchTenure:flag
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3101
    "set/clear the tenureWatch. If set, an internalError exception will be raised,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3102
     whenever objects are tenured from newSpace into oldSpace
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3103
     (except for an explicit tenure request). 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3104
     This can be used to validate that no oldSpace objects are created
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3105
     (i.e. the system operates fully in newSpace). 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3106
     Be careful, if the avoidTenure flag is not set, 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3107
     there will almost always be a tenure sooner or later.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3108
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3109
    EXPERIMENTAL - no warranty"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3110
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3111
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3112
    __watchTenure(flag == true ? 1 : 0);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3113
%}
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  3114
! !
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  3115
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3116
!ObjectMemory class methodsFor:'interrupt handler access'!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3117
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3118
childSignalInterruptHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3119
    "return the handler for UNIX-death-of-a-childprocess-signal interrupts"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3120
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3121
    ^ ChildSignalInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3122
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3123
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3124
childSignalInterruptHandler:aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3125
    "set the handler for UNIX-death-of-a-childprocess-signal interrupts"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3126
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3127
    ChildSignalInterruptHandler := aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3128
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3129
    "Created: 22.12.1995 / 14:14:52 / stefan"
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 797
diff changeset
  3130
    "Modified: 22.12.1995 / 14:15:16 / stefan"
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 797
diff changeset
  3131
!
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 797
diff changeset
  3132
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3133
customInterruptHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3134
    "return the handler for custom interrupts"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3135
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3136
    ^ CustomInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3137
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3138
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3139
customInterruptHandler:aHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3140
    "set the handler for custom interrupts"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3141
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3142
    CustomInterruptHandler := aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3143
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3144
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3145
disposeInterruptHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3146
    "return the handler for object disposal interrupts"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3147
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3148
    ^ DisposeInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3149
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3150
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3151
disposeInterruptHandler:aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3152
    "set the handler for object disposal interrupts"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3153
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3154
    DisposeInterruptHandler := aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3155
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3156
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3157
errorInterruptHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3158
    "return the handler for display error interrupts"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3159
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3160
    ^ ErrorInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3161
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3162
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3163
errorInterruptHandler:aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3164
    "set the handler for display error interrupts"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3165
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3166
    ErrorInterruptHandler := aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3167
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3168
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3169
exceptionInterruptHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3170
    "return the handler for floating point exception interrupts"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3171
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3172
    ^ ExceptionInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3173
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3174
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3175
internalErrorHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3176
    "return the handler for ST/X internal errors.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3177
     An internal error is reported for example when a methods
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3178
     bytecode is not a ByteArray, the selector table is not an Array
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3179
     etc.  
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3180
     Those should not occur in normal circumstances."
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3181
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3182
    ^ InternalErrorHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3183
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3184
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3185
ioInterruptHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3186
    "return the handler for I/O available signal interrupts (SIGIO/SIGPOLL)"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3187
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3188
    ^ IOInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3189
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3190
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3191
ioInterruptHandler:aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3192
    "set the handler for I/O available signal interrupts (SIGIO/SIGPOLL)"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3193
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3194
    IOInterruptHandler := aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3195
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3196
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3197
recursionInterruptHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3198
    "return the handler for recursion/stack overflow interrupts"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3199
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3200
    ^ RecursionInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3201
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3202
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3203
recursionInterruptHandler:aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3204
    "set the handler for recursion/stack overflow interrupts"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3205
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3206
    RecursionInterruptHandler := aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3207
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3208
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3209
registerErrorInterruptHandler:aHandler forID:errorIDSymbol
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3210
    "register a handler"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3211
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3212
    RegisteredErrorInterruptHandlers isNil ifTrue:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3213
	RegisteredErrorInterruptHandlers := IdentityDictionary new
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3214
    ].
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3215
    RegisteredErrorInterruptHandlers at:errorIDSymbol put:aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3216
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3217
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3218
registeredErrorInterruptHandlers
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3219
    "return registered handlers"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3220
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3221
    ^ RegisteredErrorInterruptHandlers
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3222
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3223
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3224
signalInterruptHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3225
    "return the handler for UNIX-signal interrupts"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3226
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3227
    ^ SignalInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3228
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3229
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3230
signalInterruptHandler:aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3231
    "set the handler for UNIX-signal interrupts"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3232
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3233
    SignalInterruptHandler := aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3234
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3235
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3236
spyInterruptHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3237
    "return the handler for spy-timer interrupts"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3238
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3239
    ^ SpyInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3240
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3241
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3242
spyInterruptHandler:aHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3243
    "set the handler for spy-timer interrupts"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3244
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3245
    SpyInterruptHandler := aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3246
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3247
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3248
stepInterruptHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3249
    "return the handler for single step interrupts"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3250
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3251
    ^ StepInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3252
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3253
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3254
stepInterruptHandler:aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3255
    "set the handler for single step interrupts"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3256
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3257
    StepInterruptHandler := aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3258
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3259
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3260
timerInterruptHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3261
    "return the handler for timer interrupts"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3262
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3263
    ^ TimerInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3264
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3265
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3266
timerInterruptHandler:aHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3267
    "set the handler for timer interrupts"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3268
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3269
    TimerInterruptHandler := aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3270
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3271
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3272
userInterruptHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3273
    "return the handler for CNTL-C interrupt handling"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3274
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3275
    ^ UserInterruptHandler
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3276
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3277
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3278
userInterruptHandler:aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3279
    "set the handler for CNTL-C interrupt handling"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3280
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3281
    UserInterruptHandler := aHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3282
! !
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3283
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3284
!ObjectMemory class methodsFor:'interrupt statistics'!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3285
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3286
interruptLatency:ms receiver:rec class:cls selector:sel vmActivity:vmActivity id:pid
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3287
    "example implementation of latencyTime monitoring:
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3288
     This method simply measures the max-latency time.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3289
     You may want to use some other handler (see #interruptLatencyMonitor:)
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3290
     and extract more information (blocking context).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3291
     DEMO Example."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3292
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3293
    ms > MaxInterruptLatency ifTrue:[
1480
df0bea6285f8 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 1427
diff changeset
  3294
        MaxInterruptLatency := ms.
2131
1eeb310e109a newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
  3295
        'IRQ-LATENCY: ' infoPrint. cls infoPrint. ' ' infoPrint. sel infoPrint. '(' infoPrint. vmActivity infoPrint . ') ---> ' infoPrint. ms infoPrintCR.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3296
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3297
    (InterruptLatencyGoal notNil and:[ms > InterruptLatencyGoal]) ifTrue:[
1480
df0bea6285f8 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 1427
diff changeset
  3298
        '*** IRQ REALTIME-DEADLINE MISSED: ' errorPrint. 
df0bea6285f8 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 1427
diff changeset
  3299
        cls errorPrint.
df0bea6285f8 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 1427
diff changeset
  3300
        ' ' errorPrint. sel errorPrint. '(' errorPrint. vmActivity errorPrint . ') ---> ' errorPrint. 
2138
351dc4abad0e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2131
diff changeset
  3301
        ms errorPrintCR.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3302
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3303
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3304
    "to enable the demo handler:
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3305
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3306
     ObjectMemory resetMaxInterruptLatency.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3307
     ObjectMemory interruptLatencyMonitor:ObjectMemory.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3308
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3309
    "to disable timing statistics:
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3310
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3311
     ObjectMemory interruptLatencyMonitor:nil.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3312
     ObjectMemory maxInterruptLatency printNL.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3313
    "
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3314
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3315
    "Created: 7.11.1995 / 21:05:50 / cg"
1480
df0bea6285f8 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 1427
diff changeset
  3316
    "Modified: 18.6.1996 / 14:15:52 / stefan"
2138
351dc4abad0e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2131
diff changeset
  3317
    "Modified: 10.1.1997 / 19:09:53 / cg"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3318
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3319
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3320
interruptLatencyGoal:millis
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3321
    "setup to report an error message, whenever a realtime goal could not be
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3322
     met due to blocked interrupts or long primitives or GC activity.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3323
     An argument of nil clears the check.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3324
     DEMO Example."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3325
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3326
    InterruptLatencyGoal := millis.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3327
    millis isNil ifTrue:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3328
	InterruptLatencyMonitor := nil.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3329
    ] ifFalse:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3330
	MaxInterruptLatency := 0.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3331
	InterruptLatencyMonitor := self.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3332
    ]
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3333
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3334
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3335
     ObjectMemory interruptLatencyGoal:50
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3336
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3337
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3338
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3339
interruptLatencyMonitor
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3340
    "return the interrupt-latency-monitor if any. 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3341
     See comment in #interruptLatencyMonitor:.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3342
     This is a non-standard debugging/realtime instrumentation entry."
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3343
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3344
    ^ InterruptLatencyMonitor
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3345
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3346
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3347
interruptLatencyMonitor:aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3348
    "set the interrupt latency monitor. If non-nil, this one will be sent
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3349
     an interruptLatency: message with the millisecond delay between
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3350
     the interrupt and its handling.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3351
     This is a non-standard debugging/realtime instrumentation entry."
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3352
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3353
    InterruptLatencyMonitor := aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3354
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3355
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3356
maxInterruptLatency
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3357
    "return the maximum accumulated interrupt latency in millis.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3358
     DEMO Example."
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3359
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3360
    ^ MaxInterruptLatency
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3361
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3362
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3363
resetMaxInterruptLatency
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3364
    "reset the maximum accumulated interrupt latency probe time.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3365
     DEMO Example."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3366
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3367
    MaxInterruptLatency := 0
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3368
! !
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3369
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3370
!ObjectMemory class methodsFor:'just in time compilation'!
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3371
2099
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3372
byteCodeSizeLimitForDynamicCompilation:aNumber
2526
d600b7b0c13e comments
Claus Gittinger <cg@exept.de>
parents: 2525
diff changeset
  3373
    "set a limit on a methods number of byteCodes.
2099
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3374
     Compilation of a method into machine code is aborted,
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3375
     if its bytecode size is larger than the given number.
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3376
     This is only useful, if large methods have a smaller
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3377
     chance of being evaluated often (which may not be true).
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3378
     The predefined limit is some 4k (which seems to be ok)."
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3379
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3380
%{  /* NOCONTEXT */
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3381
    extern int __byteCodeSizeLimitForDynamicCompilation();
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3382
    int prev;
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3383
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3384
    prev = __byteCodeSizeLimitForDynamicCompilation(
2526
d600b7b0c13e comments
Claus Gittinger <cg@exept.de>
parents: 2525
diff changeset
  3385
                                    __isSmallInteger(aNumber)
2099
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3386
                                    ? __intVal(aNumber)
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3387
                                    : -1);
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3388
    RETURN (__MKSMALLINT(prev));
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3389
%}.
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3390
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3391
    "
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3392
     ObjectMemory byteCodeSizeLimitForDynamicCompilation:nil
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3393
     ObjectMemory byteCodeSizeLimitForDynamicCompilation:8000
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3394
    "
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3395
!
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3396
2638
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3397
codeForCPU:aCPUSymbol
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3398
    "instruct the just in time compiler that some specific CPU
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3399
     is present (forcing it to generate code for that).
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3400
     The default is set correct for the architecture, and the
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3401
     runTime system tries to figure out the cpu - but who knows ...
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3402
     The valid symbols depend on the architecture:
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3403
	i386:	#i486 / #i586		(affects code ordering)
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3404
	sparc:	#sparcV8 / #sparcV8	(affects instruction set)
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3405
	mips:	#rs2000 / #rs4000	(affects delay slot generation)
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3406
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3407
     This is a nonstandard entry and may be removed without notice - 
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3408
     not for the general user."
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3409
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3410
%{  /* NOCONTEXT */
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3411
    __codeForCPU(aCPUSymbol);
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3412
%}.
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3413
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3414
    "
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3415
     ObjectMemory codeForCPU:#i486
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3416
     ObjectMemory codeForCPU:#i586
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3417
    "
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3418
!
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  3419
2099
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3420
codeSizeLimitForDynamicCompilation:aNumber
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3421
    "set a limit on the resulting dynamic generates code
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3422
     size. Compilation of a method into machine code is aborted,
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3423
     if the resulting code is larger than the given number of
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3424
     bytes. This is only useful, if large methods have a smaller
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3425
     chance of being evaluated often (which may not be true).
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3426
     The predefined limit is some 4k (which seems to be ok)."
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3427
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3428
%{  /* NOCONTEXT */
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3429
    extern int __codeSizeLimitForDynamicCompilation();
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3430
    int prev;
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3431
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3432
    prev = __codeSizeLimitForDynamicCompilation( __isSmallInteger(aNumber)
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3433
				    ? __intVal(aNumber)
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3434
				    : -1);
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3435
    RETURN (__MKSMALLINT(prev));
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3436
%}.
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3437
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3438
    "
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3439
     ObjectMemory codeSizeLimitForDynamicCompilation:nil
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3440
     ObjectMemory codeSizeLimitForDynamicCompilation:8000
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3441
    "
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3442
!
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3443
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3444
compiledCodeCounter
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3445
    "return the number of additional code-bytes which
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3446
     were generated since the counter was last reset"
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3447
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3448
%{  /* NOCONTEXT */
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3449
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3450
    extern __compiledCodeCounter();
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3451
    int nBytes;
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3452
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3453
    nBytes = __compiledCodeCounter();
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3454
    RETURN (__MKSMALLINT(nBytes));
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3455
%}
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3456
    "
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3457
     ObjectMemory compiledCodeCounter
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3458
    "
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3459
!
1637
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3460
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3461
compiledCodeSpaceUsed
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3462
    "return the actual number of bytes used for compiled code"
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3463
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3464
%{  /* NOCONTEXT */
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3465
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3466
    extern __compiledCodeSpaceUsed();
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3467
    int nBytes;
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3468
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3469
    nBytes = __compiledCodeSpaceUsed();
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3470
    RETURN (__MKSMALLINT(nBytes));
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3471
%}
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3472
    "
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3473
     ObjectMemory compiledCodeSpaceUsed
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3474
    "
1637
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3475
!
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3476
1948
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  3477
fullSingleStepSupport
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  3478
    "return the setting of the full single step support flag"
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  3479
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  3480
%{  /* NOCONTEXT */
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  3481
    extern int __fullSingleStep();
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  3482
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  3483
    RETURN (__fullSingleStep(-1) ? true : false);
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  3484
%}
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  3485
    "
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  3486
     ObjectMemory fullSingleStepSupport
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  3487
    "
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  3488
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  3489
!
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  3490
1795
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3491
fullSingleStepSupport:aBoolean
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3492
    "enable/disable full single step support for the just-in-time-compiled code. 
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3493
     If off, things like simple increment/decrement, additions and variable-
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3494
     stores are not steppable, but treated like atomar invisible operations.
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3495
     If on, single step halts at those operations. 
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3496
     Execution is a bit slower if enabled."
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3497
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3498
%{  /* NOCONTEXT */
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3499
    extern int __fullSingleStep();
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3500
    int prev;
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3501
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3502
    prev = __fullSingleStep(aBoolean == true
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3503
                                   ? 1
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3504
                                   : (aBoolean == false)
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3505
                                        ? 0
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3506
                                        : -1);
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3507
    RETURN (prev ? true : false);
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3508
%}
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3509
    "
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3510
     ObjectMemory fullSingleStepSupport:true
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3511
     ObjectMemory fullSingleStepSupport:false
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3512
    "
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3513
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3514
!
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3515
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3516
getCompiledCodeLimit
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3517
    "get the codeLimit from the VM"
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3518
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3519
%{  /* NOCONTEXT */
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3520
    extern int __dynamicCodeLimit();
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3521
    int limit;
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3522
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3523
    limit = __dynamicCodeLimit();
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3524
    if (limit) {
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3525
        RETURN (__MKSMALLINT(limit));
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3526
    }
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3527
    RETURN (nil);
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3528
%}
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3529
!
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  3530
2099
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3531
insnSizeLimitForDynamicCompilation:aNumber
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3532
    "set a limit on a methods number of internal insns.
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3533
     Compilation of a method into machine code is aborted,
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3534
     if during compilation, more than the given number of
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3535
     internal insns are generated.
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3536
     The limit controls the amount of dynamic memory allocated
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3537
     during compilation and may be changed for small-memory
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3538
     systems.
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3539
     The predefined limit is some 4k (which seems to be ok)."
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3540
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3541
%{  /* NOCONTEXT */
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3542
    extern int __insnSizeLimitForDynamicCompilation();
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3543
    int prev;
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3544
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3545
    prev = __insnSizeLimitForDynamicCompilation( __isSmallInteger(aNumber)
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3546
                                    ? __intVal(aNumber)
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3547
                                    : -1);
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3548
    RETURN (__MKSMALLINT(prev));
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3549
%}.
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3550
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3551
    "
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3552
     ObjectMemory insnSizeLimitForDynamicCompilation:nil
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3553
     ObjectMemory insnSizeLimitForDynamicCompilation:8000
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3554
    "
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3555
!
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3556
1947
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  3557
justInTimeCompilation
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  3558
    "return the value of the just-in-time-compilation flag"
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  3559
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  3560
%{  /* NOCONTEXT */
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  3561
    extern int __justInTimeCompilation();
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  3562
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  3563
    RETURN (__justInTimeCompilation(-1) ? true : false);
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  3564
%}
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  3565
    "
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  3566
     ObjectMemory justInTimeCompilation
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  3567
    "
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  3568
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  3569
!
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  3570
1637
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3571
justInTimeCompilation:aBoolean
1947
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  3572
    "enable/disable just-in-time-compilation."
1637
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3573
1939
214f42e29868 remember just-in-time state in image
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3574
    aBoolean notNil ifTrue:[
214f42e29868 remember just-in-time state in image
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3575
        JustInTimeCompilationEnabled := aBoolean.
214f42e29868 remember just-in-time state in image
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3576
    ].
214f42e29868 remember just-in-time state in image
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3577
1637
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3578
%{  /* NOCONTEXT */
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3579
    extern int __justInTimeCompilation();
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3580
    int prev;
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3581
1657
41d53ff72de9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  3582
    prev = __justInTimeCompilation(aBoolean == true
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3583
                                   ? 1
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3584
                                   : (aBoolean == false)
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3585
                                        ? 0
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3586
                                        : -1);
1637
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3587
    RETURN (prev ? true : false);
2017
fb9627540d0b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1948
diff changeset
  3588
%}.
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3589
    "
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3590
     ObjectMemory justInTimeCompilation:true
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3591
     ObjectMemory justInTimeCompilation:false
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3592
    "
2017
fb9627540d0b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1948
diff changeset
  3593
!
fb9627540d0b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1948
diff changeset
  3594
1940
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  3595
reEnableJustInTimeCompilation
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  3596
    "to be called after a snapshot restart; if justInTimeCompiler
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  3597
     was enabled before, do it again. 
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  3598
     For now, this is not done automatically, to allow restarting
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  3599
     a system with the dynamic compiler turned off (its still experimental).
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  3600
     Therefore, this reenabling is done in the smalltalk_r.rc file."
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  3601
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  3602
    JustInTimeCompilationEnabled == true ifTrue:[
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  3603
	self justInTimeCompilation:true
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  3604
    ]
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  3605
!
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  3606
1770
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  3607
resetCompiledCodeCounter
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  3608
    "reset the counter of additional code-bytes"
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  3609
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  3610
%{  /* NOCONTEXT */
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  3611
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  3612
    extern void __resetDynamicCodeGeneratedCounter();
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  3613
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  3614
    __resetDynamicCodeGeneratedCounter();
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  3615
%}
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  3616
    "
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  3617
     ObjectMemory resetCompiledCodeCounter
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  3618
    "
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  3619
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  3620
!
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  3621
1769
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  3622
setCompiledCodeLimit:newLimit
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  3623
    "set the VM's limit"
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  3624
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  3625
%{  /* NOCONTEXT */
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  3626
    extern __setDynamicCodeLimit();
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  3627
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  3628
    if (__isSmallInteger(newLimit)) {
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  3629
	__setDynamicCodeLimit(__intVal(newLimit));
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  3630
    } else if (newLimit == nil) {
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  3631
	__setDynamicCodeLimit(0);
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  3632
    }
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  3633
%}
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  3634
!
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  3635
1637
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3636
supportsJustInTimeCompilation
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3637
    "return true, if this system supports just-in-time-compilation of
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3638
     bytecode to machine code. Dont confuse this with stc-compilation."
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3639
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3640
%{  /* NOCONTEXT */
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3641
    extern int __canDoJustInTimeCompilation();
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3642
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3643
    RETURN (__canDoJustInTimeCompilation() ? true : false);
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3644
%}
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3645
    "
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3646
     ObjectMemory supportsJustInTimeCompilation
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3647
    "
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3648
1637
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3649
! !
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  3650
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3651
!ObjectMemory class methodsFor:'low memory handling'!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3652
3781
d35bce118ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3761
diff changeset
  3653
allocationFailed
d35bce118ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3761
diff changeset
  3654
    "memory allocation has failed in the VM
d35bce118ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3761
diff changeset
  3655
     This is triggered by the runtime system (or possibly by
d35bce118ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3761
diff changeset
  3656
     a user primitive)"
d35bce118ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3761
diff changeset
  3657
d35bce118ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3761
diff changeset
  3658
    ^ AllocationFailureSignal raise
d35bce118ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3761
diff changeset
  3659
!
d35bce118ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3761
diff changeset
  3660
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3661
memoryInterrupt
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3662
    "when a low-memory condition arises, ask all classes to
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3663
     remove possibly cached data. You may help the system a bit,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3664
     in providing a lowSpaceCleanup method in your classes which have
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3665
     lots of data kept somewhere (usually, cached data).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3666
     - this may or may not help."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3667
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3668
    self performLowSpaceCleanup.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3669
"/    self error:'almost out of memory'
2131
1eeb310e109a newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
  3670
    'ObjectMemory [warning]: almost out of memory' errorPrintCR.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3671
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3672
    LowSpaceSemaphore signalIf.
1160
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
  3673
2131
1eeb310e109a newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
  3674
    "Modified: 10.1.1997 / 17:59:31 / cg"
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3675
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3676
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3677
performLowSpaceCleanup
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3678
    "ask all classes to remove possibly cached data. 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3679
     You may help the system a bit, in providing a lowSpaceCleanup method 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3680
     in your classes which have lots of data kept somewhere (usually, cached data)."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3681
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3682
    Smalltalk allBehaviorsDo:[:aClass |
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3683
        aClass lowSpaceCleanup
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3684
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3685
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3686
    "Created: 12.4.1996 / 14:57:28 / cg"
362
claus
parents: 360
diff changeset
  3687
! !
claus
parents: 360
diff changeset
  3688
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3689
!ObjectMemory class methodsFor:'object finalization'!
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  3690
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3691
allChangedShadowObjectsDo:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3692
    "evaluate the argument, aBlock for all known shadow objects which have
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3693
     lost a pointer recently."
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  3694
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  3695
    __allChangedShadowObjectsDo(&aBlock);
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  3696
%}
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  3697
!
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  3698
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3699
backgroundFinalizationProcess
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3700
    "return the backgroundFinalizationProcess (or nil, if noone is running)"
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3701
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3702
    ^ BackgroundFinalizationProcess
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3703
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3704
    "Created: / 4.8.1998 / 02:00:13 / cg"
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3705
!
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3706
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3707
disposeInterrupt
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3708
    "this is triggered by the garbage collector,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3709
     whenever any shadowArray looses a pointer."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3710
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3711
    FinalizationSemaphore notNil ifTrue:[
2160
ae0c0525ff2d only signal finalizationSema once
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
  3712
        "/
ae0c0525ff2d only signal finalizationSema once
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
  3713
        "/ background finalizer is waiting ...
ae0c0525ff2d only signal finalizationSema once
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
  3714
        "/
ae0c0525ff2d only signal finalizationSema once
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
  3715
        FinalizationSemaphore signalOnce
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  3716
    ] ifFalse:[
2160
ae0c0525ff2d only signal finalizationSema once
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
  3717
        "/
ae0c0525ff2d only signal finalizationSema once
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
  3718
        "/ do it right here
ae0c0525ff2d only signal finalizationSema once
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
  3719
        "/
ae0c0525ff2d only signal finalizationSema once
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
  3720
        self finalize
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  3721
    ]
2160
ae0c0525ff2d only signal finalizationSema once
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
  3722
ae0c0525ff2d only signal finalizationSema once
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
  3723
    "Modified: 13.1.1997 / 17:26:16 / cg"
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  3724
!
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  3725
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3726
finalize
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3727
    "tell all weak objects that something happened."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3728
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3729
    self allChangedShadowObjectsDo:[:aShadowArray | 
2099
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3730
        aShadowArray lostPointer.
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3731
    ].
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3732
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3733
    "/ we should change the setup,
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3734
    "/ to make the Dependencies collection a dependent
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3735
    "/ of all the WeakArrays and WeakIDSets there,
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3736
    "/ and send a changed message when any of them looses
2100
1a356c6d25d0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2099
diff changeset
  3737
    "/ a pointer. 
1a356c6d25d0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2099
diff changeset
  3738
    "/ This would automize the send below.
1a356c6d25d0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2099
diff changeset
  3739
    "/
1a356c6d25d0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2099
diff changeset
  3740
    "/ WARNING:
1a356c6d25d0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2099
diff changeset
  3741
    "/   this can only be done, if the WeakIDSet holds its
1a356c6d25d0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2099
diff changeset
  3742
    "/   dependends itself (like a WeakArray), 
1a356c6d25d0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2099
diff changeset
  3743
    "/   otherwise we might get trouble.
1a356c6d25d0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2099
diff changeset
  3744
    "/   Therefore, things are as they are now ;-)
2099
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3745
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3746
    Dependencies removeEmptyDependencyValues
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3747
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3748
    "Modified: 9.1.1997 / 01:00:44 / cg"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3749
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3750
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3751
startBackgroundFinalizationAt:aPriority
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3752
    "start a process doing finalization work in the background.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3753
     Can be used to reduce the pauses created by finalization.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3754
     Normally, these pauses are not noticed; however if you have (say)
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3755
     ten thousands of weak objects, these could become long enough to
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3756
     make background finalization usefull.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3757
     WARNING: background finalization may lead to much delayed freeing of
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3758
     system resources. Especially, you may temporarily run out of free
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3759
     color table entries or fileDescriptors etc. Use at your own risk (if at all)"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3760
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3761
    |p|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3762
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3763
    "/
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3764
    "/ its not useful, to run it more than once
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3765
    "/
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3766
    BackgroundFinalizationProcess notNil ifTrue:[
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3767
        BackgroundFinalizationProcess priority:aPriority.
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3768
        ^ self
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3769
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3770
2262
4c4d810f006f semaphore names
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  3771
    FinalizationSemaphore := Semaphore new name:'FinalizationSemaphore'.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3772
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3773
    p :=
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3774
        [
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3775
            [
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3776
                [true] whileTrue:[
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3777
                    "
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3778
                     wait till something to do ...
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3779
                    "
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3780
                    FinalizationSemaphore wait.
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3781
                    "
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3782
                     ... and do it
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3783
                    "
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3784
                    self finalize
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3785
                ]
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3786
            ] valueOnUnwindDo:[
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3787
                BackgroundFinalizationProcess := nil.
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3788
                FinalizationSemaphore := nil
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3789
            ]
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3790
        ] newProcess.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3791
    p name:'background finalizer'.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3792
    p priority:aPriority.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3793
    p restartable:true.
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3794
    p beGroupLeader.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3795
    p resume.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3796
    BackgroundFinalizationProcess := p
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  3797
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  3798
    "
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  3799
     ObjectMemory startBackgroundFinalizationAt:5
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  3800
    "
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3801
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  3802
    "Modified: / 5.8.1998 / 14:53:27 / cg"
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3803
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3804
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3805
stopBackgroundFinalization
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3806
    "stop the background finalizer"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3807
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3808
    BackgroundFinalizationProcess notNil ifTrue:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3809
	BackgroundFinalizationProcess terminate.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3810
	BackgroundFinalizationProcess := nil
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3811
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3812
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3813
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3814
     ObjectMemory stopBackgroundFinalization
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3815
    "
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  3816
! !
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  3817
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3818
!ObjectMemory class methodsFor:'physical memory access'!
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  3819
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3820
collectedOldSpacePagesDo:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3821
    "evaluates aBlock for all pages in the prev. oldSpace, passing
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3822
     the pages address as argument. 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3823
     For internal & debugging use only."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3824
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  3825
    if (__collectedOldSpacePagesDo(&aBlock) < 0) {
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3826
	RETURN (false);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3827
    }
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3828
%}.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3829
    ^ true
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3830
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3831
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3832
newSpacePagesDo:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3833
    "evaluates aBlock for all pages in the newSpace, passing
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3834
     the pages address as argument.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3835
     For internal & debugging use only."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3836
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  3837
    if (__newSpacePagesDo(&aBlock) < 0) {
159
514c749165c3 *** empty log message ***
claus
parents: 133
diff changeset
  3838
	RETURN (false);
85
claus
parents: 77
diff changeset
  3839
    }
claus
parents: 77
diff changeset
  3840
%}.
claus
parents: 77
diff changeset
  3841
    ^ true
claus
parents: 77
diff changeset
  3842
!
claus
parents: 77
diff changeset
  3843
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3844
oldSpacePagesDo:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3845
    "evaluates aBlock for all pages in the oldSpace, passing
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3846
     the pages address as argument. 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3847
     For internal & debugging use only."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3848
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  3849
    if (__oldSpacePagesDo(&aBlock) < 0) {
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
  3850
	RETURN (false);
85
claus
parents: 77
diff changeset
  3851
    }
claus
parents: 77
diff changeset
  3852
%}.
claus
parents: 77
diff changeset
  3853
    ^ true
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3854
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3855
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3856
pageIsInCore:aPageNumber
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3857
    "return true, if the page (as enumerated via oldSpacePagesDo:)
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3858
     is in memory; false, if currently paged out. For internal
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3859
     use / monitors only; may vanish.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3860
     NOTICE: not all systems provide this information; on those that
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3861
     do not, true is returned for all pages."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3862
%{
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3863
#ifdef HAS_MINCORE
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3864
    int pageSize = getpagesize();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3865
    char result[10];
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3866
    INT addr;
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3867
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3868
    if (__isSmallInteger(aPageNumber)) {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3869
	addr = __intVal(aPageNumber) & ~(pageSize - 1);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3870
    } else {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3871
	addr = ((INT)aPageNumber) & ~(pageSize - 1);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3872
    }
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3873
    if (mincore(addr, pageSize-1, result) < 0) {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3874
	RETURN (true);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3875
    }
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3876
    RETURN ((result[0] & 1) ? true : false);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3877
#endif
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3878
%}.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3879
    "OS does not supply this info - assume yes"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3880
    ^ true
85
claus
parents: 77
diff changeset
  3881
! !
claus
parents: 77
diff changeset
  3882
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3883
!ObjectMemory class methodsFor:'queries'!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3884
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3885
bytesUsed
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3886
    "return the number of bytes allocated for objects -
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3887
     this number is not exact, since some objects may already be dead
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3888
     (i.e. not yet reclaimed by the garbage collector).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3889
     If you need the exact number, you have to loop over all
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3890
     objects and ask for the bytesize using ObjectMemory>>sizeOf:."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3891
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3892
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3893
    extern unsigned __oldSpaceUsed(), __newSpaceUsed(), __freeListSpace();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3894
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3895
    RETURN ( __MKSMALLINT(__oldSpaceUsed() + __newSpaceUsed() - __freeListSpace()) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3896
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3897
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3898
     ObjectMemory bytesUsed  
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3899
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3900
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3901
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3902
collectObjectsWhich:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3903
    "helper for the whoReferences queries. Returns a collection
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3904
     of objects for which aBlock returns true."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3905
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3906
    |aCollection|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3907
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3908
    aCollection := IdentitySet new.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3909
    self allObjectsDo:[:o |
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3910
	(aBlock value:o) ifTrue:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3911
	    aCollection add:o
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3912
	]
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3913
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3914
    (aCollection size == 0) ifTrue:[
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3915
	"actually this cannot happen - there is always one"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3916
	^ nil
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3917
    ].
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3918
    ^ aCollection
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3919
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3920
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3921
fixSpaceSize
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3922
    "return the total size of the fix space."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3923
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3924
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3925
    extern unsigned __fixSpaceSize();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3926
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3927
    RETURN ( __MKSMALLINT(__fixSpaceSize()) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3928
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3929
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3930
     ObjectMemory fixSpaceSize
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3931
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3932
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3933
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3934
fixSpaceUsed
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3935
    "return the number of bytes allocated for old objects in fix space."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3936
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3937
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3938
    extern unsigned __fixSpaceUsed();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3939
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3940
    RETURN ( __MKSMALLINT(__fixSpaceUsed()) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3941
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3942
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3943
     ObjectMemory fixSpaceUsed
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3944
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3945
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3946
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3947
freeListSpace
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3948
    "return the number of bytes in the free lists.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3949
     (which is included in oldSpaceUsed)"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3950
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3951
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3952
    extern unsigned __freeListSpace();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3953
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3954
    RETURN ( __MKSMALLINT(__freeListSpace()) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3955
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3956
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3957
     ObjectMemory freeListSpace
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3958
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3959
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3960
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3961
freeSpace
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3962
    "return the number of bytes in the compact free area.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3963
     (oldSpaceUsed + freeSpaceSize = oldSpaceSize)"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3964
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3965
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3966
    extern unsigned __oldSpaceSize(), __oldSpaceUsed();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3967
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3968
    RETURN ( __MKSMALLINT(__oldSpaceSize() - __oldSpaceUsed()) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3969
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3970
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3971
     ObjectMemory freeSpace
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3972
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3973
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3974
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3975
garbageCollectCount
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3976
    "return the number of compressing collects that occurred since startup"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3977
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3978
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3979
    extern int __garbageCollectCount();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3980
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3981
    RETURN (__MKSMALLINT(__garbageCollectCount()));
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3982
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3983
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3984
     ObjectMemory garbageCollectCount 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3985
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3986
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3987
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3988
incrementalGCCount
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3989
    "return the number of incremental collects that occurred since startup"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3990
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3991
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3992
    extern int __incrementalGCCount();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3993
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3994
    RETURN (__MKSMALLINT(__incrementalGCCount()));
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3995
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3996
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3997
     ObjectMemory incrementalGCCount
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3998
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3999
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4000
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4001
incrementalGCPhase
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4002
    "returns the internal state of the incremental GC.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4003
     The meaning of those numbers is a secret :-).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4004
     (for the curious: (currently)
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4005
      2 is idle, 3..11 are various mark phases,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4006
      12 is the sweep phase. 0 and 1 are cleanup phases when the
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4007
      incr. GC gets interrupted by a full GC).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4008
     Do not depend on the values - there may be additional phases in
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4009
     future versions (incremental compact ;-).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4010
     This is for debugging and monitoring only - and may change or vanish"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4011
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4012
%{  /* NOCONTEXT */
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4013
    extern int __incrGCphase();
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4014
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  4015
    RETURN (__MKSMALLINT(__incrGCphase()));
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4016
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4017
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4018
3742
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4019
incrementalGCPhaseSymbolic
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4020
    "returns the internal state of the incremental GC
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4021
     in a symbolic form.
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4022
     (for the curious: (currently)
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4023
      2 is idle, 3..11 are various mark phases,
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4024
      12 is the sweep phase. 0 and 1 are cleanup phases when the
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4025
      incr. GC gets interrupted by a full GC).
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4026
     Do not depend on the values - there may be additional phases in
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4027
     future versions (incremental compact ;-).
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4028
     This is for debugging and monitoring only - and may change or vanish"
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4029
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4030
    |phase|
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4031
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4032
    phase := self incrementalGCPhase.
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4033
    phase < 2 ifTrue:[^ #cleanup].
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4034
    phase == 2 ifTrue:[^ #idle].
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4035
    phase < 12 ifTrue:[^ #marking].
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4036
    ^ #sweeping
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4037
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4038
    "Created: / 10.8.1998 / 15:02:52 / cg"
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4039
!
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4040
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4041
lastScavengeReclamation
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4042
    "returns the number of bytes replacimed by the last scavenge.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4043
     For statistic only - this may vanish."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4044
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4045
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4046
    extern int __newSpaceReclaimed();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4047
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4048
    RETURN ( __MKSMALLINT(__newSpaceReclaimed()) );
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4049
%}
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4050
    "percentage of reclaimed objects is returned by:
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4051
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4052
     ((ObjectMemory lastScavengeReclamation)
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4053
      / (ObjectMemory newSpaceSize)) * 100.0  
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4054
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4055
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4056
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4057
lifoRememberedSet
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4058
    "return the lifoRemSet.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4059
     This is pure VM debugging and will vanish without notice."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4060
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4061
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4062
    extern OBJ __lifoRememberedSet();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4063
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4064
    RETURN ( __lifoRememberedSet() );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4065
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4066
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4067
     ObjectMemory lifoRememberedSet
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4068
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4069
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4070
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4071
lifoRememberedSetSize
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4072
    "return the size of the lifoRemSet.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4073
     This is a VM debugging interface and may vanish without notice."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4074
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4075
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4076
    extern int __lifoRememberedSetSize();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4077
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4078
    RETURN (__MKSMALLINT(__lifoRememberedSetSize()));
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4079
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4080
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4081
     ObjectMemory lifoRememberedSetSize
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4082
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4083
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4084
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4085
markAndSweepCount
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4086
    "return the number of mark&sweep collects that occurred since startup"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4087
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4088
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4089
    extern int __markAndSweepCount();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4090
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4091
    RETURN (__MKSMALLINT(__markAndSweepCount()));
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4092
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4093
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4094
     ObjectMemory markAndSweepCount 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4095
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4096
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4097
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4098
maximumIdentityHashValue
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4099
    "for ST-80 compatibility: return the maximum value
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4100
     a hashKey as returned by identityHash can get.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4101
     Since ST/X uses direct pointers, a field in the objectHeader
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4102
     is used, which is currently 11 bits in size."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4103
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4104
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4105
    RETURN ( __MKSMALLINT( __MAX_HASH__ << __HASH_SHIFT__) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4106
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4107
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4108
     ObjectMemory maximumIdentityHashValue
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4109
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4110
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4111
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4112
minScavengeReclamation
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4113
    "returns the number of bytes replacimed by the least effective scavenge.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4114
     For statistic only - this may vanish."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4115
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4116
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4117
    extern int __newSpaceReclaimedMin();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4118
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4119
    RETURN ( __MKSMALLINT(__newSpaceReclaimedMin()) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4120
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4121
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4122
     ObjectMemory minScavengeReclamation
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4123
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4124
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4125
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4126
newSpaceSize
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4127
    "return the total size of the new space - this is usually fix"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4128
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4129
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4130
    extern unsigned __newSpaceSize();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4131
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4132
    RETURN ( __MKSMALLINT(__newSpaceSize()) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4133
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4134
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4135
     ObjectMemory newSpaceSize
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4136
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4137
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4138
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4139
newSpaceUsed
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4140
    "return the number of bytes allocated for new objects.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4141
     The returned value is usually obsolete as soon as you do
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4142
     something with it ..."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4143
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4144
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4145
    extern unsigned __newSpaceUsed();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4146
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4147
    RETURN ( __MKSMALLINT(__newSpaceUsed()) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4148
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4149
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4150
     ObjectMemory newSpaceUsed   
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4151
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4152
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4153
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4154
numberOfObjects
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4155
    "return the number of objects in the system."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4156
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4157
    |tally "{ Class: SmallInteger }"|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4158
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4159
    tally := 0.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4160
    self allObjectsDo:[:obj | tally := tally + 1].
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4161
    ^ tally
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4162
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4163
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4164
     ObjectMemory numberOfObjects  
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4165
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4166
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4167
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4168
numberOfWeakObjects
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4169
    "return the number of weak objects in the system"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4170
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4171
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4172
    extern int __weakListSize();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4173
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4174
    RETURN ( __MKSMALLINT(__weakListSize()) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4175
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4176
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4177
     ObjectMemory numberOfWeakObjects
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4178
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4179
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4180
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4181
oldSpaceAllocatedSinceLastGC
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4182
    "return the number of bytes allocated for old objects since the
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4183
     last oldspace garbage collect occured. This information is used
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4184
     by ProcessorScheduler to decide when to start the incremental
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4185
     background GC."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4186
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4187
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4188
    extern unsigned __oldSpaceAllocatedSinceLastGC();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4189
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4190
    RETURN ( __MKSMALLINT(__oldSpaceAllocatedSinceLastGC()) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4191
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4192
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4193
     ObjectMemory oldSpaceAllocatedSinceLastGC   
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4194
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4195
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4196
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4197
oldSpaceSize
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4198
    "return the total size of the old space. - may grow slowly"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4199
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4200
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4201
    extern unsigned __oldSpaceSize();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4202
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4203
    RETURN ( __MKSMALLINT(__oldSpaceSize()) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4204
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4205
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4206
     ObjectMemory oldSpaceSize
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4207
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4208
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4209
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4210
oldSpaceUsed
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4211
    "return the number of bytes allocated for old objects.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4212
     (This includes the free lists)"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4213
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4214
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4215
    extern unsigned __oldSpaceUsed();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4216
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4217
    RETURN ( __MKSMALLINT(__oldSpaceUsed()) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4218
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4219
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4220
     ObjectMemory oldSpaceUsed  
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4221
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4222
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4223
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4224
rememberedSetSize
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4225
    "return the number of old objects referencing new ones.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4226
     This is a VM debugging interface and may vanish without notice."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4227
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4228
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4229
    extern int __rememberedSetSize();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4230
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4231
    RETURN (__MKSMALLINT(__rememberedSetSize()));
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4232
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4233
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4234
     ObjectMemory rememberedSetSize
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4235
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4236
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4237
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4238
resetMinScavengeReclamation
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4239
    "resets the number of bytes replacimed by the least effective scavenge.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4240
     For statistic only - this may vanish."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4241
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4242
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4243
    extern int __resetNewSpaceReclaimedMin();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4244
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4245
    __resetNewSpaceReclaimedMin();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4246
%}.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4247
    ^ self
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4248
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4249
     ObjectMemory resetMinScavengeReclamation.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4250
     ObjectMemory minScavengeReclamation
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4251
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4252
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4253
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4254
runsSingleOldSpace
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4255
    "return true, if the system runs in a single oldSpace or
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4256
     false if not.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4257
     The memory system will always drop the second semispace when 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4258
     running out of virtual memory, or the baker-limit is reached.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4259
     OBSOLETE: 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4260
	 the system may now decide at any time to switch between
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4261
	 single and double-space algorithms, depending on the overall memory
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4262
	 size. You will now almost always get false as result, since the
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4263
	 second semispace is only allocated when needed, and released
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4264
	 immediately afterwards.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4265
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4266
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4267
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4268
    extern int __runsSingleOldSpace();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4269
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4270
    RETURN ( (__runsSingleOldSpace() ? true : false) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4271
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4272
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4273
     ObjectMemory runsSingleOldSpace 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4274
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4275
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4276
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4277
scavengeCount
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4278
    "return the number of scavenges that occurred since startup"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4279
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4280
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4281
    extern int __scavengeCount();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4282
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4283
    RETURN (__MKSMALLINT(__scavengeCount()));
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4284
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4285
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4286
     ObjectMemory scavengeCount 
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4287
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4288
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4289
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4290
symSpaceSize
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4291
    "return the total size of the sym space."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4292
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4293
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4294
    extern unsigned __symSpaceSize();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4295
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4296
    RETURN ( __MKSMALLINT(__symSpaceSize()) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4297
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4298
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4299
     ObjectMemory symSpaceSize
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4300
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4301
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4302
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4303
symSpaceUsed
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4304
    "return the number of bytes allocated for old objects in sym space."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4305
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4306
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4307
    extern unsigned __symSpaceUsed();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4308
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4309
    RETURN ( __MKSMALLINT(__symSpaceUsed()) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4310
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4311
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4312
     ObjectMemory symSpaceUsed
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4313
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4314
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4315
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4316
tenureAge
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4317
    "return the current tenure age - thats the number of times
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4318
     an object has to survive scavenges to be moved into oldSpace.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4319
     For statistic/debugging only - this method may vanish"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4320
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4321
%{  /* NOCONTEXT */
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4322
    extern unsigned __tenureAge();
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4323
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  4324
    RETURN ( __MKSMALLINT(__tenureAge()) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4325
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4326
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4327
3181
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4328
vmSymbols
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4329
    "return a collection of symbols used by the VM"
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4330
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4331
    "/ DO NOT REMOVE THIS METHOD.
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4332
    "/ It is required to force the compiler to create those symbols
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4333
    "/ in fixed (non-moving) memory.
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4334
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4335
    ^ #(
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4336
      "/ interpreter stuff
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4337
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4338
      "/ JavaVM stuff
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4339
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4340
      nativeMethodInvokation
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4341
      newCleared
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4342
      monitorEnter:
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4343
      monitorExit:
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4344
      classInit
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4345
      javaClass
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4346
      resolve
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4347
      resolveStatic
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4348
    )
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4349
!
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  4350
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4351
whoReferences:anObject
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4352
    "return a collection of objects referencing the argument, anObject"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4353
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4354
    ^ self collectObjectsWhich:[:o | o references:anObject]
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4355
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4356
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4357
     (ObjectMemory whoReferences:Transcript) printNL
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4358
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4359
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4360
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  4361
whoReferencesAny:aCollection
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  4362
    "return a collection of objects referencing any object from
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  4363
     the argument, aCollection"
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  4364
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  4365
    ^ self collectObjectsWhich:[:o | o referencesAny:aCollection]
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  4366
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  4367
    "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  4368
     ObjectMemory whoReferencesAny:(Array with:Transcript with:Smalltalk)
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  4369
    "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  4370
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  4371
    "Modified: / 2.2.1998 / 16:08:18 / cg"
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  4372
!
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  4373
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4374
whoReferencesDerivedInstancesOf:aClass
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4375
    "return a collection of objects refering to instances
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4376
     of the argument, aClass or a subclass of it."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4377
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4378
    ^ self collectObjectsWhich:[:o | o referencesDerivedInstanceOf:aClass]
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4379
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4380
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4381
     (ObjectMemory whoReferencesDerivedInstancesOf:View) printNL
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4382
    "
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4383
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4384
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4385
whoReferencesInstancesOf:aClass
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4386
    "return a collection of objects refering to instances
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4387
     of the argument, aClass"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4388
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4389
    ^ self collectObjectsWhich:[:o | o referencesInstanceOf:aClass]
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4390
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4391
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4392
     (ObjectMemory whoReferencesInstancesOf:SystemBrowser) printNL
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4393
    "
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4394
! !
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4395
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4396
!ObjectMemory class methodsFor:'semaphore access'!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4397
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4398
lowSpaceSemaphore
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4399
    "return the semaphore that is signalled when the system detects a
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4400
     low space condition. Usually, some time after this, an allocationFailure
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4401
     will happen. You can have a cleanup process sitting in that semaphore and
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4402
     start to release object."
379
5b5a130ccd09 revision added
claus
parents: 375
diff changeset
  4403
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
  4404
    ^ LowSpaceSemaphore
379
5b5a130ccd09 revision added
claus
parents: 375
diff changeset
  4405
! !
5b5a130ccd09 revision added
claus
parents: 375
diff changeset
  4406
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4407
!ObjectMemory class methodsFor:'statistics'!
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4408
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4409
ageStatistic
2524
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4410
    "for ST/X developers only:
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4411
     dump contents of newSpace with objects age information.
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4412
     This method may be removed without notice"
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4413
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4414
%{   /* NOCONTEXT */
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
  4415
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
  4416
    __ageStatistics();
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
  4417
%}
2524
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4418
    "
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4419
     ObjectMemory ageStatistic
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4420
    "
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4421
!
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4422
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4423
codeCacheInfo
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4424
    "for ST/X developers only:
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4425
     dump contents of dynamic code cache LRU lists.
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4426
     This method may be removed without notice"
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4427
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4428
%{   /* NOCONTEXT */
2525
f12f868019d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2524
diff changeset
  4429
    OBJ __codeCacheInfo();
2524
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4430
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4431
    RETURN (__codeCacheInfo());
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4432
%}
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4433
    "
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4434
     ObjectMemory codeCacheInfo do:[:item |
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4435
        |n nMethods nBytes|
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4436
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4437
        n := item at:1.
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4438
        nMethods := item at:2.
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4439
        nBytes := item at:3.
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4440
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4441
        n isNil ifTrue:[
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4442
            '>>' print
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4443
        ] ifFalse:[
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4444
            (n printStringLeftPaddedTo:2) print.
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4445
        ].
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4446
        ' ' print.
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4447
        (nMethods printStringLeftPaddedTo:4) print.
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4448
        ' ' print.
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4449
        (nBytes printStringLeftPaddedTo:6) printCR.
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4450
     ]
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4451
    "
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  4452
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4453
! !
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4454
3699
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  4455
!ObjectMemory class methodsFor:'system configuration queries'!
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4456
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4457
allBinaryModulesDo:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4458
    "internal private method - walk over all known binary
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4459
     modules and evaluate aBlock for each entry.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4460
     Do not depend on the information returned for each - this may
418
claus
parents: 403
diff changeset
  4461
     change without notice."
claus
parents: 403
diff changeset
  4462
claus
parents: 403
diff changeset
  4463
%{
claus
parents: 403
diff changeset
  4464
    __REGISTRATION_DO_BLOCK(&aBlock COMMA_SND);
claus
parents: 403
diff changeset
  4465
%}
claus
parents: 403
diff changeset
  4466
!
claus
parents: 403
diff changeset
  4467
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4468
binaryModuleInfo
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4469
    "return a collection of moduleInfo entries.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4470
     This returns a dictionary (keys are internal moduleIDs)
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4471
     with one entry for each binary package (module)."
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4472
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4473
    |modules|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4474
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4475
    modules := IdentityDictionary new.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4476
    self allBinaryModulesDo:[:entry | 
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4477
        |id name type libName subModuleName module dynamic infoRec pathName
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4478
         typeName nameString|
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4479
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4480
        id := entry at:1.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4481
        subModuleName := (entry at:2) asSymbol.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4482
        libName := (entry at:4).
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4483
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4484
        id > 0 ifTrue:[
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4485
            pathName := ObjectFileLoader pathNameFromID:id.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4486
            dynamic := true.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4487
            typeName := 'dynamic '.
2580
d649a490f236 care for nil pathName in moduleEntry
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  4488
            pathName isNil ifTrue:[
d649a490f236 care for nil pathName in moduleEntry
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  4489
                name := '?'
d649a490f236 care for nil pathName in moduleEntry
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  4490
            ] ifFalse:[
d649a490f236 care for nil pathName in moduleEntry
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  4491
                name := pathName asFilename baseName
d649a490f236 care for nil pathName in moduleEntry
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  4492
            ]
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4493
        ] ifFalse:[
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4494
            dynamic := false.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4495
            typeName := 'builtIn '.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4496
            pathName := nil.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4497
            libName isNil ifTrue:[
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4498
                name := subModuleName
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4499
            ] ifFalse:[
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4500
                name := libName
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4501
            ].
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4502
        ].
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4503
        nameString := typeName.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4504
        libName isNil ifTrue:[
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4505
            nameString := nameString, 'module '
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4506
        ] ifFalse:[
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4507
            nameString := nameString, 'classLib '
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4508
        ].
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4509
        nameString := nameString , name.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4510
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4511
        libName isNil ifTrue:[
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4512
            type := #classObject
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4513
        ] ifFalse:[
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4514
            type := #classLibrary
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4515
        ].
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4516
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4517
        infoRec := modules at:id ifAbsent:nil.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4518
        infoRec notNil ifTrue:[
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4519
            infoRec classNames add:subModuleName.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4520
        ] ifFalse:[
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4521
            infoRec := BinaryModuleDescriptor 
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4522
                            name:nameString 
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4523
                            type:type 
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4524
                            id:id 
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4525
                            dynamic:dynamic 
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4526
                            classNames:(Set with:subModuleName) 
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4527
                            pathName:pathName 
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4528
                            libraryName:libName 
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4529
                            timeStamp:nil.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4530
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4531
            modules at:id put:infoRec.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4532
        ].
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4533
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4534
    ^ modules
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4535
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4536
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4537
     ObjectMemory binaryModuleInfo
418
claus
parents: 403
diff changeset
  4538
    "
claus
parents: 403
diff changeset
  4539
438
claus
parents: 435
diff changeset
  4540
    "Modified: 17.9.1995 / 16:33:02 / claus"
2580
d649a490f236 care for nil pathName in moduleEntry
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  4541
    "Modified: 22.4.1997 / 23:42:59 / cg"
418
claus
parents: 403
diff changeset
  4542
!
claus
parents: 403
diff changeset
  4543
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4544
fullBinaryModuleInfo
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4545
    "return a full collection of moduleInfo entries.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4546
     This returns a dictionary (keys are component names)
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4547
     with one entry for each sub-component in all binary packages."
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4548
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4549
    |modules|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4550
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4551
    modules := IdentityDictionary new.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4552
    self allBinaryModulesDo:[:entry | 
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4553
        |infoEntry
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4554
         id name type libName subModuleName module dynamic pathName t|
1503
b73090986d9b time changes (include milliseconds in osTime)
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4555
b73090986d9b time changes (include milliseconds in osTime)
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4556
        id := entry at:1.
b73090986d9b time changes (include milliseconds in osTime)
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4557
        subModuleName := (entry at:2) asSymbol.
b73090986d9b time changes (include milliseconds in osTime)
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4558
        libName := (entry at:4).
b73090986d9b time changes (include milliseconds in osTime)
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4559
        t := AbsoluteTime fromOSTime:((entry at:5) * 1000).
b73090986d9b time changes (include milliseconds in osTime)
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4560
b73090986d9b time changes (include milliseconds in osTime)
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4561
        id > 0 ifTrue:[
b73090986d9b time changes (include milliseconds in osTime)
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4562
            dynamic := true.
b73090986d9b time changes (include milliseconds in osTime)
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4563
        ] ifFalse:[
b73090986d9b time changes (include milliseconds in osTime)
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4564
            dynamic := false.
b73090986d9b time changes (include milliseconds in osTime)
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4565
        ].
b73090986d9b time changes (include milliseconds in osTime)
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4566
        libName isNil ifTrue:[
b73090986d9b time changes (include milliseconds in osTime)
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4567
            type := #classObject
b73090986d9b time changes (include milliseconds in osTime)
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4568
        ] ifFalse:[
b73090986d9b time changes (include milliseconds in osTime)
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4569
            type := #classLibrary
b73090986d9b time changes (include milliseconds in osTime)
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4570
        ].
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4571
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4572
        "/ ... new:
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4573
        infoEntry := BinaryModuleDescriptor 
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4574
                        name:nil 
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4575
                        type:type 
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4576
                        id:id 
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4577
                        dynamic:dynamic 
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4578
                        classNames:(Array with:subModuleName) 
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4579
                        pathName:nil 
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4580
                        libraryName:libName 
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4581
                        timeStamp:t.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4582
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4583
        modules at:subModuleName put:infoEntry.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4584
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4585
    ^ modules
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4586
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4587
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4588
     ObjectMemory fullBinaryModuleInfo
418
claus
parents: 403
diff changeset
  4589
    "
claus
parents: 403
diff changeset
  4590
claus
parents: 403
diff changeset
  4591
    "Modified: 30.8.1995 / 17:29:30 / claus"
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4592
    "Modified: 31.10.1996 / 13:58:44 / cg"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4593
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4594
3699
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  4595
getVMIdentificationStrings
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  4596
    "return a collection of release strings giving information
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  4597
     about the running VM. This is for configuration management only.
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  4598
     Do not depend on the information returned - this may
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  4599
     change or vanish without notice."
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  4600
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  4601
%{
3729
dfb4670c8b1f need ext decl for getVMReleaseStrings
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  4602
    extern OBJ __getVMReleaseStrings();
dfb4670c8b1f need ext decl for getVMReleaseStrings
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  4603
3699
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  4604
    RETURN (__getVMReleaseStrings());
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  4605
%}
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  4606
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  4607
     ObjectMemory getVMIdentificationStrings
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  4608
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  4609
! !
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  4610
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  4611
!ObjectMemory class methodsFor:'system management'!
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  4612
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4613
imageBaseName
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4614
    "return a reasonable filename to use as baseName (i.e. without extension).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4615
     This is the filename of the current image (without '.img') or,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4616
     if not running from an image, the default name 'st'"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4617
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4618
    |nm|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4619
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4620
    nm := ImageName.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4621
    (nm isNil or:[nm isBlank]) ifTrue:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4622
	^ 'st'
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4623
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4624
    (nm endsWith:'.sav') ifTrue:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4625
	nm := nm copyWithoutLast:4
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4626
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4627
    (nm endsWith:'.img') ifTrue:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4628
	^ nm copyWithoutLast:4
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4629
    ].
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4630
    ^ nm
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4631
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4632
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4633
     ObjectMemory imageBaseName    
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4634
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4635
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4636
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4637
imageName
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4638
    "return the filename of the current image, or nil
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4639
     if not running from an image."
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4640
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4641
    ^ ImageName
335
claus
parents: 332
diff changeset
  4642
claus
parents: 332
diff changeset
  4643
    "
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4644
     ObjectMemory imageName 
335
claus
parents: 332
diff changeset
  4645
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4646
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4647
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4648
imageSaveTime
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4649
    "return a timestamp for when the running image was saved.
1096
d88b93ce1194 remember image save time
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4650
     Return nil if not running from an image."
d88b93ce1194 remember image save time
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4651
d88b93ce1194 remember image save time
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4652
    ^ ImageSaveTime
d88b93ce1194 remember image save time
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4653
!
d88b93ce1194 remember image save time
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4654
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4655
loadClassBinary:aClassName
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4656
    "find the object file for aClassName and -if found - load it;
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4657
     this one loads precompiled object files"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4658
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4659
    |fName newClass|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4660
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4661
    fName := self fileNameForClass:aClassName.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4662
    fName notNil ifTrue:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4663
	Class withoutUpdatingChangesDo:
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4664
	[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4665
	    self loadBinary:(fName , '.o')
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4666
	].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4667
	newClass := self at:(aClassName asSymbol).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4668
	(newClass notNil and:[newClass implements:#initialize]) ifTrue:[
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4669
	    newClass initialize
159
514c749165c3 *** empty log message ***
claus
parents: 133
diff changeset
  4670
	]
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4671
    ]
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4672
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4673
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4674
nameForChanges
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4675
    "return a reasonable filename to store the changes into.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4676
     Currently, this is defined in a classVariable and defaults to 'changes'.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4677
     In future versions, this will be the basename of the current image with '.img' replaced
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4678
     by '.chg', or, if not running from an image, the default name 'st.chg'."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4679
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4680
    ChangeFileName notNil ifTrue:[^ ChangeFileName].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4681
    ^ 'changes'.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4682
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4683
"/ future versions will have:
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4684
"/ (requires some additionas at other places)
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4685
"/
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4686
"/    ^ self imageBaseName , '.chg'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4687
335
claus
parents: 332
diff changeset
  4688
    "
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4689
     ObjectMemory nameForChanges    
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4690
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4691
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4692
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4693
nameForChanges:aFilename
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4694
    "set the name of the file where changes are stored into."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4695
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4696
    ChangeFileName := aFilename
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4697
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4698
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4699
     ObjectMemory nameForChanges:'myChanges'    
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4700
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4701
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4702
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4703
nameForSnapshot
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4704
    "return a reasonable filename to store the snapshot image into.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4705
     This is the filename of the current image or,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4706
     if not running from an image, the default name 'st.img'"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4707
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4708
    ^ self imageBaseName , '.img'
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4709
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4710
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4711
     ObjectMemory nameForSnapshot    
335
claus
parents: 332
diff changeset
  4712
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4713
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4714
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4715
nameForSources
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4716
    "return a reasonable filename to store the sources into.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4717
     This is the basename of the current image with '.img' replaced
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4718
     by '.src', or, if not running from an image, the default name 'st.src'"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4719
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4720
    ^ self imageBaseName , '.src'
362
claus
parents: 360
diff changeset
  4721
claus
parents: 360
diff changeset
  4722
    "
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4723
     ObjectMemory nameForSources    
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4724
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4725
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4726
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4727
primSnapShotOn:aFileName
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4728
    "create a snapshot in the given file.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4729
     Low level entry. Does not notify classes or write an entry to
1704
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4730
     the changes file. Also, no image backup is created. 
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4731
     Returns true if the snapshot worked, false if it failed for some reason.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4732
     This method should not be used in normal cases."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4733
1704
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4734
    |ok oldImageName oldImageTime|
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4735
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4736
    "
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4737
     save the name and time with it ...
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4738
    "
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4739
    oldImageName := ImageName.
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4740
    oldImageTime := ImageSaveTime.
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4741
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4742
    ImageName := aFileName.
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4743
    ImageSaveTime := AbsoluteTime now.
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4744
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4745
%{  /* CALLSSTACK:32000 */
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4746
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4747
    OBJ __snapShotOn();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4748
    OBJ funny = @symbol(funnySnapshotSymbol);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4749
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4750
    if (__isString(aFileName)) {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4751
	__BLOCKINTERRUPTS();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4752
	ok = __snapShotOn(__context, _stringVal(aFileName), funny);
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4753
	__UNBLOCKINTERRUPTS();
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4754
    }
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4755
%}.
1704
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4756
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4757
    ImageName := oldImageName.
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4758
    ImageSaveTime := oldImageTime.
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4759
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4760
    ^ ok
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4761
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4762
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4763
snapShot
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4764
    "create a snapshot file containing all of the current state."
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4765
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4766
    self snapShotOn:(self nameForSnapshot)
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4767
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4768
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4769
     ObjectMemory snapShot
362
claus
parents: 360
diff changeset
  4770
    "
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4771
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4772
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4773
snapShotOn:aFileName
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4774
    "create a snapshot in the given file. 
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4775
     If the file exists, save it for backup.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4776
     Return true if the snapshot worked, false if it failed for some reason.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4777
     Notify dependents before and after the snapshot operation."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4778
2924
398bec06170f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2783
diff changeset
  4779
    |ok fn|
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4780
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4781
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4782
     keep a save version - just in case something
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4783
     bad happens while writing the image.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4784
     (could be st/x internal error or file-system errors etc)
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4785
    "
2924
398bec06170f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2783
diff changeset
  4786
    fn := aFileName asFilename.
398bec06170f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2783
diff changeset
  4787
    fn exists ifTrue:[
398bec06170f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2783
diff changeset
  4788
	fn renameTo:(fn withSuffix:'sav')
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4789
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4790
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4791
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4792
     give others a chance to fix things
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4793
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4794
    self changed:#save.             "/ will vanish ...
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4795
    self changed:#aboutToSnapshot.  "/ ... for ST-80 compatibility
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4796
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4797
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4798
     ST-80 compatibility; send #preSnapshot to all classes
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4799
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4800
    Smalltalk allBehaviorsDo:[:aClass |
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4801
	aClass preSnapshot
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4802
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4803
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4804
    ok := self primSnapShotOn:aFileName.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4805
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4806
    ok ifTrue:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4807
	Class addChangeRecordForSnapshot:aFileName.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4808
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4809
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4810
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4811
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4812
     ST-80 compatibility; send #postSnapshot to all classes
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4813
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4814
    Smalltalk allBehaviorsDo:[:aClass |
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4815
	aClass postSnapshot
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4816
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4817
    self changed:#finishedSnapshot.  "/ ST-80 compatibility
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4818
    ^ ok
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4819
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4820
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4821
     ObjectMemory snapShotOn:'myimage.img'
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4822
    "
362
claus
parents: 360
diff changeset
  4823
! !
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4824
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4825
!ObjectMemory::BinaryModuleDescriptor class methodsFor:'instance creation'!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4826
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4827
name:n type:t id:i dynamic:d classNames:c pathName:p libraryName:l timeStamp:ts
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4828
    ^ (self basicNew) name:n type:t id:i dynamic:d classNames:c pathName:p libraryName:l timeStamp:ts
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4829
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4830
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4831
! !
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4832
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4833
!ObjectMemory::BinaryModuleDescriptor methodsFor:'accessing'!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4834
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4835
classNames
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4836
    "return the names of the classes contained in that module"
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4837
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4838
    ^ classNames
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4839
!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4840
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4841
dynamic
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4842
    "return true, if this module was loaded dynamically 
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4843
     (as opposed to a module which was linked into the system right from
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4844
      the start. 
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4845
      Do not cofuse this with shared libraries - these may be dynamic or not)."
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4846
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4847
    ^ dynamic
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4848
!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4849
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4850
id
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4851
    "return the modules internal id; this is (currently) a small number,
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4852
     with positive values for dynamically added modules.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4853
     Modules which were present at startup (both statically linked or shared libraries)
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4854
     have a negative id (Do not depend on this - use #dynamic instead)."
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4855
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4856
    ^ id
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4857
!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4858
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4859
libraryName
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4860
    "return the name of this library. Typically, this is the libraries
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4861
     filename without a suffix (such as 'libbasic')"
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4862
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4863
    ^ libraryName
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4864
!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4865
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4866
name
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4867
    "return the modules name - usually, some descriptive text plus the modules
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4868
     libraryName."
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4869
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4870
    ^ name
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4871
!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4872
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4873
pathName
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4874
    "return the modules pathName"
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4875
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4876
    ^ pathName
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4877
!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4878
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4879
timeStamp
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4880
    "return the modules timeStamp"
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4881
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4882
    ^ timeStamp
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4883
!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4884
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4885
type
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4886
    "return the modules type. This is a symbol, such as #classLibrary."
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4887
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4888
    ^ type
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4889
! !
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4890
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4891
!ObjectMemory::BinaryModuleDescriptor methodsFor:'backward compatibility'!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4892
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4893
at:key
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4894
    "backward compatibility access: in previous releases, IdentityDictionaries
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4895
     were used to hold my information. Allow access via key messages.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4896
     This method will vanish - use the proper access protocol."
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4897
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4898
    ^ self perform:key
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4899
! !
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4900
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4901
!ObjectMemory::BinaryModuleDescriptor methodsFor:'private access'!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4902
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4903
name:n type:t id:i dynamic:d classNames:c pathName:p libraryName:l timeStamp:ts
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4904
    name := n.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4905
    type := t.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4906
    id := i.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4907
    dynamic := d.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4908
    classNames := c.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4909
    libraryName := l.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4910
    timeStamp := ts.
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4911
    pathName := p. 
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4912
! !
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  4913
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4914
!ObjectMemory class methodsFor:'documentation'!
630
b785d23d7c5b version at the end
Claus Gittinger <cg@exept.de>
parents: 615
diff changeset
  4915
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4916
version
3858
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  4917
    ^ '$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.172 1998-09-29 10:44:05 cg Exp $'
630
b785d23d7c5b version at the end
Claus Gittinger <cg@exept.de>
parents: 615
diff changeset
  4918
! !
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4919
ObjectMemory initialize!