ObjectMemory.st
author Jan Vrany <jan.vrany@labware.com>
Mon, 29 Nov 2021 23:00:04 +0000
branchjv
changeset 25437 622824e701ea
parent 23107 40173e082cbc
permissions -rw-r--r--
Fix `ObjectMemory >> #nameForSnapshot` ...to actually do what the comment says: return current image name (if any).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19283
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
     1
"
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
     2
 COPYRIGHT (c) 1992 by Claus Gittinger
23107
40173e082cbc Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23089
diff changeset
     3
 COPYRIGHT (c) 2010-2011 Jan Vrany
40173e082cbc Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23089
diff changeset
     4
 COPYRIGHT (c) 2017 Jan Vrany
25437
622824e701ea Fix `ObjectMemory >> #nameForSnapshot`
Jan Vrany <jan.vrany@labware.com>
parents: 23107
diff changeset
     5
 COPYRIGHT (c) 2021 LabWare
19283
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
     6
	      All Rights Reserved
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
     7
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
     8
 This software is furnished under a license and may be used
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
     9
 only in accordance with the terms of that license and with the
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
    10
 inclusion of the above copyright notice.   This software may not
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
    11
 be provided or otherwise made available to, or used by, any
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
    12
 other person.  No title to or ownership of the software is
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
    13
 hereby transferred.
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
    14
"
5441
e88302747bbd rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5189
diff changeset
    15
"{ Package: 'stx:libbasic' }"
e88302747bbd rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5189
diff changeset
    16
17525
6d632c4b12d0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16832
diff changeset
    17
"{ NameSpace: Smalltalk }"
6d632c4b12d0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16832
diff changeset
    18
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    19
Object subclass:#ObjectMemory
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 797
diff changeset
    20
	instanceVariableNames:''
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 797
diff changeset
    21
	classVariableNames:'InternalErrorHandler UserInterruptHandler TimerInterruptHandler
759
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    22
		SpyInterruptHandler StepInterruptHandler
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    23
		ExceptionInterruptHandler ErrorInterruptHandler
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    24
		MemoryInterruptHandler SignalInterruptHandler
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    25
		ChildSignalInterruptHandler DisposeInterruptHandler
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    26
		RecursionInterruptHandler IOInterruptHandler
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    27
		CustomInterruptHandler RegisteredErrorInterruptHandlers
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    28
		InterruptLatencyMonitor AllocationFailureSignal
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    29
		MallocFailureSignal LowSpaceSemaphore IncrementalGCLimit
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    30
		FreeSpaceGCLimit FreeSpaceGCAmount BackgroundCollectProcess
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
    31
		BackgroundFinalizationProcess FinalizationSemaphore Dependents
1108
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
    32
		ImageName ImageSaveTime ChangeFileName MaxInterruptLatency
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
    33
		InterruptLatencyGoal VMSelectors DynamicCodeGCTrigger
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
    34
		DynamicCodeLimit JustInTimeCompilationEnabled
3912
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
    35
		JavaJustInTimeCompilationEnabled JavaNativeCodeOptimization
20701
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
    36
		BackgroundCollectMaximumInterval SavedGarbageCollectorSettings
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
    37
		FinalizerAccessLock'
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 797
diff changeset
    38
	poolDictionaries:''
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 797
diff changeset
    39
	category:'System-Support'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    40
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    41
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
    42
Object subclass:#BinaryModuleDescriptor
12922
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
    43
	instanceVariableNames:'name type id dynamic classNames handle pathName libraryName
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
    44
		timeStamp'
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
    45
	classVariableNames:''
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
    46
	poolDictionaries:''
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
    47
	privateIn:ObjectMemory
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
    48
!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
    49
19374
Stefan Vogel <sv@exept.de>
parents: 19373
diff changeset
    50
!ObjectMemory primitiveDefinitions!
Stefan Vogel <sv@exept.de>
parents: 19373
diff changeset
    51
%{
Stefan Vogel <sv@exept.de>
parents: 19373
diff changeset
    52
Stefan Vogel <sv@exept.de>
parents: 19373
diff changeset
    53
/*
Stefan Vogel <sv@exept.de>
parents: 19373
diff changeset
    54
 * includes, defines, structure definitions
Stefan Vogel <sv@exept.de>
parents: 19373
diff changeset
    55
 * and typedefs come here.
Stefan Vogel <sv@exept.de>
parents: 19373
diff changeset
    56
 */
Stefan Vogel <sv@exept.de>
parents: 19373
diff changeset
    57
Stefan Vogel <sv@exept.de>
parents: 19373
diff changeset
    58
#ifdef __linux__
Stefan Vogel <sv@exept.de>
parents: 19373
diff changeset
    59
// for mallinfo() etc.
Stefan Vogel <sv@exept.de>
parents: 19373
diff changeset
    60
# include <malloc.h>
Stefan Vogel <sv@exept.de>
parents: 19373
diff changeset
    61
#endif
Stefan Vogel <sv@exept.de>
parents: 19373
diff changeset
    62
%}
Stefan Vogel <sv@exept.de>
parents: 19373
diff changeset
    63
! !
Stefan Vogel <sv@exept.de>
parents: 19373
diff changeset
    64
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
    65
!ObjectMemory class methodsFor:'documentation'!
2
claus
parents: 1
diff changeset
    66
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    67
caching
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    68
"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    69
    The system uses various caches to speed up method-lookup.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    70
    Currently, there is a three-level cache hierarchy:
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    71
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
    72
	inline-cache            keeps the target of the last send at the caller-
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
    73
				side (i.e. every send goes through its private
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
    74
				1-slot inline-cache, where the address of the last
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
    75
				called function at this call location is kept.)
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
    76
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
    77
	polymorph-inline-cache  keeps a limited list of all targets ever reached
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
    78
				at this call location. The list is automatically
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
    79
				flushed if it grows too large, or the overall number
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
    80
				of poly-chache entries exceeds a limit.
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
    81
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
    82
	method-lookup-cache     a global cache. Hashes on class-selector pairs,
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
    83
				returning the target method.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    84
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
    85
    Whenever methods are added or removed from the system, or the inheritance
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    86
    hierarchy changes, some or all caches have to be flushed.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    87
    The flushXXX methods perform the task of flushing various caches.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    88
    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
    89
    however, if you use the low level access methods in Behavior
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    90
    (for example: #setSuperclass:) special care has to be taken.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    91
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    92
    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
    93
    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
    94
    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
    95
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
    96
    To be 'on the brigth side of live', use ObjectMemory>>flushCaches (which
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
    97
    flushes all of them), when in doubt of which caches should be flushed.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
    98
    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
    99
    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
   100
"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   101
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   102
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
   103
copyright
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
   104
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
   105
 COPYRIGHT (c) 1992 by Claus Gittinger
23107
40173e082cbc Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23089
diff changeset
   106
 COPYRIGHT (c) 2010-2011 Jan Vrany
40173e082cbc Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23089
diff changeset
   107
 COPYRIGHT (c) 2017 Jan Vrany
25437
622824e701ea Fix `ObjectMemory >> #nameForSnapshot`
Jan Vrany <jan.vrany@labware.com>
parents: 23107
diff changeset
   108
 COPYRIGHT (c) 2021 LabWare
159
514c749165c3 *** empty log message ***
claus
parents: 133
diff changeset
   109
	      All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
   110
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
   111
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
   112
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
   113
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
   114
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
   115
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
   116
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
   117
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
   118
!
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
   119
2
claus
parents: 1
diff changeset
   120
documentation
claus
parents: 1
diff changeset
   121
"
403
claus
parents: 384
diff changeset
   122
    This class contains access methods to the system memory and the VM.
claus
parents: 384
diff changeset
   123
claus
parents: 384
diff changeset
   124
    In previous ST/X versions, this stuff used to be in the Smalltalk class.
claus
parents: 384
diff changeset
   125
    It has been separated for better overall class structure and modularisation.
229
210ee6865aa3 commenting
claus
parents: 216
diff changeset
   126
    There are no instances of ObjectMemory - all is done in class methods.
403
claus
parents: 384
diff changeset
   127
    (this is a functional interface).
claus
parents: 384
diff changeset
   128
claus
parents: 384
diff changeset
   129
    Many methods here are for debuging purposes, for developers
claus
parents: 384
diff changeset
   130
    or experimental, and therefore not standard.
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   131
    Do not depend on them being there - some may vanish ...
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   132
    (especially those, that depend on a specific GC implementation)
403
claus
parents: 384
diff changeset
   133
    Most of the stuff found here is not available, or different or called
claus
parents: 384
diff changeset
   134
    different in other smalltalk implementations. Be aware, that using these
claus
parents: 384
diff changeset
   135
    interfaces (especially: depending on them) may make your application
claus
parents: 384
diff changeset
   136
    non portable.
claus
parents: 384
diff changeset
   137
claus
parents: 384
diff changeset
   138
    See more documentation in -> caching
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   139
			      -> interrupts
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   140
			      -> garbageCollection
2
claus
parents: 1
diff changeset
   141
1300
2cfff4cac72f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   142
    [Class variables:]
2
claus
parents: 1
diff changeset
   143
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   144
	InternalErrorHandler            gets informed (by VM), when some runtime
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   145
					error occurs (usually fatal)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   146
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   147
	UserInterruptHandler            gets informed (by VM) when CNTL-C is pressed
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   148
	TimerInterruptHandler           gets alarm timer interrupts (from VM)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   149
	SpyInterruptHandler             another alarm timer (from VM)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   150
	StepInterruptHandler            gets single step interrupts (from VM)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   151
	ExceptionInterruptHandler       gets floating point exceptions (from VM)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   152
	ErrorInterruptHandler           gets primitive errors (from VM)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   153
	MemoryInterruptHandler          gets soon-out-of-memory conditions (from VM)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   154
	SignalInterruptHandler          gets unix signals (from VM)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   155
	ChildSignalInterruptHandler     gets child death signals (from VM)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   156
	DisposeInterruptHandler         gets informed, when an object is disposed from
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   157
					a shadowArray (from VM)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   158
	RecursionInterruptHandler       gets recursion limit violations (from VM)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   159
	IOInterruptHandler              gets SIGIO unix signals (from VM)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   160
	CustomInterruptHandler          gets custom interrupts (from VM)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   161
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   162
	InterruptLatencyMonitor         if nonNil, that one will be notified (by the VM)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   163
					with an interruptLatency:millis message for every
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   164
					interrupt and gets the delay time
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   165
					(between the time when the signal arrived and
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   166
					 when it was really delivered) as argument.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   167
					This can be used to create a statistic for
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   168
					realtime systems.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   169
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   170
	RegisteredErrorInterruptHandlers
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   171
					associates errorID (as passed from primitive
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   172
					to the __errorInterruptWithID() function)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   173
					with handlers.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   174
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   175
	IncrementalGCLimit              number of bytes, that must be allocated since
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   176
					last full garbage collect to turn the incremental
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   177
					collector on (at idle time).
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   178
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   179
	FreeSpaceGCLimit                low limit on freeSpace, at which incremental
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   180
					gc starts to run at idle time.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   181
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   182
	FreeSpaceGCAmount               amount to allocate, once freeSpace drops
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   183
					below FreeSpaceGCLimit
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   184
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   185
	DynamicCodeGCTrigger            amount of generated dynamically compiled code
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   186
					to trigger the incremental garbage collector
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   187
					nil means: no trigger
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   188
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   189
	DynamicCodeLimit                max. amount of space allocated for dynamically compiled code
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   190
					nil means: unlimited.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   191
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   192
	JustInTimeCompilationEnabled    boolean - enables/disables JIT-compilation of
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   193
					bytecode to machine code.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   194
					(this has nothing to do with stc-compilation)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   195
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   196
	Dependents                      keep my dependents locally (its faster) for
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   197
					all those registries
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   198
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   199
	LowSpaceSemaphore               a semaphore signalled whenever the system is
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   200
					running in low memory (i.e. the memory manager
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   201
					ran into memory shortage and feels that it
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   202
					may soon no longer be able to grant allocation requests).
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   203
					You can have a process waiting on this semaphore
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   204
					which starts to remove (i.e. nil-out) objects
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   205
					or preform other cleanup actions.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   206
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   207
	AllocationFailureSignal         signal raised when a new fails (see Behavior)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   208
					When this signal is raised, the memory manager
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   209
					is really in trouble (i.e. above low-mem feelings
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   210
					were correct)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   211
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   212
	MallocFailureSignal             signal raised when a malloc fails
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   213
					mallocs are used internally in the VM and/or
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   214
					by some classes (ExternalBytes)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   215
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   216
	BackgroundCollectProcess        created by startBackgroundCollectorAt:
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   217
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   218
	BackgroundFinalizationProcess   created by startBackgroundFinalizationAt:
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   219
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   220
	BackgroundCollectMaximumInterval
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   221
					number of seconds after which an incremental background
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   222
					collection is started - regardless of the allocation
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   223
					rate or freeSpace situation. If nil, IGC is only done
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   224
					when the space situation makes it feasable.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   225
					Can be set to (say) 3600, to have the memory cleaned
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   226
					at least once an hour.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   227
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   228
	FinalizationSemaphore           triggered by the VM, when any weak pointer is
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   229
					lost. Been waited upon by the backgroundFinalizer.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   230
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   231
	ImageName                       name of the current image (or nil)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   232
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   233
	ImageSaveTime   <Timestamp>  timestamp when this image was saved
1096
d88b93ce1194 remember image save time
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
   234
d88b93ce1194 remember image save time
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
   235
403
claus
parents: 384
diff changeset
   236
    Warning:
claus
parents: 384
diff changeset
   237
      The InterruptHandler variables are known by the runtime system -
claus
parents: 384
diff changeset
   238
      they are the objects that get an interrupt message when the event
claus
parents: 384
diff changeset
   239
      occurs. You may not remove any of them.
1300
2cfff4cac72f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   240
2cfff4cac72f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   241
    [author:]
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   242
	Claus Gittinger
2
claus
parents: 1
diff changeset
   243
"
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   244
!
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   245
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   246
garbageCollection
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   247
"
403
claus
parents: 384
diff changeset
   248
    Currently, Smalltalk/X uses a two-level memory hierachy (actually, there
claus
parents: 384
diff changeset
   249
    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
   250
    but for the following discussion, these are not of interest).
403
claus
parents: 384
diff changeset
   251
claus
parents: 384
diff changeset
   252
  newSpace:
claus
parents: 384
diff changeset
   253
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   254
    Objects are created in a so-called newSpace, which is relatively small.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   255
    This newSpace is cleaned by a so called ``scavenge''-operation, whenever
403
claus
parents: 384
diff changeset
   256
    becoming full. Scavenging means, that all still-live objects (i.e. referenced
claus
parents: 384
diff changeset
   257
    by some other) are copied over to another memory area, leaving all unreachable
claus
parents: 384
diff changeset
   258
    objects as garbage behind. Thus, the newSpace actually consists of two semispaces,
claus
parents: 384
diff changeset
   259
    of whih only one is active - the other being used only while objects are
claus
parents: 384
diff changeset
   260
    copied.
claus
parents: 384
diff changeset
   261
    After this copying, these two semispaces exchange their roles - i.e. reachable
claus
parents: 384
diff changeset
   262
    objects are copied ping-pong like between these semispaces.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   263
    Once an object survives enough of these copying operations, the next scavenge
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   264
    will move it into the so called oldSpace, which is much larger, and not
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   265
    processed by the scavenger.
403
claus
parents: 384
diff changeset
   266
    This movement of an object from newSpace to oldSpace is called ``tenure''.
claus
parents: 384
diff changeset
   267
    (this avoids objects being copied around forever).
claus
parents: 384
diff changeset
   268
    Once tenured, an object is no longer contained in the newSpace, and
claus
parents: 384
diff changeset
   269
    thus ceases to create any scavenging overhead after that.
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
   270
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   271
    Scavenging occurs automatically, and is usually done fast enough to go
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   272
    unnoticed (typically, it takes some 5 to 40ms to perform a scavenge,
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   273
    depending on how many live objects are in the newspace).
403
claus
parents: 384
diff changeset
   274
759
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 703
diff changeset
   275
    Interestingly, the scavenger performs better, if many garbage objects
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   276
    are to be reclaimed, since less object-copying has to be done. Therefore,
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   277
    the best-case scavenge time is almost zero, if there is only garbage in
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   278
    the newSpace.
19508
8d757d0cada7 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19374
diff changeset
   279
    In contrast, the worst-case is when all newSpace objects are still living.
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   280
    Thus, garbage reclamation of young objects is basically free -
19508
8d757d0cada7 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19374
diff changeset
   281
    the more garbage is in newspace, the faster is the collector, asymptotically approaching
8d757d0cada7 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19374
diff changeset
   282
    zero time, when all new objects are garbage!!
8d757d0cada7 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19374
diff changeset
   283
8d757d0cada7 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19374
diff changeset
   284
    From the newSpace collector's viewPoint, it makes sense to get
403
claus
parents: 384
diff changeset
   285
    objects out of the way as fast as possible. However the oldSpace is
claus
parents: 384
diff changeset
   286
    collected much less frequently and the cost to reclaim an oldspace object
claus
parents: 384
diff changeset
   287
    is much higher (actually, the cost to reclaim a newspace object is zero -
19508
8d757d0cada7 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19374
diff changeset
   288
    it's the *survival* of objects which we have to pay for).
8d757d0cada7 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19374
diff changeset
   289
    Therefore, from an oldSpace collector's point of view, it's preferable to
403
claus
parents: 384
diff changeset
   290
    keep objects in the newSpace as long as possible.
claus
parents: 384
diff changeset
   291
claus
parents: 384
diff changeset
   292
    To honor this conflicting situation, the system uses an adaptive tenure-count,
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   293
    which adjusts the number of scavenges required for tenure (the so called
207
claus
parents: 202
diff changeset
   294
    'tenureAge') according to the fill-grade of the newSpace.
403
claus
parents: 384
diff changeset
   295
    If the newSpace is relatively empty, it tries to keep objects longer there.
claus
parents: 384
diff changeset
   296
    The controlling parameters of the tenure age can be changed dynamically,
claus
parents: 384
diff changeset
   297
    detailed information is available upon request.
claus
parents: 384
diff changeset
   298
claus
parents: 384
diff changeset
   299
    The exact speed of the scavenger depends mostly on the speed of your memory
claus
parents: 384
diff changeset
   300
    interface (and, since most of todays memories have access times in the order
19508
8d757d0cada7 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19374
diff changeset
   301
    of 10-40ns, the raw CPU speed does not correlate linear with the GC speed).
8d757d0cada7 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19374
diff changeset
   302
    Measurements (1992!!) give roughly 40ms for a full 400k newSpace
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   303
    (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
   304
    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
   305
    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
   306
    help a lot.
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   307
403
claus
parents: 384
diff changeset
   308
    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
   309
    the size of the newSpace - either via a command line argument, or even dynamically
403
claus
parents: 384
diff changeset
   310
    by Objectmemory>>newSpaceSize:. Smaller sizes lead to shorter blocking periods,
claus
parents: 384
diff changeset
   311
    but greater absolute GC overhead. The default (400k) seems to be a good compromise.
claus
parents: 384
diff changeset
   312
    (if you are not happy with it, try playing around with the settings)
claus
parents: 384
diff changeset
   313
claus
parents: 384
diff changeset
   314
  oldSpace:
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   315
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   316
    To reclaim oldspace, the system uses three algorithms: mark&sweep, a copying
19509
febba5cf48ca #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19508
diff changeset
   317
    (and compressing) baker-type collector and an incremental mark&sweep&compress.
febba5cf48ca #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19508
diff changeset
   318
febba5cf48ca #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19508
diff changeset
   319
    The blocking mark&sweep runs whenever the oldspace becomes full and the oldSpace
febba5cf48ca #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19508
diff changeset
   320
    limit has been reached (i.e. it prefers to map more pages to the oldSpace up to an
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   321
    adjustable limit). It puts dead objects onto a free list.
19509
febba5cf48ca #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19508
diff changeset
   322
    If a memory request cannot be served from this freelist,
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   323
    and the total size of objects on the freelist exceeds a threshold (actually: the fragmentation does so),
19509
febba5cf48ca #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19508
diff changeset
   324
    the system 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
   325
    This compress is either done by a 1-pass semispace copy algorithm, or
19509
febba5cf48ca #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19508
diff changeset
   326
    a 2pass inplace compress - depending on the setting of the compress limit
febba5cf48ca #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19508
diff changeset
   327
    (if lots of virtual address space is available, a 1-pass algorithm is chosen).
3647
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   328
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   329
    The 1pass algorithm copies all live objects into a newly allocated
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   330
    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
   331
    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
   332
    a second pass.
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   333
    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
   334
    slightly faster, if enough real memory is available.
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   335
    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
   336
    since it is less affected by paging.
f653279988f8 updated doc for inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3646
diff changeset
   337
    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
   338
    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
   339
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   340
    We recommend setting the compressLimit to roughly 1/4th of the physical
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   341
    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
   342
    (i.e. an XServer, some xterms etc.).
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   343
    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
   344
    can be set to 1/3rd of the physical memory.
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   345
    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
   346
    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
   347
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   348
    Since a compressing oldspace collect leads to a noticable pause of the system,
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   349
    the memory manager tries hard to avoid oldspace compression.
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   350
    (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
   351
     memory, the compress algorithms are actually pretty fast).
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   352
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   353
    The incremental mark&sweep runs in the background, whenever the system is idle
403
claus
parents: 384
diff changeset
   354
    (see ProcessorSceduler>>waitForEventOrTimeout), or alternatively as a low or high
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   355
    priority background process (see ObjectMemory>>startBackgroundCollector).
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   356
    Like the normal mark&sweep, this incremental collector follows object references
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   357
    and marks reachable objects on its way.
19509
febba5cf48ca #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19508
diff changeset
   358
    However, this is done 'a few objects-at-a-time', to not disrupt the system noticably.
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   359
    Currently, there are some (theoretical) and in practice never occurring situations,
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   360
    in which the incremental GC still creates noticable delays.
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   361
    A current project is involved with this and a future version of ST/X (ST/X-RT)
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   362
    will be available which shows deterministic worst case behavior in its GC pauses
403
claus
parents: 384
diff changeset
   363
    (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
   364
19509
febba5cf48ca #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19508
diff changeset
   365
    Currently (1995), incremental GC blockings are in the order of 10-70ms.
403
claus
parents: 384
diff changeset
   366
    There is one catch with low priority background IGC: if there is never any idle
claus
parents: 384
diff changeset
   367
    time available (i.e. all processes run all the time), it would never get a chance
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   368
    to do any collection work.
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   369
    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
   370
    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
   371
    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
   372
    A high priority background collector will always make progress and eventually finish
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   373
    a GC cycle. However, it may have more of an influence on the other processes.
19509
febba5cf48ca #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19508
diff changeset
   374
    The default setup to date is to give it a dynamic priority, so it is ensured to make some
febba5cf48ca #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19508
diff changeset
   375
    progress - although sometimes only slowly.
febba5cf48ca #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19508
diff changeset
   376
    So, its up to you, to decide ...
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   377
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   378
    Incremental garbage collection is controlled by the variables
362
claus
parents: 360
diff changeset
   379
    'IncrementalGCLimit', 'FreeSpaceGCLimit' and 'FreeSpaceGCAmount':
310
fbfb977ae1bd *** empty log message ***
claus
parents: 308
diff changeset
   380
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   381
      the ProcessorScheduler will perform incremental GC steps at idle time,
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   382
      if the total space allocated since the last full collect exceeds
362
claus
parents: 360
diff changeset
   383
      'IncrementalGCLimit',
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
   384
      or if there are less than 'FreeSpaceGCLimit' bytes available in free store.
362
claus
parents: 360
diff changeset
   385
      If after the incrementalGC, less than 'FreeSpaceGCLimi't bytes are available,
310
fbfb977ae1bd *** empty log message ***
claus
parents: 308
diff changeset
   386
      'FreeSpaceGCAmount' more bytes are requested from the memory manager.
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
   387
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   388
    The defaults are set in ObjectMemory>>initialize and can be changed in your
403
claus
parents: 384
diff changeset
   389
    startup 'smalltalk.rc'-file. Setting them to nil turns incremental GC off.
270
f036aaa9a836 *** empty log message ***
claus
parents: 253
diff changeset
   390
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   391
362
claus
parents: 360
diff changeset
   392
    For example, setting 'IncrementalGCLimit' to 500000 will start the background collector
207
claus
parents: 202
diff changeset
   393
    whenever 500k bytes have been allocated - usually very seldom. Setting it to some
claus
parents: 202
diff changeset
   394
    small number (say 10000) will have it run very often.
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
   395
362
claus
parents: 360
diff changeset
   396
    Setting 'FreeSpaceGCAmount' to (say) 1meg lets the system try to always keep
403
claus
parents: 384
diff changeset
   397
    1meg of freeSpace. If less memory is available, more oldSpace will be allocated.
claus
parents: 384
diff changeset
   398
    Keeping some memory in the pocket may prevent the system from running into a blocking
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   399
    GC if memory is allocated in peaks (but only, if the incremental GC can keep up with
403
claus
parents: 384
diff changeset
   400
    allocation rate). The trigger level 'FreeSpaceGCLimit' should be below that amount;
310
fbfb977ae1bd *** empty log message ***
claus
parents: 308
diff changeset
   401
    to avoid excessive incremental GC activity (say 1/4 if the amount).
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
   402
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   403
    Having the background GC running often should not hurt the performance of your
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   404
    smalltalk processes, since the IGC only runs at times when no ST processes are runnable.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   405
    (there are some short delays in event processing, since the IGC's steps may take
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   406
    some XX ms.)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   407
    However, if you are not alone on your machine (i.e. a timesharing system) or
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   408
    you have other Unix processes to run, you should not run the IGC too often,
362
claus
parents: 360
diff changeset
   409
    since it may hurt OTHER users/unix processes.
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   410
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   411
    Since this collector only runs at idle times, even a low priority background
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   412
    process will prevent it from doing its work. You may want to start a somewhat
207
claus
parents: 202
diff changeset
   413
    higher priority background collect (say at prio 4), which also preempts these
claus
parents: 202
diff changeset
   414
    background processes. (see ObjectMemory>>startBackgroundCollectorAt:).
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   415
325
claus
parents: 324
diff changeset
   416
    Beginning with 2.10.4, a third space, called symSpace has been added.
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   417
    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
   418
    This space is (currently) used for symbols only.
325
claus
parents: 324
diff changeset
   419
claus
parents: 324
diff changeset
   420
    Beginning with 2.10.5, a fourth space, called fixSpace has been added.
claus
parents: 324
diff changeset
   421
    Objects in this space are never moved or garbage collected.
claus
parents: 324
diff changeset
   422
    This space is used for constant objects (true, false, some basic classes etc.).
229
210ee6865aa3 commenting
claus
parents: 216
diff changeset
   423
210ee6865aa3 commenting
claus
parents: 216
diff changeset
   424
    A plan for 2.11 is to offer an arbitrary number of spaces, which can be
210ee6865aa3 commenting
claus
parents: 216
diff changeset
   425
    attached and detached at runtime. This will allow easy share of object
210ee6865aa3 commenting
claus
parents: 216
diff changeset
   426
    with remote systems and separating objects into a per application/package
210ee6865aa3 commenting
claus
parents: 216
diff changeset
   427
    space. (be prepared for changes in the future and make your application
210ee6865aa3 commenting
claus
parents: 216
diff changeset
   428
    independ of the VM internals)
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   429
403
claus
parents: 384
diff changeset
   430
  default setup:
claus
parents: 384
diff changeset
   431
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   432
    The following table lists some default settings and means for changing them;
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   433
    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
   434
    These may already be changed by a smalltalk.rc or private.rc startup file.
403
claus
parents: 384
diff changeset
   435
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   436
	    what        default     change by
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   437
				    command line arg    dynamically
403
claus
parents: 384
diff changeset
   438
    -----------------------------------------------------------------------
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   439
	newSpace size     400k      -Mnew nnn           newSpaceSize:nnn
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   440
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   441
	oldSpace size    3000k      -Mold nnn           moreOldSpace:
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   442
							announceSpaceNeed:
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   443
							collectGarbage
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   444
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   445
	max tenure age     29                           lockTenure:
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   446
							avoidTenure:
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   447
							(sets it to infinity)
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   448
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   449
	adaptive tenure     -       -                   tenureParameters
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   450
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   451
	2pass oldSpace
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   452
	compressor      enabled     -Msingle            -
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   453
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   454
	limit for 1pass
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   455
	old-compress     8000k      -                   oldSpaceCompressLimit:
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   456
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   457
	chunk size
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   458
	to increase
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   459
	oldSpace          256k      -                   oldSpaceIncrement:
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   460
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   461
	prefer moreOld
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   462
	to doing GC      false      -                   fastMoreOldSpaceAllocation:
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   463
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   464
	limit for
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   465
	above                -      -                   fastMoreOldSpaceLimit:
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   466
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   467
	keep size for        -      -                   freeSpaceGCAmount:
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   468
	IGC
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   469
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   470
	low water
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   471
	trigger for IGC      -      -                   freeSpaceGCLimit:
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   472
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   473
	allocated
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   474
	trigger for IGC   500k      -                   incrementalGCLimit
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   475
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   476
	maximum time
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   477
	interval between
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   478
	IGC's                -      -                   BackgroundCollectMaximumInterval
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   479
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   480
	JIT codeCache
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   481
	size            unlimited   -                   dynamicCodeLimit:
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   482
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   483
	new JIT code
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   484
	trigger for IGC   none      -                   dynamicCodeGCTrigger:
3652
Claus Gittinger <cg@exept.de>
parents: 3649
diff changeset
   485
Claus Gittinger <cg@exept.de>
parents: 3649
diff changeset
   486
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   487
    By default, no incremental GC is started by the system; however,
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   488
    the standard startup script starts a low prio background incremental GC process.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   489
    You have to edit your startup files to change this.
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   490
    A suggested configuration (used by the author and the default) is:
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   491
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   492
	' keep 1meg in the pocket '
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   493
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   494
	ObjectMemory freeSpaceGCAmount:1000000.
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   495
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   496
	' start incrementalGC when freespace drops below 250k '
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   497
	' or 500k of oldSpace has been allocated              '
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   498
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   499
	ObjectMemory freeSpaceGCLimit:250000.                 '
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   500
	ObjectMemory incrementalGCLimit:500000.               '
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   501
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   502
	' collect as a background process (the default is: at idle times)
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   503
	' this means that running cubes or other demo processes are suspended
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   504
	' for the collect; change the prio to below 4 if you want them to continue
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   505
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   506
	ObjectMemory startBackgroundCollectorAt:5.            '
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   507
	ObjectMemory startBackgroundFinalizationAt:5.         '
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   508
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   509
	' quickly allocate more space (i.e. avoid blocking collects)
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   510
	' up to 8meg - then start to collect if more memory is needed.
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   511
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   512
	ObjectMemory fastMoreOldSpaceLimit:8*1024*1024.       '
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   513
	ObjectMemory fastMoreOldSpaceAllocation:true.         '
403
claus
parents: 384
diff changeset
   514
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   515
  hints & tricks:
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   516
213
3b56a17534fd *** empty log message ***
claus
parents: 211
diff changeset
   517
    normally, there is no need to call for an explicit garbage collection, or
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   518
    modify the default parameters.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   519
    The memory system should adapt reasonable and provide good performance
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   520
    for a wide range of allocation patterns (see Example3 below for an exception).
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   521
207
claus
parents: 202
diff changeset
   522
    However, there may be situations, in which hints and/or explicit
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   523
    control over allocation can speedup your programs; but please:
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   524
207
claus
parents: 202
diff changeset
   525
      - if you think you have to play around with the memory policies,
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   526
	first check your program - you may find useless allocations
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   527
	or bad uses of collections. A typical error that is made is to
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   528
	create large collections using the #, (comma) concatenation method,
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   529
	which shows square behavior, since it allocates many, many temporary
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   530
	collections. Also, watch out for #copyWith:, #add: etc.
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   531
	All of these create a new collection. Remember, that most collections
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   532
	offer methods to preallocate some space; for example, 'Set new:' creates
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   533
	an empty set, but preallocates space to avoid resizing over and over.
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   534
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   535
	An especially bad performace dog is to use #add: on fix-size collection
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   536
	objects (such as Strings or Arrays), since in addition to allocating
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   537
	lots of garbage, a #become: operation is required for EACH element
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   538
	added. NEVER use Arrays for growing/shrinking data - use OrderedCollection
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   539
	instead. (if you really need an array, use asArray afterwards)
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   540
207
claus
parents: 202
diff changeset
   541
      - if you are going to allocate huge data structures, think about
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   542
	optimizing space. For example, if you allocate a million instances of
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   543
	some object, each added instance variable makes up 4Mb of additional
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   544
	memory need.
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   545
	Also, for Byte-valued, Integer-valued and Float like objects, special
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   546
	collections are provided, which store their values directly inside (instead
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   547
	of a reference to the object). A FloatArray consisting of 1 million floats
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   548
	requires about 4mb of memory, while an Array of Floats requires 4mb for the
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   549
	references to the floats, PLUS 20Mb for the floats themself.
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   550
207
claus
parents: 202
diff changeset
   551
      - check if you really need fast access to all of these objects; you may
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   552
	try to only keep some subset in memory, and use binary storage or
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   553
	(if this is too slow) optimized store/retrieve methods and keep the bigger
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   554
	part in a file.
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   555
	(How about a DiskArray class, which does this transparently ?
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
   556
	 See the FileText class for some ideas and something to start with ...)
207
claus
parents: 202
diff changeset
   557
claus
parents: 202
diff changeset
   558
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   559
    Hint / Example 1:
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   560
      you are about to allocate a huge data structure, which is known to
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   561
      survive long. In this case, it is better to have these objects move into the
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   562
      oldspace sooner, to avoid the copying overhead during scavenges.
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   563
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   564
      To do this, you can call ObjectMemory>>tenure after allocation, which
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   565
      forces all new-objects immediately into the oldspace.
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   566
      Make certain, that not to many (ideally no) short-living objects are in the
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   567
      newspace when doing this.
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   568
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   569
      Another alternative is to tell the system that all allocation should be
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   570
      done directly in the oldspace. This completely avoids the scavenging overhead
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   571
      for these objects. To do so, use ObjectMemory>>turnGarbageCollectorOff
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   572
      before the allocation, and ObjectMemory>>turnGarbageCollectorOn afterwards.
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   573
      Keep in mind, that do-loops may allocate block-objects and other temporaries,
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   574
      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
   575
      in the oldspace afterwards. (which is not a fatal situation, but will
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   576
      force the system to do an oldspace collect earlier, which may not be your
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   577
      intention).
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   578
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   579
207
claus
parents: 202
diff changeset
   580
   Hint / Example 2:
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   581
      you know in advance, that a certain (big) amount of memory will be needed.
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   582
      For example, the fileBrowser wants to show a huge file in its text-view.
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
   583
      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
   584
      memory will be needed, since otherwise many compresses and reallocations will
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
   585
      occur (the memory system will allocate additional memory in chunks of smaller
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   586
      256k pieces, if a compress failes. Thus, if you are going to allocate (say) 1Mb of
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
   587
      strings, it will perform 5 compressing GC's).
433d44af1630 more GC control
claus
parents: 93
diff changeset
   588
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
   589
      This is done using ObjectMemory>>moreOldSpace: or ObjectMemory announceSpaceNeed:.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   590
      In the above example, you would do 'ObjectMemory announceSpaceNeed:500000', which
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
   591
      avoids those annoying 5 compressing GC's.
207
claus
parents: 202
diff changeset
   592
      BTW: if you have other smalltalk processes (threads) running which should not be
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   593
      paused if possible, it is better to use #announceSpaceNeed. This tries to avoid
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   594
      pausing in other processes and sometimes succeeds, while moreOldSpace will always
207
claus
parents: 202
diff changeset
   595
      block the whole system for a while. However, there is no 'no-pause' guarantee.
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
   596
433d44af1630 more GC control
claus
parents: 93
diff changeset
   597
      The amount of automatic increase (in case the oldSpace becomes full) is 256k by
433d44af1630 more GC control
claus
parents: 93
diff changeset
   598
      default. This number can be changed with ObjectMemory>>oldSpaceIncrement:.
433d44af1630 more GC control
claus
parents: 93
diff changeset
   599
207
claus
parents: 202
diff changeset
   600
claus
parents: 202
diff changeset
   601
    Hint / Example3:
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   602
      There are rare cases, when an explicit GC makes a difference: since
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   603
      object finalization is done at GC time, objects which keep operatingSystem
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   604
      resources may be finalized late. This is normally no problem, except if
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   605
      the system is running out of resources. For example, allocating new colors
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   606
      may fail if many colors have already been allocated in the past - even
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   607
      though these colors are actually free. The Depth8Image calls for an
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   608
      explicit GC, whenever it fails to allocate a color for a bitmap, to force
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   609
      finalization of free, but not yet finalized colors.
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   610
      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
   611
      correctly.
207
claus
parents: 202
diff changeset
   612
claus
parents: 202
diff changeset
   613
    Hint 4:
claus
parents: 202
diff changeset
   614
      If you run in too small of physical memory, the incremental GC may have a
claus
parents: 202
diff changeset
   615
      bad effect on your working set: since it touches pages (which may otherwise
claus
parents: 202
diff changeset
   616
      not be needed at the moment, the operating system is forced to steal other
claus
parents: 202
diff changeset
   617
      (possibly more useful) pages from your set of incore pages.
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   618
      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
   619
      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
   620
      the madvice system calls - other systems do not implement it.
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   621
      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
   622
      a program which sequentially scans its memory once in a single direction ...
207
claus
parents: 202
diff changeset
   623
      You may get better performance, if you turn off the incremental GC while
claus
parents: 202
diff changeset
   624
      processing a big data structure.
claus
parents: 202
diff changeset
   625
claus
parents: 202
diff changeset
   626
229
210ee6865aa3 commenting
claus
parents: 216
diff changeset
   627
    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
   628
    future versions of ST/X. Use them only in very special situations or experiments.
229
210ee6865aa3 commenting
claus
parents: 216
diff changeset
   629
207
claus
parents: 202
diff changeset
   630
    Let me know about additional special features you think are useful, and about
claus
parents: 202
diff changeset
   631
    special features you are using - this provides the feedback required to decide
403
claus
parents: 384
diff changeset
   632
    which methods are to be removed, kept or enhanced in future versions.
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   633
"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   634
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   635
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   636
interrupts
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
    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
   639
    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
   640
    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
   641
    (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
   642
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   643
    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
   644
    without any context switch, for high speed interrupt response.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   645
    However, if you do this, special care is needed, since it is not defined,
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   646
    which (smalltalk-)process gets the interrupt and will do the processing
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   647
    (therefore, the default setup installs handlers which simply signal a semaphore
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   648
     and continue the current process).
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   649
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   650
    Typically, the handlers are set during early initialization of the system
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   651
    by sending 'ObjectMemory XXXInterruptHandler:aHandler' and not changed later.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   652
    (see Smalltalk>>initialize or ProcessorScheduler>>initialize).
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   653
    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
   654
    and make it the handler using the above method.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   655
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   656
    Interrupt messages sent to handlers are:
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
   657
	internalError:<someString>      - internal interpreter/GC errors
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
   658
	userInterrupt                   - ^C interrupt
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
   659
	customInterrupt                 - custom interrupt
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
   660
	ioInterrupt                     - SIGIO interrupt
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
   661
	timerInterrupt                  - alarm timer (SIGALRM)
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
   662
	errorInterrupt:<id>             - errors from other primitives/subsystems
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
   663
					  (DisplayError)
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
   664
	spyInterrupt                    - spy timer interrupt (SIGVTALARM)
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
   665
	stepInterrupt                   - single step interrupt
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
   666
	disposeInterrupt                - finalization required
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
   667
	recursionInterrupt              - recursion (stack) overflow
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
   668
	memoryInterrupt                 - soon running out of memory
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
   669
	fpExceptionInterrupt            - floating point exception (SIGFPE)
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
   670
	childSignalInterrupt            - death of a child process (SIGCHILD)
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
   671
	signalInterrupt:<number>        - unix signal (if other than above signals)
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   672
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   673
    To avoid frustration in case of badly set handlers, these messages
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   674
    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
   675
    as interrupt handler. However, the VM will not send any
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   676
    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
   677
    (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
   678
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   679
    Interrupt processing is not done immediately after the event arrives:
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   680
    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
   681
    (message send, method return and loop-heads).
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   682
    If not explicitely enabled, primitive code is never interrupted.
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   683
    However, if you do enable interrupts in your primitive (see ExternalStream as example),
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   684
    be prepared for your objects to move around ... therefore, these have to
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   685
    be coded very carefully.
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   686
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   687
    Interrupts may be disabled completely (OperatingSystem blockInterrupts) and
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   688
    reenabled (unblockInterrupts) to allow for critical data to be manipulated.
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   689
    The above are low-level primitive entries - you better use #valueUninterruptably,
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   690
    which cares for unwinds, long returns and restores the blocking state.
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   691
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   692
    Every process has its own interrupt-enable state which is switched
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   693
    when processes switch control (i.e. you cannot block interrupts across
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   694
    a suspend, delay etc.).
1152
1de5488d7c80 commentary
Claus Gittinger <cg@exept.de>
parents: 1150
diff changeset
   695
    However, the state will be restored after a resume.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   696
"
2
claus
parents: 1
diff changeset
   697
! !
claus
parents: 1
diff changeset
   698
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
   699
!ObjectMemory class methodsFor:'initialization'!
2
claus
parents: 1
diff changeset
   700
claus
parents: 1
diff changeset
   701
initialize
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   702
    "initialize the class"
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
   703
17532
f71ff4160e94 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 17525
diff changeset
   704
    "/ protect against double initialization
2
claus
parents: 1
diff changeset
   705
    AllocationFailureSignal isNil ifTrue:[
20701
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   706
        AllocationFailureSignal := AllocationFailure.
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   707
        AllocationFailureSignal notifierString:'allocation failure'.
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   708
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   709
        MallocFailureSignal := MallocFailure.
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   710
        MallocFailureSignal notifierString:'(malloc) allocation failure'.
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   711
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   712
        LowSpaceSemaphore := Semaphore new name:'LowSpaceSemaphore'.
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   713
        FinalizerAccessLock := Semaphore forMutualExclusion.
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   714
        
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   715
        DisposeInterruptHandler := self.
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   716
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   717
        "/ BackgroundCollectMaximumInterval := 3600.     "/ run it at least once an hour
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   718
        BackgroundCollectMaximumInterval := nil.      "/ only run when space situation makes it feasable
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   719
        IncrementalGCLimit := 500000.                 "/ run it whenever 500k have been allocated
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   720
        FreeSpaceGCLimit := FreeSpaceGCAmount := nil. "/ no minumum-freeSpace trigger.
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   721
        MemoryInterruptHandler := self.
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   722
        ExceptionInterruptHandler := self.
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   723
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   724
        VMSelectors := #( #noByteCode #invalidCodeObject #invalidByteCode #invalidInstruction
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   725
                          #tooManyArguments #badLiteralTable #receiverNotBoolean: #typeCheckError
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   726
                          #integerCheckError #wrongNumberOfArguments: #privateMethodCalled
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   727
                          #doesNotUnderstand: #invalidReturn: #invalidReturnOrRestart:
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   728
                          #userInterrupt #internalError: #spyInterrupt #timerInterrupt #stepInterrupt
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   729
                          #errorInterrupt:with: #disposeInterrupt #recursionInterrupt
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   730
                          #memoryInterrupt #fpExceptionInterrupt #signalInterrupt: #childSignalInterrupt
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   731
                          #ioInterrupt #customInterrupt #schedulerInterrupt #contextInterrupt
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
   732
                          #interruptLatency:receiver:class:selector:vmActivity:id:).
17532
f71ff4160e94 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 17525
diff changeset
   733
    ]
1926
eda492a4e179 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
   734
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
   735
    "Modified: / 5.8.1998 / 15:30:12 / cg"
2
claus
parents: 1
diff changeset
   736
! !
claus
parents: 1
diff changeset
   737
7295
9ddb9543e369 category
Claus Gittinger <cg@exept.de>
parents: 7258
diff changeset
   738
!ObjectMemory class methodsFor:'Compatibility-ST80'!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   739
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   740
availableFreeBytes
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   741
    "return the amount of free memory
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   742
     (both in the compact free area and in the free lists)"
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   743
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   744
    ^ self freeSpace + self freeListSpace
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   745
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   746
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   747
     ObjectMemory availableFreeBytes
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   748
    "
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   749
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   750
    "Modified: 29.1.1997 / 23:43:05 / cg"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   751
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   752
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   753
bytesPerOOP
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   754
    "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
   755
     takes"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   756
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   757
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   758
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   759
    return __c__._RETURN(8);    // not really true
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   760
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
   761
    RETURN(__mkSmallInteger(sizeof(OBJ)));
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   762
#endif
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   763
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   764
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   765
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   766
     ObjectMemory bytesPerOOP
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   767
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   768
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   769
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   770
bytesPerOTE
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   771
    "return the number of overhead bytes of an object.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   772
     i.e. the number of bytes in every objects header."
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   773
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   774
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   775
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   776
    return __c__._RETURN(0);    // not really true
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   777
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
   778
    RETURN(__mkSmallInteger(OHDR_SIZE));
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   779
#endif
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   780
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   781
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   782
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   783
     ObjectMemory bytesPerOTE
615
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
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   786
9451
f9aa323a0c31 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9163
diff changeset
   787
collectGarbage
f9aa323a0c31 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9163
diff changeset
   788
    self garbageCollect
f9aa323a0c31 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9163
diff changeset
   789
f9aa323a0c31 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9163
diff changeset
   790
    "
f9aa323a0c31 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9163
diff changeset
   791
     ObjectMemory garbageCollect
f9aa323a0c31 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9163
diff changeset
   792
    "
f9aa323a0c31 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9163
diff changeset
   793
f9aa323a0c31 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9163
diff changeset
   794
    "Created: / 19-07-2006 / 09:11:37 / cg"
f9aa323a0c31 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9163
diff changeset
   795
!
f9aa323a0c31 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9163
diff changeset
   796
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   797
compactingGC
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   798
    "perform a compacting garbage collect"
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   799
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   800
    self garbageCollect
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   801
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   802
    "Modified: 29.1.1997 / 23:43:25 / cg"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   803
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   804
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   805
current
20422
94210802ce28 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20400
diff changeset
   806
    "the 'current' ObjectMemory - that's myself"
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   807
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   808
    ^ self
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   809
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   810
    "Modified: 29.1.1997 / 23:43:39 / cg"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   811
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   812
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   813
globalCompactingGC
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   814
    "perform a compacting garbage collect"
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   815
3605
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   816
    self reclaimSymbols.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   817
    self garbageCollect
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   818
3605
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   819
    "Modified: / 18.6.1998 / 15:00:52 / cg"
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   820
!
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   821
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   822
globalGarbageCollect
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   823
    "perform a compacting garbage collect"
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   824
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   825
    self reclaimSymbols.
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   826
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   827
    "Created: / 18.6.1998 / 15:00:05 / cg"
50d548f8de87 ST-80 compat: added #globalGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3277
diff changeset
   828
    "Modified: / 18.6.1998 / 15:00:47 / cg"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   829
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   830
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   831
growMemoryBy:numberOfBytes
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   832
    "allocate more memory"
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   833
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   834
    ^ self moreOldSpace:numberOfBytes
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   835
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   836
    "Modified: 29.1.1997 / 23:44:01 / cg"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   837
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   838
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   839
numOopsNumBytes
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   840
    "return an array filled with the number of objects
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   841
     and the number of used bytes."
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   842
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   843
    ^ Array with:(self numberOfObjects)
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
   844
	    with:(self bytesUsed)
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   845
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   846
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   847
     ObjectMemory numOopsNumBytes
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   848
    "
2320
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   849
a6f75a38159f comments
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   850
    "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
   851
!
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   852
8304
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
   853
verboseCompactingGC
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
   854
    "ST80 compatibility; same as verboseGarbageCollect"
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
   855
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
   856
    self verboseGarbageCollect
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
   857
!
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
   858
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
   859
verboseGlobalCompactingGC
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
   860
    "ST80 compatibility; same as verboseGarbageCollect"
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
   861
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
   862
    self verboseGarbageCollect
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
   863
!
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
   864
3057
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   865
versionId
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   866
    "return this systems version.
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   867
     For ST80 compatibility."
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   868
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   869
    ^ Smalltalk versionString
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   870
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   871
    "Created: / 27.10.1997 / 13:51:59 / cg"
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   872
    "Modified: / 28.10.1997 / 20:06:14 / cg"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   873
! !
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   874
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
   875
!ObjectMemory class methodsFor:'Signal constants'!
2
claus
parents: 1
diff changeset
   876
claus
parents: 1
diff changeset
   877
allocationFailureSignal
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   878
    "return the signal raised when an object allocation failed"
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   879
2
claus
parents: 1
diff changeset
   880
    ^ AllocationFailureSignal
464
83af924c8cff differenciate between object-allocation-failure and malloc-allocation-failure
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   881
!
83af924c8cff differenciate between object-allocation-failure and malloc-allocation-failure
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   882
83af924c8cff differenciate between object-allocation-failure and malloc-allocation-failure
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   883
mallocFailureSignal
83af924c8cff differenciate between object-allocation-failure and malloc-allocation-failure
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   884
    "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
   885
     (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
   886
      non-Object storage)"
83af924c8cff differenciate between object-allocation-failure and malloc-allocation-failure
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   887
83af924c8cff differenciate between object-allocation-failure and malloc-allocation-failure
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   888
    ^ MallocFailureSignal
2
claus
parents: 1
diff changeset
   889
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   890
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
   891
!ObjectMemory class methodsFor:'VM messages'!
375
claus
parents: 370
diff changeset
   892
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   893
debugPrinting
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   894
    "return true, if various debug printouts in the VM
375
claus
parents: 370
diff changeset
   895
     are turned on, false of off."
claus
parents: 370
diff changeset
   896
claus
parents: 370
diff changeset
   897
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   898
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   899
    return __c__._RETURN( STMain.DebugPrinting ? STObject.True : STObject.False);
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   900
#else
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
   901
    extern int __getDebugPrinting();
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
   902
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
   903
    RETURN (__getDebugPrinting() ? true : false);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   904
#endif
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   905
%}.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   906
    "
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   907
     ObjectMemory debugPrinting
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   908
    "
375
claus
parents: 370
diff changeset
   909
!
claus
parents: 370
diff changeset
   910
claus
parents: 370
diff changeset
   911
debugPrinting:aBoolean
claus
parents: 370
diff changeset
   912
    "turn on/off various debug printouts in the VM
claus
parents: 370
diff changeset
   913
     in case of an error. For example, a double-notUnderstood
claus
parents: 370
diff changeset
   914
     leads to a VM context dump if debugPrinting is on.
claus
parents: 370
diff changeset
   915
     If off, those messages are suppressed.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   916
     The default is on, since these messages are only printed for severe errors.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   917
     Returns the previous setting."
375
claus
parents: 370
diff changeset
   918
claus
parents: 370
diff changeset
   919
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   920
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   921
    {
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   922
	boolean prev = STMain.DebugPrinting;
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   923
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   924
	STMain.DebugPrinting = (aBoolean == STObject.True);
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   925
	return __c__._RETURN( prev ? STObject.True : STObject.False);
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   926
    }
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   927
    /* NOTREACHED */
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   928
#else
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   929
    extern int __setDebugPrinting();
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   930
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   931
    RETURN ( __setDebugPrinting( (aBoolean == true) ) ? true : false);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   932
#endif
375
claus
parents: 370
diff changeset
   933
%}
claus
parents: 370
diff changeset
   934
!
claus
parents: 370
diff changeset
   935
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   936
infoPrinting
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   937
    "return true, if various informational printouts in the VM
375
claus
parents: 370
diff changeset
   938
     are turned on, false of off."
claus
parents: 370
diff changeset
   939
claus
parents: 370
diff changeset
   940
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   941
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   942
    return __c__._RETURN( STMain.InfoPrinting ? STObject.True : STObject.False);
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   943
#else
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
   944
    extern int __getInfoPrinting();
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
   945
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
   946
    RETURN (__getInfoPrinting() ? true : false);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   947
#endif
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   948
%}
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   949
    "
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   950
     ObjectMemory infoPrinting
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   951
    "
615
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
infoPrinting:aBoolean
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   955
    "turn on/off various informational printouts in the VM.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   956
     For example, the GC activity messages are controlled by
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
   957
     this flags setting.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   958
     The default is true, since (currently) those messages are useful for ST/X developers.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   959
     Returns the previous setting."
615
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
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   962
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   963
    {
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   964
	boolean prev = STMain.InfoPrinting;
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   965
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   966
	STMain.InfoPrinting = (aBoolean == STObject.True);
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   967
	return __c__._RETURN( prev ? STObject.True : STObject.False);
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   968
    }
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   969
    /* NOTREACHED */
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   970
#else
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   971
    extern int __setInfoPrinting();
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   972
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   973
    RETURN ( __setInfoPrinting( (aBoolean == true) ) ? true : false);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   974
#endif
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   975
%}
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   976
!
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   977
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   978
initTrace:aBoolean
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   979
    "turn on/off various init-trace printouts in the VM.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   980
     The default is false.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   981
     Returns the previous setting."
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   982
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   983
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   984
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   985
    return __c__._RETURN_false();
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   986
#else
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   987
    extern int __setInitTrace();
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   988
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
   989
    RETURN ( __setInitTrace( (aBoolean == true) ) ? true : false);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
   990
#endif
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
15962
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
   994
!ObjectMemory class methodsFor:'VM unwind protect support'!
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
   995
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
   996
lookupMethodForSelectorUnwindHandlerFor: lookup
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
   997
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
   998
    "
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
   999
    An unwind handler for external method lookup
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1000
    (MOP). This method effectively called only
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1001
    from handler block returned by
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1002
    ObjectMemory>>unwindHandlerInContext:.
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1003
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1004
    The VM also create an artifical context with
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1005
    ObjectMemory as receiver and selector if this
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1006
    method as selector and marks it for unwind.
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1007
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1008
    See: ObjectMemory>>unwindHandlerInContext:
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1009
    "
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1010
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1011
    Processor activeProcess externalLookupPopIfEqual: lookup.
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1012
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1013
    "Created: / 06-10-2011 / 16:31:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1014
!
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1015
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1016
unwindHandlerInContext:aContext
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1017
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1018
    "
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1019
    Return an unwind handler block for given context.
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1020
    Selector of that context denotes which unwind handler
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1021
    to use.
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1022
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1023
    Occasionally, the VM needs to unwind-protect some C code.
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1024
    If so, it creates and artificial context on the stack and
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1025
    marks it for unwind, so stack unwinding logic finds it
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1026
    and handles it.
15962
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1027
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1028
    Now, only #lookupMethodForSelectorUnwindProtect is supported
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1029
    (ensures the lookup is popped out from the lookupActications)
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1030
    "
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1031
    aContext selector == #lookupMethodForSelectorUnwindHandlerFor: ifTrue:[
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1032
	^[self lookupMethodForSelectorUnwindHandlerFor: (aContext argAt: 1)]
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1033
    ].
15962
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1034
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1035
    self internalError:'Unknown VM unwind protect action'
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1036
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1037
    "Created: / 01-10-2011 / 19:15:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1038
! !
5ff4752179f0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 15643
diff changeset
  1039
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  1040
!ObjectMemory class methodsFor:'access debugging'!
703
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1041
14699
a80577551b86 allow privacyChecks to be disabled at runtime
Claus Gittinger <cg@exept.de>
parents: 14649
diff changeset
  1042
debugPrivacyChecks:aBoolean
a80577551b86 allow privacyChecks to be disabled at runtime
Claus Gittinger <cg@exept.de>
parents: 14649
diff changeset
  1043
    "turn on/off checks for private methods being called.
a80577551b86 allow privacyChecks to be disabled at runtime
Claus Gittinger <cg@exept.de>
parents: 14649
diff changeset
  1044
     By default, this is on in the ST/X IDE, but off for standAlone (packaged) endUser
a80577551b86 allow privacyChecks to be disabled at runtime
Claus Gittinger <cg@exept.de>
parents: 14649
diff changeset
  1045
     applications. Method privacy is an experimental feature, which may be removed in later
a80577551b86 allow privacyChecks to be disabled at runtime
Claus Gittinger <cg@exept.de>
parents: 14649
diff changeset
  1046
     versions, if it turns out to be not useful."
a80577551b86 allow privacyChecks to be disabled at runtime
Claus Gittinger <cg@exept.de>
parents: 14649
diff changeset
  1047
a80577551b86 allow privacyChecks to be disabled at runtime
Claus Gittinger <cg@exept.de>
parents: 14649
diff changeset
  1048
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1049
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1050
    return __c__._RETURN_false();
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1051
#else
14699
a80577551b86 allow privacyChecks to be disabled at runtime
Claus Gittinger <cg@exept.de>
parents: 14649
diff changeset
  1052
    extern int __setPrivacyChecks__();
a80577551b86 allow privacyChecks to be disabled at runtime
Claus Gittinger <cg@exept.de>
parents: 14649
diff changeset
  1053
a80577551b86 allow privacyChecks to be disabled at runtime
Claus Gittinger <cg@exept.de>
parents: 14649
diff changeset
  1054
    RETURN ( __setPrivacyChecks__( (aBoolean == true) ) ? true : false);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1055
#endif
14699
a80577551b86 allow privacyChecks to be disabled at runtime
Claus Gittinger <cg@exept.de>
parents: 14649
diff changeset
  1056
%}
a80577551b86 allow privacyChecks to be disabled at runtime
Claus Gittinger <cg@exept.de>
parents: 14649
diff changeset
  1057
!
a80577551b86 allow privacyChecks to be disabled at runtime
Claus Gittinger <cg@exept.de>
parents: 14649
diff changeset
  1058
703
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1059
setTrapOnAccessFor:anObject
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1060
    "install an access trap for anObject;
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1061
     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
  1062
     This is not supported on all architectures, therefore the return value
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1063
     (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
  1064
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1065
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1066
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1067
    return __c__._RETURN_false();
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1068
#else
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
  1069
    RETURN (__addTrapOnAccess(anObject, 2) ? true : false);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1070
#endif
703
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1071
%}
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1072
!
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1073
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1074
setTrapOnReadFor:anObject
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1075
    "install a read trap for anObject;
20273
d64872bc1ce8 #DOCUMENTATION by mawalch
mawalch
parents: 20264
diff changeset
  1076
     An accessSignal will be raised, whenever any access into anObject occurs.
703
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1077
     This is not supported on all architectures, therefore the return value
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1078
     (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
  1079
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1080
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1081
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1082
    return __c__._RETURN_false();
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1083
#else
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
  1084
    RETURN (__addTrapOnAccess(anObject, 0) ? true : false);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1085
#endif
703
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1086
%}
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1087
!
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1088
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1089
setTrapOnWriteFor:anObject
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1090
    "install a write trap for anObject;
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1091
     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
  1092
     This is not supported on all architectures, therefore the return value
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1093
     (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
  1094
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1095
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1096
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1097
    return __c__._RETURN_false();
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1098
#else
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
  1099
    RETURN (__addTrapOnAccess(anObject, 1) ? true : false);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1100
#endif
703
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1101
%}
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1102
!
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1103
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1104
unsetAllTraps
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1105
    "remove all access traps"
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1106
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1107
%{  /* NOCONTEXT */
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
  1108
    __removeAllAccessTraps();
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1109
%}
703
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1110
!
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1111
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1112
unsetTrapFor:anObject
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1113
    "remove any access trap for anObject."
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1114
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1115
%{  /* NOCONTEXT */
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 827
diff changeset
  1116
    __removeTrapOnAccess(anObject);
703
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1117
%}
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1118
! !
2d4202542a59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 683
diff changeset
  1119
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  1120
!ObjectMemory class methodsFor:'cache management'!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1121
19283
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
  1122
debugBreakPoint
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
  1123
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
  1124
%{
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
  1125
    extern void __debugBreakPoint__();
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
  1126
    __debugBreakPoint__();
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
  1127
%}.
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
  1128
    ^ 0
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
  1129
!
501cf9f6c030 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18875
diff changeset
  1130
13421
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  1131
debugBreakPoint3
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  1132
13421
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  1133
%{
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  1134
#ifndef __win32__
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1135
    /*extern void __debugBreakPoint3__();*/
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1136
    __debugBreakPoint3__();
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  1137
#endif
13421
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  1138
%}.
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1139
    ^ 0
13421
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  1140
!
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  1141
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1142
flushCaches
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1143
    "flush method and inline caches for all classes"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1144
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1145
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1146
    __flushMethodCache();
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1147
    __flushAllInlineCaches();
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1148
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1149
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1150
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1151
flushCachesFor:aClass
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1152
    "flush method and inline caches for aClass"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1153
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1154
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1155
    __flushMethodCacheFor(aClass);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1156
    __flushInlineCachesFor(aClass);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1157
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1158
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1159
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1160
flushCachesForSelector:aSelector
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1161
    "flush method and inline caches for aSelector"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1162
8527
3605e14cbcca cache flushing
Claus Gittinger <cg@exept.de>
parents: 8455
diff changeset
  1163
    self flushMethodCacheForSelector:aSelector.
3605e14cbcca cache flushing
Claus Gittinger <cg@exept.de>
parents: 8455
diff changeset
  1164
3605e14cbcca cache flushing
Claus Gittinger <cg@exept.de>
parents: 8455
diff changeset
  1165
    "/ self flushInlineCachesForSelector:aSelector.
3605e14cbcca cache flushing
Claus Gittinger <cg@exept.de>
parents: 8455
diff changeset
  1166
    self flushInlineCachesWithArgs:(aSelector numArgs).
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1167
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1168
17525
6d632c4b12d0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16832
diff changeset
  1169
flushCachesForSelector:aSelector numArgs:numArgs
6d632c4b12d0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16832
diff changeset
  1170
    "flush method and inline caches for aSelector"
6d632c4b12d0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16832
diff changeset
  1171
6d632c4b12d0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16832
diff changeset
  1172
    self flushMethodCacheForSelector:aSelector.
6d632c4b12d0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16832
diff changeset
  1173
6d632c4b12d0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16832
diff changeset
  1174
    "/ self flushInlineCachesForSelector:aSelector.
6d632c4b12d0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16832
diff changeset
  1175
    self flushInlineCachesWithArgs:numArgs.
6d632c4b12d0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16832
diff changeset
  1176
!
6d632c4b12d0 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16832
diff changeset
  1177
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1178
flushInlineCaches
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1179
    "flush all inlinecaches"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1180
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1181
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1182
    __flushAllInlineCaches();
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1183
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1184
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1185
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1186
flushInlineCachesFor:aClass withArgs:nargs
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1187
    "flush inlinecaches for calls to aClass with nargs arguments"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1188
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1189
%{  /* NOCONTEXT */
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  1190
    __flushInlineCachesForAndNargs(aClass, __intVal(nargs));
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1191
%}
8528
bea11c185490 cache flushing
Claus Gittinger <cg@exept.de>
parents: 8527
diff changeset
  1192
!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1193
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1194
flushInlineCachesForClass:aClass
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1195
    "flush inlinecaches for calls to aClass."
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1196
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1197
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1198
    __flushInlineCachesFor(aClass);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1199
%}
8528
bea11c185490 cache flushing
Claus Gittinger <cg@exept.de>
parents: 8527
diff changeset
  1200
!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1201
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1202
flushInlineCachesForSelector:aSelector
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1203
    "flush inlinecaches for sends of aSelector"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1204
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1205
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1206
    __flushInlineCachesForSelector(aSelector);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1207
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1208
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1209
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1210
flushInlineCachesWithArgs:nargs
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1211
    "flush inlinecaches for calls with nargs arguments"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1212
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1213
%{  /* NOCONTEXT */
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  1214
    __flushInlineCaches(__intVal(nargs));
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1215
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1216
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1217
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1218
flushMethodCache
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1219
    "flush the method cache"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1220
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1221
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1222
    __flushMethodCache();
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1223
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1224
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1225
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1226
flushMethodCacheFor:aClass
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1227
    "flush the method cache for sends to aClass"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1228
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1229
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1230
    __flushMethodCacheFor(aClass);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1231
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1232
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1233
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1234
flushMethodCacheForSelector:aSelector
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1235
    "flush the method cache for sends of aSelector"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1236
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1237
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1238
    __flushMethodCacheForSelector(aSelector);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1239
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1240
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1241
13421
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  1242
ilcMisses: newValue
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1243
    newValue class == SmallInteger ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1244
	^ self error:'Not an integer value'
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1245
    ].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1246
13421
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  1247
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1248
    /*extern int __ilcMisses(int);*/
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  1249
#ifdef ILC_PROFILING
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1250
    RETURN ( __MKSMALLINT ( __ilcMisses ( __intVal ( newValue ) ) ) );
13421
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  1251
#endif
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  1252
%}.
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1253
    ^ -1
13421
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  1254
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  1255
!
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  1256
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  1257
ilcMissesTrace: bool
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  1258
13421
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  1259
%{
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1260
    /*extern int __ilcMissesTrace(int);*/
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  1261
#ifdef ILC_PROFILING
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1262
    RETURN ( __ilcMissesTrace ( bool == true ) ? true : false );
13421
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  1263
#endif
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  1264
%}.
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1265
    ^ 0
13421
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  1266
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  1267
!
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  1268
1108
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1269
incrementSnapshotID
2526
d600b7b0c13e comments
Claus Gittinger <cg@exept.de>
parents: 2525
diff changeset
  1270
    "obsolete - do not use"
d600b7b0c13e comments
Claus Gittinger <cg@exept.de>
parents: 2525
diff changeset
  1271
1108
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1272
%{  /* NOCONTEXT */
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1273
    __bumpSnapshotID();
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1274
%}
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1275
!
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1276
876
2fb0b80d8731 added entries to manipulate snapshotIDs
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1277
snapshotID
918
05c16023099c commentary
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
  1278
    "return the internal snapshotID number.
05c16023099c commentary
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
  1279
     This is incremented when an image is restarted, and
05c16023099c commentary
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
  1280
     stored with the image.
05c16023099c commentary
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
  1281
     Not for normal users, this is used by the VM to invalidate
05c16023099c commentary
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
  1282
     caches which are stored with the image"
05c16023099c commentary
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
  1283
876
2fb0b80d8731 added entries to manipulate snapshotIDs
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1284
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1285
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1286
    return __c__._RETURN(0);
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1287
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  1288
    RETURN ( __mkSmallInteger( __snapshotID() ));
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1289
#endif
876
2fb0b80d8731 added entries to manipulate snapshotIDs
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1290
%}
918
05c16023099c commentary
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
  1291
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1292
     ObjectMemory snapshotID
918
05c16023099c commentary
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
  1293
    "
876
2fb0b80d8731 added entries to manipulate snapshotIDs
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1294
!
2fb0b80d8731 added entries to manipulate snapshotIDs
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1295
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1296
trapRestrictedMethods:trap
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1297
    "Allow/Deny execution of restricted Methods (see Method>>>restricted:)
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1298
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1299
     Notice: method restriction is a nonstandard feature, not supported
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1300
     by other smalltalk implementations and not specified in the ANSI spec.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1301
     This is EXPERIMENTAL - and being evaluated for usability.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1302
     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
  1303
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1304
    |oldTrap|
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1305
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1306
%{
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1307
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1308
    return __c__._RETURN_false();
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1309
#else
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1310
    if (__setTrapRestrictedMethods(trap == true))
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1311
	oldTrap = true;
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1312
    else
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1313
	oldTrap = false;
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1314
#endif
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1315
%}.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1316
    (trap and:[oldTrap not]) ifTrue:[
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1317
	self flushCaches
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1318
    ].
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1319
    ^ oldTrap
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1320
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1321
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1322
	ObjectMemory trapRestrictedMethods:true
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1323
	ObjectMemory trapRestrictedMethods:false
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1324
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1325
! !
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1326
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  1327
!ObjectMemory class methodsFor:'debug queries'!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1328
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1329
addressOf:anObject
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1330
    "return the core address of anObject as an integer
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1331
     - 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
  1332
     next scavenge/collect.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1333
     WARNING: this method is for ST/X debugging only
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1334
	      it will be removed without notice"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1335
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1336
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1337
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1338
    return __c__._RETURN(0);
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1339
#else
5783
061587b57d05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5734
diff changeset
  1340
    if (anObject != nil) {
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1341
	if (! __isNonNilObject(anObject)) {
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1342
	    RETURN ( nil );
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1343
	}
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1344
    }
2783
172c91b94aff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2769
diff changeset
  1345
    if ((unsigned INT)anObject <= _MAX_INT) {
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1346
	RETURN ( __mkSmallInteger((INT)anObject) );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1347
    }
2769
2fd416e4b589 alpha64 changes
Claus Gittinger <cg@exept.de>
parents: 2638
diff changeset
  1348
    RETURN ( __MKUINT((INT)anObject) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1349
#endif
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1350
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1351
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1352
    |p|
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1353
    p := Point new.
8556
96a185c5058d Use #referencesObject instead of #references:
Stefan Vogel <sv@exept.de>
parents: 8543
diff changeset
  1354
    ((ObjectMemory addressOf:p) printStringRadix:16) printCR.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1355
    ObjectMemory scavenge.
8556
96a185c5058d Use #referencesObject instead of #references:
Stefan Vogel <sv@exept.de>
parents: 8543
diff changeset
  1356
    ((ObjectMemory addressOf:p) printStringRadix:16) printCR.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1357
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1358
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1359
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1360
ageOf:anObject
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1361
    "return the number of scavenges, an object has survived
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1362
     in new space.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1363
     For old objects and living contexts, the returned number is invalid.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1364
     WARNING: this method is for ST/X debugging only
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1365
	      it will be removed without notice"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1366
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1367
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1368
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1369
    return __c__._RETURN(0);
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1370
#else
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1371
    if (! __isNonNilObject(anObject)) {
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1372
	RETURN ( 0 );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1373
    }
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  1374
    RETURN ( __mkSmallInteger( __GET_AGE(anObject) ) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1375
#endif
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1376
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1377
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1378
    |p|
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1379
    p := Point new.
8556
96a185c5058d Use #referencesObject instead of #references:
Stefan Vogel <sv@exept.de>
parents: 8543
diff changeset
  1380
    (ObjectMemory ageOf:p) printCR.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1381
    ObjectMemory tenuringScavenge.
8556
96a185c5058d Use #referencesObject instead of #references:
Stefan Vogel <sv@exept.de>
parents: 8543
diff changeset
  1382
    (ObjectMemory spaceOf:p) printCR.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1383
    ObjectMemory tenuringScavenge.
8556
96a185c5058d Use #referencesObject instead of #references:
Stefan Vogel <sv@exept.de>
parents: 8543
diff changeset
  1384
    (ObjectMemory spaceOf:p) printCR.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1385
    ObjectMemory tenuringScavenge.
8556
96a185c5058d Use #referencesObject instead of #references:
Stefan Vogel <sv@exept.de>
parents: 8543
diff changeset
  1386
    (ObjectMemory spaceOf:p) printCR.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1387
    ObjectMemory tenuringScavenge.
8556
96a185c5058d Use #referencesObject instead of #references:
Stefan Vogel <sv@exept.de>
parents: 8543
diff changeset
  1388
    (ObjectMemory spaceOf:p) printCR.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1389
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1390
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1391
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1392
displayRefChainTo:anObject
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1393
    self displayRefChainToAny:(Array with:anObject).
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1394
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1395
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1396
      self displayRefChainTo:Point new
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1397
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1398
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1399
      Smalltalk at:#foo put:Point new.
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1400
      self displayRefChainTo:(Smalltalk at:#foo)
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1401
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1402
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1403
      |p|
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1404
      p := Point new.
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1405
      Smalltalk at:#foo put:(#x -> p).
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1406
      self displayRefChainTo:p
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1407
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1408
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1409
      |a|
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1410
      a := Array new:1. a at:1 put:a.
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1411
      Smalltalk at:#foo put:(#x -> a).
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1412
      self displayRefChainTo:a
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1413
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1414
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1415
      |a|
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1416
      a := Array new:1. a at:1 put:a.
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1417
      Smalltalk at:#foo put:(#x -> (Array with:a)).
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1418
      self displayRefChainTo:a
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1419
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1420
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1421
      |a|
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1422
      a := Array new:1. a at:1 put:a.
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1423
      Smalltalk at:#foo put:(#x -> (Array with:a with:(#y -> a))).
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1424
      self displayRefChainTo:a
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1425
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1426
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1427
      |p|
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1428
      p := Point new.
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1429
      Smalltalk at:#foo put:(WeakArray with:(#x -> (#y -> p))).
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1430
      self displayRefChainTo:p
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1431
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1432
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1433
      self displayRefChainTo:Transcript topView
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1434
     "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1435
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1436
    "Created: / 2.2.1998 / 19:23:55 / cg"
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1437
    "Modified: / 3.2.1998 / 00:30:14 / cg"
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1438
!
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1439
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1440
displayRefChainToAny:aCollection
10855
21b25cfec73d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10833
diff changeset
  1441
    self displayRefChainToAny:aCollection limitNumberOfSearchedReferences:nil
21b25cfec73d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10833
diff changeset
  1442
!
21b25cfec73d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10833
diff changeset
  1443
21b25cfec73d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10833
diff changeset
  1444
displayRefChainToAny:aCollection limitNumberOfSearchedReferences:limitOrNil
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1445
    |levels objects done showMore stop userStop chain
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1446
     top progress lbl h nDone nAll panel listV
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1447
     moreButton owners objectArray numObjects numObjectsDone
4739
4edaff2107ea Remove unused method vars
Stefan Vogel <sv@exept.de>
parents: 4736
diff changeset
  1448
     found moreChainsOnThisLevel temporaryRemoved chains
3643
d2625b6d95b3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3642
diff changeset
  1449
     anyShown anyShownInAnyLevel list tLevels firstRound|
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1450
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1451
    top := StandardSystemView new.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1452
    top extent:350@250.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1453
    top label:'Object reference finder'.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1454
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1455
    lbl := Label label:'compressing garbage ...' in:top.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1456
    lbl adjust:#left.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1457
    lbl origin:(0.0@0.0) corner:(1.0@0.0).
11030
d23ae30a947a added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 10921
diff changeset
  1458
    h := lbl preferredHeight.
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1459
    lbl
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1460
	topInset:5;
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1461
	bottomInset:(h+5) negated;
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1462
	leftInset:5;
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1463
	rightInset:5.
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1464
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1465
    progress := ProgressIndicator in:top.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1466
    progress origin:(0.0@45) corner:(1.0@45).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1467
    progress level:-1.
11030
d23ae30a947a added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 10921
diff changeset
  1468
    h := progress preferredHeight.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1469
    progress
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1470
	topInset:(h // 2) negated;
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1471
	bottomInset:(h // 2) negated;
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1472
	leftInset:5;
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1473
	rightInset:5.
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1474
    progress beInvisible.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1475
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1476
    listV := HVScrollableView for:SelectionInListView in:top.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1477
    listV origin:(0.0@55) corner:(1.0@1.0).
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1478
    listV
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1479
	topInset:(h // 2);
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1480
	bottomInset:40;
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1481
	leftInset:5;
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1482
	rightInset:5.
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1483
    listV beInvisible.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1484
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1485
    panel := HorizontalPanelView in:top.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1486
    panel origin:(0.0@1.0) corner:(1.0@1.0).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1487
    panel topInset:-40.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1488
    panel horizontalLayout:#left.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1489
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1490
    panel add:(Button label:'stop' action:[stop := userStop := true]).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1491
    panel add:(moreButton := Button label:'more' action:[showMore := true]).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1492
    panel ignoreInvisibleComponents:false.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1493
    moreButton beInvisible.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1494
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1495
    top openWithPriority:(Processor activePriority + 1).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1496
    top waitUntilVisible.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1497
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1498
    lbl label:'compressing garbage ...'.
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1499
    self compressingGarbageCollect.
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1500
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1501
    progress beVisible.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1502
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1503
    levels := OrderedCollection new.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1504
    objects := WeakIdentitySet withAll:aCollection.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1505
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1506
    done := (objects includesIdentical:Smalltalk).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1507
    stop := userStop := false.
3643
d2625b6d95b3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3642
diff changeset
  1508
    anyShown := anyShownInAnyLevel := false.
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1509
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1510
    "/ consider this a kludge:
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1511
    "/ 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
  1512
    "/ only known to the VM.
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1513
    "/ 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
  1514
    "/ These are released later.
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1515
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1516
    Smalltalk at:#'__VMProcesses__' put:(self processesKnownInVM).
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1517
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1518
    firstRound := true.
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1519
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1520
    [done] whileFalse:[
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1521
	anyShown := false.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1522
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1523
	progress percentage:0.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1524
	firstRound ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1525
	    firstRound := false.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1526
	] ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1527
	    lbl label:'compressing garbage ...'.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1528
	    self garbageCollect.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1529
	].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1530
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1531
	lbl label:('searching level '
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1532
		   , levels size printString
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1533
		   , ' (' , objects size printString , ' refs) ...').
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1534
	nAll := objects size.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1535
	nDone := 0.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1536
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1537
	objectArray := objects asArray.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1538
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1539
	owners := "Weak"IdentitySet new.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1540
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1541
	numObjectsDone := 0.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1542
	found := false.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1543
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1544
	AbortOperationRequest catch:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1545
	    self allObjectsIncludingContextsDo:[:o |
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1546
		|inPrevLevel isOwner|
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1547
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1548
		stop ifTrue:[AbortOperationRequest raise].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1549
		stop ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1550
		    isOwner := false.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1551
		    (o referencesAny:objectArray) ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1552
			o isBehavior ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1553
			    o == Smalltalk ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1554
				found := true.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1555
			    ] ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1556
				"/ only add it if it has classInstVars
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1557
				o instSize ~~ Class instSize ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1558
				    isOwner := true.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1559
				]
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1560
			    ]
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1561
			] ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1562
			    o class ~~ WeakArray ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1563
				isOwner := true.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1564
			    ]
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1565
			].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1566
		    ].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1567
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1568
		    isOwner ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1569
			(objects includesIdentical:o) ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1570
			    inPrevLevel := false.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1571
			    levels do:[:lColl |
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1572
				lColl == o ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1573
				    inPrevLevel := true
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1574
				] ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1575
				    (lColl includesIdentical:o) ifTrue:[inPrevLevel := true].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1576
				]
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1577
			    ].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1578
			    inPrevLevel ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1579
				owners add:o.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1580
				(limitOrNil notNil and:[owners size >= limitOrNil]) ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1581
				    AbortOperationRequest raise
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1582
				].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1583
			    ]
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1584
			]
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1585
		    ].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1586
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1587
		    numObjectsDone := numObjectsDone + 1.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1588
		    numObjects notNil ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1589
			numObjectsDone \\ 1000 == 0 ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1590
			    progress percentage:(numObjectsDone / numObjects * 100).
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1591
			    Processor yield.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1592
			]
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1593
		    ]
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1594
		]
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1595
	    ].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1596
	].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1597
	progress percentage:100.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1598
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1599
	numObjects isNil ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1600
	    numObjects := numObjectsDone.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1601
	].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1602
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1603
	owners remove:aCollection ifAbsent:nil.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1604
	owners remove:thisContext ifAbsent:nil.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1605
	owners remove:objectArray ifAbsent:nil.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1606
	owners remove:objects keyArray ifAbsent:nil.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1607
	owners remove:owners keyArray ifAbsent:nil.
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1608
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1609
"/ '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
  1610
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1611
	owners isEmpty ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1612
	    found ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1613
		stop := true.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1614
	    ]
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1615
	].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1616
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1617
	stop ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1618
	    done := found or:[(owners includesIdentical:Smalltalk)].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1619
	    done ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1620
		moreChainsOnThisLevel := true.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1621
		temporaryRemoved := IdentitySet new.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1622
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1623
		levels size > 0 ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1624
		    "/ show what we found so far.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1625
		    levels last add:Smalltalk.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1626
		    levels reverse.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1627
		].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1628
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1629
		chains := OrderedCollection new.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1630
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1631
		tLevels := levels collect:[:lColl | lColl copy].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1632
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1633
		lbl label:('building refchains ...').
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1634
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1635
		nAll := aCollection size.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1636
		nDone := 0.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1637
		aCollection do:[:anObject | |theseChains|
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1638
		    stop ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1639
			theseChains := self
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1640
				refChainsFrom:Smalltalk
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1641
				to:anObject
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1642
				inRefSets:tLevels
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1643
				startingAt:1.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1644
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1645
			theseChains size > 0 ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1646
			    chains addAll:theseChains
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1647
			].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1648
			nDone := nDone + 1.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1649
			progress percentage:(nDone / nAll * 100).
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1650
		    ]
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1651
		].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1652
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1653
		tLevels := nil.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1654
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1655
		levels size > 0 ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1656
		    levels reverse.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1657
		    levels last remove:Smalltalk.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1658
		].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1659
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1660
		[stop not
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1661
		 and:[chains size > 0]] whileTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1662
		    chain := chains first.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1663
		    chains removeFirst.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1664
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1665
		    lbl label:('found a reference chain.').
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1666
		    progress beInvisible.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1667
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1668
		    chain addFirst:Smalltalk.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1669
		    list := OrderedCollection newWithSize:chain size.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1670
		    1 to:chain size-1 do:[:i |
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1671
			list
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1672
			    at:i
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1673
			    put:(self refNameFor:(chain at:i+1) in:(chain at:i))
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1674
		    ].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1675
		    list at:list size put:(chain last classNameWithArticle).
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1676
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1677
		    "/ hide the VMProcesses stuff from the user ...
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1678
		    (list at:1) string = 'Smalltalk:__VMProcesses__' ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1679
			list at:1 put:'__VMProcesses__ (a hidden VM reference)'.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1680
			list removeIndex:2.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1681
			chain at:1 put:nil.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1682
			chain removeIndex:2.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1683
		    ].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1684
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1685
		    listV list:list.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1686
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1687
		    listV beVisible.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1688
		    listV doubleClickAction:[:idx | |o|
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1689
						(o := chain at:idx) notNil ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1690
						    o inspect.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1691
						]
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1692
					    ].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1693
		    moreButton beVisible.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1694
		    anyShown := anyShownInAnyLevel := true.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1695
		    showMore := false.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1696
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1697
		    "/ kludge - wait for some user action
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1698
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1699
		    [showMore or:[stop or:[top realized not]]] whileFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1700
			Delay waitForSeconds:0.1
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1701
		    ].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1702
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1703
		    chain := nil.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1704
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1705
		    top realized ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1706
			stop := true
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1707
		    ] ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1708
			listV doubleClickAction:nil.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1709
			showMore ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1710
			    stop := true.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1711
			].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1712
		    ].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1713
		    done := false.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1714
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1715
		    stop ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1716
			progress beVisible.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1717
			listV beInvisible.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1718
			moreButton beInvisible.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1719
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1720
			chain := nil.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1721
		    ]
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1722
		].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1723
		levels size > 0 ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1724
		    levels last addAll:temporaryRemoved.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1725
		]
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1726
	    ].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1727
	].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1728
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1729
	owners remove:Smalltalk ifAbsent:nil.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1730
	owners remove:(owners keyArray) ifAbsent:nil.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1731
	owners remove:objectArray ifAbsent:nil.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1732
	levels do:[:lColl |
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1733
	    owners remove:lColl ifAbsent:nil
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1734
	].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1735
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1736
	levels add:owners.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1737
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1738
	objects := owners.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1739
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1740
	objects size == 0 ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1741
	    stop := true
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1742
	].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1743
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1744
	stop ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1745
	    Smalltalk at:#'__VMProcesses__' put:nil.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1746
	    top destroy.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1747
	    anyShown ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1748
		userStop ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1749
		    self information:(anyShownInAnyLevel ifTrue:['no more references'] ifFalse:['no references']).
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1750
		]
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1751
	    ].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1752
	   ^ self.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1753
	].
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1754
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1755
    ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1756
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1757
    anyShown ifTrue:[
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1758
	userStop ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1759
	    self information:'no more references'.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1760
	]
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1761
    ].
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  1762
    Smalltalk at:#'__VMProcesses__' put:nil.
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1763
    ^ self
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1764
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1765
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1766
      self displayRefChainTo:Point new
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1767
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1768
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1769
      Smalltalk at:#foo put:Point new.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1770
      self displayRefChainTo:(Smalltalk at:#foo)
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1771
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1772
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1773
      |p|
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1774
      p := Point new.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1775
      Smalltalk at:#foo put:(#x -> p).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1776
      self displayRefChainTo:p
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1777
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1778
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1779
      |a|
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1780
      a := Array new:1. a at:1 put:a.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1781
      Smalltalk at:#foo put:(#x -> a).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1782
      Smalltalk at:#bar put:(Array with:(#y -> a)).
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1783
      self displayRefChainTo:a
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1784
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1785
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1786
      |a|
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1787
      a := Array new:1. a at:1 put:a.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1788
      Smalltalk at:#foo put:(#x -> (Array with:a)).
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1789
      self displayRefChainTo:a
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1790
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1791
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1792
      |a|
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1793
      a := Array new:1. a at:1 put:a.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1794
      Smalltalk at:#foo put:(#x -> (Array with:a with:(#y -> a))).
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1795
      self displayRefChainTo:a
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1796
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1797
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1798
      |p|
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1799
      p := Point new.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1800
      Smalltalk at:#foo put:(WeakArray with:(#x -> (#y -> p))).
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1801
      self displayRefChainTo:p
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1802
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1803
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1804
      self displayRefChainTo:Transcript topView
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1805
     "
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1806
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1807
    "Created: / 2.2.1998 / 23:58:04 / cg"
3643
d2625b6d95b3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3642
diff changeset
  1808
    "Modified: / 10.7.1998 / 17:22:06 / cg"
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1809
!
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1810
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1811
dumpObject:someObject
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1812
    "low level dump an object.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1813
     WARNING: this method is for ST/X debugging only
794
d713b6c04379 more __xx__ renames (dumpObject)
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1814
	      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
  1815
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1816
%{
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1817
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1818
    someObject.dumpObject();
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1819
#else
14068
46a8289bf92a pass linenr to dumpObject
Claus Gittinger <cg@exept.de>
parents: 13946
diff changeset
  1820
    __dumpObject__(someObject, __LINE__);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1821
#endif
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1822
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1823
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1824
     ObjectMemory dumpObject:true
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1825
     ObjectMemory dumpObject:(Array new:10)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1826
     ObjectMemory dumpObject:(10@20 corner:30@40)
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1827
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1828
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1829
7326
ce7d54205527 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1830
dumpSender
ce7d54205527 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1831
    "dump my senders context"
ce7d54205527 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1832
ce7d54205527 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1833
%{
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1834
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1835
    __c__.currentContinuation.dumpObject();
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1836
#else
7326
ce7d54205527 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1837
    __PATCHUPCONTEXT(__thisContext);
ce7d54205527 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1838
    __dumpContext__(__ContextInstPtr(__thisContext)->c_sender);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1839
#endif
7326
ce7d54205527 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1840
%}
ce7d54205527 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1841
    "
ce7d54205527 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1842
     ObjectMemory dumpSender
ce7d54205527 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1843
    "
ce7d54205527 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1844
!
ce7d54205527 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1845
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1846
flagsOf:anObject
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1847
    "For debugging only.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1848
     WARNING: this method is for ST/X debugging only
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1849
	      it will be removed without notice"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1850
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1851
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1852
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1853
    return __c__._RETURN(0);
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1854
#else
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1855
    if (! __isNonNilObject(anObject)) {
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1856
	RETURN ( nil );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1857
    }
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  1858
    RETURN ( __mkSmallInteger( anObject->o_flags ) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1859
#endif
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1860
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1861
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1862
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
  1863
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
  1864
F_DEREFERENCED  4       /* a collection after grow (not currently used) */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1865
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
  1866
F_MARK          16      /* mark bit for background collector */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1867
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1868
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1869
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1870
     |arr|
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1871
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1872
     arr := Array new.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1873
     arr at:1 put:([thisContext] value).
8556
96a185c5058d Use #referencesObject instead of #references:
Stefan Vogel <sv@exept.de>
parents: 8543
diff changeset
  1874
     (ObjectMemory flagsOf:anObject) printCR
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1875
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1876
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1877
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1878
objectAt:anAddress
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1879
    "return whatever anAddress points to as object.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1880
     BIG BIG DANGER ALERT:
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1881
	this method is only to be used for debugging ST/X itself
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1882
	- you can easily (and badly) crash the system.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1883
     WARNING: this method is for ST/X debugging only
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1884
	      it will be removed without notice"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1885
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1886
%{  /* NOCONTEXT */
4104
fda98b55a734 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3913
diff changeset
  1887
    INT addr = __longIntVal(anAddress);
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1888
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1889
    if (addr) {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1890
	RETURN ((OBJ)(addr));
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1891
    }
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1892
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  1893
    ^ nil
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1894
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1895
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1896
printReferences:anObject
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1897
    "for debugging: print referents to anObject.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1898
     WARNING: this method is for ST/X debugging only
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1899
	      it will be removed without notice
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1900
	use ObjectMemory>>whoReferences: or anObject>>allOwners."
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1901
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1902
%{
20315
a57647e1072b many warnings eliminated
Claus Gittinger <cg@exept.de>
parents: 20304
diff changeset
  1903
    __printRefChain((OBJ)__context, anObject);
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1904
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1905
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  1906
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1907
refChainFrom:start to:anObject inRefSets:levels startingAt:index
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1908
     |chain|
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1909
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1910
     index > levels size ifTrue:[
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1911
	(start referencesObject:anObject) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1912
	    ^ OrderedCollection with:anObject. "/ (self refNameFor:anObject in:start)
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1913
	].
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1914
	^ nil.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1915
     ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1916
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1917
     (levels at:index) do:[:el |
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1918
el ~~ start ifTrue:[
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1919
	(start referencesObject:el) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1920
	    chain := self
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1921
			refChainFrom:el
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1922
			to:anObject
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1923
			inRefSets:levels
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1924
			startingAt:(index+1).
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1925
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1926
	    chain notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1927
		(levels at:index) safeRemove:el.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1928
		chain addFirst:el. "/ (self refNameFor:el in:start).
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1929
		^ chain.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1930
	    ]
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1931
	].
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
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
     ^ nil
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1935
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
     "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1938
      |o a1 a2|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1939
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1940
      o := Object new.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1941
      a1 := Array with:o with:nil with:nil.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1942
      a2 := Array with:a1 with:nil with:nil.
8556
96a185c5058d Use #referencesObject instead of #references:
Stefan Vogel <sv@exept.de>
parents: 8543
diff changeset
  1943
      a2 referencesObject:a1
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1944
     "
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
     "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1947
      |o a1 a2 a3 a4 levels|
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
      o := Object new.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1950
      a1 := Array with:o.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1951
      a2 := Array with:a1.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1952
      a3 := Array with:a2.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1953
      a4 := Array with:a3.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1954
      levels := Array with:(Array with:a3)
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1955
		      with:(Array with:a2)
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1956
		      with:(Array with:a1).
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1957
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  1958
      self refChainFrom:a4 to:o inRefSets:levels startingAt:1.
1108
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1959
     "
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1960
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1961
    "Modified: / 3.2.1998 / 02:38:27 / cg"
1108
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1962
!
c6a864afd7bd refChain-debugging
Claus Gittinger <cg@exept.de>
parents: 1105
diff changeset
  1963
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1964
refChainsFrom:start to:anObject inRefSets:levels startingAt:index
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1965
     |chains chain c|
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1966
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1967
     chains := OrderedCollection new.
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1968
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1969
     index > levels size ifTrue:[
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1970
	(start referencesObject:anObject) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1971
	    chains add:(OrderedCollection with:anObject "(self refNameFor:anObject in:start)").
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1972
	].
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1973
	^ chains
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1974
     ].
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1975
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  1976
     (levels at:index) do:[:el |
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1977
el ~~ start ifTrue:[
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1978
	(start referencesObject:el) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1979
	    chain := self
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1980
			refChainFrom:el
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1981
			to:anObject
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1982
			inRefSets:levels
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1983
			startingAt:(index+1).
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1984
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1985
	    chain size > 0 ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1986
		(levels at:index) safeRemove:el.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1987
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1988
		c := chain copy.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1989
		c addFirst:el "(self refNameFor:el in:start)".
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1990
		chains add:c.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1991
	    ]
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1992
].
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  1993
	].
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1994
     ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1995
     ^ chains
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1996
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1997
    "Created: / 2.2.1998 / 19:09:22 / cg"
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1998
    "Modified: / 3.2.1998 / 02:38:17 / cg"
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  1999
!
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2000
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2001
refNameFor:anObject in:referent
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2002
    |names oClass|
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2003
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2004
    referent == Smalltalk ifTrue:[
21094
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2005
        referent keysAndValuesDo:[:key :val |
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2006
            |idx|
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2007
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2008
            (anObject == val) ifTrue:[
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2009
                "/ for our convenience - if its a nameSpace, cut off Smalltalk.
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2010
                idx := key string indexOf:$:.
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2011
                (idx ~~ 0
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2012
                and:[idx < key string size
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2013
                and:[(key string at:(idx+1)) == $:]]) ifTrue:[
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2014
                    ^ key allBold "/ (key copyFrom:(idx+2)) allBold
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2015
                ].
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2016
                ^ 'Smalltalk:' , (key allBold).
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2017
            ]
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2018
        ].
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2019
    ] ifFalse:[
21094
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2020
        names := referent class allInstVarNames.
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2021
        oClass := referent class.
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2022
        oClass == anObject ifTrue:[
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2023
            ^ oClass name.
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2024
        ].
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2025
        1 to:oClass instSize do:[:i |
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2026
            ((referent instVarAt:i) == anObject) ifTrue:[
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2027
                ^ '%1 [%2]' bindWith:referent class nameWithArticle with:(names at:i) allBold.
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2028
            ].
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2029
        ].
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2030
        oClass isVariable ifTrue:[
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2031
            oClass isPointers ifTrue:[
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2032
                1 to:referent basicSize do:[:i |
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2033
                    ((referent basicAt:i) == anObject) ifTrue:[
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2034
                        ^ '%1 [%2] (sz=%2)' bindWith:referent class nameWithArticle with:i printString allBold with:referent basicSize printString
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2035
                    ]
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2036
                ]
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2037
            ]
e6a4ef61584c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20822
diff changeset
  2038
        ].
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2039
    ].
10833
c703555361e0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10743
diff changeset
  2040
    self error:'no reference' mayProceed:true.
6568
26cf1400e655 Make image files executable.
Stefan Vogel <sv@exept.de>
parents: 6470
diff changeset
  2041
    ^ nil.
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2042
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2043
    "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
  2044
    "Modified: / 4.2.1998 / 22:03:36 / cg"
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2045
!
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2046
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2047
sizeOf:anObject
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2048
    "return the size of anObject in bytes.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2049
     (this is not the same as 'anObject size').
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2050
     WARNING: this method is for ST/X debugging only
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2051
	      it will be removed without notice"
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2052
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2053
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2054
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2055
    return __c__._RETURN(0);
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2056
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  2057
    RETURN ( __isNonNilObject(anObject) ? __mkSmallInteger(__qSize(anObject)) : __mkSmallInteger(0) )
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2058
#endif
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2059
%}
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2060
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2061
     |hist big nw|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2062
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2063
     hist := Array new:100 withAll:0.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2064
     big := 0.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2065
     ObjectMemory allObjectsDo:[:o |
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2066
	 nw := (ObjectMemory sizeOf:o) // 4 + 1.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2067
	 nw > 100 ifTrue:[
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2068
	    big := big + 1
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2069
	 ] ifFalse:[
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2070
	    hist at:nw put:(hist at:nw) + 1
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2071
	 ].
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2072
     ].
8556
96a185c5058d Use #referencesObject instead of #references:
Stefan Vogel <sv@exept.de>
parents: 8543
diff changeset
  2073
     hist printCR.
96a185c5058d Use #referencesObject instead of #references:
Stefan Vogel <sv@exept.de>
parents: 8543
diff changeset
  2074
     big printCR
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2075
    "
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2076
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2077
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2078
spaceOf:anObject
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2079
    "return the memory space, in which anObject is.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2080
     - since objects may move between spaces,
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2081
       the returned value may be invalid after the next scavenge/collect.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2082
     WARNING: this method is for ST/X debugging only
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2083
	      it will be removed without notice"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2084
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2085
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2086
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2087
    return __c__._RETURN(0);
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2088
#else
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2089
    if (! __isNonNilObject(anObject)) {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2090
	RETURN ( nil );
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2091
    }
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  2092
    RETURN ( __mkSmallInteger( __qSpace(anObject) ) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2093
#endif
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2094
%}
375
claus
parents: 370
diff changeset
  2095
! !
claus
parents: 370
diff changeset
  2096
3699
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2097
!ObjectMemory class methodsFor:'debugging ST/X'!
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2098
13946
8cd0070fa496 added: #checkConsistency
Claus Gittinger <cg@exept.de>
parents: 13587
diff changeset
  2099
checkConsistency
8cd0070fa496 added: #checkConsistency
Claus Gittinger <cg@exept.de>
parents: 13587
diff changeset
  2100
    "call the object memory consistency checker.
8cd0070fa496 added: #checkConsistency
Claus Gittinger <cg@exept.de>
parents: 13587
diff changeset
  2101
     Useful to check if all obejct references are still valid,
20400
644b7b8711f4 #OTHER by mawalch
mawalch
parents: 20316
diff changeset
  2102
     especially when primitive (inline-C) code is developed.
13946
8cd0070fa496 added: #checkConsistency
Claus Gittinger <cg@exept.de>
parents: 13587
diff changeset
  2103
     If called before and after a primitive, missing STORE checks or
8cd0070fa496 added: #checkConsistency
Claus Gittinger <cg@exept.de>
parents: 13587
diff changeset
  2104
     overwritten object headers etc. might be detected.
8cd0070fa496 added: #checkConsistency
Claus Gittinger <cg@exept.de>
parents: 13587
diff changeset
  2105
     (there is no real guarantee, that all such errors are detected, though)"
8cd0070fa496 added: #checkConsistency
Claus Gittinger <cg@exept.de>
parents: 13587
diff changeset
  2106
8cd0070fa496 added: #checkConsistency
Claus Gittinger <cg@exept.de>
parents: 13587
diff changeset
  2107
%{
8cd0070fa496 added: #checkConsistency
Claus Gittinger <cg@exept.de>
parents: 13587
diff changeset
  2108
    __checkConsistency("user call");
8cd0070fa496 added: #checkConsistency
Claus Gittinger <cg@exept.de>
parents: 13587
diff changeset
  2109
%}
8cd0070fa496 added: #checkConsistency
Claus Gittinger <cg@exept.de>
parents: 13587
diff changeset
  2110
8cd0070fa496 added: #checkConsistency
Claus Gittinger <cg@exept.de>
parents: 13587
diff changeset
  2111
    "
8cd0070fa496 added: #checkConsistency
Claus Gittinger <cg@exept.de>
parents: 13587
diff changeset
  2112
     ObjectMemory checkConsistency
8cd0070fa496 added: #checkConsistency
Claus Gittinger <cg@exept.de>
parents: 13587
diff changeset
  2113
    "
8cd0070fa496 added: #checkConsistency
Claus Gittinger <cg@exept.de>
parents: 13587
diff changeset
  2114
8cd0070fa496 added: #checkConsistency
Claus Gittinger <cg@exept.de>
parents: 13587
diff changeset
  2115
    "Created: / 18-01-2012 / 12:10:37 / cg"
8cd0070fa496 added: #checkConsistency
Claus Gittinger <cg@exept.de>
parents: 13587
diff changeset
  2116
!
8cd0070fa496 added: #checkConsistency
Claus Gittinger <cg@exept.de>
parents: 13587
diff changeset
  2117
3699
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2118
printPolyCaches
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2119
    "{ Pragma: +optSpace }"
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2120
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2121
    "dump poly caches.
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2122
     WARNING: this method is for debugging only
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2123
	      it will be removed without notice"
3699
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2124
%{
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2125
    __dumpILCCaches();
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2126
%}
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2127
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2128
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2129
     ObjectMemory printPolyCaches
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2130
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2131
!
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2132
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2133
printStackBacktrace
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2134
    "{ Pragma: +optSpace }"
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2135
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2136
    "print a stack backtrace - then continue.
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2137
     (You may turn off the stack print with debugPrinting:false)
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2138
     WARNING: this method is for debugging only
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2139
	      it will be removed without notice"
3699
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2140
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2141
%{
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2142
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2143
    __c__.printWalkback( STObject.StandardErrorStream );
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2144
#else
20315
a57647e1072b many warnings eliminated
Claus Gittinger <cg@exept.de>
parents: 20304
diff changeset
  2145
    __printStack((OBJ)__context);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2146
#endif
3699
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2147
%}
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2148
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2149
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2150
     ObjectMemory printStackBacktrace
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2151
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2152
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2153
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2154
!
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2155
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2156
printStackBacktraceFrom:aContext
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2157
    "{ Pragma: +optSpace }"
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2158
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2159
    "print a stack backtrace - then continue.
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2160
     (You may turn off the stack print with debugPrinting:false)
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2161
     WARNING: this method is for debugging only
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2162
	      it will be removed without notice"
3699
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2163
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2164
%{
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2165
    __printStack(aContext);
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2166
%}
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2167
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2168
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2169
     ObjectMemory printStackBacktraceFrom:thisContext sender sender
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2170
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2171
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2172
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2173
!
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2174
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2175
printSymbols
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2176
    "{ Pragma: +optSpace }"
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2177
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2178
    "dump the internal symbol table.
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2179
     WARNING: this method is for debugging only
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2180
	      it will be removed without notice"
3699
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2181
%{
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2182
#ifdef DEBUG
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2183
    __dumpSymbols();
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2184
#endif
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2185
%}
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2186
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2187
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2188
     ObjectMemory printSymbols
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2189
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2190
!
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2191
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2192
sendTraceOff
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2193
    "{ Pragma: +optSpace }"
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2194
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2195
    "turns tracing of message sends off.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2196
     WARNING: this method is for debugging only
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2197
	      it may be removed without notice"
3699
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2198
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2199
%{  /* NOCONTEXT */
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2200
    __setMessageTrace__(0);
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2201
%}
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2202
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2203
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2204
     ObjectMemory sendTraceOff
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2205
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2206
!
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2207
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2208
sendTraceOn
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2209
    "{ Pragma: +optSpace }"
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2210
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2211
    "turns tracing of message sends on.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2212
     WARNING: this method is for debugging only
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2213
	      it may be removed without notice"
3699
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2214
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2215
%{  /* NOCONTEXT */
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2216
    __setMessageTrace__(1);
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2217
%}
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2218
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2219
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2220
     ObjectMemory sendTraceOn
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2221
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2222
! !
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  2223
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  2224
!ObjectMemory class methodsFor:'dependents access'!
10
claus
parents: 5
diff changeset
  2225
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2226
dependents
3223
ccdfe7ceb88e comment
Claus Gittinger <cg@exept.de>
parents: 3181
diff changeset
  2227
    "return the collection of my dependents"
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2228
3057
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
  2229
    ^ Dependents ? #()
f9199215f9b0 dependents now always returns a collection
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
  2230
3223
ccdfe7ceb88e comment
Claus Gittinger <cg@exept.de>
parents: 3181
diff changeset
  2231
    "Modified: / 26.1.1998 / 11:17:59 / cg"
10
claus
parents: 5
diff changeset
  2232
!
claus
parents: 5
diff changeset
  2233
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2234
dependents:aCollection
10
claus
parents: 5
diff changeset
  2235
    "set the dependents collection"
claus
parents: 5
diff changeset
  2236
claus
parents: 5
diff changeset
  2237
    Dependents := aCollection
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2238
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2239
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2240
dependentsDo:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2241
    "evaluate aBlock for all of my dependents.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2242
     Since this is performed at startup time (under the scheduler),
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2243
     this is redefined here to catch abort signals.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2244
     Thus, if any error occurs in a #returnFromSnapshot,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2245
     the user can press abort to continue."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2246
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2247
    |deps|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2248
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2249
    deps := Dependents.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2250
    deps notNil ifTrue:[
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2251
	deps do:[:each |
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2252
	    AbortOperationRequest handle:[:ex |
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2253
		ex return
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2254
	    ] do:[
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2255
		aBlock value:each
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2256
	    ]
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2257
	]
282
94f5c3a6230d *** empty log message ***
claus
parents: 270
diff changeset
  2258
    ]
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2259
! !
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2260
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  2261
!ObjectMemory class methodsFor:'enumerating'!
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2262
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2263
allInstancesOf:aClass do:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2264
    "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
  2265
     There is one caveat: if a compressing oldSpace collect
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2266
     occurs while looping over the objects, the loop cannot be
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2267
     continued (for some internal reasons). In this case, false
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2268
     is returned."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2269
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2270
    |work|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2271
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2272
%{  /* NOREGISTER - work may not be placed into a register here */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2273
    __nonTenuringScavenge(__context);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2274
    /*
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2275
     * allInstancesDo needs a temporary to hold newSpace objects
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2276
     */
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  2277
    if (__allInstancesOfDo(&aClass, &aBlock, &work) < 0) {
159
514c749165c3 *** empty log message ***
claus
parents: 133
diff changeset
  2278
	RETURN (false);
85
claus
parents: 77
diff changeset
  2279
    }
claus
parents: 77
diff changeset
  2280
%}.
claus
parents: 77
diff changeset
  2281
    ^ true
2
claus
parents: 1
diff changeset
  2282
!
claus
parents: 1
diff changeset
  2283
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2284
allObjectsDo:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2285
    "evaluate the argument, aBlock for all objects in the system.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2286
     There is one caveat: if a compressing oldSpace collect
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2287
     occurs while looping over the objects, the loop cannot be
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2288
     continued (for some internal reasons). In this case, false
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2289
     is returned."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2290
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2291
    |work|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2292
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2293
%{  /* NOREGISTER - work may not be placed into a register here */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2294
    __nonTenuringScavenge(__context);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2295
    /*
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2296
     * allObjectsDo needs a temporary to hold newSpace objects
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2297
     */
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  2298
    if (__allInstancesOfDo((OBJ *)0, &aBlock, &work) < 0) {
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2299
	RETURN (false);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2300
    }
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2301
%}.
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2302
    ^ true
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2303
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2304
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2305
allObjectsIncludingContextsDo:aBlock
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2306
    "like allObjectsDo, but also walks over all contexts
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2307
     of living processes"
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2308
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2309
    self allObjectsDo:aBlock.
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2310
    ProcessorScheduler knownProcesses do:[:p |
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2311
	|con|
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2312
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2313
	con := p suspendedContext.
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2314
	[con notNil] whileTrue:[
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2315
	    aBlock value:con.
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2316
	    con := con sender.
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2317
	].
3266
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2318
    ].
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2319
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2320
    "Created: / 3.2.1998 / 11:32:08 / cg"
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2321
!
839e8f33d509 #displayRefChain
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  2322
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2323
allOldObjectsDo:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2324
    "evaluate the argument, aBlock for all old objects in the system.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2325
     For debugging and tests only - do not use"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2326
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  2327
    if (__allInstancesOfDo((OBJ *)0, &aBlock, (OBJ *)0) < 0) {
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2328
	RETURN (false);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2329
    }
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2330
%}.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2331
    ^ true
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2332
!
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2333
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2334
processesKnownInVM
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2335
    "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
  2336
     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
  2337
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2338
%{
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2339
    extern OBJ __processesKnownInVM();
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2340
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2341
    RETURN (__processesKnownInVM());
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2342
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2343
    ^ #()
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2344
3277
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2345
    "
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2346
     ObjectMemory processesKnownInVM
35bc5ebe73ce now, also track references from the (hidden) processes
Claus Gittinger <cg@exept.de>
parents: 3275
diff changeset
  2347
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2348
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2349
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  2350
!ObjectMemory class methodsFor:'garbage collection'!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2351
3725
b50bfa6fdbca added accessors for BackgroundCollectProcess and
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
  2352
backgroundCollectProcess
b50bfa6fdbca added accessors for BackgroundCollectProcess and
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
  2353
    "return the backgroundCollectProcess (or nil, if noone is running)"
b50bfa6fdbca added accessors for BackgroundCollectProcess and
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
  2354
b50bfa6fdbca added accessors for BackgroundCollectProcess and
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
  2355
    ^ BackgroundCollectProcess
b50bfa6fdbca added accessors for BackgroundCollectProcess and
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
  2356
b50bfa6fdbca added accessors for BackgroundCollectProcess and
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
  2357
    "Created: / 4.8.1998 / 01:54:16 / cg"
b50bfa6fdbca added accessors for BackgroundCollectProcess and
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
  2358
!
b50bfa6fdbca added accessors for BackgroundCollectProcess and
Claus Gittinger <cg@exept.de>
parents: 3699
diff changeset
  2359
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2360
backgroundCollectorRunning
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2361
    "return true, if a backgroundCollector is running"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2362
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2363
    ^ BackgroundCollectProcess notNil
500
e5fd4f3c9f37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2364
e5fd4f3c9f37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2365
    "
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2366
     ObjectMemory backgroundCollectorRunning
375
claus
parents: 370
diff changeset
  2367
    "
claus
parents: 370
diff changeset
  2368
!
claus
parents: 370
diff changeset
  2369
3646
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2370
compressOldSpace
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2371
    "COMPRESS the oldSpace memory area.
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2372
     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
  2373
     be slightly slower than the semispace compress if lots of real memory
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2374
     is available.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2375
     In memory limited systems, this inplace compress is usually preferable.
3646
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2376
     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
  2377
     small number.
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2378
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2379
     This can take a long time."
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2380
%{
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2381
    __compressOldSpace(__context);
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2382
%}
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2383
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2384
    "
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2385
     ObjectMemory compressOldSpace
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2386
    "
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2387
    "
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2388
     Transcript showCR:(Time millisecondsToRun:[
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2389
	 ObjectMemory markAndSweep.
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2390
	 ObjectMemory compressOldSpace.
3646
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2391
     ]).
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2392
    "
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2393
    "
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2394
     Transcript showCR:(Time millisecondsToRun:[
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2395
	 ObjectMemory compressingGarbageCollect.
3646
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2396
     ]).
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2397
    "
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2398
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2399
!
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2400
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2401
compressingGarbageCollect
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2402
    "search for and free garbage in the oldSpace (newSpace is cleaned automatically)
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2403
     performing a COMPRESSING garbage collect.
3646
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2404
     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
  2405
     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
  2406
     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
  2407
     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
  2408
     small number.
42a4c18146a2 added #compressOldSpace method - a 2-pass inplace compress.
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  2409
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2410
     This can take a long time - especially, if paging is involved
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2411
     (when no paging is involved, its faster than I thought :-).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2412
     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
  2413
     the -Msingle option, this does a non-COMPRESSING collect."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2414
%{
20315
a57647e1072b many warnings eliminated
Claus Gittinger <cg@exept.de>
parents: 20304
diff changeset
  2415
    if (! __garbageCollect((OBJ)__context)) {
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2416
	__markAndSweep();
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2417
	RETURN (false);
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  2418
    }
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2419
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2420
    ^ true
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2421
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  2422
    "
375
claus
parents: 370
diff changeset
  2423
     ObjectMemory compressingGarbageCollect
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  2424
    "
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  2425
!
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  2426
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2427
garbageCollect
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2428
    "search for and free garbage in the oldSpace.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2429
     This can take a long time - especially, if paging is involved."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2430
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2431
    "/ used to be
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2432
    "/    self compressingGarbageCollect
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2433
    "/ here; changed to default to markAndSweep
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2434
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2435
    self markAndSweep
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2436
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  2437
    "
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2438
     ObjectMemory garbageCollect
375
claus
parents: 370
diff changeset
  2439
    "
claus
parents: 370
diff changeset
  2440
!
claus
parents: 370
diff changeset
  2441
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2442
gcStep
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2443
    "one incremental garbage collect step.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2444
     Mark or sweep some small number of objects. This
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2445
     method will return after a reasonable (short) time.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2446
     This is used by the ProcessorScheduler at idle times.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2447
     Returns true, if an incremental GC cycle has finished."
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
    extern int __incrGCstep();
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2450
5461
3d1a6fdb524b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5441
diff changeset
  2451
    RETURN (__incrGCstep() ? true : false);
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2452
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2453
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2454
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2455
gcStepIfUseful
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2456
    "If either the IncrementalGCLimit or the FreeSpaceGCLimits have been
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2457
     reached, perform one incremental garbage collect step.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2458
     Return true, if more gcSteps are required to finish the cycle,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2459
     false if done with a gc round.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2460
     If no limit has been reached yet, do nothing and return false.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2461
     This is called by the ProcessorScheduler at idle times or by the
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2462
     backgroundCollector."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2463
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2464
    |done limit|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2465
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2466
    self isSchteamEngine ifTrue:[^ false ].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2467
15467
df2d6d3d92ca class: ObjectMemory
Stefan Vogel <sv@exept.de>
parents: 15441
diff changeset
  2468
    AbortOperationRequest handle:[:ex |
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2469
	"/ in case of abort (from the debugger),
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2470
	"/ disable gcSteps.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2471
	done := true.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2472
	IncrementalGCLimit := FreeSpaceGCLimit := nil.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2473
	'ObjectMemory [error]: IGC aborted; turning off incremental GC' errorPrintCR
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2474
    ] do:[
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2475
	limit := IncrementalGCLimit.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2476
	(limit notNil and:[self oldSpaceAllocatedSinceLastGC > limit]) ifTrue:[
3761
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2477
"/            'IGC [info]: start since allocatedSinceLastGC > IncrementalGCLimit' infoPrintCR.
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2478
	    done := ObjectMemory gcStep
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2479
	] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2480
	    limit := FreeSpaceGCLimit.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2481
	    (limit notNil and:[(self freeSpace + self freeListSpace) < limit]) ifTrue:[
3761
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2482
"/            'IGC [info]: start since freeSpace < FreeSpaceGCLimit' infoPrintCR.
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2483
		done := ObjectMemory gcStep.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2484
		done ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2485
		    self moreOldSpaceIfUseful
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2486
		].
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2487
	    ] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2488
		limit := DynamicCodeGCTrigger.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2489
		(limit notNil and:[self compiledCodeCounter > limit]) ifTrue:[
3761
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2490
"/                    'IGC [info]: start since compiledCodeCounter > DynamicCodeGCTrigger' infoPrintCR.
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2491
		    done := ObjectMemory gcStep.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2492
		] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2493
		    limit := DynamicCodeLimit.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2494
		    (limit notNil and:[self compiledCodeSpaceUsed > limit]) ifTrue:[
3761
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2495
"/                    'IGC [info]: start since compiledCodeSpaceUsed > DynamicCodeLimit' infoPrintCR.
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2496
			done := ObjectMemory gcStep.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2497
		    ] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2498
			done := true
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2499
		    ]
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2500
		]
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2501
	    ]
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2502
	].
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2503
    ].
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2504
    ^ done not
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2505
3761
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2506
    "Modified: / 14.8.1998 / 13:08:15 / cg"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2507
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2508
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2509
incrementalGC
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2510
    "perform one round of incremental GC steps.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2511
     The overall effect of this method is (almost) the same as calling
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2512
     markAndSweep. However, #incrementalGC is interruptable while #markAndSweep
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2513
     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
  2514
     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
  2515
     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
  2516
     step for a while.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2517
     Thus this method can be called either from a low prio (background) process
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2518
     or from a high prio process.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2519
     (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
  2520
      since it is faster)
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2521
     For example, someone allocating huge amounts of memory could
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2522
     ask for the possibility of a quick allocation using
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2523
     #checkForFastNew: and try a #incrementalGC if not. In many
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2524
     cases, this can avoid a pause (in the higher prio processes) due to
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2525
     a blocking GC."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2526
1669
4951596746f7 comments & code cleanup
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2527
    |delay|
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2528
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2529
    self isSchteamEngine ifTrue:[^ self].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2530
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2531
    Processor activeProcess priority > Processor userBackgroundPriority ifTrue:[
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2532
	delay := Delay forMilliseconds:1
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2533
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2534
3742
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2535
    ((self incrementalGCPhaseSymbolic ~~ #idle)
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2536
    or:[self gcStepIfUseful]) ifTrue:[
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2537
	[self gcStep] whileFalse:[
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2538
	    delay notNil ifTrue:[delay wait]
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  2539
	]
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2540
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2541
    self moreOldSpaceIfUseful
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2542
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2543
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2544
     ObjectMemory incrementalGC
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2545
     [ObjectMemory incrementalGC] forkAt:3
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2546
     [ObjectMemory incrementalGC] forkAt:9
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2547
    "
3108
52cecf074ee5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
  2548
3742
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  2549
    "Modified: / 10.8.1998 / 15:03:07 / cg"
194
197c209e61f4 fine tuning tenure
claus
parents: 178
diff changeset
  2550
!
197c209e61f4 fine tuning tenure
claus
parents: 178
diff changeset
  2551
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2552
markAndSweep
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2553
    "mark/sweep garbage collector.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2554
     perform a full mark&sweep collect.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2555
     Warning: this may take some time and it is NOT interruptable.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2556
     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
  2557
     other things to do, better use #incrementalGC which is interruptable."
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2558
%{
5461
3d1a6fdb524b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5441
diff changeset
  2559
    __markAndSweep();
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2560
%}
194
197c209e61f4 fine tuning tenure
claus
parents: 178
diff changeset
  2561
197c209e61f4 fine tuning tenure
claus
parents: 178
diff changeset
  2562
    "
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2563
     ObjectMemory markAndSweep
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2564
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2565
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2566
8304
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
  2567
nonVerboseGarbageCollect
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
  2568
    "perform a compressing garbage collect or fallback to non-compressing collect,
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
  2569
     if required."
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
  2570
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
  2571
    "/ try 1pass baker collect first.
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
  2572
    "/ this will fail if oldSpace size is above compressLimit
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
  2573
    (self compressingGarbageCollect) ifFalse:[
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2574
	"/ fallBack - use 2pass inplace compress
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2575
	self compressOldSpace
8304
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
  2576
    ].
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
  2577
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
  2578
    "
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
  2579
     ObjectMemory nonVerboseGarbageCollect
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
  2580
    "
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
  2581
!
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
  2582
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2583
reclaimSymbols
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2584
    "reclaim unused symbols;
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2585
     Unused symbols are (currently) not reclaimed automatically,
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2586
     but only upon request with this method.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2587
     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
  2588
     Future versions may do this automatically, while garbage collecting."
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2589
%{
5461
3d1a6fdb524b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5441
diff changeset
  2590
    __reclaimSymbols();
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2591
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2592
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2593
     ObjectMemory reclaimSymbols
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2594
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2595
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2596
8455
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2597
resumeBackgroundCollector
10743
3a082f8aa7fc comments
Claus Gittinger <cg@exept.de>
parents: 10660
diff changeset
  2598
    "resume the background collector process"
8455
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2599
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2600
    BackgroundCollectProcess notNil ifTrue:[
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  2601
	BackgroundCollectProcess resume.
8455
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2602
    ]
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2603
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2604
    "
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2605
     ObjectMemory resumeBackgroundCollector
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2606
    "
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2607
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2608
    "Created: / 03-08-2004 / 18:12:30 / stefan"
10743
3a082f8aa7fc comments
Claus Gittinger <cg@exept.de>
parents: 10660
diff changeset
  2609
    "Modified: / 17-10-2007 / 13:14:46 / cg"
8455
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2610
!
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2611
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2612
scavenge
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2613
    "collect young objects, without aging (i.e. no tenure).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2614
     Can be used to quickly get rid of shortly before allocated
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2615
     stuff. This is relatively fast (compared to oldspace collect).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2616
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2617
     An example where a non-tenuring scavenge makes sense is when
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2618
     allocating some OperatingSystem resource (a Color, File or View)
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2619
     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
  2620
     free some ST-objects and therefore (by signalling the WeakArrays
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2621
     or Registries) free the OS resources too.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2622
     Of course, only recently allocated resources will be freed this
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2623
     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
  2624
%{
5461
3d1a6fdb524b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5441
diff changeset
  2625
    __nonTenuringScavenge();
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2626
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2627
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2628
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2629
     ObjectMemory scavenge
194
197c209e61f4 fine tuning tenure
claus
parents: 178
diff changeset
  2630
    "
207
claus
parents: 202
diff changeset
  2631
!
claus
parents: 202
diff changeset
  2632
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2633
startBackgroundCollectorAt:aPriority
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2634
    "start a process doing incremental GC in the background.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2635
     Use this, if you have suspendable background processes which
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2636
     run all the time, and therefore would prevent the idle-collector
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2637
     from running. See documentation in this class for more details."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2638
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2639
    |p|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2640
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2641
    self isSchteamEngine ifTrue:[^ self].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  2642
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2643
    "/
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2644
    "/ its not useful, to run it more than once
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
    BackgroundCollectProcess notNil ifTrue:[
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2647
	BackgroundCollectProcess priority:aPriority.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2648
	^ self
1288
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
    p :=
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2652
	[
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2653
	    [
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2654
		|myDelay timeOfLastGC doGC|
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2655
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2656
		myDelay := Delay forSeconds:5.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2657
		timeOfLastGC := Timestamp now.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2658
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2659
		[true] whileTrue:[
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2660
		    doGC := self gcStepIfUseful.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2661
		    doGC ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2662
			(BackgroundCollectMaximumInterval notNil
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2663
			and:[(Timestamp now secondDeltaFrom: timeOfLastGC) > BackgroundCollectMaximumInterval])
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2664
			ifTrue:[
3743
2a29f0c02432 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
  2665
"/                            'ObjectMemory [info]: start time-triggered background collect.' infoPrintCR.
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2666
			    doGC := true.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2667
			]
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2668
		    ].
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2669
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2670
		    doGC ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2671
			"/
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2672
			"/ perform a full cycle (finish cycle)
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2673
			"/
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2674
			[self gcStep] whileFalse:[].
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2675
			"/
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2676
			"/ increase oldSpace, if freeSpace is below limits.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2677
			"/
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2678
			self moreOldSpaceIfUseful.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2679
			timeOfLastGC := Timestamp now.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2680
		    ].
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2681
		    "/
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2682
		    "/ wait a bit
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2683
		    "/
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2684
		    myDelay wait.
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2685
		]
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2686
	    ] ifCurtailed:[
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2687
		BackgroundCollectProcess := nil
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2688
	    ]
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  2689
	] newProcess.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2690
    p name:'background collector'.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2691
    p priority:aPriority.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2692
    p restartable:true.
10493
ed3649e79223 Start background processes as system processes (background collector and finalizer)
Stefan Vogel <sv@exept.de>
parents: 10226
diff changeset
  2693
    p beSystemProcess.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2694
    p resume.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2695
    BackgroundCollectProcess := p
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2696
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2697
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2698
     the following lets the backgroundCollector run at prio 5
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2699
     whenever 100000 bytes have been allocated, OR freeSpace drops
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2700
     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
  2701
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2702
     Doing this may reduce pauses due to inevitable collects when running
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2703
     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
  2704
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2705
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2706
    "
2258
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2707
     ObjectMemory stopBackgroundCollector.
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2708
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2709
     ObjectMemory incrementalGCLimit:100000.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2710
     ObjectMemory freeSpaceGCLimit:1000000.
2258
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2711
     ObjectMemory startBackgroundCollectorAt:5.
211
58bb873aa83c *** empty log message ***
claus
parents: 207
diff changeset
  2712
    "
2258
8894d33af5f6 reuse delays
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
  2713
3761
bb1263c45b60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3743
diff changeset
  2714
    "Modified: / 14.8.1998 / 13:09:19 / cg"
207
claus
parents: 202
diff changeset
  2715
!
claus
parents: 202
diff changeset
  2716
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2717
stopBackgroundCollector
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2718
    "stop the background collector"
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
    BackgroundCollectProcess notNil ifTrue:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2721
	BackgroundCollectProcess terminate.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2722
	BackgroundCollectProcess := nil
207
claus
parents: 202
diff changeset
  2723
    ]
293
31df3850e98c *** empty log message ***
claus
parents: 291
diff changeset
  2724
211
58bb873aa83c *** empty log message ***
claus
parents: 207
diff changeset
  2725
    "
58bb873aa83c *** empty log message ***
claus
parents: 207
diff changeset
  2726
     ObjectMemory stopBackgroundCollector
58bb873aa83c *** empty log message ***
claus
parents: 207
diff changeset
  2727
    "
362
claus
parents: 360
diff changeset
  2728
!
claus
parents: 360
diff changeset
  2729
8455
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2730
suspendBackgroundCollector
10743
3a082f8aa7fc comments
Claus Gittinger <cg@exept.de>
parents: 10660
diff changeset
  2731
    "suspend the background collector process.
3a082f8aa7fc comments
Claus Gittinger <cg@exept.de>
parents: 10660
diff changeset
  2732
     Answer true, if the background collector was running before"
8455
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2733
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2734
    |backgroundCollectorWasRunning|
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2735
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2736
    backgroundCollectorWasRunning := false.
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2737
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2738
    BackgroundCollectProcess notNil ifTrue:[
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  2739
	"suspend doesn't work due to interrupt processing"
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  2740
	backgroundCollectorWasRunning := BackgroundCollectProcess isStopped not.
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  2741
	BackgroundCollectProcess stop.
8455
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2742
    ].
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2743
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2744
    ^ backgroundCollectorWasRunning
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2745
8455
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2746
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2747
    "
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2748
     ObjectMemory suspendBackgroundCollector.
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2749
     ObjectMemory resumeBackgroundCollector
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2750
    "
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2751
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2752
    "Created: / 03-08-2004 / 18:11:41 / stefan"
10743
3a082f8aa7fc comments
Claus Gittinger <cg@exept.de>
parents: 10660
diff changeset
  2753
    "Modified: / 17-10-2007 / 13:15:01 / cg"
8455
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2754
!
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  2755
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2756
tenure
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2757
    "force all living new stuff into old-space - effectively making
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2758
     all living young objects become old objects immediately.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2759
     This is relatively fast (compared to oldspace collect).
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
     This method should only be used in very special situations:
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2762
     for example, when building up some long-living data structure
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2763
     in a time critical application.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2764
     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
  2765
     objects are created. Be careful, to not reference any other chunk-
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2766
     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
  2767
     the oldspace).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2768
     In normal situations, explicit tenures are not needed."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2769
%{
5461
3d1a6fdb524b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5441
diff changeset
  2770
    __tenure();
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2771
%}
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2772
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2773
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2774
     ObjectMemory tenure
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2775
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2776
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2777
     ... build up long living objects ...
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2778
     ObjectMemory scavenge.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2779
     ObjectMemory tenure
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2780
     ... continue - objects created above are now in oldSpace ...
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2781
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2782
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2783
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2784
tenuringScavenge
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2785
    "collect newspace stuff, with aging (i.e. objects old enough
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2786
     will be moved into the oldSpace).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2787
     Use this for debugging and testing only - the system performs
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2788
     this automatically when the newspace fills up.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2789
     This is relatively fast (compared to oldspace collect)"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2790
%{
5461
3d1a6fdb524b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5441
diff changeset
  2791
    __scavenge();
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2792
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2793
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2794
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2795
     ObjectMemory tenuringScavenge
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2796
    "
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2797
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2798
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2799
verboseGarbageCollect
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2800
    "perform a compressing garbage collect and show some informational
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2801
     output on the Transcript"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2802
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2803
    |nBytesBefore nReclaimed value unit|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2804
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2805
    nBytesBefore := self oldSpaceUsed.
3648
a6da5ea8a7df fallBack to 2pass compress in #verboseGarbageCollect.
Claus Gittinger <cg@exept.de>
parents: 3647
diff changeset
  2806
8304
c82abebade70 +nonVerboseGC
werner
parents: 8252
diff changeset
  2807
    self nonVerboseGarbageCollect.
3649
30a8ecdc6b5c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2808
30a8ecdc6b5c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2809
    "/ show what we reclaimed
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2810
    nReclaimed := nBytesBefore - self oldSpaceUsed.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2811
    nReclaimed > 0 ifTrue:[
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2812
	nReclaimed > 1024 ifTrue:[
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2813
	    nReclaimed > (1024 * 1024) ifTrue:[
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2814
		value := nReclaimed * 10 // (1024 * 1024) / 10.0.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2815
		unit := ' Mb.'
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2816
	    ] ifFalse:[
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2817
		value := nReclaimed // 1024.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2818
		unit := ' Kb.'
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2819
	    ]
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2820
	] ifFalse:[
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2821
	    value := nReclaimed.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2822
	    unit := ' bytes.'
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2823
	].
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2824
	Transcript show:'reclaimed '; show:value.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2825
	Transcript showCR:unit
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2826
    ]
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2827
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2828
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2829
     ObjectMemory verboseGarbageCollect
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2830
    "
1418
23df6a323b69 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  2831
3649
30a8ecdc6b5c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
  2832
    "Modified: / 15.7.1998 / 13:28:05 / cg"
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  2833
! !
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  2834
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  2835
!ObjectMemory class methodsFor:'garbage collector control'!
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2836
18792
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2837
allowTenureOf:anObject
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2838
    "set the age of anObject back to 0 so it may eventually tenure
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  2839
     into old space.
18792
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2840
     This should only be used in very special situations.
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2841
     One such situation may be to ensure that an object is finalized early by the next
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2842
     scavenge, and not by a (possibly late) old space collect.
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2843
     To undo this setup (i.e. to allow the object to tenure again), set its age back to
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2844
     any value with the seatAgeOf:to: message.
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2845
     If the object is already old, this call has no effect.
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2846
     WARNING: this method is for ST/X experts only
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  2847
	      it is dangerous, should be used with care
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  2848
	      and it may be removed without notice"
18792
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2849
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2850
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2851
    self setAgeOf:anObject to:0
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  2852
18792
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2853
    "
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2854
    |p|
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2855
    p := Point new.
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2856
    Transcript showCR:(ObjectMemory preventTenureOf:p).
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2857
    ObjectMemory tenuringScavenge.
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2858
    Transcript showCR:(ObjectMemory ageOf:p).
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2859
    ObjectMemory tenure.
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2860
    Transcript showCR:(ObjectMemory ageOf:p).
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2861
    ObjectMemory tenure.
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2862
    ObjectMemory tenure.
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2863
    ObjectMemory tenure.
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2864
    Transcript showCR:(ObjectMemory ageOf:p).
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2865
    ObjectMemory setAgeOf:p to:30.
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2866
    Transcript showCR:(ObjectMemory ageOf:p).
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2867
    ObjectMemory tenure.
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2868
    Transcript showCR:(ObjectMemory ageOf:p).
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2869
    ObjectMemory tenure.
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2870
    Transcript showCR:(ObjectMemory ageOf:p).
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2871
    "
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2872
!
91839b570010 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18778
diff changeset
  2873
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2874
announceOldSpaceNeed:howMuch
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2875
    "announce to the memory system, that howMuch bytes of memory will be needed
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2876
     soon, which is going to live longer (whatever that means).
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2877
     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
  2878
     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
  2879
     collect. However, many smaller increases are avoided afterwards. Calling this
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2880
     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
  2881
     Notice: this is a nonstandard interface - use only in special situations."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2882
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2883
    (self checkForFastNew:howMuch) ifFalse:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2884
	self incrementalGC.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2885
	(self checkForFastNew:howMuch) ifFalse:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2886
	    self moreOldSpace:howMuch
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2887
	]
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2888
    ]
310
fbfb977ae1bd *** empty log message ***
claus
parents: 308
diff changeset
  2889
fbfb977ae1bd *** empty log message ***
claus
parents: 308
diff changeset
  2890
    "
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  2891
     ObjectMemory announceOldSpaceNeed:1000000
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2892
    "
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2893
!
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2894
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2895
announceSpaceNeed:howMuch
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2896
    "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
  2897
     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
  2898
     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
  2899
     big chunk (instead of doing many smaller reallocations later).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2900
     Notice: this is a nonstandard interface - use only in special situations.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2901
     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
  2902
     allocated, not locking other processes while doing so."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2903
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2904
    (howMuch < (self newSpaceSize // 2)) ifTrue:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2905
	self scavenge.
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
    (self checkForFastNew:howMuch) ifFalse:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2908
	(howMuch > (self newSpaceSize // 2)) ifFalse:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2909
	    self scavenge.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2910
	].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2911
	self incrementalGC.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2912
	(self checkForFastNew:howMuch) ifFalse:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2913
	    self moreOldSpace:howMuch
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
  2914
	]
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
  2915
    ]
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
  2916
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
  2917
    "
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
  2918
     ObjectMemory announceSpaceNeed:100000
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
  2919
    "
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
  2920
!
40ca7cc6fb9c *** empty log message ***
claus
parents: 194
diff changeset
  2921
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2922
avoidTenure:flag
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2923
    "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
  2924
     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
  2925
     If off (the default), aging is done as usual.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2926
     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
  2927
     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
  2928
     or (almost idle) system, less objects are moved into oldSpace.
20213
8e1886ca9293 #OTHER by mawalch
mawalch
parents: 19860
diff changeset
  2929
     Therefore, this helps to avoid oldSpace collects, in systems which go into
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2930
     some standby mode and are reactivated by some external event.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2931
     (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
  2932
     is reentered).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2933
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2934
    This is an EXPERIMENTAL interface."
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  2935
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  2936
%{  /* NOCONTEXT */
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2937
    __avoidTenure(flag == true ? 1 : 0, 0);
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2938
%}.
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2939
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2940
    self saveGarbageCollectorSetting:#avoidTenure: value:flag.
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2941
!
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2942
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2943
avoidTenure:flag fraction:edenFraction
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2944
    "set/clear the avoidTenure flag and set the fraction of eden to be kept.
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2945
     If set, aging of newSpace is turned off
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2946
     as long as the newSpace fill-grade stays below a 1/edenFraction high-water mark.
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2947
     If off (the default), aging is done as usual.
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2948
     If the flag is turned on, scavenge may be a bit slower, due to more
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2949
     objects being copied around. However, chances are high that in an idle
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2950
     or (almost idle) system, less objects are moved into oldSpace.
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2951
     Therefore, this helps to avoid oldSpace collects, in systems which go into
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2952
     some standby mode and are reactivated by some external event.
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2953
     (the avoid-flag should be turned off there, and set again once the idle loop
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2954
     is reentered).
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2955
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2956
    This is an EXPERIMENTAL interface."
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2957
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  2958
%{  /* NOCONTEXT */
20304
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  2959
    __avoidTenure(flag == true ? 1 : 0, __intVal(edenFraction));
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  2960
%}.
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  2961
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  2962
    self saveGarbageCollectorSetting:#avoidTenure: value:flag.
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2963
!
433d44af1630 more GC control
claus
parents: 93
diff changeset
  2964
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2965
checkForFastNew:amount
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2966
    "this method returns true, if amount bytes could be allocated
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2967
     quickly (i.e. without forcing a full GC or compress).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2968
     This can be used for smart background processes, which want to
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2969
     allocate big chunks of data without disturbing foreground processes
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2970
     too much. Such a process would check for fast-allocation, and perform
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2971
     incremental GC-steps if required. Thus, avoiding the long blocking pause
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2972
     due to a forced (non-incremental) GC.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2973
     Especially: doing so will not block higher priority foreground processes.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2974
     See an example use in Behavior>>niceBasicNew:.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2975
     This is experimental and not guaranteed to be in future versions."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2976
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2977
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2978
    extern int __checkForFastNew();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2979
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2980
    if (__isSmallInteger(amount)) {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2981
	if (! __checkForFastNew(__intVal(amount))) {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2982
	    RETURN (false);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2983
	}
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2984
    }
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2985
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2986
%}.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2987
    ^ true
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  2988
!
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  2989
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2990
dynamicCodeGCTrigger
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2991
    "return the dynamic code trigger limit for incremental GC activation.
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2992
     The system will start doing incremental background GC, whenever this amount
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  2993
     of code was dynamically generated.
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2994
     The default is nil; which disables this trigger"
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2995
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2996
    ^ DynamicCodeGCTrigger
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2997
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2998
    "
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  2999
     ObjectMemory dynamicCodeGCTrigger
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3000
    "
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3001
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3002
    "Created: 16.10.1996 / 17:42:01 / cg"
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3003
!
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3004
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3005
dynamicCodeGCTrigger:numberOfBytesOrNil
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3006
    "set the dynamic code trigger limit for incremental GC activation.
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3007
     The system will start doing incremental background GC, whenever this amount
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3008
     of code was dynamically generated.
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3009
     The default is nil; which disables this trigger"
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3010
4565
cae420a1d1ac care for 0 dynamic code triggers
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
  3011
    (numberOfBytesOrNil notNil and:[numberOfBytesOrNil > 0]) ifTrue:[
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3012
	DynamicCodeGCTrigger := numberOfBytesOrNil.
4565
cae420a1d1ac care for 0 dynamic code triggers
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
  3013
    ] ifFalse:[
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3014
	DynamicCodeGCTrigger := nil
4565
cae420a1d1ac care for 0 dynamic code triggers
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
  3015
    ]
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3016
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3017
    "
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3018
     ObjectMemory dynamicCodeGCTrigger:50000
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3019
    "
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3020
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3021
    "Created: 16.10.1996 / 17:42:29 / cg"
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3022
!
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3023
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3024
dynamicCodeLimit
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3025
    "return the dynamic code limit.
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3026
     The system will start doing incremental background GC, whenever this amount
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3027
     of code has been generated (overall), and start to flush the code cache,
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3028
     if (after the GC), more code is still allocated.
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3029
     The default is nil; which disables this trigger"
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3030
1781
da1b4cf13ad4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1770
diff changeset
  3031
    DynamicCodeLimit := self getCompiledCodeLimit.
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3032
    ^ DynamicCodeLimit
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3033
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3034
    "
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3035
     ObjectMemory dynamicCodeLimit
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3036
    "
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3037
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3038
    "Created: 16.10.1996 / 17:43:37 / cg"
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3039
!
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3040
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3041
dynamicCodeLimit:nBytesOrNil
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3042
    "set the dynamic code limit.
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3043
     The system will start doing incremental background GC, whenever this amount
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3044
     of code has been generated (overall), and start to flush the code cache,
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3045
     if (after the GC), more code is still allocated.
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3046
     The default is nil; which disables this trigger"
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3047
1770
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  3048
    self setCompiledCodeLimit:nBytesOrNil.
4565
cae420a1d1ac care for 0 dynamic code triggers
Claus Gittinger <cg@exept.de>
parents: 4186
diff changeset
  3049
    DynamicCodeLimit := self getCompiledCodeLimit.
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3050
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3051
    "
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3052
     ObjectMemory dynamicCodeLimit:100000
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3053
    "
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3054
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3055
    "Created: 16.10.1996 / 17:43:58 / cg"
1770
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  3056
    "Modified: 16.10.1996 / 19:30:46 / cg"
1768
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3057
!
19c806a25f26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1767
diff changeset
  3058
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3059
fastMoreOldSpaceAllocation:aBoolean
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3060
    "this method turns on/off fastMoreOldSpace allocation.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3061
     By default, this is turned off (false), which means that in case of
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3062
     a filled-up oldSpace, a GC is tried first before more oldSpace is allocated.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3063
     This strategy is ok for the normal operation of the system,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3064
     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
  3065
     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
  3066
     by a GC.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3067
     Of course while building this tree, and the memory becomes full, the system
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3068
     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
  3069
8455
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  3070
     Setting fastMoreOldSpaceAllocation to true will avoid this, by forcing the
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3071
     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
  3072
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3073
     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
  3074
     is allocated, since otherwise the system may continue to increase its
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3075
     virtual memory without ever checking for garbage.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3076
     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
  3077
     value should be used to switch back."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3078
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3079
    |result|
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3080
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3081
%{
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3082
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3083
    return __c__._RETURN_false();
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3084
#else
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3085
     extern int __fastMoreOldSpaceAllocation();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3086
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3087
     result = __fastMoreOldSpaceAllocation(aBoolean == true ? 1 : 0) ? true : false;
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3088
#endif
5441
e88302747bbd rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5189
diff changeset
  3089
%}.
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3090
    self saveGarbageCollectorSetting:#fastMoreOldSpaceAllocation: value:aBoolean.
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3091
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3092
     ^ result
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3093
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3094
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3095
     |previousSetting|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3096
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3097
     previousSetting := ObjectMemory fastMoreOldSpaceAllocation:true.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3098
     [
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3099
	...
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3100
	allocate your huge data
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3101
	...
8455
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  3102
     ] ensure:[
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3103
	ObjectMemory fastMoreOldSpaceAllocation:previousSetting
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3104
     ]
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3105
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3106
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3107
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3108
     |prev this|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3109
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3110
     prev := ObjectMemory fastMoreOldSpaceAllocation:true.
370
claus
parents: 369
diff changeset
  3111
     ObjectMemory fastMoreOldSpaceAllocation:prev.
claus
parents: 369
diff changeset
  3112
     ^ prev
claus
parents: 369
diff changeset
  3113
    "
8455
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  3114
e4d9900a76f9 More IGC control
Stefan Vogel <sv@exept.de>
parents: 8423
diff changeset
  3115
    "Modified: / 03-08-2004 / 18:05:31 / stefan"
370
claus
parents: 369
diff changeset
  3116
!
claus
parents: 369
diff changeset
  3117
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3118
fastMoreOldSpaceLimit:aNumber
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3119
    "this method sets and returns the fastMoreOldSpace limit.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3120
     If fastMoreOldSpaceAllocation is true, and the current oldSpace size is
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3121
     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
  3122
     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
  3123
     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
  3124
     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
  3125
     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
  3126
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3127
    |result|
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3128
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3129
%{
8983
ef429fa3d4e0 Allow oldSpace size >= 1 GByte (remove Smallinteger limit)
Stefan Vogel <sv@exept.de>
parents: 8963
diff changeset
  3130
     extern unsigned int __fastMoreOldSpaceLimit();
ef429fa3d4e0 Allow oldSpace size >= 1 GByte (remove Smallinteger limit)
Stefan Vogel <sv@exept.de>
parents: 8963
diff changeset
  3131
ef429fa3d4e0 Allow oldSpace size >= 1 GByte (remove Smallinteger limit)
Stefan Vogel <sv@exept.de>
parents: 8963
diff changeset
  3132
     if (__isInteger(aNumber)) {
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3133
	 result = __MKUINT( __fastMoreOldSpaceLimit(__unsignedLongIntVal(aNumber)));
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3134
     }
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3135
%}.
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3136
    result isNil ifTrue:[
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3137
	^ 0.
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3138
    ].
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3139
    self saveGarbageCollectorSetting:#fastMoreOldSpaceLimit: value:aNumber.
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3140
    ^ result.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3141
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3142
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3143
     |prev this|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3144
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3145
     prev := ObjectMemory fastMoreOldSpaceLimit:10*1024*1024.
370
claus
parents: 369
diff changeset
  3146
     ObjectMemory fastMoreOldSpaceLimit:prev.
claus
parents: 369
diff changeset
  3147
     ^ prev
claus
parents: 369
diff changeset
  3148
    "
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
  3149
!
433d44af1630 more GC control
claus
parents: 93
diff changeset
  3150
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3151
freeSpaceGCAmount
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3152
    "return the amount to be allocated if, after an incrementalGC,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3153
     not at least FreeSpaceGCLimit bytes are available for allocation.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3154
     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
  3155
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3156
    ^ FreeSpaceGCAmount
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3157
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3158
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3159
     ObjectMemory freeSpaceGCAmount
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3160
    "
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
freeSpaceGCAmount:aNumber
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3164
    "set the amount to be allocated if, after an incrementalGC,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3165
     not at least FreeSpaceGCLimit bytes are available for allocation.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3166
     The amount should be greater than the limit, otherwise the incremental
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3167
     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
  3168
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3169
    FreeSpaceGCAmount := aNumber
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3170
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3171
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3172
     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
  3173
     (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
  3174
     below 250k.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3175
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3176
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3177
     ObjectMemory freeSpaceGCLimit:250000.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3178
     ObjectMemory freeSpaceGCAmount:1000000.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3179
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3180
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3181
    "
20273
d64872bc1ce8 #DOCUMENTATION by mawalch
mawalch
parents: 20264
diff changeset
  3182
     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
  3183
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3184
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3185
     ObjectMemory freeSpaceGCAmount:nil.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3186
    "
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
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3189
freeSpaceGCLimit
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3190
    "return the freeSpace limit for incremental GC activation.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3191
     The system will start doing incremental background GC, once less than this number
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3192
     of bytes are available in the compact free space.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3193
     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
  3194
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3195
    ^ FreeSpaceGCLimit
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3196
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3197
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3198
     ObjectMemory freeSpaceGCLimit
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3199
    "
133
433d44af1630 more GC control
claus
parents: 93
diff changeset
  3200
!
433d44af1630 more GC control
claus
parents: 93
diff changeset
  3201
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3202
freeSpaceGCLimit:aNumber
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3203
    "set the freeSpace limit for incremental GC activation.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3204
     The system will start doing incremental background GC, once less than this number
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3205
     of bytes are available for allocation.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3206
     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
  3207
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3208
    FreeSpaceGCLimit := aNumber
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3209
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3210
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3211
     the following will start the incrementalGC (in the background)
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3212
     whenever the freeSpace drops below 1meg of free space
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3213
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3214
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3215
     ObjectMemory freeSpaceGCLimit:1000000.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3216
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3217
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3218
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3219
     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
  3220
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3221
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3222
     ObjectMemory freeSpaceGCLimit:nil.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3223
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3224
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3225
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3226
incrementalGCLimit
20273
d64872bc1ce8 #DOCUMENTATION by mawalch
mawalch
parents: 20264
diff changeset
  3227
    "return the allocatedSinceLastGC limit for incremental GC activation.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3228
     The system will start doing incremental background GC, once more than this number
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3229
     of bytes have been allocated since the last GC.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3230
     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
  3231
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3232
    ^ IncrementalGCLimit
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3233
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
     ObjectMemory incrementalGCLimit
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3236
    "
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  3237
!
85
claus
parents: 77
diff changeset
  3238
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3239
incrementalGCLimit:aNumber
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3240
    "set the allocatedSinceLastGC limit for incremental GC activation.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3241
     The system will start doing incremental background GC, once more than this number
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3242
     of bytes have been allocated since the last GC.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3243
     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
  3244
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3245
    IncrementalGCLimit := aNumber
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3246
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3247
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3248
     ObjectMemory incrementalGCLimit:500000.  'do incr. GC very seldom'
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3249
     ObjectMemory incrementalGCLimit:100000.  'medium'
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3250
     ObjectMemory incrementalGCLimit:10000.   'do incr. GC very often'
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3251
     ObjectMemory incrementalGCLimit:nil.     'never'
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3252
    "
370
claus
parents: 369
diff changeset
  3253
!
claus
parents: 369
diff changeset
  3254
3859
9b422cede70d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3858
diff changeset
  3255
incrementalSweep:aBoolean
3858
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  3256
    "ineable/disable incremental sweeps during background GC.
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  3257
     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
  3258
     used by applications - it may vanish without notice"
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  3259
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3260
    |result|
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3261
3858
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  3262
%{
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3263
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3264
    return __c__._RETURN_false();
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3265
#else
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3266
     result = __incrementalSweep((aBoolean == true) ? 1 : 0) ? true : false;
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3267
#endif
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3268
%}.
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3269
    self saveGarbageCollectorSetting:#incrementalSweep: value:aBoolean.
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3270
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3271
    ^ result.
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3272
3858
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  3273
    "
3859
9b422cede70d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3858
diff changeset
  3274
     ObjectMemory incrementalSweep:false.
9b422cede70d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3858
diff changeset
  3275
     ObjectMemory incrementalSweep:true
3858
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  3276
    "
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  3277
!
4be800f88b8e added interface to incrementalSweeping()
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  3278
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3279
lockTenure:flag
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3280
    "set/clear the tenureLock. If the lock is set, the system
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3281
     completely turns off tenuring, and objects remain in newSpace (forever).
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3282
     Once this lock is set, the system operates only in the newSpace and no memory
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3283
     allocations from oldSpace are allowed (except for explicit tenure calls).
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3284
     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
  3285
     clears the lockTenure-flag and returns nil. Thus, it automatically falls back into
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3286
     the normal mode of operation, to avoid big trouble
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3287
     (fail to allocate memory when handling the exception).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3289
     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
  3290
     working set completely in the newSpace AND want to limit the worst case
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3291
     pause times to the worst case scavenge time
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3292
     (which itself is limitd by the size of the newSpace).
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3293
     I.e. systems which go into some event loop after initial startup,
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3294
     may turn on the tenureLock to make certain that no oldSpace memory is
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3295
     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
  3296
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3297
     This is an EXPERIMENTAL interface.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3298
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3299
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3300
%{
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3301
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3302
    return __c__._RETURN_false();
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3303
#else
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3304
    if (flag == true) {
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3305
	__tenure(__context);
370
claus
parents: 369
diff changeset
  3306
    }
379
5b5a130ccd09 revision added
claus
parents: 375
diff changeset
  3307
    __lockTenure(flag == true ? 1 : 0);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3308
#endif
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3309
%}.
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3310
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3311
    self saveGarbageCollectorSetting:#lockTenure: value:flag.
379
5b5a130ccd09 revision added
claus
parents: 375
diff changeset
  3312
!
5b5a130ccd09 revision added
claus
parents: 375
diff changeset
  3313
20400
644b7b8711f4 #OTHER by mawalch
mawalch
parents: 20316
diff changeset
  3314
makeOld:anObject
644b7b8711f4 #OTHER by mawalch
mawalch
parents: 20316
diff changeset
  3315
    "move anObject into oldSpace.
644b7b8711f4 #OTHER by mawalch
mawalch
parents: 20316
diff changeset
  3316
     This method is for internal & debugging purposes only -
644b7b8711f4 #OTHER by mawalch
mawalch
parents: 20316
diff changeset
  3317
     it may vanish. Don't use it, unless you know what you are doing."
644b7b8711f4 #OTHER by mawalch
mawalch
parents: 20316
diff changeset
  3318
644b7b8711f4 #OTHER by mawalch
mawalch
parents: 20316
diff changeset
  3319
    ^ self makeOld:anObject now:false
644b7b8711f4 #OTHER by mawalch
mawalch
parents: 20316
diff changeset
  3320
!
644b7b8711f4 #OTHER by mawalch
mawalch
parents: 20316
diff changeset
  3321
20315
a57647e1072b many warnings eliminated
Claus Gittinger <cg@exept.de>
parents: 20304
diff changeset
  3322
makeOld:anObject now:aBoolean
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3323
    "move anObject into oldSpace.
20315
a57647e1072b many warnings eliminated
Claus Gittinger <cg@exept.de>
parents: 20304
diff changeset
  3324
     If aBoolean is true, this is done immediately, but takes some processing time.
a57647e1072b many warnings eliminated
Claus Gittinger <cg@exept.de>
parents: 20304
diff changeset
  3325
     Otherwise, it will be done on-the-fly in the near future, without any cost.
a57647e1072b many warnings eliminated
Claus Gittinger <cg@exept.de>
parents: 20304
diff changeset
  3326
     If multiple objects are to be aged this way, pass a false as argument.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3327
     This method is for internal & debugging purposes only -
20315
a57647e1072b many warnings eliminated
Claus Gittinger <cg@exept.de>
parents: 20304
diff changeset
  3328
     it may vanish. Don't use it, unless you know what you are doing."
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3329
%{
20315
a57647e1072b many warnings eliminated
Claus Gittinger <cg@exept.de>
parents: 20304
diff changeset
  3330
    if (__moveToOldSpace(anObject, (OBJ)__context, aBoolean==true) < 0) {
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3331
	RETURN (false);
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
    ^ true
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3335
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3336
2337
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  3337
maxOldSpace
20422
94210802ce28 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20400
diff changeset
  3338
    "return the maxOldSpace value. If non-zero, that's the limit for which the
2339
cf9acb06a903 comments
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  3339
     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
  3340
     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
  3341
     The default is zero."
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  3342
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  3343
%{  /* NOCONTEXT */
14721
8fb5b324ee12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14699
diff changeset
  3344
    extern unsigned INT __maxOldSpace();
8fb5b324ee12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14699
diff changeset
  3345
8fb5b324ee12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14699
diff changeset
  3346
    RETURN (__MKUINT( __maxOldSpace((unsigned INT)-1) ));
5441
e88302747bbd rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5189
diff changeset
  3347
%}.
e88302747bbd rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5189
diff changeset
  3348
    ^ 0
2337
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  3349
    "
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  3350
     ObjectMemory maxOldSpace
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  3351
    "
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  3352
!
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  3353
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  3354
maxOldSpace:amount
20422
94210802ce28 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20400
diff changeset
  3355
    "set the maxOldSpace value. If non-zero, that's the limit for which the
2339
cf9acb06a903 comments
Claus Gittinger <cg@exept.de>
parents: 2338
diff changeset
  3356
     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
  3357
     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
  3358
     The default is zero.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3359
     WARNING:
20422
94210802ce28 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20400
diff changeset
  3360
        an oldSpace limit may lead to trashing due to exorbitant GC activity;
94210802ce28 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20400
diff changeset
  3361
        its usually better to let it allocate more and page in/page out.
94210802ce28 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20400
diff changeset
  3362
        Usually, the background GC will catch up sooner or later and reclaim
94210802ce28 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20400
diff changeset
  3363
        the memory without blocking the system"
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3364
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3365
    |result|
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3366
%{
14721
8fb5b324ee12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14699
diff changeset
  3367
    extern unsigned INT __maxOldSpace();
2337
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  3368
8983
ef429fa3d4e0 Allow oldSpace size >= 1 GByte (remove Smallinteger limit)
Stefan Vogel <sv@exept.de>
parents: 8963
diff changeset
  3369
    if (__isInteger(amount)) {
20422
94210802ce28 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20400
diff changeset
  3370
        result = __MKUINT( __maxOldSpace(__unsignedLongIntVal(amount)));
2337
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  3371
    }
5441
e88302747bbd rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5189
diff changeset
  3372
%}.
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3373
    result notNil ifTrue:[
20422
94210802ce28 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20400
diff changeset
  3374
        self saveGarbageCollectorSetting:#maxOldSpace: value:amount.
94210802ce28 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20400
diff changeset
  3375
        ^ result.
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3376
    ].
5441
e88302747bbd rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5189
diff changeset
  3377
    ^ 0
8983
ef429fa3d4e0 Allow oldSpace size >= 1 GByte (remove Smallinteger limit)
Stefan Vogel <sv@exept.de>
parents: 8963
diff changeset
  3378
ef429fa3d4e0 Allow oldSpace size >= 1 GByte (remove Smallinteger limit)
Stefan Vogel <sv@exept.de>
parents: 8963
diff changeset
  3379
    "
ef429fa3d4e0 Allow oldSpace size >= 1 GByte (remove Smallinteger limit)
Stefan Vogel <sv@exept.de>
parents: 8963
diff changeset
  3380
     to change maximum to 1GByte:
ef429fa3d4e0 Allow oldSpace size >= 1 GByte (remove Smallinteger limit)
Stefan Vogel <sv@exept.de>
parents: 8963
diff changeset
  3381
20422
94210802ce28 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20400
diff changeset
  3382
        ObjectMemory maxOldSpace:1024*1024*1024
2337
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  3383
    "
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  3384
!
f3d67c64da4d added access to maxOldSpace
Claus Gittinger <cg@exept.de>
parents: 2320
diff changeset
  3385
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3386
moreOldSpace:howMuch
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3387
    "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
  3388
     false if that failed.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3389
     This is done automatically, when running out of space, but makes
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3390
     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
  3391
     avoid multiple reallocations and compresses.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3392
     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
  3393
     this (currently) implies a compressing garbage collect - so its slow.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3394
     Notice: this is a nonstandard interface - use only in special situations."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3395
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3396
%{
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3397
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3398
    return __c__._RETURN_true();
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3399
#else
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3400
    if (__isSmallInteger(howMuch)) {
20316
7cfb8d4515a3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 20315
diff changeset
  3401
	RETURN( __moreOldSpace((OBJ)__context, __intVal(howMuch)) ? true : false );
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3402
    }
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3403
    RETURN (false);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3404
#endif
379
5b5a130ccd09 revision added
claus
parents: 375
diff changeset
  3405
%}
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3406
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3407
     ObjectMemory moreOldSpace:1000000
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3408
    "
379
5b5a130ccd09 revision added
claus
parents: 375
diff changeset
  3409
!
5b5a130ccd09 revision added
claus
parents: 375
diff changeset
  3410
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3411
moreOldSpaceIfUseful
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3412
    "to be called after an incremental GC cycle;
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3413
     if freeSpace is still below limit, allocate more oldSpace"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3414
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3415
    |limit free amount|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3416
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3417
    limit := FreeSpaceGCLimit.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3418
    limit notNil ifTrue:[
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3419
	"/ if reclaimed space is below limit, we have to allocate more
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3420
	"/ oldSpace, to avoid excessive gcSteps (due to freeSpaceLimit
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3421
	"/ still not reached)
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3422
	"/
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3423
	free := self freeSpace + self freeListSpace.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3424
	free < (limit * 3 // 2) ifTrue:[
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3425
	    amount := FreeSpaceGCAmount.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3426
	    amount isNil ifTrue:[
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3427
		amount := limit * 3 // 2.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3428
	    ].
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3429
	    "/ 'ObjectMemory [info]: moreOldSpace to satisfy free-limit' infoPrintCR.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3430
	    (self moreOldSpace:(amount - free + (64*1024))) ifFalse:[
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3431
		"/
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3432
		"/ could not increase oldspace; reset FreeSpaceGCLimit to avoid
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3433
		"/ useless retries
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3434
		'ObjectMemory [warning]: could not increase oldSpace - reset limit' errorPrintCR.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3435
		FreeSpaceGCLimit := nil
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3436
	    ]
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3437
	].
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3438
    ].
2122
3d1cb9312f2c new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  3439
2131
1eeb310e109a newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
  3440
    "Modified: 10.1.1997 / 17:59:48 / cg"
370
claus
parents: 369
diff changeset
  3441
!
claus
parents: 369
diff changeset
  3442
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3443
newSpaceSize:newSize
23089
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3444
    "
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3445
    Change the size of the newSpace. Returns true if newspace 
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3446
    has been resized, false otherwise. 
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3447
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3448
    NOTE: 
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3449
    Making newspace smaller forces objects in newspace to tenure. 
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3450
    The tenuring may fail for various reasons, most notably: 
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3451
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3452
      (i)  there's not enough old space to tenure objects to or
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3453
      (ii) there are so many non-tenurable objects. 
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3454
         
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3455
    The former being most likely. Therefore, if shrinking newspace
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3456
    fails, you may want to allocate more oldspace (#moreOldSpace:)
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3457
    and try again, like:
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3458
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3459
        (ObjectMemory newSpaceSize: desiredSize) ifFalse:[
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3460
            (ObjectMemory moreOldSpace: ObjectMemory newSpaceSize) ifTrue:[
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3461
                ObjectMemory newSpaceSize: desiredSize
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3462
            ]
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3463
        ].
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3464
5022933af197 Improved comment in `ObjectMemory >> newSpaceSize:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23079
diff changeset
  3465
    WARNING
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3466
	be careful too big of a size may lead to longer scavenge pauses.
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3467
	Too small of a newSpace may lead to more CPU overhead, due to
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3468
	excessive scavenges. You have been warned."
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3469
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3470
   |result|
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3471
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3472
%{
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3473
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3474
    return __c__._RETURN_false();
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3475
#else
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3476
    extern int __setNewSpaceSize();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3477
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3478
    if (__isSmallInteger(newSize)) {
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3479
	result = __setNewSpaceSize(__intVal(newSize)) ? true : false;
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3480
    }
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  3481
#endif
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3482
%}.
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3483
    result isNil ifTrue:[
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3484
	self primitiveFailed.
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3485
    ].
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3486
    result ifTrue:[
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3487
	self saveGarbageCollectorSetting:#newSpaceSize: value:newSize.
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3488
    ].
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3489
    ^ result.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3490
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3491
    " less absolute CPU overhead (but longer pauses):
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3492
8423
b5b2d689e684 comments
Stefan Vogel <sv@exept.de>
parents: 8304
diff changeset
  3493
     ObjectMemory newSpaceSize:1600*1024
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3494
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3495
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3496
    " smaller pauses, but more overall CPU overhead:
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3497
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3498
     ObjectMemory newSpaceSize:200*1024
370
claus
parents: 369
diff changeset
  3499
    "
claus
parents: 369
diff changeset
  3500
claus
parents: 369
diff changeset
  3501
    " the default:
claus
parents: 369
diff changeset
  3502
8423
b5b2d689e684 comments
Stefan Vogel <sv@exept.de>
parents: 8304
diff changeset
  3503
     ObjectMemory newSpaceSize:800*1024
370
claus
parents: 369
diff changeset
  3504
    "
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3505
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3506
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3507
oldSpaceCompressLimit
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3508
    "return the limit for oldSpace compression. If more memory than this
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3509
     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
  3510
     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
  3511
     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
  3512
     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
  3513
     you may want to increase this limit."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3514
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3515
%{  /* NOCONTEXT */
15441
5a7d4a7de37d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15233
diff changeset
  3516
    extern unsigned INT __compressingGCLimit();
5a7d4a7de37d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15233
diff changeset
  3517
5a7d4a7de37d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15233
diff changeset
  3518
    RETURN (__MKUINT( __compressingGCLimit((unsigned INT)-1) ));
5441
e88302747bbd rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5189
diff changeset
  3519
%}.
e88302747bbd rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5189
diff changeset
  3520
    ^ 0
1105
fe3a6359e13b added access to oldSpaceCompressLimit
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
  3521
    "
fe3a6359e13b added access to oldSpaceCompressLimit
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
  3522
     ObjectMemory oldSpaceCompressLimit
fe3a6359e13b added access to oldSpaceCompressLimit
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
  3523
    "
fe3a6359e13b added access to oldSpaceCompressLimit
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
  3524
!
fe3a6359e13b added access to oldSpaceCompressLimit
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
  3525
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3526
oldSpaceCompressLimit:amount
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3527
    "set the limit for oldSpace compression. If more memory than this
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3528
     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
  3529
     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
  3530
     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
  3531
     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
  3532
     you may want to increase this limit.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3533
     This method returns the previous increment value."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3534
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3535
    |result|
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3536
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3537
%{
15441
5a7d4a7de37d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15233
diff changeset
  3538
    extern unsigned INT __compressingGCLimit();
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3539
8983
ef429fa3d4e0 Allow oldSpace size >= 1 GByte (remove Smallinteger limit)
Stefan Vogel <sv@exept.de>
parents: 8963
diff changeset
  3540
    if (__isInteger(amount)) {
15441
5a7d4a7de37d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15233
diff changeset
  3541
	result = __MKUINT( __compressingGCLimit((unsigned INT)__unsignedLongIntVal(amount)) );
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3542
    }
5441
e88302747bbd rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5189
diff changeset
  3543
%}.
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3544
    result isNil ifTrue:[
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3545
	^ 0.
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3546
    ].
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3547
    self saveGarbageCollectorSetting:#oldSpaceCompressLimit: value:amount.
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3548
    ^ result.
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3549
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3550
    "to change the limit to 12Mb:"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3551
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3552
     ObjectMemory oldSpaceCompressLimit:12*1024*1024
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3553
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3554
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3555
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3556
oldSpaceIncrement
20422
94210802ce28 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20400
diff changeset
  3557
    "return the oldSpaceIncrement value. That's the amount by which
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3558
     more memory is allocated in case the oldSpace gets filled up.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3559
     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
  3560
     and there is no need to change it."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3561
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3562
%{  /* NOCONTEXT */
15441
5a7d4a7de37d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15233
diff changeset
  3563
    extern unsigned INT __oldSpaceIncrement();
5a7d4a7de37d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15233
diff changeset
  3564
5a7d4a7de37d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15233
diff changeset
  3565
    RETURN (__MKUINT( __oldSpaceIncrement((unsigned INT)-1) ));
5441
e88302747bbd rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5189
diff changeset
  3566
%}.
e88302747bbd rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5189
diff changeset
  3567
    ^ 0
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3568
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3569
     ObjectMemory oldSpaceIncrement
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3570
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3571
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3572
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3573
oldSpaceIncrement:amount
20422
94210802ce28 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20400
diff changeset
  3574
    "set the oldSpaceIncrement value. That's the amount by which
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3575
     more memory is allocated in case the oldSpace gets filled up.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3576
     In normal situations, the default value used in the VM is fine
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3577
     and there is no need to change it. This method returns the
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3578
     previous increment value."
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3579
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3580
    |result|
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3581
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3582
%{
15441
5a7d4a7de37d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15233
diff changeset
  3583
    extern unsigned INT __oldSpaceIncrement();
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3584
8983
ef429fa3d4e0 Allow oldSpace size >= 1 GByte (remove Smallinteger limit)
Stefan Vogel <sv@exept.de>
parents: 8963
diff changeset
  3585
    if (__isInteger(amount)) {
20422
94210802ce28 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20400
diff changeset
  3586
        result = __MKUINT( __oldSpaceIncrement((unsigned INT)__unsignedLongIntVal(amount)) );
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3587
    }
5441
e88302747bbd rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5189
diff changeset
  3588
%}.
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3589
    result isNil ifTrue:[
20422
94210802ce28 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20400
diff changeset
  3590
        ^ 0.
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3591
    ].
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3592
    self saveGarbageCollectorSetting:#oldSpaceIncrement: value:amount.
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3593
    ^ result.
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3594
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3595
    "to change increment to 1Meg:"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3596
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3597
     ObjectMemory oldSpaceIncrement:1024*1024
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3598
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3599
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3600
18778
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3601
preventTenureOf:anObject
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  3602
    "set the age of anObject to the never-tenure special age.
18778
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3603
     This prevents the object from ever going out of the new space,
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  3604
     and if used without care may lead to a filling of the newspace to a point,
18778
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3605
     where the system becomes inoperable.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3606
     Therefore it should only be used in very special situations.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3607
     One such situation may be to ensure that an object is finalized early by the next
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3608
     scavenge, and not by a (possibly late) old space collect.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3609
     To undo this setup (i.e. to allow the object to tenure again), set its age back to
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  3610
     any value with the setAgeOf:to: message.
18778
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3611
     If the object is already old, this call has no effect.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3612
     WARNING: this method is for ST/X experts only
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  3613
	      it is dangerous, should be used with care
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  3614
	      and it may be removed without notice"
18778
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3615
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3616
%{  /* NOCONTEXT */
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3617
#ifndef __SCHTEAM__
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3618
    if (__isNonNilObject(anObject)) {
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  3619
	__SET_AGE(anObject, NO_TENURE_AGE);
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  3620
    }
18778
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3621
#endif
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3622
%}
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3623
    "
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3624
    |p|
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3625
    p := Point new.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3626
    Transcript showCR:(ObjectMemory preventTenureOf:p).
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3627
    ObjectMemory tenuringScavenge.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3628
    Transcript showCR:(ObjectMemory ageOf:p).
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3629
    ObjectMemory tenure.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3630
    Transcript showCR:(ObjectMemory ageOf:p).
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3631
    ObjectMemory tenure.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3632
    ObjectMemory tenure.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3633
    ObjectMemory tenure.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3634
    Transcript showCR:(ObjectMemory ageOf:p).
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3635
    ObjectMemory setAgeOf:p to:30.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3636
    Transcript showCR:(ObjectMemory ageOf:p).
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3637
    ObjectMemory tenure.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3638
    Transcript showCR:(ObjectMemory ageOf:p).
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3639
    ObjectMemory tenure.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3640
    Transcript showCR:(ObjectMemory ageOf:p).
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3641
    "
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3642
!
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3643
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3644
setAgeOf:anObject to:newAge
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  3645
    "change the age of anObject.
18778
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3646
     This counts the number of scavenges that an object has survived in new space.
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  3647
     If it is set to 0, this makes GC think, that the object is just created, and it will
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  3648
     remain in eden for a longer time.
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  3649
     If it is set to a big number (say > 32), GC will think that it is old, and tenure it
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  3650
     with the next collect into old space. This later operation will get the object out of the way,
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  3651
     if it is well-known, that it will survive for a very long time.
18778
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3652
     For old space objects, this is a no-op.
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  3653
18778
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3654
     WARNING: this method is for ST/X debugging only
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  3655
	      it may be removed without notice"
18778
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3656
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3657
%{  /* NOCONTEXT */
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3658
#ifndef __SCHTEAM__
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3659
    if (__isNonNilObject(anObject) && __isSmallInteger(newAge)) {
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  3660
	int age = __intVal(newAge);
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  3661
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  3662
	if (age < 0) age = 0;
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  3663
	else if (age > AGE_MAX) age = AGE_MAX;
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20273
diff changeset
  3664
	__SET_AGE(anObject, age);
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  3665
    }
18778
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3666
#endif
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3667
%}
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3668
    "
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3669
    |p|
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3670
    p := Point new.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3671
    Transcript showCR:(ObjectMemory ageOf:p).
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3672
    ObjectMemory tenuringScavenge.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3673
    Transcript showCR:(ObjectMemory ageOf:p).
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3674
    ObjectMemory tenuringScavenge.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3675
    Transcript showCR:(ObjectMemory ageOf:p).
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3676
    ObjectMemory tenuringScavenge.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3677
    Transcript showCR:(ObjectMemory ageOf:p).
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3678
    ObjectMemory tenuringScavenge.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3679
    Transcript showCR:(ObjectMemory ageOf:p).
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3680
    ObjectMemory setAgeOf:p to:0.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3681
    Transcript showCR:(ObjectMemory ageOf:p).
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3682
    ObjectMemory tenuringScavenge.
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3683
    Transcript showCR:(ObjectMemory ageOf:p).
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3684
    "
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3685
!
17e71d0bbeda #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18777
diff changeset
  3686
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3687
tenureParameters:magic
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3688
    "this is pure magic and not for public eyes ...
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3689
     This method allows fine tuning the scavenger internals,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3690
     in cooperation to some statistic & test programs.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3691
     It is undocumented, secret and may vanish.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3692
     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
  3693
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3694
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3695
    __tenureParams(magic);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3696
%}.
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3697
    self saveGarbageCollectorSetting:#tenureParameters: value:magic.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3698
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3699
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3700
turnGarbageCollectorOff
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3701
    "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
  3702
     allocated directly in oldSpace (instead of newSpace)
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3703
     WARNING:
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3704
     This is somewhat dangerous: if collector is turned off,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3705
     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
  3706
     (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
  3707
     or even a compressing collect - making the overall realtime behavior worse.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3708
     Use this only for special purposes or when realtime behavior
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3709
     is required for a limited time period.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3710
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3711
     OBSOLETE: this is no longer supported
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3712
	       - 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
  3713
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3714
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3715
    __allocForceSpace(OLDSPACE);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3716
%}
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3717
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3718
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3719
turnGarbageCollectorOn
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3720
    "turn garbage collector on again (see ObjectMemory>>turnGarbageCollectorOff)"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3721
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3722
%{  /* NOCONTEXT */
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3723
    __allocForceSpace(9999);
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3724
%}
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3725
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3726
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3727
watchTenure:flag
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3728
    "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
  3729
     whenever objects are tenured from newSpace into oldSpace
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3730
     (except for an explicit tenure request).
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3731
     This can be used to validate that no oldSpace objects are created
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3732
     (i.e. the system operates fully in newSpace).
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3733
     Be careful, if the avoidTenure flag is not set,
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3734
     there will almost always be a tenure sooner or later.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3735
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3736
    EXPERIMENTAL - no warranty"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3737
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3738
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3739
    __watchTenure(flag == true ? 1 : 0);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3740
%}
178
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  3741
! !
4da1b10bf42c more GC control
claus
parents: 159
diff changeset
  3742
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3743
!ObjectMemory class methodsFor:'garbage collector settings'!
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3744
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3745
restoreGarbageCollectorSettings
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3746
   "restore the saved garbage collector settings"
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3747
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3748
   SavedGarbageCollectorSettings isEmptyOrNil ifTrue:[
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3749
	^ self.
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3750
   ].
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3751
   SavedGarbageCollectorSettings keysAndValuesDo:[:eachKey :eachValue|
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3752
	eachKey numArgs == 1 ifTrue:[
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3753
	    self perform:eachKey with:eachValue.
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3754
	] ifFalse:[
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3755
	    self perform:eachKey.
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3756
	].
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3757
   ].
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3758
!
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3759
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3760
saveGarbageCollectorSetting:aSymbol value:something
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3761
   "save some garbage collector setting, which is stored only in the VM,
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3762
    to be restored on snapshot return"
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3763
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3764
   SavedGarbageCollectorSettings isNil ifTrue:[
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  3765
	SavedGarbageCollectorSettings := IdentityDictionary new.
12781
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3766
   ].
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3767
   SavedGarbageCollectorSettings at:aSymbol put:something.
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3768
! !
1db2d89385ac Save garbage collector settings and reinstall them after snapIn
Stefan Vogel <sv@exept.de>
parents: 12650
diff changeset
  3769
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3770
!ObjectMemory class methodsFor:'interrupt handler access'!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3771
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3772
childSignalInterruptHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3773
    "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
  3774
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3775
    ^ ChildSignalInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3776
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3777
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3778
childSignalInterruptHandler:aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3779
    "set the handler for UNIX-death-of-a-childprocess-signal interrupts"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3780
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3781
    ChildSignalInterruptHandler := aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3782
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3783
    "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
  3784
    "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
  3785
!
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 797
diff changeset
  3786
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3787
customInterruptHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3788
    "return the handler for custom interrupts"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3789
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3790
    ^ CustomInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3791
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3792
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3793
customInterruptHandler:aHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3794
    "set the handler for custom interrupts"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3795
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3796
    CustomInterruptHandler := aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3797
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3798
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3799
disposeInterruptHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3800
    "return the handler for object disposal interrupts"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3801
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3802
    ^ DisposeInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3803
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3804
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3805
disposeInterruptHandler:aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3806
    "set the handler for object disposal interrupts"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3807
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3808
    DisposeInterruptHandler := aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3809
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3810
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3811
errorInterruptHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3812
    "return the handler for display error interrupts"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3813
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3814
    ^ ErrorInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3815
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3816
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3817
errorInterruptHandler:aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3818
    "set the handler for display error interrupts"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3819
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3820
    ErrorInterruptHandler := aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3821
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3822
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3823
exceptionInterruptHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3824
    "return the handler for floating point exception interrupts"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3825
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3826
    ^ ExceptionInterruptHandler
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
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3829
internalErrorHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3830
    "return the handler for ST/X internal errors.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3831
     An internal error is reported for example when a methods
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3832
     bytecode is not a ByteArray, the selector table is not an Array
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3833
     etc.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3834
     Those should not occur in normal circumstances."
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3835
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3836
    ^ InternalErrorHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3837
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3838
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3839
ioInterruptHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3840
    "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
  3841
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3842
    ^ IOInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3843
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3844
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3845
ioInterruptHandler:aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3846
    "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
  3847
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3848
    IOInterruptHandler := aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3849
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3850
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3851
recursionInterruptHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3852
    "return the handler for recursion/stack overflow interrupts"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3853
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3854
    ^ RecursionInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3855
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3856
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3857
recursionInterruptHandler:aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3858
    "set the handler for recursion/stack overflow interrupts"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3859
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3860
    RecursionInterruptHandler := aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3861
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3862
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3863
registerErrorInterruptHandler:aHandler forID:errorIDSymbol
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3864
    "register a handler"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3865
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3866
    RegisteredErrorInterruptHandlers isNil ifTrue:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3867
	RegisteredErrorInterruptHandlers := IdentityDictionary new
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3868
    ].
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3869
    RegisteredErrorInterruptHandlers at:errorIDSymbol put:aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3870
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3871
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3872
registeredErrorInterruptHandlers
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3873
    "return registered handlers"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3874
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3875
    ^ RegisteredErrorInterruptHandlers
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3876
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3877
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3878
signalInterruptHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3879
    "return the handler for UNIX-signal interrupts"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3880
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3881
    ^ SignalInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3882
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3883
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3884
signalInterruptHandler:aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3885
    "set the handler for UNIX-signal interrupts"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3886
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3887
    SignalInterruptHandler := aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3888
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3889
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3890
spyInterruptHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3891
    "return the handler for spy-timer interrupts"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3892
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3893
    ^ SpyInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3894
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3895
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3896
spyInterruptHandler:aHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3897
    "set the handler for spy-timer interrupts"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3898
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3899
    SpyInterruptHandler := aHandler
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
stepInterruptHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3903
    "return the handler for single step interrupts"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3904
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3905
    ^ StepInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3906
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3907
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3908
stepInterruptHandler:aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3909
    "set the handler for single step interrupts"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3910
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3911
    StepInterruptHandler := aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3912
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3913
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3914
timerInterruptHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3915
    "return the handler for timer interrupts"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3916
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3917
    ^ TimerInterruptHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3918
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3919
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3920
timerInterruptHandler:aHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3921
    "set the handler for timer interrupts"
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3922
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3923
    TimerInterruptHandler := aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3924
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3925
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3926
userInterruptHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3927
    "return the handler for CNTL-C interrupt handling"
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
    ^ UserInterruptHandler
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3930
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3931
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3932
userInterruptHandler:aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3933
    "set the handler for CNTL-C interrupt handling"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3934
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3935
    UserInterruptHandler := aHandler
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3936
! !
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3937
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  3938
!ObjectMemory class methodsFor:'interrupt statistics'!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3939
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3940
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
  3941
    "example implementation of latencyTime monitoring:
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3942
     This method simply measures the max-latency time.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3943
     You may want to use some other handler (see #interruptLatencyMonitor:)
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3944
     and extract more information (blocking context).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3945
     DEMO Example."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3946
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3947
    ms > MaxInterruptLatency ifTrue:[
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3948
	MaxInterruptLatency := ms.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3949
	'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
  3950
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3951
    (InterruptLatencyGoal notNil and:[ms > InterruptLatencyGoal]) ifTrue:[
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3952
	'*** IRQ REALTIME-DEADLINE MISSED: ' errorPrint.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3953
	cls errorPrint.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3954
	' ' errorPrint. sel errorPrint. '(' errorPrint. vmActivity errorPrint . ') ---> ' errorPrint.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3955
	ms errorPrintCR.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3956
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3957
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3958
    "to enable the demo handler:
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3959
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3960
     ObjectMemory resetMaxInterruptLatency.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3961
     ObjectMemory interruptLatencyMonitor:ObjectMemory.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3962
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3963
    "to disable timing statistics:
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
     ObjectMemory interruptLatencyMonitor:nil.
8556
96a185c5058d Use #referencesObject instead of #references:
Stefan Vogel <sv@exept.de>
parents: 8543
diff changeset
  3966
     ObjectMemory maxInterruptLatency printCR.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3967
    "
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3968
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3969
    "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
  3970
    "Modified: 18.6.1996 / 14:15:52 / stefan"
2138
351dc4abad0e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2131
diff changeset
  3971
    "Modified: 10.1.1997 / 19:09:53 / cg"
615
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
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3974
interruptLatencyGoal:millis
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3975
    "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
  3976
     met due to blocked interrupts or long primitives or GC activity.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3977
     An argument of nil clears the check.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3978
     DEMO Example."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3979
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3980
    InterruptLatencyGoal := millis.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3981
    millis isNil ifTrue:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3982
	InterruptLatencyMonitor := nil.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3983
    ] ifFalse:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3984
	MaxInterruptLatency := 0.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3985
	InterruptLatencyMonitor := self.
615
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
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3988
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3989
     ObjectMemory interruptLatencyGoal:50
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3990
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3991
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3992
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3993
interruptLatencyMonitor
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  3994
    "return the interrupt-latency-monitor if any.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3995
     See comment in #interruptLatencyMonitor:.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  3996
     This is a non-standard debugging/realtime instrumentation entry."
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3997
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  3998
    ^ InterruptLatencyMonitor
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
interruptLatencyMonitor:aHandler
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4002
    "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
  4003
     an interruptLatency: message with the millisecond delay between
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4004
     the interrupt and its handling.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4005
     This is a non-standard debugging/realtime instrumentation entry."
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4006
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4007
    InterruptLatencyMonitor := aHandler
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4008
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4009
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4010
maxInterruptLatency
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4011
    "return the maximum accumulated interrupt latency in millis.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4012
     DEMO Example."
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4013
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4014
    ^ MaxInterruptLatency
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4015
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4016
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4017
resetMaxInterruptLatency
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4018
    "reset the maximum accumulated interrupt latency probe time.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4019
     DEMO Example."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4020
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4021
    MaxInterruptLatency := 0
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4022
! !
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4023
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4024
!ObjectMemory class methodsFor:'just in time compilation'!
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4025
2099
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4026
byteCodeSizeLimitForDynamicCompilation:aNumber
2526
d600b7b0c13e comments
Claus Gittinger <cg@exept.de>
parents: 2525
diff changeset
  4027
    "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
  4028
     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
  4029
     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
  4030
     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
  4031
     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
  4032
     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
  4033
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4034
%{  /* NOCONTEXT */
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4035
    extern int __byteCodeSizeLimitForDynamicCompilation();
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4036
    int prev;
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4037
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4038
    prev = __byteCodeSizeLimitForDynamicCompilation(
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4039
				    __isSmallInteger(aNumber)
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4040
				    ? __intVal(aNumber)
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4041
				    : -1);
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  4042
    RETURN (__mkSmallInteger(prev));
2099
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4043
%}.
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4044
    ^ 0
2099
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4045
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4046
    "
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4047
     ObjectMemory byteCodeSizeLimitForDynamicCompilation:nil
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4048
     ObjectMemory byteCodeSizeLimitForDynamicCompilation:8000
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4049
    "
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4050
!
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4051
2638
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  4052
codeForCPU:aCPUSymbol
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  4053
    "instruct the just in time compiler that some specific CPU
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  4054
     is present (forcing it to generate code for that).
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  4055
     The default is set correct for the architecture, and the
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  4056
     runTime system tries to figure out the cpu - but who knows ...
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  4057
     The valid symbols depend on the architecture:
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4058
	i386:   #i486 / #i586           (affects code ordering)
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4059
	sparc:  #sparcV8 / #sparcV8     (affects instruction set)
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4060
	mips:   #rs2000 / #rs4000       (affects delay slot generation)
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4061
     This method returns the current setting; a nil arg will not change
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4062
     the setting (but only return the current).
2638
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  4063
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  4064
     This is a nonstandard entry and may be removed without notice -
2638
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  4065
     not for the general user."
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  4066
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  4067
%{  /* NOCONTEXT */
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4068
    extern OBJ __codeForCPU();
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4069
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4070
    RETURN (__codeForCPU(aCPUSymbol));
2638
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  4071
%}.
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4072
    ^ nil
2638
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  4073
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  4074
    "
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4075
     ObjectMemory codeForCPU:nil
2638
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  4076
     ObjectMemory codeForCPU:#i486
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  4077
     ObjectMemory codeForCPU:#i586
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  4078
    "
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  4079
!
2f29d1634bdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2580
diff changeset
  4080
2099
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4081
codeSizeLimitForDynamicCompilation:aNumber
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4082
    "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
  4083
     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
  4084
     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
  4085
     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
  4086
     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
  4087
     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
  4088
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4089
%{  /* NOCONTEXT */
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4090
    extern int __codeSizeLimitForDynamicCompilation();
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4091
    int prev;
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4092
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4093
    prev = __codeSizeLimitForDynamicCompilation( __isSmallInteger(aNumber)
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4094
				    ? __intVal(aNumber)
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4095
				    : -1);
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  4096
    RETURN (__mkSmallInteger(prev));
2099
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4097
%}.
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4098
    ^ 0
2099
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4099
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4100
    "
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4101
     ObjectMemory codeSizeLimitForDynamicCompilation:nil
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4102
     ObjectMemory codeSizeLimitForDynamicCompilation:8000
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4103
    "
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4104
!
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4105
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4106
compiledCodeCounter
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4107
    "return the number of additional code-bytes which
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4108
     were generated since the counter was last reset"
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4109
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4110
%{  /* NOCONTEXT */
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4111
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4112
    extern __compiledCodeCounter();
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4113
    int nBytes;
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4114
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4115
    nBytes = __compiledCodeCounter();
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  4116
    RETURN (__mkSmallInteger(nBytes));
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4117
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4118
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4119
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4120
    "
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4121
     ObjectMemory compiledCodeCounter
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4122
    "
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4123
!
1637
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4124
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4125
compiledCodeSpaceUsed
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4126
    "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
  4127
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4128
%{  /* NOCONTEXT */
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4129
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4130
    extern __compiledCodeSpaceUsed();
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4131
    int nBytes;
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4132
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4133
    nBytes = __compiledCodeSpaceUsed();
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  4134
    RETURN (__mkSmallInteger(nBytes));
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4135
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4136
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4137
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4138
    "
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4139
     ObjectMemory compiledCodeSpaceUsed
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4140
    "
1637
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4141
!
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4142
1948
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  4143
fullSingleStepSupport
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  4144
    "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
  4145
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  4146
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4147
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4148
    return __c__._RETURN_false();
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4149
#else
1948
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  4150
    extern int __fullSingleStep();
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  4151
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  4152
    RETURN (__fullSingleStep(-1) ? true : false);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4153
#endif
1948
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  4154
%}
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  4155
    "
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  4156
     ObjectMemory fullSingleStepSupport
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  4157
    "
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  4158
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  4159
!
ca8c3f2f5374 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  4160
1795
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4161
fullSingleStepSupport:aBoolean
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  4162
    "enable/disable full single step support for the just-in-time-compiled code.
1795
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4163
     If off, things like simple increment/decrement, additions and variable-
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4164
     stores are not steppable, but treated like atomar invisible operations.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  4165
     If on, single step halts at those operations.
1795
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4166
     Execution is a bit slower if enabled."
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4167
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4168
%{  /* NOCONTEXT */
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4169
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4170
    return __c__._RETURN_false();
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4171
#else
1795
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4172
    extern int __fullSingleStep();
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4173
    int prev;
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4174
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4175
    prev = __fullSingleStep(aBoolean == true
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4176
				   ? 1
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4177
				   : (aBoolean == false)
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4178
					? 0
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4179
					: -1);
1795
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4180
    RETURN (prev ? true : false);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4181
#endif
1795
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4182
%}
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4183
    "
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4184
     ObjectMemory fullSingleStepSupport:true
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4185
     ObjectMemory fullSingleStepSupport:false
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4186
    "
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4187
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4188
!
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4189
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4190
getCompiledCodeLimit
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4191
    "get the codeLimit from the VM"
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4192
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4193
%{  /* NOCONTEXT */
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4194
    extern int __dynamicCodeLimit();
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4195
    int limit;
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4196
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4197
    limit = __dynamicCodeLimit();
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4198
    if (limit) {
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  4199
	RETURN (__mkSmallInteger(limit));
1795
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4200
    }
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4201
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4202
    ^ nil
1795
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4203
!
736f97664aaf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  4204
2099
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4205
insnSizeLimitForDynamicCompilation:aNumber
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4206
    "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
  4207
     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
  4208
     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
  4209
     internal insns are generated.
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4210
     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
  4211
     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
  4212
     systems.
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4213
     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
  4214
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4215
%{  /* NOCONTEXT */
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4216
    extern int __insnSizeLimitForDynamicCompilation();
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4217
    int prev;
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4218
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4219
    prev = __insnSizeLimitForDynamicCompilation( __isSmallInteger(aNumber)
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4220
				    ? __intVal(aNumber)
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4221
				    : -1);
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  4222
    RETURN (__mkSmallInteger(prev));
2099
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4223
%}.
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4224
    ^ 0
2099
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4225
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4226
    "
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4227
     ObjectMemory insnSizeLimitForDynamicCompilation:nil
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4228
     ObjectMemory insnSizeLimitForDynamicCompilation:8000
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4229
    "
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4230
!
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4231
3912
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4232
javaJustInTimeCompilation
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4233
    "return the value of the java-just-in-time-compilation flag"
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4234
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4235
%{  /* NOCONTEXT */
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4236
    extern int __javaJustInTimeCompilation();
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4237
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4238
    RETURN (__javaJustInTimeCompilation(-1) ? true : false);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4239
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4240
    ^ false
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4241
3912
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4242
    "
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4243
     ObjectMemory javaJustInTimeCompilation
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4244
    "
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4245
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4246
!
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4247
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4248
javaJustInTimeCompilation:aBoolean
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4249
    "enable/disable java just-in-time-compilation."
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4250
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4251
    aBoolean notNil ifTrue:[
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4252
	JavaJustInTimeCompilationEnabled := aBoolean.
3912
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4253
    ].
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4254
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4255
%{  /* NOCONTEXT */
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4256
    extern int __javaJustInTimeCompilation();
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4257
    int prev;
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4258
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4259
    prev = __javaJustInTimeCompilation(aBoolean == true
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4260
				   ? 1
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4261
				   : (aBoolean == false)
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4262
					? 0
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4263
					: -1);
3912
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4264
    RETURN (prev ? true : false);
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4265
%}.
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4266
    "
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4267
     ObjectMemory javaJustInTimeCompilation:true
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4268
     ObjectMemory javaJustInTimeCompilation:false
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4269
    "
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4270
!
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4271
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4272
javaNativeCodeOptimization
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4273
    "return the value of the java-native-code-optimization flag"
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4274
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4275
%{  /* NOCONTEXT */
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4276
    extern int __javaNativeCodeOptimization();
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4277
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4278
    RETURN (__javaNativeCodeOptimization(-1) ? true : false);
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4279
%}
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4280
    "
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4281
     ObjectMemory javaNativeCodeOptimization
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4282
    "
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4283
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4284
!
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4285
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4286
javaNativeCodeOptimization:aBoolean
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4287
    "enable/disable java native code-optimization."
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4288
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4289
    aBoolean notNil ifTrue:[
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4290
	JavaNativeCodeOptimization := aBoolean.
3912
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4291
    ].
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4292
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4293
%{  /* NOCONTEXT */
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4294
    extern int __javaNativeCodeOptimization();
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4295
    int prev;
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4296
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4297
    prev = __javaNativeCodeOptimization(aBoolean == true
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4298
				   ? 1
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4299
				   : (aBoolean == false)
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4300
					? 0
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4301
					: -1);
3912
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4302
    RETURN (prev ? true : false);
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4303
%}.
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4304
    "
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4305
     ObjectMemory javaNativeCodeOptimization:true
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4306
     ObjectMemory javaNativeCodeOptimization:false
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4307
    "
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4308
!
17535909fa49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4309
1947
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  4310
justInTimeCompilation
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  4311
    "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
  4312
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  4313
%{  /* NOCONTEXT */
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  4314
    extern int __justInTimeCompilation();
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  4315
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  4316
    RETURN (__justInTimeCompilation(-1) ? true : false);
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  4317
%}
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  4318
    "
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  4319
     ObjectMemory justInTimeCompilation
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  4320
    "
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  4321
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  4322
!
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  4323
1637
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4324
justInTimeCompilation:aBoolean
1947
7ef53563e2f9 added a separate query for justInTimeCompilation
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
  4325
    "enable/disable just-in-time-compilation."
1637
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4326
1939
214f42e29868 remember just-in-time state in image
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  4327
    aBoolean notNil ifTrue:[
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4328
	JustInTimeCompilationEnabled := aBoolean.
1939
214f42e29868 remember just-in-time state in image
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  4329
    ].
214f42e29868 remember just-in-time state in image
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  4330
1637
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4331
%{  /* NOCONTEXT */
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4332
    extern int __justInTimeCompilation();
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4333
    int prev;
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4334
1657
41d53ff72de9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  4335
    prev = __justInTimeCompilation(aBoolean == true
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4336
				   ? 1
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4337
				   : (aBoolean == false)
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4338
					? 0
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4339
					: -1);
1637
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4340
    RETURN (prev ? true : false);
2017
fb9627540d0b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1948
diff changeset
  4341
%}.
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4342
    ^ false
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4343
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4344
    "
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4345
     ObjectMemory justInTimeCompilation:true
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4346
     ObjectMemory justInTimeCompilation:false
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4347
    "
2017
fb9627540d0b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1948
diff changeset
  4348
!
fb9627540d0b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1948
diff changeset
  4349
13421
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4350
optimizeContexts
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4351
    "return the setting of the optimize contexts flag"
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4352
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4353
%{  /* NOCONTEXT */
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4354
    extern int __optimizeContexts();
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4355
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4356
    RETURN (__optimizeContexts(-1) ? true : false);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4357
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4358
    ^ false
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4359
13421
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4360
    "
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4361
     ObjectMemory optimizeContexts
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4362
    "
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4363
!
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4364
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4365
optimizeContexts:aBoolean
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4366
    "enable/disable restartable contexts for the just-in-time-compiled code.
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4367
     If off, contexts that does not contain blocks are not restartable.
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4368
     Execution is a bit slower if enabled."
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4369
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4370
%{  /* NOCONTEXT */
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4371
    extern int __optimizeContexts();
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4372
    int prev;
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4373
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4374
    prev = __optimizeContexts(aBoolean == true
15441
5a7d4a7de37d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15233
diff changeset
  4375
				   ? 1
5a7d4a7de37d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15233
diff changeset
  4376
				   : (aBoolean == false)
5a7d4a7de37d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15233
diff changeset
  4377
					? 0
5a7d4a7de37d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15233
diff changeset
  4378
					: -1);
13421
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4379
    RETURN (prev ? true : false);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4380
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4381
    ^ false
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4382
13421
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4383
    "
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4384
     ObjectMemory optimizeContexts:true
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4385
     ObjectMemory optimizeContexts:false
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4386
    "
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4387
!
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  4388
1940
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  4389
reEnableJustInTimeCompilation
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  4390
    "to be called after a snapshot restart; if justInTimeCompiler
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  4391
     was enabled before, do it again.
1940
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  4392
     For now, this is not done automatically, to allow restarting
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  4393
     a system with the dynamic compiler turned off (its still experimental).
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  4394
     Therefore, this reenabling is done in the smalltalk_r.rc file."
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  4395
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  4396
    JustInTimeCompilationEnabled == true ifTrue:[
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4397
	self justInTimeCompilation:true
3913
19c1b6007f28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3912
diff changeset
  4398
    ].
19c1b6007f28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3912
diff changeset
  4399
    JavaJustInTimeCompilationEnabled == true ifTrue:[
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4400
	self javaJustInTimeCompilation:true
3913
19c1b6007f28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3912
diff changeset
  4401
    ].
19c1b6007f28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3912
diff changeset
  4402
    JavaNativeCodeOptimization == true ifTrue:[
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4403
	self javaNativeCodeOptimization:true
3913
19c1b6007f28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3912
diff changeset
  4404
    ].
19c1b6007f28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3912
diff changeset
  4405
19c1b6007f28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3912
diff changeset
  4406
    "Modified: / 5.11.1998 / 15:00:00 / cg"
1940
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  4407
!
6dabd5d2b75c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  4408
1770
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  4409
resetCompiledCodeCounter
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  4410
    "reset the counter of additional code-bytes"
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  4411
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  4412
%{  /* NOCONTEXT */
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  4413
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  4414
    extern void __resetDynamicCodeGeneratedCounter();
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  4415
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  4416
    __resetDynamicCodeGeneratedCounter();
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  4417
%}
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  4418
    "
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  4419
     ObjectMemory resetCompiledCodeCounter
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  4420
    "
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  4421
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  4422
!
2fb34e801860 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
  4423
1769
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  4424
setCompiledCodeLimit:newLimit
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  4425
    "set the VM's limit"
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  4426
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  4427
%{  /* NOCONTEXT */
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  4428
    extern __setDynamicCodeLimit();
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  4429
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  4430
    if (__isSmallInteger(newLimit)) {
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  4431
	__setDynamicCodeLimit(__intVal(newLimit));
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  4432
    } else if (newLimit == nil) {
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  4433
	__setDynamicCodeLimit(0);
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  4434
    }
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  4435
%}
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  4436
!
8692613186c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  4437
1637
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4438
supportsJustInTimeCompilation
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4439
    "return true, if this system supports just-in-time-compilation of
20822
a41b72875124 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20701
diff changeset
  4440
     bytecode to machine code. Don't confuse this with stc-compilation."
1637
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4441
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4442
%{  /* NOCONTEXT */
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4443
    extern int __canDoJustInTimeCompilation();
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4444
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4445
    RETURN (__canDoJustInTimeCompilation() ? true : false);
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4446
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4447
    ^ false
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4448
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4449
    "
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4450
     ObjectMemory supportsJustInTimeCompilation
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4451
    "
1637
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4452
! !
0548117601bd more queries for just-in-time compiler
Claus Gittinger <cg@exept.de>
parents: 1503
diff changeset
  4453
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4454
!ObjectMemory class methodsFor:'low memory handling'!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4455
3781
d35bce118ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3761
diff changeset
  4456
allocationFailed
d35bce118ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3761
diff changeset
  4457
    "memory allocation has failed in the VM
d35bce118ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3761
diff changeset
  4458
     This is triggered by the runtime system (or possibly by
d35bce118ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3761
diff changeset
  4459
     a user primitive)"
d35bce118ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3761
diff changeset
  4460
8963
e81373595ecf Take care not to allocate memory in #lowSpaceCleanup
Stefan Vogel <sv@exept.de>
parents: 8913
diff changeset
  4461
    ^ AllocationFailure raiseRequest
3781
d35bce118ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3761
diff changeset
  4462
!
d35bce118ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3761
diff changeset
  4463
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4464
memoryInterrupt
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4465
    "when a low-memory condition arises, ask all classes to
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4466
     remove possibly cached data. You may help the system a bit,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4467
     in providing a lowSpaceCleanup method in your classes which have
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4468
     lots of data kept somewhere (usually, cached data).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4469
     - this may or may not help."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4470
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  4471
    self changed:#memoryLow.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4472
    self performLowSpaceCleanup.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4473
"/    self error:'almost out of memory'
2131
1eeb310e109a newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
  4474
    'ObjectMemory [warning]: almost out of memory' errorPrintCR.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4475
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4476
    LowSpaceSemaphore signalIf.
1160
1a30ffb90937 separated #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
  4477
2131
1eeb310e109a newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
  4478
    "Modified: 10.1.1997 / 17:59:31 / cg"
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4479
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4480
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4481
performLowSpaceCleanup
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  4482
    "ask all classes to remove possibly cached data.
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  4483
     You may help the system a bit, in providing a lowSpaceCleanup method
13573
3de2d68dda25 comment: #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 13421
diff changeset
  4484
     in your classes which have lots of data kept somewhere (usually, cached data).
3de2d68dda25 comment: #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 13421
diff changeset
  4485
     Notice: it may never hurt to call lowSpaceCleanup (i.e. the data must always be
3de2d68dda25 comment: #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 13421
diff changeset
  4486
     reconstructable)"
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4487
8963
e81373595ecf Take care not to allocate memory in #lowSpaceCleanup
Stefan Vogel <sv@exept.de>
parents: 8913
diff changeset
  4488
    "avoid to allocate memory here - so don't send Smalltalk>>allClassesDo:,
e81373595ecf Take care not to allocate memory in #lowSpaceCleanup
Stefan Vogel <sv@exept.de>
parents: 8913
diff changeset
  4489
     which allocates an IdentitySet"
e81373595ecf Take care not to allocate memory in #lowSpaceCleanup
Stefan Vogel <sv@exept.de>
parents: 8913
diff changeset
  4490
e81373595ecf Take care not to allocate memory in #lowSpaceCleanup
Stefan Vogel <sv@exept.de>
parents: 8913
diff changeset
  4491
    Smalltalk do:[:eachGlobal|
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  4492
	eachGlobal isBehavior ifTrue:[
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  4493
	    eachGlobal lowSpaceCleanup
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  4494
	].
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4495
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4496
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  4497
    "
13573
3de2d68dda25 comment: #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 13421
diff changeset
  4498
     ObjectMemory performLowSpaceCleanup
3de2d68dda25 comment: #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 13421
diff changeset
  4499
    "
3de2d68dda25 comment: #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 13421
diff changeset
  4500
3de2d68dda25 comment: #performLowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 13421
diff changeset
  4501
    "Created: / 12-04-1996 / 14:57:28 / cg"
362
claus
parents: 360
diff changeset
  4502
! !
claus
parents: 360
diff changeset
  4503
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4504
!ObjectMemory class methodsFor:'object finalization'!
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  4505
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4506
allChangedShadowObjectsDo:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4507
    "evaluate the argument, aBlock for all known shadow objects which have
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4508
     lost a pointer recently."
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  4509
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  4510
    __allChangedShadowObjectsDo(&aBlock);
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  4511
%}
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  4512
!
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  4513
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  4514
backgroundFinalizationProcess
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  4515
    "return the backgroundFinalizationProcess (or nil, if noone is running)"
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  4516
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  4517
    ^ BackgroundFinalizationProcess
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  4518
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  4519
    "Created: / 4.8.1998 / 02:00:13 / cg"
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  4520
!
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  4521
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4522
disposeInterrupt
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4523
    "this is triggered by the garbage collector,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4524
     whenever any shadowArray looses a pointer."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4525
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4526
    FinalizationSemaphore notNil ifTrue:[
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4527
	"/
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4528
	"/ background finalizer is waiting ...
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4529
	"/
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4530
	FinalizationSemaphore signalOnce
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  4531
    ] ifFalse:[
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4532
	"/
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4533
	"/ do it right here
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4534
	"/
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  4535
	self finalize
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  4536
    ]
2160
ae0c0525ff2d only signal finalizationSema once
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
  4537
ae0c0525ff2d only signal finalizationSema once
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
  4538
    "Modified: 13.1.1997 / 17:26:16 / cg"
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  4539
!
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  4540
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4541
finalize
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4542
    "tell all weak objects that something happened."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4543
20701
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
  4544
    FinalizerAccessLock critical:[
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
  4545
        self allChangedShadowObjectsDo:[:aShadowArray |
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
  4546
            Error handle:[:ex |
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
  4547
                'ObjectMemory [warning]: caught error in weakArray processing: ' errorPrint.
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
  4548
                ex description errorPrintCR.
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
  4549
                ex suspendedContext fullPrintAllLevels:10.
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
  4550
                "Restart the do block to clean up the rest of the shadow array.
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
  4551
                 This is safe here, because the old executor that triggered the error
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
  4552
                 has already been removed from the Registry"
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
  4553
                ex restart.
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
  4554
            ] do:[
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
  4555
                aShadowArray lostPointer.
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
  4556
            ].
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
  4557
        ].
2099
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4558
    ].
20701
32a0109f2ccb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20478
diff changeset
  4559
    
2099
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4560
    "/ we should change the setup,
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4561
    "/ to make the Dependencies collection a dependent
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4562
    "/ of all the WeakArrays and WeakIDSets there,
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4563
    "/ and send a changed message when any of them looses
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  4564
    "/ a pointer.
2100
1a356c6d25d0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2099
diff changeset
  4565
    "/ This would automize the send below.
1a356c6d25d0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2099
diff changeset
  4566
    "/
1a356c6d25d0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2099
diff changeset
  4567
    "/ WARNING:
1a356c6d25d0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2099
diff changeset
  4568
    "/   this can only be done, if the WeakIDSet holds its
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  4569
    "/   dependends itself (like a WeakArray),
2100
1a356c6d25d0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2099
diff changeset
  4570
    "/   otherwise we might get trouble.
1a356c6d25d0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2099
diff changeset
  4571
    "/   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
  4572
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4573
    Dependencies removeEmptyDependencyValues
dd8e237f87e5 clean up weakArrays in the Dependency collection
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4574
3885
b699abd9476f catch errors while finalizing
Claus Gittinger <cg@exept.de>
parents: 3859
diff changeset
  4575
    "Modified: / 19.10.1998 / 22:03:12 / cg"
4675
33eb346aff9c checkin from browser
ps
parents: 4621
diff changeset
  4576
    "Modified: / 3.9.1999 / 14:03:05 / ps"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4577
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4578
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4579
startBackgroundFinalizationAt:aPriority
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4580
    "start a process doing finalization work in the background.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4581
     Can be used to reduce the pauses created by finalization.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4582
     Normally, these pauses are not noticed; however if you have (say)
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4583
     ten thousands of weak objects, these could become long enough to
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4584
     make background finalization usefull.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4585
     WARNING: background finalization may lead to much delayed freeing of
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4586
     system resources. Especially, you may temporarily run out of free
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4587
     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
  4588
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4589
    |p|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4590
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4591
    "/
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4592
    "/ its not useful, to run it more than once
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4593
    "/
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4594
    BackgroundFinalizationProcess notNil ifTrue:[
10660
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  4595
	BackgroundFinalizationProcess priority:aPriority.
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  4596
	^ self
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4597
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4598
2262
4c4d810f006f semaphore names
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  4599
    FinalizationSemaphore := Semaphore new name:'FinalizationSemaphore'.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4600
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4601
    p :=
10660
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  4602
	[
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  4603
	    [
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  4604
		[true] whileTrue:[
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  4605
		    "
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  4606
		     wait till something to do ...
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  4607
		    "
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  4608
		    FinalizationSemaphore wait.
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  4609
		    "
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  4610
		     ... and do it
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  4611
		    "
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  4612
		    self finalize
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  4613
		]
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  4614
	    ] ifCurtailed:[
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  4615
		BackgroundFinalizationProcess := nil.
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  4616
		FinalizationSemaphore := nil
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  4617
	    ]
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  4618
	] newProcess.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4619
    p name:'background finalizer'.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4620
    p priority:aPriority.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4621
    p restartable:true.
10493
ed3649e79223 Start background processes as system processes (background collector and finalizer)
Stefan Vogel <sv@exept.de>
parents: 10226
diff changeset
  4622
    p beSystemProcess.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4623
    p resume.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4624
    BackgroundFinalizationProcess := p
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  4625
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  4626
    "
10493
ed3649e79223 Start background processes as system processes (background collector and finalizer)
Stefan Vogel <sv@exept.de>
parents: 10226
diff changeset
  4627
     ObjectMemory stopBackgroundFinalization.
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  4628
     ObjectMemory startBackgroundFinalizationAt:5
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  4629
    "
3733
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  4630
d287d4fc20ae comments & documentation;
Claus Gittinger <cg@exept.de>
parents: 3729
diff changeset
  4631
    "Modified: / 5.8.1998 / 14:53:27 / cg"
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4632
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4633
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4634
stopBackgroundFinalization
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4635
    "stop the background finalizer"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4636
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4637
    BackgroundFinalizationProcess notNil ifTrue:[
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4638
	BackgroundFinalizationProcess terminate.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4639
	BackgroundFinalizationProcess := nil
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4640
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4641
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4642
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4643
     ObjectMemory stopBackgroundFinalization
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4644
    "
290
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  4645
! !
23994c0a7f7b *** empty log message ***
claus
parents: 282
diff changeset
  4646
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4647
!ObjectMemory class methodsFor:'physical memory access'!
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  4648
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4649
collectedOldSpacePagesDo:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4650
    "evaluates aBlock for all pages in the prev. oldSpace, passing
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  4651
     the pages address as argument.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4652
     For internal & debugging use only."
23079
48844c90b8aa Make `ObjectMemory >> #collectedOldSpacePagesDo:` obsolete
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21242
diff changeset
  4653
48844c90b8aa Make `ObjectMemory >> #collectedOldSpacePagesDo:` obsolete
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21242
diff changeset
  4654
    <resource: #obsolete>
48844c90b8aa Make `ObjectMemory >> #collectedOldSpacePagesDo:` obsolete
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21242
diff changeset
  4655
48844c90b8aa Make `ObjectMemory >> #collectedOldSpacePagesDo:` obsolete
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21242
diff changeset
  4656
    ^ self error: 'Not supported since Smalltalk/X 8.0.0'.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4657
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4658
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4659
newSpacePagesDo:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4660
    "evaluates aBlock for all pages in the newSpace, passing
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4661
     the pages address as argument.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4662
     For internal & debugging use only."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4663
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  4664
    if (__newSpacePagesDo(&aBlock) < 0) {
159
514c749165c3 *** empty log message ***
claus
parents: 133
diff changeset
  4665
	RETURN (false);
85
claus
parents: 77
diff changeset
  4666
    }
claus
parents: 77
diff changeset
  4667
%}.
claus
parents: 77
diff changeset
  4668
    ^ true
claus
parents: 77
diff changeset
  4669
!
claus
parents: 77
diff changeset
  4670
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4671
oldSpacePagesDo:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4672
    "evaluates aBlock for all pages in the oldSpace, passing
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  4673
     the pages address as argument.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4674
     For internal & debugging use only."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4675
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  4676
    if (__oldSpacePagesDo(&aBlock) < 0) {
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
  4677
	RETURN (false);
85
claus
parents: 77
diff changeset
  4678
    }
claus
parents: 77
diff changeset
  4679
%}.
claus
parents: 77
diff changeset
  4680
    ^ true
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4681
!
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
pageIsInCore:aPageNumber
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4684
    "return true, if the page (as enumerated via oldSpacePagesDo:)
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4685
     is in memory; false, if currently paged out. For internal
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4686
     use / monitors only; may vanish.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4687
     NOTICE: not all systems provide this information; on those that
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4688
     do not, true is returned for all pages."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4689
%{
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4690
#ifdef HAS_MINCORE
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4691
    int pageSize = getpagesize();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4692
    char result[10];
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4693
    INT addr;
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4694
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4695
    if (__isSmallInteger(aPageNumber)) {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4696
	addr = __intVal(aPageNumber) & ~(pageSize - 1);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4697
    } else {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4698
	addr = ((INT)aPageNumber) & ~(pageSize - 1);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4699
    }
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4700
    if (mincore(addr, pageSize-1, result) < 0) {
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4701
	RETURN (true);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4702
    }
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4703
    RETURN ((result[0] & 1) ? true : false);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4704
#endif
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4705
%}.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4706
    "OS does not supply this info - assume yes"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4707
    ^ true
85
claus
parents: 77
diff changeset
  4708
! !
claus
parents: 77
diff changeset
  4709
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  4710
!ObjectMemory class methodsFor:'queries'!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4711
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4712
bytesUsed
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4713
    "return the number of bytes allocated for objects -
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4714
     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
  4715
     (i.e. not yet reclaimed by the garbage collector).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4716
     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
  4717
     objects and ask for the bytesize using ObjectMemory>>sizeOf:."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4718
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4719
%{  /* NOCONTEXT */
14649
cec1b4965e5d 64bit changes
Claus Gittinger <cg@exept.de>
parents: 14622
diff changeset
  4720
    extern unsigned INT __oldSpaceUsed(), __freeListSpace();
cec1b4965e5d 64bit changes
Claus Gittinger <cg@exept.de>
parents: 14622
diff changeset
  4721
    extern unsigned int __newSpaceUsed();
cec1b4965e5d 64bit changes
Claus Gittinger <cg@exept.de>
parents: 14622
diff changeset
  4722
cec1b4965e5d 64bit changes
Claus Gittinger <cg@exept.de>
parents: 14622
diff changeset
  4723
    RETURN ( __MKUINT(__oldSpaceUsed() + (INT)__newSpaceUsed() - __freeListSpace()) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4724
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4725
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4726
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4727
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  4728
     ObjectMemory bytesUsed
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4729
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4730
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4731
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4732
collectObjectsWhich:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4733
    "helper for the whoReferences queries. Returns a collection
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4734
     of objects for which aBlock returns true."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4735
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4736
    |aCollection|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4737
15011
c34a4f4a216f class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 14721
diff changeset
  4738
    aCollection := OrderedCollection new.
c34a4f4a216f class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 14721
diff changeset
  4739
    self allObjectsIncludingContextsDo:[:o |
15441
5a7d4a7de37d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15233
diff changeset
  4740
	(aBlock value:o) ifTrue:[
5a7d4a7de37d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15233
diff changeset
  4741
	    aCollection add:o
5a7d4a7de37d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15233
diff changeset
  4742
	]
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4743
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4744
    (aCollection size == 0) ifTrue:[
15441
5a7d4a7de37d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15233
diff changeset
  4745
	"actually this cannot happen - there is always one"
5a7d4a7de37d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15233
diff changeset
  4746
	^ nil
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4747
    ].
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4748
    ^ aCollection
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4749
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4750
11554
1d045beabc5f Add queries for old space addresses
Stefan Vogel <sv@exept.de>
parents: 11334
diff changeset
  4751
collectedOldSpaceAddress
1d045beabc5f Add queries for old space addresses
Stefan Vogel <sv@exept.de>
parents: 11334
diff changeset
  4752
%{
14649
cec1b4965e5d 64bit changes
Claus Gittinger <cg@exept.de>
parents: 14622
diff changeset
  4753
#ifdef COLLECTEDOLD_ADDRESS
11554
1d045beabc5f Add queries for old space addresses
Stefan Vogel <sv@exept.de>
parents: 11334
diff changeset
  4754
    RETURN(__MKUINT(COLLECTEDOLD_ADDRESS));
14622
59306ad8f1be handle non-fix OLDSPACE
Claus Gittinger <cg@exept.de>
parents: 14381
diff changeset
  4755
#else
15643
8ca343d37d39 class: ObjectMemory
Stefan Vogel <sv@exept.de>
parents: 15632
diff changeset
  4756
    RETURN(__mkSmallInteger(0));
14622
59306ad8f1be handle non-fix OLDSPACE
Claus Gittinger <cg@exept.de>
parents: 14381
diff changeset
  4757
#endif
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4758
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4759
    ^ 0
11554
1d045beabc5f Add queries for old space addresses
Stefan Vogel <sv@exept.de>
parents: 11334
diff changeset
  4760
1d045beabc5f Add queries for old space addresses
Stefan Vogel <sv@exept.de>
parents: 11334
diff changeset
  4761
    "
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  4762
	self collectedOldSpaceAddress
11554
1d045beabc5f Add queries for old space addresses
Stefan Vogel <sv@exept.de>
parents: 11334
diff changeset
  4763
    "
1d045beabc5f Add queries for old space addresses
Stefan Vogel <sv@exept.de>
parents: 11334
diff changeset
  4764
!
1d045beabc5f Add queries for old space addresses
Stefan Vogel <sv@exept.de>
parents: 11334
diff changeset
  4765
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4766
fixSpaceSize
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4767
    "return the total size of the fix space."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4768
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4769
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4770
    extern unsigned __fixSpaceSize();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4771
14381
dd40729e4157 large memory
Claus Gittinger <cg@exept.de>
parents: 14243
diff changeset
  4772
    RETURN ( __MKUINT(__fixSpaceSize()) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4773
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4774
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4775
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4776
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4777
     ObjectMemory fixSpaceSize
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4778
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4779
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4780
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4781
fixSpaceUsed
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4782
    "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
  4783
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4784
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4785
    extern unsigned __fixSpaceUsed();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4786
14381
dd40729e4157 large memory
Claus Gittinger <cg@exept.de>
parents: 14243
diff changeset
  4787
    RETURN ( __MKUINT(__fixSpaceUsed()) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4788
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4789
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4790
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4791
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4792
     ObjectMemory fixSpaceUsed
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4793
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4794
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4795
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4796
freeListSpace
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4797
    "return the number of bytes in the free lists.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4798
     (which is included in oldSpaceUsed)"
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
%{  /* NOCONTEXT */
14649
cec1b4965e5d 64bit changes
Claus Gittinger <cg@exept.de>
parents: 14622
diff changeset
  4801
    extern unsigned INT __freeListSpace();
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4802
14381
dd40729e4157 large memory
Claus Gittinger <cg@exept.de>
parents: 14243
diff changeset
  4803
    RETURN ( __MKUINT(__freeListSpace()) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4804
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4805
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4806
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4807
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4808
     ObjectMemory freeListSpace
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4809
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4810
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4811
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4812
freeSpace
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4813
    "return the number of bytes in the compact free area.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4814
     (oldSpaceUsed + freeSpaceSize = oldSpaceSize)"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4815
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4816
%{  /* NOCONTEXT */
14649
cec1b4965e5d 64bit changes
Claus Gittinger <cg@exept.de>
parents: 14622
diff changeset
  4817
    extern unsigned INT __oldSpaceSize(), __oldSpaceUsed();
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4818
14381
dd40729e4157 large memory
Claus Gittinger <cg@exept.de>
parents: 14243
diff changeset
  4819
    RETURN ( __MKUINT(__oldSpaceSize() - __oldSpaceUsed()) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4820
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4821
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4822
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4823
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4824
     ObjectMemory freeSpace
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4825
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4826
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4827
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4828
garbageCollectCount
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4829
    "return the number of compressing collects that occurred since startup"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4830
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4831
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4832
    extern int __garbageCollectCount();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4833
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  4834
    RETURN (__mkSmallInteger(__garbageCollectCount()));
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4835
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4836
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4837
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4838
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  4839
     ObjectMemory garbageCollectCount
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4840
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4841
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4842
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4843
incrementalGCCount
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4844
    "return the number of incremental collects that occurred since startup"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4845
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4846
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4847
    extern int __incrementalGCCount();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4848
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  4849
    RETURN (__mkSmallInteger(__incrementalGCCount()));
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4850
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4851
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4852
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4853
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4854
     ObjectMemory incrementalGCCount
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4855
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4856
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4857
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4858
incrementalGCPhase
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4859
    "returns the internal state of the incremental GC.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4860
     The meaning of those numbers is a secret :-).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4861
     (for the curious: (currently)
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4862
      2 is idle, 3..11 are various mark phases,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4863
      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
  4864
      incr. GC gets interrupted by a full GC).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4865
     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
  4866
     future versions (incremental compact ;-).
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4867
     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
  4868
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4869
%{  /* NOCONTEXT */
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4870
    extern int __incrGCphase();
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4871
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  4872
    RETURN (__mkSmallInteger(__incrGCphase()));
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4873
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4874
    ^ 2
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4875
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4876
3742
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4877
incrementalGCPhaseSymbolic
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4878
    "returns the internal state of the incremental GC
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4879
     in a symbolic form.
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4880
     (for the curious: (currently)
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4881
      2 is idle, 3..11 are various mark phases,
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4882
      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
  4883
      incr. GC gets interrupted by a full GC).
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4884
     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
  4885
     future versions (incremental compact ;-).
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4886
     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
  4887
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4888
    |phase|
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4889
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4890
    phase := self incrementalGCPhase.
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4891
    phase < 2 ifTrue:[^ #cleanup].
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4892
    phase == 2 ifTrue:[^ #idle].
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4893
    phase < 12 ifTrue:[^ #marking].
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4894
    ^ #sweeping
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4895
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4896
    "Created: / 10.8.1998 / 15:02:52 / cg"
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4897
!
4bfc73e69cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3733
diff changeset
  4898
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4899
isSchteamEngine
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4900
    "is this Smalltalk/X system running under the new Schteam engine?"
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4901
%{
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4902
#ifdef __SCHTEAM__
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4903
    return __c__._RETURN_true();
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4904
#endif
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4905
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4906
    ^ false
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4907
!
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4908
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4909
lastScavengeReclamation
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4910
    "returns the number of bytes replacimed by the last scavenge.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4911
     For statistic only - this may vanish."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4912
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4913
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4914
    extern int __newSpaceReclaimed();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4915
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  4916
    RETURN ( __mkSmallInteger(__newSpaceReclaimed()) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4917
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4918
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4919
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4920
    "percentage of reclaimed objects is returned by:
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4921
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4922
     ((ObjectMemory lastScavengeReclamation)
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  4923
      / (ObjectMemory newSpaceSize)) * 100.0
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4924
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4925
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4926
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4927
lifoRememberedSet
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4928
    "return the lifoRemSet.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4929
     This is pure VM debugging and will vanish without notice."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4930
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4931
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4932
    extern OBJ __lifoRememberedSet();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4933
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4934
    RETURN ( __lifoRememberedSet() );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4935
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4936
    ^ nil
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4937
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4938
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4939
     ObjectMemory lifoRememberedSet
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4940
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4941
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4942
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4943
lifoRememberedSetSize
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4944
    "return the size of the lifoRemSet.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4945
     This is a VM debugging interface and may vanish without notice."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4946
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4947
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4948
    extern int __lifoRememberedSetSize();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4949
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  4950
    RETURN (__mkSmallInteger(__lifoRememberedSetSize()));
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4951
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4952
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4953
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4954
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4955
     ObjectMemory lifoRememberedSetSize
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4956
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4957
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  4958
13585
Stefan Vogel <sv@exept.de>
parents: 13584
diff changeset
  4959
mallocAllocated
Stefan Vogel <sv@exept.de>
parents: 13584
diff changeset
  4960
    "return the number of bytes allocated (and used) by malloc."
Stefan Vogel <sv@exept.de>
parents: 13584
diff changeset
  4961
13586
636b2e7b2748 do not use unix types (size_t)
Claus Gittinger <cg@exept.de>
parents: 13585
diff changeset
  4962
%{  /* NOCONTEXT */
19374
Stefan Vogel <sv@exept.de>
parents: 19373
diff changeset
  4963
#if defined(__linux__)
19370
77c0ce2ee8eb #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 19283
diff changeset
  4964
    struct mallinfo minfo;
77c0ce2ee8eb #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 19283
diff changeset
  4965
77c0ce2ee8eb #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 19283
diff changeset
  4966
    minfo = mallinfo();
77c0ce2ee8eb #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 19283
diff changeset
  4967
    RETURN ( __MKUINT(minfo.uordblks));
77c0ce2ee8eb #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 19283
diff changeset
  4968
#endif
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4969
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4970
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4971
13585
Stefan Vogel <sv@exept.de>
parents: 13584
diff changeset
  4972
    "
Stefan Vogel <sv@exept.de>
parents: 13584
diff changeset
  4973
     ObjectMemory mallocAllocated
Stefan Vogel <sv@exept.de>
parents: 13584
diff changeset
  4974
    "
Stefan Vogel <sv@exept.de>
parents: 13584
diff changeset
  4975
!
Stefan Vogel <sv@exept.de>
parents: 13584
diff changeset
  4976
Stefan Vogel <sv@exept.de>
parents: 13584
diff changeset
  4977
mallocTotal
Stefan Vogel <sv@exept.de>
parents: 13584
diff changeset
  4978
    "return the number of bytes reserved by malloc (may not have been used yet)."
Stefan Vogel <sv@exept.de>
parents: 13584
diff changeset
  4979
13586
636b2e7b2748 do not use unix types (size_t)
Claus Gittinger <cg@exept.de>
parents: 13585
diff changeset
  4980
%{  /* NOCONTEXT */
19374
Stefan Vogel <sv@exept.de>
parents: 19373
diff changeset
  4981
#if defined(__linux__)
19370
77c0ce2ee8eb #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 19283
diff changeset
  4982
    struct mallinfo minfo;
77c0ce2ee8eb #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 19283
diff changeset
  4983
77c0ce2ee8eb #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 19283
diff changeset
  4984
    minfo = mallinfo();
77c0ce2ee8eb #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 19283
diff changeset
  4985
    RETURN ( __MKUINT(minfo.usmblks));
77c0ce2ee8eb #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 19283
diff changeset
  4986
#endif
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4987
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4988
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  4989
13585
Stefan Vogel <sv@exept.de>
parents: 13584
diff changeset
  4990
    "
Stefan Vogel <sv@exept.de>
parents: 13584
diff changeset
  4991
     ObjectMemory mallocTotal
Stefan Vogel <sv@exept.de>
parents: 13584
diff changeset
  4992
    "
Stefan Vogel <sv@exept.de>
parents: 13584
diff changeset
  4993
!
Stefan Vogel <sv@exept.de>
parents: 13584
diff changeset
  4994
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4995
markAndSweepCount
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4996
    "return the number of mark&sweep collects that occurred since startup"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4997
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4998
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  4999
    extern int __markAndSweepCount();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5000
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  5001
    RETURN (__mkSmallInteger(__markAndSweepCount()));
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5002
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5003
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5004
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5005
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5006
     ObjectMemory markAndSweepCount
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5007
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5008
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5009
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5010
maximumIdentityHashValue
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5011
    "for ST-80 compatibility: return the maximum value
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5012
     a hashKey as returned by identityHash can get.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5013
     Since ST/X uses direct pointers, a field in the objectHeader
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5014
     is used, which is currently 11 bits in size."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5015
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5016
%{  /* NOCONTEXT */
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  5017
    RETURN ( __mkSmallInteger( __MAX_HASH__ << __HASH_SHIFT__) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5018
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5019
    ^ 8191
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5020
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5021
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5022
     ObjectMemory maximumIdentityHashValue
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5023
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5024
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5025
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5026
minScavengeReclamation
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5027
    "returns the number of bytes replaimed by the least effective scavenge.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5028
     For statistic only - this may vanish."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5029
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5030
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5031
    extern int __newSpaceReclaimedMin();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5032
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  5033
    RETURN ( __mkSmallInteger(__newSpaceReclaimedMin()) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5034
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5035
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5036
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5037
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5038
     ObjectMemory minScavengeReclamation
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5039
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5040
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5041
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5042
newSpaceSize
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5043
    "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
  5044
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5045
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5046
    extern unsigned __newSpaceSize();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5047
14381
dd40729e4157 large memory
Claus Gittinger <cg@exept.de>
parents: 14243
diff changeset
  5048
    RETURN ( __MKUINT(__newSpaceSize()) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5049
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5050
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5051
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5052
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5053
     ObjectMemory newSpaceSize
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5054
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5055
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5056
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5057
newSpaceUsed
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5058
    "return the number of bytes allocated for new objects.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5059
     The returned value is usually obsolete as soon as you do
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5060
     something with it ..."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5061
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5062
%{  /* NOCONTEXT */
14649
cec1b4965e5d 64bit changes
Claus Gittinger <cg@exept.de>
parents: 14622
diff changeset
  5063
    extern unsigned int __newSpaceUsed();
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5064
14381
dd40729e4157 large memory
Claus Gittinger <cg@exept.de>
parents: 14243
diff changeset
  5065
    RETURN ( __MKUINT(__newSpaceUsed()) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5066
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5067
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5068
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5069
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5070
     ObjectMemory newSpaceUsed
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5071
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5072
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5073
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5074
numberOfObjects
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5075
    "return the number of objects in the system."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5076
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5077
    |tally "{ Class: SmallInteger }"|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5078
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5079
    tally := 0.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5080
    self allObjectsDo:[:obj | tally := tally + 1].
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5081
    ^ tally
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5082
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5083
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5084
     ObjectMemory numberOfObjects
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5085
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5086
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5087
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5088
numberOfWeakObjects
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5089
    "return the number of weak objects in the system"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5090
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5091
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5092
    extern int __weakListSize();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5093
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  5094
    RETURN ( __mkSmallInteger(__weakListSize()) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5095
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5096
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5097
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5098
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5099
     ObjectMemory numberOfWeakObjects
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5100
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5101
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5102
11554
1d045beabc5f Add queries for old space addresses
Stefan Vogel <sv@exept.de>
parents: 11334
diff changeset
  5103
oldSpaceAddress
1d045beabc5f Add queries for old space addresses
Stefan Vogel <sv@exept.de>
parents: 11334
diff changeset
  5104
%{
14622
59306ad8f1be handle non-fix OLDSPACE
Claus Gittinger <cg@exept.de>
parents: 14381
diff changeset
  5105
#ifdef OLDSPACE_ADDRESS
11554
1d045beabc5f Add queries for old space addresses
Stefan Vogel <sv@exept.de>
parents: 11334
diff changeset
  5106
    RETURN(__MKUINT(OLDSPACE_ADDRESS));
14622
59306ad8f1be handle non-fix OLDSPACE
Claus Gittinger <cg@exept.de>
parents: 14381
diff changeset
  5107
#else
15643
8ca343d37d39 class: ObjectMemory
Stefan Vogel <sv@exept.de>
parents: 15632
diff changeset
  5108
    RETURN(__mkSmallInteger(0));
14622
59306ad8f1be handle non-fix OLDSPACE
Claus Gittinger <cg@exept.de>
parents: 14381
diff changeset
  5109
#endif
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5110
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5111
    ^ 0
11554
1d045beabc5f Add queries for old space addresses
Stefan Vogel <sv@exept.de>
parents: 11334
diff changeset
  5112
1d045beabc5f Add queries for old space addresses
Stefan Vogel <sv@exept.de>
parents: 11334
diff changeset
  5113
    "
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  5114
	self oldSpaceAddress
11554
1d045beabc5f Add queries for old space addresses
Stefan Vogel <sv@exept.de>
parents: 11334
diff changeset
  5115
    "
1d045beabc5f Add queries for old space addresses
Stefan Vogel <sv@exept.de>
parents: 11334
diff changeset
  5116
!
1d045beabc5f Add queries for old space addresses
Stefan Vogel <sv@exept.de>
parents: 11334
diff changeset
  5117
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5118
oldSpaceAllocatedSinceLastGC
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5119
    "return the number of bytes allocated for old objects since the
20264
fa4cbb768ffe #OTHER by mawalch
mawalch
parents: 20213
diff changeset
  5120
     last oldspace garbage collect occurred. This information is used
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5121
     by ProcessorScheduler to decide when to start the incremental
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5122
     background GC."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5123
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5124
%{  /* NOCONTEXT */
14649
cec1b4965e5d 64bit changes
Claus Gittinger <cg@exept.de>
parents: 14622
diff changeset
  5125
    extern unsigned INT __oldSpaceAllocatedSinceLastGC();
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5126
14381
dd40729e4157 large memory
Claus Gittinger <cg@exept.de>
parents: 14243
diff changeset
  5127
    RETURN ( __MKUINT(__oldSpaceAllocatedSinceLastGC()) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5128
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5129
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5130
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5131
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5132
     ObjectMemory oldSpaceAllocatedSinceLastGC
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5133
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5134
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5135
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5136
oldSpaceSize
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5137
    "return the total size of the old space. - may grow slowly"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5138
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5139
%{  /* NOCONTEXT */
14649
cec1b4965e5d 64bit changes
Claus Gittinger <cg@exept.de>
parents: 14622
diff changeset
  5140
    extern unsigned INT __oldSpaceSize();
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5141
14381
dd40729e4157 large memory
Claus Gittinger <cg@exept.de>
parents: 14243
diff changeset
  5142
    RETURN ( __MKUINT(__oldSpaceSize()) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5143
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5144
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5145
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5146
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5147
     ObjectMemory oldSpaceSize
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5148
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5149
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5150
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5151
oldSpaceUsed
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5152
    "return the number of bytes allocated for old objects.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5153
     (This includes the free lists)"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5154
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5155
%{  /* NOCONTEXT */
14649
cec1b4965e5d 64bit changes
Claus Gittinger <cg@exept.de>
parents: 14622
diff changeset
  5156
    extern unsigned INT __oldSpaceUsed();
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5157
14381
dd40729e4157 large memory
Claus Gittinger <cg@exept.de>
parents: 14243
diff changeset
  5158
    RETURN ( __MKUINT(__oldSpaceUsed()) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5159
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5160
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5161
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5162
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5163
     ObjectMemory oldSpaceUsed
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5164
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5165
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5166
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5167
rememberedSetSize
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5168
    "return the number of old objects referencing new ones.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5169
     This is a VM debugging interface and may vanish without notice."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5170
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5171
%{  /* NOCONTEXT */
14649
cec1b4965e5d 64bit changes
Claus Gittinger <cg@exept.de>
parents: 14622
diff changeset
  5172
    extern unsigned int __rememberedSetSize();
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5173
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  5174
    RETURN (__mkSmallInteger(__rememberedSetSize()));
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5175
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5176
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5177
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5178
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5179
     ObjectMemory rememberedSetSize
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5180
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5181
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5182
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5183
resetMinScavengeReclamation
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5184
    "resets the number of bytes replacimed by the least effective scavenge.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5185
     For statistic only - this may vanish."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5186
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5187
%{  /* NOCONTEXT */
14649
cec1b4965e5d 64bit changes
Claus Gittinger <cg@exept.de>
parents: 14622
diff changeset
  5188
    extern void __resetNewSpaceReclaimedMin();
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5189
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5190
    __resetNewSpaceReclaimedMin();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5191
%}.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5192
    ^ self
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5193
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5194
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5195
     ObjectMemory resetMinScavengeReclamation.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5196
     ObjectMemory minScavengeReclamation
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5197
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5198
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5199
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5200
runsSingleOldSpace
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5201
    "return true, if the system runs in a single oldSpace or
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5202
     false if not.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5203
     The memory system will always drop the second semispace when
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5204
     running out of virtual memory, or the baker-limit is reached.
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5205
     OBSOLETE:
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5206
	 the system may now decide at any time to switch between
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5207
	 single and double-space algorithms, depending on the overall memory
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5208
	 size. You will now almost always get true as result, since the
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5209
	 second semispace is only allocated when needed, and released
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5210
	 immediately afterwards.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5211
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5212
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5213
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5214
    extern int __runsSingleOldSpace();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5215
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5216
    RETURN ( (__runsSingleOldSpace() ? true : false) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5217
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5218
    ^ true
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5219
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5220
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5221
     ObjectMemory runsSingleOldSpace
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5222
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5223
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5224
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5225
scavengeCount
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5226
    "return the number of scavenges that occurred since startup"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5227
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5228
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5229
    extern int __scavengeCount();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5230
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  5231
    RETURN (__mkSmallInteger(__scavengeCount()));
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5232
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5233
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5234
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5235
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5236
     ObjectMemory scavengeCount
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5237
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5238
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5239
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5240
symSpaceSize
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5241
    "return the total size of the sym space."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5242
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5243
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5244
    extern unsigned __symSpaceSize();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5245
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  5246
    RETURN ( __mkSmallInteger(__symSpaceSize()) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5247
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5248
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5249
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5250
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5251
     ObjectMemory symSpaceSize
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5252
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5253
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5254
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5255
symSpaceUsed
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5256
    "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
  5257
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5258
%{  /* NOCONTEXT */
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5259
    extern unsigned __symSpaceUsed();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5260
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  5261
    RETURN ( __mkSmallInteger(__symSpaceUsed()) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5262
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5263
    ^ 0
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5264
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5265
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5266
     ObjectMemory symSpaceUsed
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5267
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5268
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5269
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5270
tenureAge
20422
94210802ce28 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20400
diff changeset
  5271
    "return the current tenure age - that's the number of times
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5272
     an object has to survive scavenges to be moved into oldSpace.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5273
     For statistic/debugging only - this method may vanish"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5274
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5275
%{  /* NOCONTEXT */
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5276
    extern unsigned __tenureAge();
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5277
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8805
diff changeset
  5278
    RETURN ( __mkSmallInteger(__tenureAge()) );
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5279
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5280
    ^ 0
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5281
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5282
3181
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5283
vmSymbols
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5284
    "return a collection of symbols used by the VM"
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5285
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5286
    "/ DO NOT REMOVE THIS METHOD.
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5287
    "/ 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
  5288
    "/ in fixed (non-moving) memory.
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5289
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5290
    ^ #(
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5291
      "/ interpreter stuff
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5292
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5293
      "/ JavaVM stuff
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5294
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5295
      nativeMethodInvokation
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5296
      newCleared
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5297
      monitorEnter:
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5298
      monitorExit:
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5299
      classInit
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5300
      javaClass
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5301
      resolve
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5302
      resolveStatic
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5303
    )
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5304
!
c7041542f8b8 added vmSymbols (needed for Java)
Claus Gittinger <cg@exept.de>
parents: 3108
diff changeset
  5305
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5306
whoReferences:anObject
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5307
    "return a collection of objects referencing the argument, anObject"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5308
8556
96a185c5058d Use #referencesObject instead of #references:
Stefan Vogel <sv@exept.de>
parents: 8543
diff changeset
  5309
    ^ self collectObjectsWhich:[:o | o referencesObject:anObject]
96a185c5058d Use #referencesObject instead of #references:
Stefan Vogel <sv@exept.de>
parents: 8543
diff changeset
  5310
96a185c5058d Use #referencesObject instead of #references:
Stefan Vogel <sv@exept.de>
parents: 8543
diff changeset
  5311
    "
96a185c5058d Use #referencesObject instead of #references:
Stefan Vogel <sv@exept.de>
parents: 8543
diff changeset
  5312
     (ObjectMemory whoReferences:Transcript) printCR
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5313
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5314
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5315
3262
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  5316
whoReferencesAny:aCollection
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  5317
    "return a collection of objects referencing any object from
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  5318
     the argument, aCollection"
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  5319
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  5320
    ^ self collectObjectsWhich:[:o | o referencesAny:aCollection]
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  5321
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  5322
    "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  5323
     ObjectMemory whoReferencesAny:(Array with:Transcript with:Smalltalk)
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  5324
    "
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  5325
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  5326
    "Modified: / 2.2.1998 / 16:08:18 / cg"
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  5327
!
5a9d609d8b25 added #displayRefChainTo: - for debugging
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  5328
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5329
whoReferencesDerivedInstancesOf:aClass
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5330
    "return a collection of objects refering to instances
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5331
     of the argument, aClass or a subclass of it."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5332
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5333
    ^ self collectObjectsWhich:[:o | o referencesDerivedInstanceOf:aClass]
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5334
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5335
    "
8556
96a185c5058d Use #referencesObject instead of #references:
Stefan Vogel <sv@exept.de>
parents: 8543
diff changeset
  5336
     (ObjectMemory whoReferencesDerivedInstancesOf:View) printCR
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5337
    "
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5338
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5339
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5340
whoReferencesInstancesOf:aClass
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5341
    "return a collection of objects refering to instances
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5342
     of the argument, aClass"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5343
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5344
    ^ self collectObjectsWhich:[:o | o referencesInstanceOf:aClass]
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5345
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5346
    "
8556
96a185c5058d Use #referencesObject instead of #references:
Stefan Vogel <sv@exept.de>
parents: 8543
diff changeset
  5347
     (ObjectMemory whoReferencesInstancesOf:SystemBrowser) printCR
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5348
    "
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5349
! !
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5350
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  5351
!ObjectMemory class methodsFor:'semaphore access'!
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5352
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5353
lowSpaceSemaphore
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5354
    "return the semaphore that is signalled when the system detects a
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5355
     low space condition. Usually, some time after this, an allocationFailure
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5356
     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
  5357
     start to release object."
379
5b5a130ccd09 revision added
claus
parents: 375
diff changeset
  5358
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
  5359
    ^ LowSpaceSemaphore
379
5b5a130ccd09 revision added
claus
parents: 375
diff changeset
  5360
! !
5b5a130ccd09 revision added
claus
parents: 375
diff changeset
  5361
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  5362
!ObjectMemory class methodsFor:'statistics'!
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5363
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5364
ageStatistic
2524
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5365
    "for ST/X developers only:
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5366
     dump contents of newSpace with objects age information.
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5367
     This method may be removed without notice"
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5368
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5369
%{   /* NOCONTEXT */
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
  5370
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
  5371
    __ageStatistics();
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
  5372
%}
2524
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5373
    "
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5374
     ObjectMemory ageStatistic
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5375
    "
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5376
!
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5377
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5378
codeCacheInfo
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5379
    "for ST/X developers only:
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5380
     dump contents of dynamic code cache LRU lists.
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5381
     This method may be removed without notice"
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5382
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5383
%{   /* NOCONTEXT */
2525
f12f868019d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2524
diff changeset
  5384
    OBJ __codeCacheInfo();
2524
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5385
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5386
    RETURN (__codeCacheInfo());
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5387
%}
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5388
    "
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5389
     ObjectMemory codeCacheInfo do:[:item |
4186
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  5390
	|n nMethods nBytes|
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  5391
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  5392
	n := item at:1.
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  5393
	nMethods := item at:2.
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  5394
	nBytes := item at:3.
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  5395
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  5396
	n isNil ifTrue:[
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  5397
	    '>>' print
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  5398
	] ifFalse:[
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  5399
	    (n printStringLeftPaddedTo:2) print.
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  5400
	].
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  5401
	' ' print.
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  5402
	(nMethods printStringLeftPaddedTo:4) print.
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  5403
	' ' print.
e1b3efd74643 codeForCPU: returns the old setting
Claus Gittinger <cg@exept.de>
parents: 4104
diff changeset
  5404
	(nBytes printStringLeftPaddedTo:6) printCR.
2524
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5405
     ]
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5406
    "
9304e01f8f25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  5407
13581
3166c400dc11 added: #mallocStatistics
Stefan Vogel <sv@exept.de>
parents: 13573
diff changeset
  5408
!
3166c400dc11 added: #mallocStatistics
Stefan Vogel <sv@exept.de>
parents: 13573
diff changeset
  5409
3166c400dc11 added: #mallocStatistics
Stefan Vogel <sv@exept.de>
parents: 13573
diff changeset
  5410
mallocStatistics
3166c400dc11 added: #mallocStatistics
Stefan Vogel <sv@exept.de>
parents: 13573
diff changeset
  5411
    "for ST/X developers only:
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  5412
     dump statistics on malloc memory allocation (used, for example for ExternalBytes) on
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  5413
     the standard output. Dummy on some architectures, where the standard malloc is used (win32, for example).
13581
3166c400dc11 added: #mallocStatistics
Stefan Vogel <sv@exept.de>
parents: 13573
diff changeset
  5414
     This method may be removed without notice"
3166c400dc11 added: #mallocStatistics
Stefan Vogel <sv@exept.de>
parents: 13573
diff changeset
  5415
3166c400dc11 added: #mallocStatistics
Stefan Vogel <sv@exept.de>
parents: 13573
diff changeset
  5416
%{   /* NOCONTEXT */
19374
Stefan Vogel <sv@exept.de>
parents: 19373
diff changeset
  5417
#if defined(__linux__)
19371
acc083e7ab80 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 19370
diff changeset
  5418
    malloc_info(0, stderr);
acc083e7ab80 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 19370
diff changeset
  5419
#endif
13581
3166c400dc11 added: #mallocStatistics
Stefan Vogel <sv@exept.de>
parents: 13573
diff changeset
  5420
%}
3166c400dc11 added: #mallocStatistics
Stefan Vogel <sv@exept.de>
parents: 13573
diff changeset
  5421
    "
3166c400dc11 added: #mallocStatistics
Stefan Vogel <sv@exept.de>
parents: 13573
diff changeset
  5422
     ObjectMemory mallocStatistics
3166c400dc11 added: #mallocStatistics
Stefan Vogel <sv@exept.de>
parents: 13573
diff changeset
  5423
    "
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5424
! !
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5425
3699
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  5426
!ObjectMemory class methodsFor:'system configuration queries'!
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5427
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5428
allBinaryModulesDo:aBlock
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5429
    "internal private method - walk over all known binary
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5430
     modules and evaluate aBlock for each entry.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5431
     Do not depend on the information returned for each - this may
418
claus
parents: 403
diff changeset
  5432
     change without notice."
claus
parents: 403
diff changeset
  5433
claus
parents: 403
diff changeset
  5434
%{
10660
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  5435
    __REGISTRATION_DO_BLOCK5__(&aBlock COMMA_SND);
418
claus
parents: 403
diff changeset
  5436
%}
claus
parents: 403
diff changeset
  5437
!
claus
parents: 403
diff changeset
  5438
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5439
binaryModuleInfo
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5440
    "return a collection of moduleInfo entries.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5441
     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
  5442
     with one entry for each binary package (module)."
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5443
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5444
    |modules|
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5445
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5446
    modules := IdentityDictionary new.
10660
4c0906a6d369 be careful with invalid objects during module-enumeration
Claus Gittinger <cg@exept.de>
parents: 10493
diff changeset
  5447
    self allBinaryModulesDo:[:idArg :nameArg :flagsArg :libName :timeStamp |
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5448
	|type subModuleName module dynamic infoRec handle pathName
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5449
	 typeName name nameString|
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5450
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5451
	nameArg isString ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5452
	    'Error in binaryModuleInfo - skip entry' errorPrintCR.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5453
	] ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5454
	    name := nameArg.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5455
	    subModuleName := name asSymbol.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5456
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5457
	    idArg > 0 ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5458
		dynamic := true.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5459
		typeName := 'dynamic '.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5460
		handle := ObjectFileLoader handleFromID:idArg.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5461
		(handle isNil or:[(pathName := handle pathName) isNil]) ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5462
		    name := '?'
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5463
		] ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5464
		    name := pathName asFilename baseName
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5465
		]
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5466
	    ] ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5467
		dynamic := false.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5468
		typeName := 'builtIn '.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5469
		pathName := nil.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5470
		libName isNil ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5471
		    name := subModuleName
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5472
		] ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5473
		    name := libName
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5474
		].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5475
	    ].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5476
	    nameString := typeName.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5477
	    libName isNil ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5478
		nameString := nameString, 'module '
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5479
	    ] ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5480
		nameString := nameString, 'classLib '
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5481
	    ].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5482
	    nameString := nameString , name.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5483
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5484
	    libName isNil ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5485
		type := #classObject
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5486
	    ] ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5487
		type := #classLibrary
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5488
	    ].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5489
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5490
	    infoRec := modules at:idArg ifAbsent:nil.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5491
	    infoRec notNil ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5492
		infoRec classNames add:subModuleName.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5493
	    ] ifFalse:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5494
		infoRec := BinaryModuleDescriptor
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5495
				name:nameString
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5496
				type:type
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5497
				id:idArg
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5498
				dynamic:dynamic
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5499
				classNames:( (OrderedSet ? Set) with:subModuleName)
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5500
				handle:handle
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5501
				pathName:pathName
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5502
				libraryName:libName
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5503
				timeStamp:nil.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5504
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5505
		modules at:idArg put:infoRec.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5506
	    ].
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5507
	].
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5508
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5509
    ^ modules
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5510
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5511
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5512
     ObjectMemory binaryModuleInfo
418
claus
parents: 403
diff changeset
  5513
    "
claus
parents: 403
diff changeset
  5514
438
claus
parents: 435
diff changeset
  5515
    "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
  5516
    "Modified: 22.4.1997 / 23:42:59 / cg"
418
claus
parents: 403
diff changeset
  5517
!
claus
parents: 403
diff changeset
  5518
3699
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  5519
getVMIdentificationStrings
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  5520
    "return a collection of release strings giving information
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  5521
     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
  5522
     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
  5523
     change or vanish without notice."
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  5524
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  5525
%{
3729
dfb4670c8b1f need ext decl for getVMReleaseStrings
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5526
    extern OBJ __getVMReleaseStrings();
dfb4670c8b1f need ext decl for getVMReleaseStrings
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5527
3699
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  5528
    RETURN (__getVMReleaseStrings());
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5529
%}.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5530
    ^ #()
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5531
3699
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  5532
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  5533
     ObjectMemory getVMIdentificationStrings
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  5534
    "
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  5535
! !
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  5536
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  5537
!ObjectMemory class methodsFor:'system management'!
6d315f76aa33 moved some debugging methods from Smalltalk.
Claus Gittinger <cg@exept.de>
parents: 3652
diff changeset
  5538
16650
92b1c33b39f8 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16649
diff changeset
  5539
directoryForImageAndChangeFile
92b1c33b39f8 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16649
diff changeset
  5540
    |dir exeDir|
92b1c33b39f8 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16649
diff changeset
  5541
92b1c33b39f8 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16649
diff changeset
  5542
    dir := Filename currentDirectory.
92b1c33b39f8 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16649
diff changeset
  5543
92b1c33b39f8 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16649
diff changeset
  5544
    "/ the current directory is not a good idea, if stx is started via a desktop manager
92b1c33b39f8 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16649
diff changeset
  5545
    "/ or in osx, by clicking on stx.app.
92b1c33b39f8 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16649
diff changeset
  5546
    dir isRootDirectory ifTrue:[
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5547
	exeDir := OperatingSystem nameOfSTXExecutable asFilename directory.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5548
	dir ~= exeDir ifTrue:[
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5549
	    "/ Change it to ~/.smalltalk or is executable directory better?
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5550
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5551
	    "/ use executable dir, as otherwise I'd have to change the VM to include an image path...
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5552
	    "/ dir := Filename usersPrivateSmalltalkDirectory.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5553
	    dir := exeDir.
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5554
	].
16650
92b1c33b39f8 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16649
diff changeset
  5555
    ].
92b1c33b39f8 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16649
diff changeset
  5556
    ^ dir
92b1c33b39f8 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16649
diff changeset
  5557
92b1c33b39f8 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16649
diff changeset
  5558
    "
92b1c33b39f8 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16649
diff changeset
  5559
     self directoryForImageAndChangeFile
92b1c33b39f8 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16649
diff changeset
  5560
    "
92b1c33b39f8 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16649
diff changeset
  5561
!
92b1c33b39f8 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16649
diff changeset
  5562
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5563
imageBaseName
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5564
    "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
  5565
     This is the filename of the current image (without '.img') or,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5566
     if not running from an image, the default name 'st'"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5567
12648
d3c1fea8f18d added: #suffixForSnapshot
Stefan Vogel <sv@exept.de>
parents: 12644
diff changeset
  5568
    |nm filename suffix|
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5569
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5570
    nm := ImageName.
12648
d3c1fea8f18d added: #suffixForSnapshot
Stefan Vogel <sv@exept.de>
parents: 12644
diff changeset
  5571
    (nm isEmptyOrNil or:[nm isBlank]) ifTrue:[
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  5572
	^ 'st'
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5573
    ].
12648
d3c1fea8f18d added: #suffixForSnapshot
Stefan Vogel <sv@exept.de>
parents: 12644
diff changeset
  5574
d3c1fea8f18d added: #suffixForSnapshot
Stefan Vogel <sv@exept.de>
parents: 12644
diff changeset
  5575
    filename := nm asFilename.
d3c1fea8f18d added: #suffixForSnapshot
Stefan Vogel <sv@exept.de>
parents: 12644
diff changeset
  5576
    suffix := filename suffix.
d3c1fea8f18d added: #suffixForSnapshot
Stefan Vogel <sv@exept.de>
parents: 12644
diff changeset
  5577
    (suffix = 'sav' or:[suffix = self suffixForSnapshot]) ifTrue:[
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  5578
	^ filename nameWithoutSuffix.
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5579
    ].
12648
d3c1fea8f18d added: #suffixForSnapshot
Stefan Vogel <sv@exept.de>
parents: 12644
diff changeset
  5580
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5581
    ^ nm
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5582
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5583
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5584
     ObjectMemory imageBaseName
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5585
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5586
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5587
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5588
imageName
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5589
    "return the filename of the current image, or nil
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5590
     if not running from an image."
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5591
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5592
    ^ ImageName
335
claus
parents: 332
diff changeset
  5593
claus
parents: 332
diff changeset
  5594
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5595
     ObjectMemory imageName
335
claus
parents: 332
diff changeset
  5596
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5597
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5598
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5599
imageSaveTime
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5600
    "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
  5601
     Return nil if not running from an image."
d88b93ce1194 remember image save time
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  5602
d88b93ce1194 remember image save time
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  5603
    ^ ImageSaveTime
d88b93ce1194 remember image save time
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  5604
!
d88b93ce1194 remember image save time
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  5605
16649
5e7d84ca6923 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16561
diff changeset
  5606
initChangeFilename
5e7d84ca6923 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16561
diff changeset
  5607
    "/ make the changeFilePath an absolute one,
5e7d84ca6923 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16561
diff changeset
  5608
    "/ in case some stupid windows fileDialog changes the current directory...
5e7d84ca6923 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16561
diff changeset
  5609
    self
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5610
	nameForChanges:(self directoryForImageAndChangeFile / ObjectMemory nameForChangesLocal)
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5611
			    asAbsoluteFilename pathName
16649
5e7d84ca6923 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16561
diff changeset
  5612
5e7d84ca6923 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16561
diff changeset
  5613
    "
5e7d84ca6923 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16561
diff changeset
  5614
     self initChangeFilename
5e7d84ca6923 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16561
diff changeset
  5615
    "
5e7d84ca6923 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16561
diff changeset
  5616
!
5e7d84ca6923 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16561
diff changeset
  5617
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5618
nameForChanges
18875
14934d864d0d #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18870
diff changeset
  5619
    "return a reasonable filename string to store the changes into.
16468
df6c048f98c1 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16350
diff changeset
  5620
     By default, this is the basename of the current image with '.img' replaced
df6c048f98c1 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16350
diff changeset
  5621
     by '.chg', or, if not running from an image, the default name 'st.chg'.
18875
14934d864d0d #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18870
diff changeset
  5622
     However, it can be overwritten via the nameForChanges: setter.
14934d864d0d #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18870
diff changeset
  5623
     For now, this returns a string (for backward compatibility);
14934d864d0d #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18870
diff changeset
  5624
     senders should be prepared to get a filename in the future."
16468
df6c048f98c1 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16350
diff changeset
  5625
18870
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5626
    |userPrefs localName nm wd|
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5627
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5628
    localName := self nameForChangesLocal.
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5629
    userPrefs := UserPreferences current.
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  5630
18870
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5631
    "/ if the prefs provide a full, explicit name
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  5632
    (nm := userPrefs changeFileName) isNil ifTrue:[
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  5633
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  5634
	"/ if there is a workspace, create it there
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  5635
	((wd := userPrefs workspaceDirectory) notNil and:[wd exists]) ifTrue:[
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  5636
	    nm := wd / (localName asFilename baseName)
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  5637
	] ifFalse:[
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  5638
	    "/ if it was set by a startup file
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  5639
	    (nm := ChangeFileName) isNil ifTrue:[
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  5640
		"/ finally, fall back to a default.
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  5641
		nm := localName
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  5642
	    ]
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  5643
	]
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  5644
    ].
18875
14934d864d0d #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18870
diff changeset
  5645
    ^ nm asFilename pathName.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5646
335
claus
parents: 332
diff changeset
  5647
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5648
     ObjectMemory nameForChanges
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5649
    "
13302
24c3c50a0750 added: #nameForChangesLocal
Claus Gittinger <cg@exept.de>
parents: 12924
diff changeset
  5650
24c3c50a0750 added: #nameForChangesLocal
Claus Gittinger <cg@exept.de>
parents: 12924
diff changeset
  5651
    "Modified: / 09-02-2011 / 20:44:37 / cg"
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5652
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5653
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5654
nameForChanges:aFilename
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5655
    "set the name of the file where changes are stored into."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5656
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5657
    ChangeFileName := aFilename
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5658
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5659
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5660
     ObjectMemory nameForChanges:'myChanges'
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5661
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5662
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5663
13302
24c3c50a0750 added: #nameForChangesLocal
Claus Gittinger <cg@exept.de>
parents: 12924
diff changeset
  5664
nameForChangesLocal
24c3c50a0750 added: #nameForChangesLocal
Claus Gittinger <cg@exept.de>
parents: 12924
diff changeset
  5665
    "return a reasonable filename to store the changes into."
24c3c50a0750 added: #nameForChangesLocal
Claus Gittinger <cg@exept.de>
parents: 12924
diff changeset
  5666
24c3c50a0750 added: #nameForChangesLocal
Claus Gittinger <cg@exept.de>
parents: 12924
diff changeset
  5667
    ^ self imageBaseName , '.chg'
24c3c50a0750 added: #nameForChangesLocal
Claus Gittinger <cg@exept.de>
parents: 12924
diff changeset
  5668
24c3c50a0750 added: #nameForChangesLocal
Claus Gittinger <cg@exept.de>
parents: 12924
diff changeset
  5669
    "
24c3c50a0750 added: #nameForChangesLocal
Claus Gittinger <cg@exept.de>
parents: 12924
diff changeset
  5670
     ObjectMemory nameForChanges
24c3c50a0750 added: #nameForChangesLocal
Claus Gittinger <cg@exept.de>
parents: 12924
diff changeset
  5671
    "
24c3c50a0750 added: #nameForChangesLocal
Claus Gittinger <cg@exept.de>
parents: 12924
diff changeset
  5672
24c3c50a0750 added: #nameForChangesLocal
Claus Gittinger <cg@exept.de>
parents: 12924
diff changeset
  5673
    "Created: / 09-02-2011 / 20:44:31 / cg"
24c3c50a0750 added: #nameForChangesLocal
Claus Gittinger <cg@exept.de>
parents: 12924
diff changeset
  5674
!
24c3c50a0750 added: #nameForChangesLocal
Claus Gittinger <cg@exept.de>
parents: 12924
diff changeset
  5675
10019
fc8948925fc0 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 10018
diff changeset
  5676
nameForCrashImage
12648
d3c1fea8f18d added: #suffixForSnapshot
Stefan Vogel <sv@exept.de>
parents: 12644
diff changeset
  5677
    ^ 'crash', '.', self suffixForSnapshot
10019
fc8948925fc0 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 10018
diff changeset
  5678
fc8948925fc0 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 10018
diff changeset
  5679
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5680
     ObjectMemory nameForCrashImage
10019
fc8948925fc0 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 10018
diff changeset
  5681
    "
fc8948925fc0 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 10018
diff changeset
  5682
fc8948925fc0 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 10018
diff changeset
  5683
    "Created: / 29-09-2006 / 13:16:52 / cg"
fc8948925fc0 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 10018
diff changeset
  5684
!
fc8948925fc0 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 10018
diff changeset
  5685
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5686
nameForSnapshot
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5687
    "return a reasonable filename to store the snapshot image into.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5688
     This is the filename of the current image or,
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5689
     if not running from an image, the default name 'st.img'"
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5690
18870
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5691
    |localName wd|
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5692
25437
622824e701ea Fix `ObjectMemory >> #nameForSnapshot`
Jan Vrany <jan.vrany@labware.com>
parents: 23107
diff changeset
  5693
    self imageName notNil ifTrue: [ 
622824e701ea Fix `ObjectMemory >> #nameForSnapshot`
Jan Vrany <jan.vrany@labware.com>
parents: 23107
diff changeset
  5694
        ^ self imageName
622824e701ea Fix `ObjectMemory >> #nameForSnapshot`
Jan Vrany <jan.vrany@labware.com>
parents: 23107
diff changeset
  5695
    ].
622824e701ea Fix `ObjectMemory >> #nameForSnapshot`
Jan Vrany <jan.vrany@labware.com>
parents: 23107
diff changeset
  5696
18870
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5697
    localName := self nameForSnapshotLocal.
19860
324edacff5cc unified cpu and os defines;
Claus Gittinger <cg@exept.de>
parents: 19509
diff changeset
  5698
18870
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5699
    "/ if there is a workspace, create it there
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5700
    ((wd := UserPreferences current workspaceDirectory) notNil and:[wd exists]) ifTrue:[
25437
622824e701ea Fix `ObjectMemory >> #nameForSnapshot`
Jan Vrany <jan.vrany@labware.com>
parents: 23107
diff changeset
  5701
        ^ wd / (localName asFilename baseName)
18870
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5702
    ].
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5703
    ^ localName
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5704
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5705
    "
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5706
     ObjectMemory nameForSnapshot
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5707
    "
25437
622824e701ea Fix `ObjectMemory >> #nameForSnapshot`
Jan Vrany <jan.vrany@labware.com>
parents: 23107
diff changeset
  5708
622824e701ea Fix `ObjectMemory >> #nameForSnapshot`
Jan Vrany <jan.vrany@labware.com>
parents: 23107
diff changeset
  5709
    "Modified: / 29-11-2021 / 15:11:27 / Jan Vrany <jan.vrany@labware.com>"
18870
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5710
!
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5711
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5712
nameForSnapshotLocal
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5713
    "return a reasonable filename to store the snapshot image into.
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5714
     This is the filename of the current image or,
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5715
     if not running from an image, the default name 'st.img'"
cae2dba046a1 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18869
diff changeset
  5716
12648
d3c1fea8f18d added: #suffixForSnapshot
Stefan Vogel <sv@exept.de>
parents: 12644
diff changeset
  5717
    ^ self imageBaseName , '.', self suffixForSnapshot
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5718
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5719
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5720
     ObjectMemory nameForSnapshot
335
claus
parents: 332
diff changeset
  5721
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5722
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5723
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5724
nameForSources
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5725
    "return a reasonable filename to store the sources into.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5726
     This is the basename of the current image with '.img' replaced
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5727
     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
  5728
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5729
    ^ self imageBaseName , '.src'
362
claus
parents: 360
diff changeset
  5730
claus
parents: 360
diff changeset
  5731
    "
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5732
     ObjectMemory nameForSources
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5733
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5734
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5735
8805
573157b1b5dd Make snapshot writing more robust against errors
Stefan Vogel <sv@exept.de>
parents: 8713
diff changeset
  5736
primSnapShotOn:aFilename
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5737
    "create a snapshot in the given file.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5738
     Low level entry. Does not notify classes or write an entry to
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5739
     the changes file. Also, no image backup is created.
1704
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  5740
     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
  5741
     This method should not be used in normal cases."
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5742
8805
573157b1b5dd Make snapshot writing more robust against errors
Stefan Vogel <sv@exept.de>
parents: 8713
diff changeset
  5743
    |ok oldImageName oldImageTime filenameString|
1704
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  5744
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  5745
    "
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  5746
     save the name and time with it ...
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  5747
    "
8805
573157b1b5dd Make snapshot writing more robust against errors
Stefan Vogel <sv@exept.de>
parents: 8713
diff changeset
  5748
573157b1b5dd Make snapshot writing more robust against errors
Stefan Vogel <sv@exept.de>
parents: 8713
diff changeset
  5749
    filenameString := aFilename asString.
1704
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  5750
    oldImageName := ImageName.
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  5751
    oldImageTime := ImageSaveTime.
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  5752
8805
573157b1b5dd Make snapshot writing more robust against errors
Stefan Vogel <sv@exept.de>
parents: 8713
diff changeset
  5753
    ImageName := filenameString.
8252
16ed6cd9868d Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents: 7769
diff changeset
  5754
    ImageSaveTime := Timestamp now.
18400
68951cdfb08b fallbcks for unimpl. primitives
Claus Gittinger <cg@exept.de>
parents: 17532
diff changeset
  5755
    ok := false.
1704
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  5756
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  5757
%{  /* CALLSSTACK:32000 */
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5758
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5759
    OBJ __snapShotOn();
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5760
    OBJ funny = @symbol(funnySnapshotSymbol);
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5761
8805
573157b1b5dd Make snapshot writing more robust against errors
Stefan Vogel <sv@exept.de>
parents: 8713
diff changeset
  5762
    if (__isStringLike(filenameString)) {
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5763
	__BLOCKINTERRUPTS();
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5764
	ok = __snapShotOn(__context, __stringVal(filenameString), funny);
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5765
	__UNBLOCKINTERRUPTS();
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5766
    }
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5767
%}.
1704
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  5768
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  5769
    ImageName := oldImageName.
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  5770
    ImageSaveTime := oldImageTime.
e2238bff1159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  5771
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5772
    ^ ok
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5773
!
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5774
8543
ebe9ec9d4dec changefile handling (experimental)
Claus Gittinger <cg@exept.de>
parents: 8528
diff changeset
  5775
refreshChangesFrom: oldChangesName
ebe9ec9d4dec changefile handling (experimental)
Claus Gittinger <cg@exept.de>
parents: 8528
diff changeset
  5776
    "The snapshot image name has changed (snapshot saved),
ebe9ec9d4dec changefile handling (experimental)
Claus Gittinger <cg@exept.de>
parents: 8528
diff changeset
  5777
     the changes file must be copied to the new name.
ebe9ec9d4dec changefile handling (experimental)
Claus Gittinger <cg@exept.de>
parents: 8528
diff changeset
  5778
     No copy when the changes name is given explicitly."
ebe9ec9d4dec changefile handling (experimental)
Claus Gittinger <cg@exept.de>
parents: 8528
diff changeset
  5779
16468
df6c048f98c1 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16350
diff changeset
  5780
    ChangeFileName notNil ifTrue: [
16561
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  5781
	ChangeFileName ~= self nameForChangesLocal ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  5782
	    ^ self
Claus Gittinger <cg@exept.de>
parents: 16517
diff changeset
  5783
	]
16468
df6c048f98c1 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16350
diff changeset
  5784
    ].
8543
ebe9ec9d4dec changefile handling (experimental)
Claus Gittinger <cg@exept.de>
parents: 8528
diff changeset
  5785
    oldChangesName asFilename copyTo:self nameForChanges
ebe9ec9d4dec changefile handling (experimental)
Claus Gittinger <cg@exept.de>
parents: 8528
diff changeset
  5786
ebe9ec9d4dec changefile handling (experimental)
Claus Gittinger <cg@exept.de>
parents: 8528
diff changeset
  5787
    "Created: / 15.5.2004 / 20:29:03 / masca"
ebe9ec9d4dec changefile handling (experimental)
Claus Gittinger <cg@exept.de>
parents: 8528
diff changeset
  5788
!
ebe9ec9d4dec changefile handling (experimental)
Claus Gittinger <cg@exept.de>
parents: 8528
diff changeset
  5789
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5790
snapShot
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5791
    "create a snapshot file containing all of the current state."
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5792
18869
6e750f31f326 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18792
diff changeset
  5793
    self snapShotOn:(self nameForSnapshot) setImageName:true
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5794
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5795
    "
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5796
     ObjectMemory snapShot
362
claus
parents: 360
diff changeset
  5797
    "
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5798
!
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5799
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5800
snapShotOn:aFileName
18869
6e750f31f326 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18792
diff changeset
  5801
    "create a snapshot file containing all of the current state."
6e750f31f326 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18792
diff changeset
  5802
10921
44e6290ed93f Do not set the ImageName and do not create a copy of the change file when
Stefan Vogel <sv@exept.de>
parents: 10855
diff changeset
  5803
    ^ self snapShotOn:aFileName setImageName:true.
44e6290ed93f Do not set the ImageName and do not create a copy of the change file when
Stefan Vogel <sv@exept.de>
parents: 10855
diff changeset
  5804
44e6290ed93f Do not set the ImageName and do not create a copy of the change file when
Stefan Vogel <sv@exept.de>
parents: 10855
diff changeset
  5805
    "
44e6290ed93f Do not set the ImageName and do not create a copy of the change file when
Stefan Vogel <sv@exept.de>
parents: 10855
diff changeset
  5806
     ObjectMemory snapShotOn:'myimage.img'
44e6290ed93f Do not set the ImageName and do not create a copy of the change file when
Stefan Vogel <sv@exept.de>
parents: 10855
diff changeset
  5807
    "
44e6290ed93f Do not set the ImageName and do not create a copy of the change file when
Stefan Vogel <sv@exept.de>
parents: 10855
diff changeset
  5808
!
44e6290ed93f Do not set the ImageName and do not create a copy of the change file when
Stefan Vogel <sv@exept.de>
parents: 10855
diff changeset
  5809
44e6290ed93f Do not set the ImageName and do not create a copy of the change file when
Stefan Vogel <sv@exept.de>
parents: 10855
diff changeset
  5810
snapShotOn:aFileName setImageName:setImageName
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5811
    "create a snapshot in the given file.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5812
     If the file exists, save it for backup.
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5813
     Return true if the snapshot worked, false if it failed for some reason.
10921
44e6290ed93f Do not set the ImageName and do not create a copy of the change file when
Stefan Vogel <sv@exept.de>
parents: 10855
diff changeset
  5814
     Notify dependents before and after the snapshot operation.
44e6290ed93f Do not set the ImageName and do not create a copy of the change file when
Stefan Vogel <sv@exept.de>
parents: 10855
diff changeset
  5815
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  5816
     If setImageName is true, the name of the current image is set and
10921
44e6290ed93f Do not set the ImageName and do not create a copy of the change file when
Stefan Vogel <sv@exept.de>
parents: 10855
diff changeset
  5817
     a copy of the change file is created."
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5818
8805
573157b1b5dd Make snapshot writing more robust against errors
Stefan Vogel <sv@exept.de>
parents: 8713
diff changeset
  5819
    |ok snapshotFilename tempFilename oldChangeFile|
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5820
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5821
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5822
     give others a chance to fix things
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5823
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5824
    self changed:#save.             "/ will vanish ...
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5825
    self changed:#aboutToSnapshot.  "/ ... for ST-80 compatibility
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5826
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5827
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5828
     ST-80 compatibility; send #preSnapshot to all classes
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5829
    "
5581
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5461
diff changeset
  5830
    Smalltalk allClassesDo:[:aClass |
20478
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5831
        aClass preSnapshot
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5832
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5833
8805
573157b1b5dd Make snapshot writing more robust against errors
Stefan Vogel <sv@exept.de>
parents: 8713
diff changeset
  5834
    "
573157b1b5dd Make snapshot writing more robust against errors
Stefan Vogel <sv@exept.de>
parents: 8713
diff changeset
  5835
     save in a temp file and rename - just in case something
573157b1b5dd Make snapshot writing more robust against errors
Stefan Vogel <sv@exept.de>
parents: 8713
diff changeset
  5836
     bad happens while writing the image.
573157b1b5dd Make snapshot writing more robust against errors
Stefan Vogel <sv@exept.de>
parents: 8713
diff changeset
  5837
     (could be ST/X error or file-system errors etc.)
573157b1b5dd Make snapshot writing more robust against errors
Stefan Vogel <sv@exept.de>
parents: 8713
diff changeset
  5838
    "
573157b1b5dd Make snapshot writing more robust against errors
Stefan Vogel <sv@exept.de>
parents: 8713
diff changeset
  5839
    snapshotFilename := aFileName asFilename.
16650
92b1c33b39f8 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16649
diff changeset
  5840
    snapshotFilename isAbsolute ifFalse:[
20478
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5841
        snapshotFilename := self directoryForImageAndChangeFile
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5842
                            / snapshotFilename name.
16650
92b1c33b39f8 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16649
diff changeset
  5843
    ].
92b1c33b39f8 class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 16649
diff changeset
  5844
15632
34bd14582206 class: ObjectMemory
Stefan Vogel <sv@exept.de>
parents: 15467
diff changeset
  5845
    tempFilename := (FileStream newTemporaryIn:snapshotFilename directory)
20478
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5846
                        close;
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5847
                        fileName.
8805
573157b1b5dd Make snapshot writing more robust against errors
Stefan Vogel <sv@exept.de>
parents: 8713
diff changeset
  5848
    ok := self primSnapShotOn:tempFilename.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5849
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5850
    ok ifTrue:[
20478
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5851
        "keep history of one snapshot file"
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5852
        snapshotFilename exists ifTrue:[
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5853
            tempFilename symbolicAccessRights:snapshotFilename symbolicAccessRights.
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5854
            snapshotFilename renameTo:(snapshotFilename withSuffix:'sav').
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5855
        ] ifFalse:[
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5856
            "image file has stx as interpreter and can be executed"
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5857
            tempFilename makeExecutable.
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5858
        ].
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5859
        tempFilename renameTo:snapshotFilename.
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5860
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5861
        Class addChangeRecordForSnapshot:aFileName.
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5862
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5863
        setImageName ifTrue:[
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5864
            oldChangeFile := self nameForChanges.
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5865
            ImageName := snapshotFilename asAbsoluteFilename asString.
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5866
            self refreshChangesFrom:oldChangeFile.
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5867
        ].
8805
573157b1b5dd Make snapshot writing more robust against errors
Stefan Vogel <sv@exept.de>
parents: 8713
diff changeset
  5868
    ] ifFalse:[
20478
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5869
        tempFilename remove.
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5870
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5871
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5872
    "
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5873
     ST-80 compatibility; send #postSnapshot to all classes
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5874
    "
5581
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5461
diff changeset
  5875
    Smalltalk allClassesDo:[:aClass |
20478
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5876
        aClass postSnapshot
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5877
    ].
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5878
    self changed:#finishedSnapshot.  "/ ST-80 compatibility
6113
a0e97e77ba55 class based exceptions
Claus Gittinger <cg@exept.de>
parents: 6111
diff changeset
  5879
8805
573157b1b5dd Make snapshot writing more robust against errors
Stefan Vogel <sv@exept.de>
parents: 8713
diff changeset
  5880
    ok ifFalse:[
20478
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5881
        SnapshotError raise.
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5882
        "not reached"
8805
573157b1b5dd Make snapshot writing more robust against errors
Stefan Vogel <sv@exept.de>
parents: 8713
diff changeset
  5883
    ].
10921
44e6290ed93f Do not set the ImageName and do not create a copy of the change file when
Stefan Vogel <sv@exept.de>
parents: 10855
diff changeset
  5884
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5885
    Transcript
20478
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5886
        show:'Snapshot '; show:snapshotFilename baseName allBold;
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5887
        show:' saved '; show:Timestamp now;
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5888
        show:' in '; show:snapshotFilename asAbsoluteFilename directoryName;
1cf1156c31dc #DOCUMENTATION by mawalch
mawalch
parents: 20422
diff changeset
  5889
        showCR:'.'.
10921
44e6290ed93f Do not set the ImageName and do not create a copy of the change file when
Stefan Vogel <sv@exept.de>
parents: 10855
diff changeset
  5890
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5891
    ^ ok
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5892
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5893
    "
10921
44e6290ed93f Do not set the ImageName and do not create a copy of the change file when
Stefan Vogel <sv@exept.de>
parents: 10855
diff changeset
  5894
     ObjectMemory snapShotOn:'myimage.img' setImageName:false
44e6290ed93f Do not set the ImageName and do not create a copy of the change file when
Stefan Vogel <sv@exept.de>
parents: 10855
diff changeset
  5895
     ObjectMemory snapShotOn:'myimage.img' setImageName:true
1288
9f6420305017 oops - got corrupted
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  5896
    "
9467
be68d09088ce snapshot save message on the transcript.
Claus Gittinger <cg@exept.de>
parents: 9451
diff changeset
  5897
be68d09088ce snapshot save message on the transcript.
Claus Gittinger <cg@exept.de>
parents: 9451
diff changeset
  5898
    "Modified: / 04-08-2006 / 18:14:45 / cg"
10018
0050c3925a11 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 9488
diff changeset
  5899
!
0050c3925a11 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 9488
diff changeset
  5900
12648
d3c1fea8f18d added: #suffixForSnapshot
Stefan Vogel <sv@exept.de>
parents: 12644
diff changeset
  5901
suffixForSnapshot
d3c1fea8f18d added: #suffixForSnapshot
Stefan Vogel <sv@exept.de>
parents: 12644
diff changeset
  5902
    "return the suffix used for snapshot files'"
d3c1fea8f18d added: #suffixForSnapshot
Stefan Vogel <sv@exept.de>
parents: 12644
diff changeset
  5903
d3c1fea8f18d added: #suffixForSnapshot
Stefan Vogel <sv@exept.de>
parents: 12644
diff changeset
  5904
    ^ 'img'.
d3c1fea8f18d added: #suffixForSnapshot
Stefan Vogel <sv@exept.de>
parents: 12644
diff changeset
  5905
!
d3c1fea8f18d added: #suffixForSnapshot
Stefan Vogel <sv@exept.de>
parents: 12644
diff changeset
  5906
10018
0050c3925a11 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 9488
diff changeset
  5907
writeCrashImage
10921
44e6290ed93f Do not set the ImageName and do not create a copy of the change file when
Stefan Vogel <sv@exept.de>
parents: 10855
diff changeset
  5908
    "create a 'crash.img' snapshot file containing all of the current state.
44e6290ed93f Do not set the ImageName and do not create a copy of the change file when
Stefan Vogel <sv@exept.de>
parents: 10855
diff changeset
  5909
     Keep the current image name."
44e6290ed93f Do not set the ImageName and do not create a copy of the change file when
Stefan Vogel <sv@exept.de>
parents: 10855
diff changeset
  5910
44e6290ed93f Do not set the ImageName and do not create a copy of the change file when
Stefan Vogel <sv@exept.de>
parents: 10855
diff changeset
  5911
    self snapShotOn:self nameForCrashImage setImageName:false
10018
0050c3925a11 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 9488
diff changeset
  5912
0050c3925a11 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 9488
diff changeset
  5913
    "
0050c3925a11 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 9488
diff changeset
  5914
     ObjectMemory writeCrashImage
0050c3925a11 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 9488
diff changeset
  5915
    "
0050c3925a11 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 9488
diff changeset
  5916
0050c3925a11 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 9488
diff changeset
  5917
    "Created: / 29-09-2006 / 12:22:54 / cg"
362
claus
parents: 360
diff changeset
  5918
! !
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  5919
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5920
!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
  5921
12922
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  5922
name:n type:t id:i dynamic:d classNames:c handle:h pathName:p libraryName:l timeStamp:ts
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  5923
    ^ (self basicNew) name:n type:t id:i dynamic:d classNames:c handle:h pathName:p libraryName:l timeStamp:ts
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5924
! !
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5925
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5926
!ObjectMemory::BinaryModuleDescriptor methodsFor:'accessing'!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5927
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5928
classNames
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5929
    "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
  5930
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5931
    ^ classNames
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5932
!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5933
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5934
dynamic
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5935
    "return true, if this module was loaded dynamically
11334
8db8d76a3529 comment
Claus Gittinger <cg@exept.de>
parents: 11030
diff changeset
  5936
     (as opposed to a module which was linked into the system right from the start.
8db8d76a3529 comment
Claus Gittinger <cg@exept.de>
parents: 11030
diff changeset
  5937
      Do not confuse this with shared libraries - these may be dynamic or not)."
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5938
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5939
    ^ dynamic
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5940
!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5941
12922
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  5942
handle
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  5943
    ^ handle
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  5944
!
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  5945
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  5946
handle:something
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  5947
    handle := something.
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  5948
!
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  5949
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5950
id
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5951
    "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
  5952
     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
  5953
     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
  5954
     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
  5955
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5956
    ^ id
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5957
!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5958
12266
724b6519f348 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11747
diff changeset
  5959
isSingleMethod
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  5960
    ^ type == #classObject and:[ libraryName isNil ]
12266
724b6519f348 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11747
diff changeset
  5961
!
724b6519f348 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11747
diff changeset
  5962
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5963
libraryName
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5964
    "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
  5965
     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
  5966
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5967
    ^ libraryName
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5968
!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5969
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5970
name
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5971
    "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
  5972
     libraryName."
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5973
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5974
    ^ name
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5975
!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5976
4686
71f59aaa7d0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  5977
package
71f59aaa7d0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  5978
    "retrieve the modules packageId.
71f59aaa7d0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  5979
     For now, this is constructed, but will be kept in the VM in later
71f59aaa7d0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  5980
     versions."
71f59aaa7d0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  5981
71f59aaa7d0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  5982
    "/ must fetch from my classes ...
71f59aaa7d0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  5983
    classNames do:[:className |
10226
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5984
	|class|
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5985
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5986
	(class := Smalltalk at:className) isBehavior ifTrue:[
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5987
	    ^ class package
541f75c859a0 +setInitTrace
Claus Gittinger <cg@exept.de>
parents: 10019
diff changeset
  5988
	]
4686
71f59aaa7d0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  5989
    ].
71f59aaa7d0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  5990
    ^ nil
71f59aaa7d0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  5991
!
71f59aaa7d0c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  5992
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5993
pathName
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5994
    "return the modules pathName"
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5995
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5996
    ^ pathName
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5997
!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5998
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  5999
timeStamp
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6000
    "return the modules timeStamp"
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6001
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6002
    ^ timeStamp
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6003
!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6004
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6005
type
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6006
    "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
  6007
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6008
    ^ type
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6009
! !
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6010
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6011
!ObjectMemory::BinaryModuleDescriptor methodsFor:'backward compatibility'!
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6012
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6013
at:key
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6014
    "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
  6015
     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
  6016
     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
  6017
12924
1e165b38598b mark obsolete method
Stefan Vogel <sv@exept.de>
parents: 12923
diff changeset
  6018
    <resource: #obsolete>
1e165b38598b mark obsolete method
Stefan Vogel <sv@exept.de>
parents: 12923
diff changeset
  6019
1e165b38598b mark obsolete method
Stefan Vogel <sv@exept.de>
parents: 12923
diff changeset
  6020
    self obsoleteMethodWarning.
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6021
    ^ self perform:key
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6022
! !
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6023
4736
8447ede82551 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4686
diff changeset
  6024
!ObjectMemory::BinaryModuleDescriptor methodsFor:'printing & storing'!
8447ede82551 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4686
diff changeset
  6025
12644
ea39ef35da93 BinaryModuleDescriptor >> printOn:
Stefan Vogel <sv@exept.de>
parents: 12266
diff changeset
  6026
printOn:aStream
13584
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  6027
    aStream
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  6028
	nextPutAll:self class name;
909d95112f7f comment
Claus Gittinger <cg@exept.de>
parents: 13582
diff changeset
  6029
	nextPut:$(.
12644
ea39ef35da93 BinaryModuleDescriptor >> printOn:
Stefan Vogel <sv@exept.de>
parents: 12266
diff changeset
  6030
ea39ef35da93 BinaryModuleDescriptor >> printOn:
Stefan Vogel <sv@exept.de>
parents: 12266
diff changeset
  6031
    name printOn:aStream.
ea39ef35da93 BinaryModuleDescriptor >> printOn:
Stefan Vogel <sv@exept.de>
parents: 12266
diff changeset
  6032
    aStream nextPut:$).
4736
8447ede82551 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4686
diff changeset
  6033
! !
8447ede82551 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4686
diff changeset
  6034
7258
9ccdbee7d1ad method category rename
Claus Gittinger <cg@exept.de>
parents: 7055
diff changeset
  6035
!ObjectMemory::BinaryModuleDescriptor methodsFor:'private-accessing'!
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6036
12922
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  6037
name:n type:t id:i dynamic:d classNames:c handle:h pathName:p libraryName:l timeStamp:ts
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  6038
    name := n.
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  6039
    type := t.
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  6040
    id := i.
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  6041
    dynamic := d.
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  6042
    classNames := c.
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  6043
    libraryName := l.
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  6044
    timeStamp := ts.
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  6045
    handle := h.
7c3ff7cd7d07 Fix dll unloading
Stefan Vogel <sv@exept.de>
parents: 12781
diff changeset
  6046
    pathName := p.
1848
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6047
! !
5aa378aa47a9 make use of private classes in the moduleInfo record
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  6048
1767
d641ddf29273 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
  6049
!ObjectMemory class methodsFor:'documentation'!
630
b785d23d7c5b version at the end
Claus Gittinger <cg@exept.de>
parents: 615
diff changeset
  6050
16324
d64660bd203c class: ObjectMemory
Stefan Vogel <sv@exept.de>
parents: 16323
diff changeset
  6051
version
18777
e7e66b7bb4dd #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18400
diff changeset
  6052
    ^ '$Header$'
16324
d64660bd203c class: ObjectMemory
Stefan Vogel <sv@exept.de>
parents: 16323
diff changeset
  6053
!
d64660bd203c class: ObjectMemory
Stefan Vogel <sv@exept.de>
parents: 16323
diff changeset
  6054
12266
724b6519f348 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11747
diff changeset
  6055
version_CVS
18777
e7e66b7bb4dd #FEATURE
Claus Gittinger <cg@exept.de>
parents: 18400
diff changeset
  6056
    ^ '$Header$'
13421
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  6057
!
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  6058
25437
622824e701ea Fix `ObjectMemory >> #nameForSnapshot`
Jan Vrany <jan.vrany@labware.com>
parents: 23107
diff changeset
  6059
version_HG
622824e701ea Fix `ObjectMemory >> #nameForSnapshot`
Jan Vrany <jan.vrany@labware.com>
parents: 23107
diff changeset
  6060
622824e701ea Fix `ObjectMemory >> #nameForSnapshot`
Jan Vrany <jan.vrany@labware.com>
parents: 23107
diff changeset
  6061
    ^ '$Changeset: <not expanded> $'
622824e701ea Fix `ObjectMemory >> #nameForSnapshot`
Jan Vrany <jan.vrany@labware.com>
parents: 23107
diff changeset
  6062
!
622824e701ea Fix `ObjectMemory >> #nameForSnapshot`
Jan Vrany <jan.vrany@labware.com>
parents: 23107
diff changeset
  6063
13421
27e78b698bff Jan's changes
vrany
parents: 13302
diff changeset
  6064
version_SVN
15233
d1ceef1dcfd2 class: ObjectMemory
Stefan Vogel <sv@exept.de>
parents: 15011
diff changeset
  6065
    ^ '$ Id: ObjectMemory.st 10643 2011-06-08 21:53:07Z vranyj1  $'
630
b785d23d7c5b version at the end
Claus Gittinger <cg@exept.de>
parents: 615
diff changeset
  6066
! !
7055
83b9d61e4b3c do not depend on TimeStamp - TimeStamp to return seconds-integer
Claus Gittinger <cg@exept.de>
parents: 6710
diff changeset
  6067
15011
c34a4f4a216f class: ObjectMemory
Claus Gittinger <cg@exept.de>
parents: 14721
diff changeset
  6068
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 532
diff changeset
  6069
ObjectMemory initialize!