SnapShotImageMemory.st
author Claus Gittinger <cg@exept.de>
Wed, 25 Oct 2000 12:31:46 +0200
changeset 1420 9a649c1bb8cf
parent 1419 f808d17ff6f5
child 1422 948a90b76e72
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"{ Package: 'cg:private' }"
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
Object subclass:#SnapShotImageMemory
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
     4
	instanceVariableNames:'image stream msb ptrSize intSize intTag spaceInfos symbolEntries
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
		globalEntries addrToObjectMapping'
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
	classVariableNames:''
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
	poolDictionaries:''
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
	category:'System-Support'
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    11
Object subclass:#ImageHeader
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    12
	instanceVariableNames:'memory classRef bits byteSize'
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    13
	classVariableNames:''
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    14
	poolDictionaries:''
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    15
	privateIn:SnapShotImageMemory
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    16
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    17
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
    18
SnapShotImageMemory::ImageHeader variableByteSubclass:#ImageByteObject
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
    19
	instanceVariableNames:''
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
    20
	classVariableNames:''
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
    21
	poolDictionaries:''
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
    22
	privateIn:SnapShotImageMemory
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
    23
!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
    24
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
Object subclass:#SpaceInfo
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
	instanceVariableNames:'start end size flags imageBase'
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
	classVariableNames:''
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
	poolDictionaries:''
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
	privateIn:SnapShotImageMemory
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    32
SnapShotImageMemory::ImageHeader variableSubclass:#ImageObject
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
    33
	instanceVariableNames:'cachedContents'
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
	classVariableNames:''
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
	poolDictionaries:''
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
	privateIn:SnapShotImageMemory
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
SnapShotImageMemory::ImageObject variableSubclass:#ImageClassObject
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
	instanceVariableNames:''
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
	classVariableNames:''
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
	poolDictionaries:''
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
	privateIn:SnapShotImageMemory
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
!SnapShotImageMemory class methodsFor:'instance creation'!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
for:aFilename
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
    ^ self new for:aFilename
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
! !
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
!SnapShotImageMemory class methodsFor:'private'!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
isNilOOP:anOOP
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    ^ anOOP == 0
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
isPointerOOP:anOOP
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    ^ (anOOP bitTest:1) not
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
isSmallIntegerOOP:anOOP
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
    ^ anOOP bitTest:1
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
! !
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
!SnapShotImageMemory methodsFor:'accessing'!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
globalEntries
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
    "return the value of the instance variable 'globalEntries' (automatically generated)"
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    ^ globalEntries!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
globalEntries:something
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
    "set the value of the instance variable 'globalEntries' (automatically generated)"
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    77
    globalEntries := something.!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    78
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    79
image
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    80
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    81
    ^ image
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    82
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    83
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    84
image:something
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    85
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    86
    image := something.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    87
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    88
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    89
ptrSize
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    90
    "return the value of the instance variable 'ptrSize' (automatically generated)"
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    91
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    92
    ^ ptrSize!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    93
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    94
ptrSize:something
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    95
    "set the value of the instance variable 'ptrSize' (automatically generated)"
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    96
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
    97
    ptrSize := something.! !
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
!SnapShotImageMemory methodsFor:'object access'!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   101
fetchByteAt:addr
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   102
    |byte imgAddr|
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   103
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   104
    imgAddr := self imageAddressOf:addr.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   105
    stream position:imgAddr.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   106
    byte := stream next.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   107
    ^ byte
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   108
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   109
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
fetchClassObjectAt:baseAddr
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   111
    |addr classPtr size bits o classRef nInsts|
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   112
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   113
    (baseAddr bitAnd:3) ~~ 0 ifTrue:[self halt].
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
    o := addrToObjectMapping at:baseAddr ifAbsent:nil.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
    o notNil ifTrue:[^ o].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
    addr := baseAddr.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
    classPtr := self fetchPointerAt:addr.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
    addr := addr + ptrSize.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
    size := self fetchUnboxedIntegerAt:addr.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
    addr := addr + ptrSize.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
    bits := self fetchUnboxedIntegerAt:addr.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
    addr := addr + ptrSize.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   126
    nInsts := (size - (intSize *3)) // intSize.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   127
    o := ImageClassObject new:nInsts.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   128
    addrToObjectMapping at:baseAddr put:o.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   129
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   130
    (self class isPointerOOP:classPtr) ifFalse:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   131
        self halt
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   132
    ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   133
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   134
    classRef := self fetchClassObjectAt:classPtr.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   135
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   136
    o classRef:classRef.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   137
size > 8000 ifTrue:[self halt].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   138
    o byteSize:size.
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
    o bits:bits.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   141
    1 to:nInsts do:[:idx |
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
        o at:idx put:(self fetchUnboxedIntegerAt:addr).
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   143
"/        o at:idx put:(self fetchObjectAt:(self fetchUnboxedIntegerAt:addr)).
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   144
        addr := addr + ptrSize.
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
    ].
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   146
    o memory:self.
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
    ^ o
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
fetchObjectAt:baseAddr
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   151
    |addr classPtr classRef size bits o nBytes nInsts flags imgAddr|
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   152
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   153
    baseAddr == 0 ifTrue:[^ nil].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   154
    (baseAddr bitAnd:1) == 1 ifTrue:[(baseAddr bitTest:16r80000000) ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   155
                                         ^ (baseAddr - 16r100000000) bitShift32:-1
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   156
                                     ] ifFalse:[   
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   157
                                         ^ baseAddr bitShift32:-1
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   158
                                     ]
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   159
                                    ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   160
    (baseAddr bitAnd:3) ~~ 0 ifTrue:[self halt].
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
    o := addrToObjectMapping at:baseAddr ifAbsent:nil.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
    o notNil ifTrue:[^ o].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
    addr := baseAddr.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
    classPtr := self fetchPointerAt:addr.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
    addr := addr + ptrSize.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
    size := self fetchUnboxedIntegerAt:addr.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
    addr := addr + ptrSize.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
    bits := self fetchUnboxedIntegerAt:addr.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
    addr := addr + ptrSize.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
    (self class isPointerOOP:classPtr) ifFalse:[
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
        self halt
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
    ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
    classRef := self fetchClassObjectAt:classPtr.
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   178
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   179
    flags := classRef flags bitAnd:Behavior maskIndexType.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   180
    (flags = Behavior flagBytes) ifTrue:[ 
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   181
        nBytes := (size - (intSize * 3)).
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   182
        o := ImageByteObject new:nBytes.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   183
        o classRef:classRef.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   184
size > 8000 ifTrue:[self halt].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   185
        o byteSize:size.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   186
        o bits:bits.
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   188
        imgAddr := self imageAddressOf:addr.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   189
        stream position:imgAddr.
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   191
        1 to:nBytes do:[:idx |
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   192
            o at:idx put:(stream next).
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   193
            addr := addr + 1.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   194
        ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   195
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   196
"/Transcript show:'#'.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   197
"/Transcript show:((ByteArray new:nBytes-1) replaceFrom:1 to:nBytes-1 with:o startingAt:1) asString.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   198
"/Transcript cr.
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   200
    ] ifFalse:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   201
        (flags = Behavior flagNotIndexed) ifFalse:[ 
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   202
            (flags ~= Behavior flagPointers) ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   203
                (flags ~= Behavior flagWeakPointers) ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   204
                    self halt 
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   205
                ]
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   206
            ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   207
        ].
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   209
        nInsts := (size - (intSize * 3)) // intSize.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   210
        (classRef flags bitTest:Behavior flagBehavior)
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   211
        "/ classRef isImageBehavior 
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   212
        ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   213
            o := ImageClassObject new:nInsts.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   214
        ] ifFalse:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   215
            o := ImageObject new:nInsts.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   216
        ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   217
        o classRef:classRef.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   218
size > 8000 ifTrue:[self halt].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   219
        o byteSize:size.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   220
        o bits:bits.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   221
        addrToObjectMapping at:baseAddr put:o.
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   223
        1 to:nInsts do:[:idx |
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   224
            o at:idx put:(self fetchUnboxedIntegerAt:addr).
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   225
"/            o at:idx put:(self fetchObjectAt:(self fetchUnboxedIntegerAt:addr)).
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   226
            addr := addr + ptrSize.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   227
        ]
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   228
    ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   229
    o memory:self.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   230
    ^ o
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
fetchPointerAt:addr
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
    ^ self fetchUnboxedIntegerAt:addr
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
fetchUnboxedIntegerAt:addr
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   238
    |ptr imgAddr|
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   239
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   240
    (addr bitAnd:3) ~~ 0 ifTrue:[self halt].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   241
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   242
    imgAddr := self imageAddressOf:addr.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   243
    stream position:imgAddr.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   244
    ptr := stream nextUnsignedLongMSB:msb.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   245
    ^ ptr
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   246
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   247
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   248
imageAddressOf:addr
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
    spaceInfos do:[:eachSpace |
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   250
        |byte imgAddr|
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
        addr >= eachSpace start ifTrue:[
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
            addr <= eachSpace end ifTrue:[
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
                imgAddr := eachSpace imageBase + (addr - eachSpace start).
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   255
                ^ imgAddr
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
            ]
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
        ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
    ].
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   259
    self halt:'image address error'.
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
! !
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
!SnapShotImageMemory methodsFor:'private'!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
allClassesDo:aBlock
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
    self allGlobalKeysDo:[:eachKey |
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
        |val|
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
        val := self at:eachKey.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
        val isBehavior ifTrue:[
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
            aBlock value:val
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   271
        ] ifFalse:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   272
            self halt.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   273
        ].
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
    ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
allGlobalKeysDo:aBlock
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   278
    globalEntries isNil ifTrue:[
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
        self readHeader.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
        self readGlobals.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
    ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   284
fetchByteArrayFor:aByteArrayRef
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   285
    |nBytes|
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   286
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   287
    (aByteArrayRef isImageBytes) ifFalse:[self halt].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   288
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   289
    nBytes := aByteArrayRef byteSize - (intSize * 3).
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   290
    ^ ((ByteArray new:nBytes) replaceFrom:1 to:nBytes-1 with:aByteArrayRef startingAt:1).!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   291
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   292
fetchStringFor:aStringRef
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   293
    |nBytes|
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   294
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   295
    (aStringRef isImageBytes) ifFalse:[self halt].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   296
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   297
    nBytes := aStringRef byteSize - (intSize * 3).
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   298
    ^ ((ByteArray new:nBytes-1) replaceFrom:1 to:nBytes-1 with:aStringRef startingAt:1) asString.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   299
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   300
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
for:aFilename
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
    stream := aFilename asFilename readStream binary.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
    addrToObjectMapping := IdentityDictionary new.
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   304
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   305
    addrToObjectMapping at:(ObjectMemory addressOf:false) put:false.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   306
    addrToObjectMapping at:(ObjectMemory addressOf:true) put:true.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   307
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   308
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   309
printStringOfClass:aClassRef
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   310
    |nameSlot|
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   311
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   312
    (aClassRef isImageBehavior) ifFalse:[self halt].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   313
    ((aClassRef byteSize // intSize) - 3) < Class instSize ifTrue:[self halt.].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   314
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   315
    nameSlot := aClassRef at:7.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   316
    nameSlot isInteger ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   317
        nameSlot := self fetchObjectAt:nameSlot
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   318
    ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   319
    nameSlot isImageSymbol ifFalse:[self halt].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   320
    ^ 'Class: ' , (self printStringOfSymbol:nameSlot)
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   321
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   322
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   323
printStringOfObject:anObjectRef
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   324
    |s nBytes|
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   325
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   326
    anObjectRef isNil ifTrue:[^ 'nil'].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   327
    (anObjectRef isInteger) ifTrue:[^ anObjectRef printString].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   328
    (anObjectRef == true ) ifTrue:[^ anObjectRef printString].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   329
    (anObjectRef == false) ifTrue:[^ anObjectRef printString].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   330
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   331
    (anObjectRef isImageSymbol) ifTrue:[^ self printStringOfSymbol:anObjectRef].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   332
    (anObjectRef isImageBehavior) ifTrue:[^ self printStringOfClass:anObjectRef].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   333
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   334
    ^ 'obj(' , anObjectRef printString , ')'
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   335
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   336
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   337
printStringOfString:aStringRef
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   338
    |nBytes|
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   339
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   340
    (aStringRef isString) ifFalse:[self halt].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   341
    ^ self fetchStringFor:aStringRef.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   342
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   343
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   344
printStringOfSymbol:aSymbolRef
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   345
    |nBytes|
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   346
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   347
    (aSymbolRef isImageSymbol) ifFalse:[self halt].
1420
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   348
    ^ self fetchStringFor:aSymbolRef.
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   349
"/    nBytes := aSymbolRef size - (intSize * 3).
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   350
"/    ^ ((ByteArray new:nBytes-1) replaceFrom:1 to:nBytes-1 with:aSymbolRef startingAt:1) asString.
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
readGlobalEntries
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   354
        |refPointer theSymbolPtr theSymbolRef theValuePtr theValueRef pos|
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
        globalEntries := OrderedCollection new.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
        [
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
            refPointer := stream nextUnsignedLongMSB:msb.
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   359
            theSymbolPtr := stream nextUnsignedLongMSB:msb.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   360
            theValuePtr := stream nextUnsignedLongMSB:msb.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   361
            theSymbolPtr ~~ 0
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
        ] whileTrue:[
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   363
            globalEntries add:(theSymbolPtr -> theValuePtr).
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
        ].
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   365
        globalEntries := globalEntries asArray.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   366
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   367
"/ globalEntries inspect.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   368
        pos := stream position.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   369
        globalEntries do:[:item |
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   370
            theSymbolPtr := item key.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   371
            theValuePtr := item value.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   372
            theSymbolRef := self fetchObjectAt:theSymbolPtr.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   373
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   374
"/            Transcript show:(self printStringOfSymbol:theSymbolRef).
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   375
"/            Transcript show:'->'.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   376
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   377
            theValueRef := self fetchObjectAt:theValuePtr.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   378
"/            Transcript show:(self printStringOfObject:theValueRef).
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   379
"/            Transcript cr.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   380
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   381
            item key:theSymbolRef.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   382
            item value:theValueRef.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   383
        ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   384
        stream position:pos.
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   386
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   387
readHeader
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
        "
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
         (self for:'stmeas.img') readHeader
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
        "
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
        |order magic version timeStamp snapID last_util_addr hiText_addr flags 
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   393
         lowData hiData charSlots charTableSlots fixMemStart fixMemEnd 
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   394
         symMemStart symMemEnd vmDataAddr sharedMethodCode sharedBlockCode 
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
         nContexts contextSpace nRegistered symbolsSeqNr nSpaces 
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   396
         classNameSize spaceSize|
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
        stream next:256.        "/ skip execCmd
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   399
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   400
        msb := false.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   401
        order := stream nextUnsignedLongMSB:msb.        
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   402
        order = 16r076543210 ifTrue:[
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
        ] ifFalse:[
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
            order = 16r01234567 ifTrue:[
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
                msb := true.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   406
            ] ifFalse:[
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
                self error:'unhandled byteorder'
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   408
            ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   409
        ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   410
        magic := (stream next:8) asString.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   411
        magic ~= 'ST/X-IMG' ifTrue:[
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   412
            self error:'not an st/x image'
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   413
        ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   414
        version := stream nextUnsignedLongMSB:msb.        
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   415
        timeStamp := stream nextUnsignedLongMSB:msb.        
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   416
        ptrSize := stream nextByte.        
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   417
        ptrSize ~~ 4 ifTrue:[
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   418
            self error:'unhandled ptr format'
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   419
        ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   420
        stream next:7.    "/ filler    
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   421
        intSize := stream nextUnsignedLongMSB:msb.        
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   422
        intSize == 9 ifTrue:[
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   423
            intSize := 4.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   424
            intTag := 1.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
        ] ifFalse:[
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   426
            self error:'unhandled int format'
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   427
        ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
        
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
        snapID := stream nextUnsignedLongMSB:msb.        
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   430
        last_util_addr := stream next:intSize.        
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   431
        hiText_addr := stream next:intSize.        
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   432
        flags := stream next:intSize.        
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   433
        stream next:8.    "/ info, debug & filler    
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   434
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   435
        lowData := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   436
        hiData := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   437
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   438
        charSlots := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   439
        charTableSlots := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   440
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   441
        version >= 8 ifTrue:[
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   442
            fixMemStart := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   443
            fixMemEnd := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   444
            symMemStart := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   445
            symMemEnd := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   446
            vmDataAddr := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   447
        ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   448
        stream next:(128 * intSize).    "/ skip sharedMethodCode ptrs
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
        stream next:(128 * intSize).    "/ skip sharedBlockCode ptrs
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   450
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   451
        nContexts := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   452
        contextSpace := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   453
        nRegistered := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   454
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   455
        version >= 8 ifTrue:[
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   456
            version >= 9 ifTrue:[
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   457
                symbolsSeqNr := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   458
                stream next:(intSize * 31).
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   459
            ] ifFalse:[
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   460
                stream next:(intSize * 32).
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   461
            ]
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   462
        ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   463
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   464
        nSpaces := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   465
        spaceInfos := (1 to:nSpaces) collect:[:idx | SpaceInfo new].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   466
        
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   467
        1 to:nSpaces do:[:i |
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
            (spaceInfos at:i) flags:(stream nextUnsignedLongMSB:msb).
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   469
        ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   470
        nSpaces+1 to:32 do:[:i | stream nextUnsignedLongMSB:msb].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   471
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   472
        1 to:nSpaces do:[:i |
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   473
            (spaceInfos at:i) start:(stream nextUnsignedLongMSB:msb).
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
        ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   475
        nSpaces+1 to:32 do:[:i | stream nextUnsignedLongMSB:msb].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   476
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   477
        1 to:nSpaces do:[:i |
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   478
            (spaceInfos at:i) size:(stream nextUnsignedLongMSB:msb).
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   479
        ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   480
        nSpaces+1 to:32 do:[:i | stream nextUnsignedLongMSB:msb].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   481
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   482
        version >= 8 ifTrue:[
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   483
            stream position:(stream class zeroPosition).
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   484
            stream skip:4096.
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   485
        ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   487
        1 to:nSpaces do:[:i |
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   488
            (spaceInfos at:i) end:((spaceInfos at:i) start + (spaceInfos at:i) size - 1).
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   489
        ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   490
        1 to:nSpaces do:[:i |
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   491
            (spaceInfos at:i) imageBase:(stream position).
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   492
            spaceSize := (spaceInfos at:i) size.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   493
            stream skip:spaceSize.
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   494
        ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
        "/ registration
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   498
        self readRegistrationEntries.
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   499
        Transcript showCR:'reading symbols...'.
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   500
        self readSymbolEntries.
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   501
        self readUGlobalEntries.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   502
        Transcript showCR:'reading globals...'.
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   503
        self readGlobalEntries.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   504
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   505
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   506
"/struct basicImageHeader {
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   507
"/        char            h_execCmd[256];
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   508
"/
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   509
"/        int             h_orderWord;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   510
"/        char            h_magic[8];
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   511
"/        int             h_version;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   512
"/        int             h_timeStamp;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   513
"/        char            h_ptrSize;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
"/        char            h_filler1[7];
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   515
"/        int             h_intSize;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   516
"/        int             h_snapID;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   517
"/        INT             h_last_util_addr;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   518
"/        INT             h_hiText_addr;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   519
"/        INT             h_flags;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   520
"/        char            h_infoPrinting;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
"/        char            h_debugPrinting;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   522
"/        char            h_filler2[6];
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
"/
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
"/        /*
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   525
"/         * these are to verify compatibility of the image with
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   526
"/         * myself ...
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
"/         * this is now obsolete.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   528
"/         */
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   529
"/        INT             h_lowData, h_hiData;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   530
"/
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   531
"/        /*
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   532
"/         * base address of character- and characterTable slots
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   533
"/         */
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   534
"/        INT             h_charSlots;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
"/        INT             h_charTableSlots;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   536
"/
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   537
"/#if HEADER_VERSION >= 8
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   538
"/        /*
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   539
"/         * the fixBase (VMDATA address)
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   540
"/         */
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   541
"/        INT             h_fixMemStart;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   542
"/        INT             h_fixMemEnd;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   543
"/        INT             h_symMemStart;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   544
"/        INT             h_symMemEnd;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   545
"/
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   546
"/        INT             h_vmDataAddr;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   547
"/#endif
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   548
"/
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   549
"/        INT             h_sharedMethodCode[128];
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   550
"/        INT             h_sharedBlockCode[128];
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   551
"/
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   552
"/        /*      
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   553
"/         * space needed to restore contexts
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   554
"/         */
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   555
"/        INT             h_nContexts;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   556
"/        INT             h_contextSpace;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   557
"/
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   558
"/        /*
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   559
"/         * number of class registration info records
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   560
"/         */
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   561
"/        INT             h_nRegistered;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   562
"/
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   563
"/#if HEADER_VERSION >= 8
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   564
"/        /*
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   565
"/         * reserved slots, for future versions
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   566
"/         * (can add additional info, without affecting position of following stuff)
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   567
"/         * If you add slots, you MUST DECREMENT the fillcount.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   568
"/         */
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   569
"/# if HEADER_VERSION >= 9
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   570
"/        INT             h_symbolsSeqNr;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   571
"/        INT             h_reserved[31];
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   572
"/# else
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   573
"/        INT             h_reserved[32];
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   574
"/# endif
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   575
"/#endif
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   576
"/
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   577
"/        /*
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   578
"/         * number of spaces, base and size of each
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   579
"/         */
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   580
"/        INT             h_nSpaces;
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   581
"/        INT             h_spaceFlags[MAXSPACES];
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   582
"/        INT             h_spaceBase[MAXSPACES];
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   583
"/        INT             h_spaceSize[MAXSPACES];
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   584
"/
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   585
"/        /*
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   586
"/         * here come nSpaces object spaces
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   587
"/         */
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   588
"/
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   589
"/        /*
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   590
"/         * here comes registration info
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   591
"/         */
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   592
"/
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   593
"/        /*
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   594
"/         * here come nSymbols symbolEntries
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   595
"/         * followed by a zero/zero entry
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   596
"/         */
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   597
"/
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   598
"/        /*
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   599
"/         * here come nGlobal globalEntries
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   600
"/         * followed by a zero/zero entry
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   601
"/         */
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   602
"/
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   603
"/        /*
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   604
"/         * here come nUnnamedGlobal globalEntries
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   605
"/         * followed by a zero/zero entry
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   606
"/         */
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   607
"/
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   608
"/        /*
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   609
"/         * here come stack contexts
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   610
"/         */
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   611
"/};      
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   612
!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   613
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   614
readRegistrationEntries
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   615
        |classNameSize|
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   616
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   617
        [
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   618
            classNameSize := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   619
            classNameSize ~~ 0
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   620
        ] whileTrue:[
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   621
            |className flags moduleTimestamp signature nMethods nBlocks oldLitRefs nLitRefs
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   622
             oldConstTable nConsts|
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   623
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   624
            className := (stream next:classNameSize) asString.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   625
            stream next. "/ 0-byte
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   626
            flags := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   627
            moduleTimestamp := stream nextUnsignedLongMSB:msb.   
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   628
            signature := stream nextUnsignedLongMSB:msb.   
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   629
            nMethods := stream nextUnsignedLongMSB:msb.   
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   630
            nMethods timesRepeat:[ stream nextUnsignedLongMSB:msb ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   631
            nBlocks := stream nextUnsignedLongMSB:msb.   
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   632
            nBlocks timesRepeat:[ stream nextUnsignedLongMSB:msb ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   633
            oldLitRefs := stream nextUnsignedLongMSB:msb.  
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   634
            nLitRefs := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   635
            nLitRefs timesRepeat:[ stream nextUnsignedLongMSB:msb ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   636
            stream nextUnsignedLongMSB:msb. "/ 0-litRef
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   637
            oldConstTable := stream nextUnsignedLongMSB:msb.  
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   638
            nConsts := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   639
            nConsts timesRepeat:[ stream nextUnsignedLongMSB:msb ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   640
1420
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   641
            "/ Transcript showCR:className.
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   642
        ].
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   643
!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   644
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   645
readSymbolEntries
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   646
        |refPointer theSymbolPtr theSymbolRef pos|
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   647
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   648
        symbolEntries := OrderedCollection new.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   649
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   650
        [
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   651
            refPointer := stream nextUnsignedLongMSB:msb.
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   652
            theSymbolPtr := stream nextUnsignedLongMSB:msb.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   653
            theSymbolPtr ~~ 0
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   654
        ] whileTrue:[
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   655
            symbolEntries add:theSymbolPtr.
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   656
        ].
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   657
        symbolEntries := symbolEntries asArray.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   658
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   659
        pos := stream position.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   660
        symbolEntries := symbolEntries collect:[:theSymbolPtr |
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   661
            theSymbolRef := self fetchObjectAt:theSymbolPtr.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   662
            theSymbolRef isImageSymbol ifFalse:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   663
                self halt
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   664
            ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   665
        ].        
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   666
        stream position:pos
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   667
!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   668
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   669
readUGlobalEntries
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   670
        |refPointer theValue|
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   671
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   672
        [
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   673
            refPointer := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   674
            theValue := stream nextUnsignedLongMSB:msb.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   675
            refPointer ~~ 0
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   676
        ] whileTrue
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   677
! !
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   678
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   679
!SnapShotImageMemory::ImageHeader methodsFor:'accessing'!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   680
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   681
bits
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   682
    "return the value of the instance variable 'bits' (automatically generated)"
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   683
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   684
    ^ bits!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   685
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   686
bits:something
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   687
    "set the value of the instance variable 'bits' (automatically generated)"
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   688
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   689
    bits := something.!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   690
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   691
byteSize
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   692
    "return the value of the instance variable 'size' (automatically generated)"
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   693
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   694
    ^ byteSize
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   695
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   696
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   697
byteSize:something
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   698
    "set the value of the instance variable 'size' (automatically generated)"
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   699
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   700
something > 8000 ifTrue:[self halt].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   701
    byteSize := something.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   702
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   703
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   704
classRef
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   705
    "return the value of the instance variable 'classRef' (automatically generated)"
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   706
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   707
    ^ classRef!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   708
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   709
classRef:something
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   710
    "set the value of the instance variable 'classRef' (automatically generated)"
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   711
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   712
    classRef := something.!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   713
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   714
memory
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   715
    "return the value of the instance variable 'memory' (automatically generated)"
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   716
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   717
    ^ memory!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   718
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   719
memory:something
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   720
    "set the value of the instance variable 'memory' (automatically generated)"
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   721
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   722
    memory := something.! !
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   723
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   724
!SnapShotImageMemory::ImageHeader methodsFor:'queries'!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   725
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   726
category
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   727
    |categoryPtr categoryRef category|
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   728
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   729
    self isMethodOrLazyMethod ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   730
        categoryPtr := self at:6.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   731
        categoryRef := memory fetchObjectAt:categoryPtr.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   732
        category := memory fetchStringFor:categoryRef.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   733
        ^ category
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   734
    ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   735
self halt.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   736
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   737
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   738
isBehavior
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   739
    ^ self isImageBehavior!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   740
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   741
isImageBehavior
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   742
    |flags|
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   743
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   744
    flags := classRef flags.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   745
    ^ flags bitTest:Behavior flagBehavior  
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   746
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   747
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   748
isImageBytes
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   749
    |flags|
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   750
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   751
    flags := classRef flags bitAnd:Behavior maskIndexType.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   752
    ^ flags = Behavior flagBytes 
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   753
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   754
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   755
isImageMethod
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   756
    |flags|
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   757
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   758
    flags := classRef flags.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   759
    ^ flags bitTest:Behavior flagMethod 
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   760
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   761
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   762
isImageSymbol
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   763
    |flags|
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   764
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   765
    flags := classRef flags.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   766
    ^ flags bitTest:Behavior flagSymbol 
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   767
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   768
1420
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   769
isJavaMethod    
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   770
    |nm|
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   771
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   772
    nm := classRef name.
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   773
    ^ (nm = 'JavaMethod'
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   774
      or:[ nm = 'JavaMethodWithException' 
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   775
      or:[ nm = 'JavaMethodWithHandler' 
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   776
      or:[ nm = 'JavaNativeMethod' ]]])
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   777
!
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   778
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   779
isLazyMethod                               
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   780
    ^ classRef name = 'LazyMethod'!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   781
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   782
isMeta
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   783
    ^ false
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   784
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   785
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   786
isMethod                               
1420
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   787
    |cls|
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   788
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   789
    cls := classRef.
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   790
    [cls notNil] whileTrue:[
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   791
        cls name = 'Method' ifTrue:[^ true].
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   792
        cls := cls superclass
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   793
    ].
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   794
    ^ false.
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   795
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   796
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   797
isMethodDictionary
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   798
    ^ classRef name = 'MethodDictionary'
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   799
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   800
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   801
isMethodOrLazyMethod                 
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   802
    classRef name = 'LazyMethod' ifTrue:[^ true].
1420
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   803
    ^ self isMethod
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   804
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   805
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   806
isString                               
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   807
    ^ classRef name = 'String'
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   808
! !
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   809
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   810
!SnapShotImageMemory::ImageByteObject methodsFor:'queries'!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   811
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   812
size
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   813
    ^ byteSize
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   814
! !
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   815
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   816
!SnapShotImageMemory::SpaceInfo methodsFor:'accessing'!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   817
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   818
end
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   819
    "return the value of the instance variable 'end' (automatically generated)"
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   820
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   821
    ^ end!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   822
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   823
end:something
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   824
    "set the value of the instance variable 'end' (automatically generated)"
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   825
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   826
    end := something.!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   827
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   828
flags
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   829
    "return the value of the instance variable 'flags' (automatically generated)"
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   830
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   831
    ^ flags!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   832
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   833
flags:something
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   834
    "set the value of the instance variable 'flags' (automatically generated)"
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   835
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   836
    flags := something.!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   837
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   838
imageBase
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   839
    "return the value of the instance variable 'imageBase' (automatically generated)"
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   840
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   841
    ^ imageBase!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   842
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   843
imageBase:something
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   844
    "set the value of the instance variable 'imageBase' (automatically generated)"
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   845
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   846
    imageBase := something.!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   847
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   848
size
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   849
    "return the value of the instance variable 'size' (automatically generated)"
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   850
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   851
    ^ size!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   852
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   853
size:something
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   854
    "set the value of the instance variable 'size' (automatically generated)"
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   855
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   856
    size := something.!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   857
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   858
start
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   859
    "return the value of the instance variable 'start' (automatically generated)"
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   860
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   861
    ^ start!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   862
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   863
start:something
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   864
    "set the value of the instance variable 'start' (automatically generated)"
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   865
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   866
    start := something.! !
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   867
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   868
!SnapShotImageMemory::ImageObject methodsFor:'method protocol'!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   869
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   870
byteCode
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   871
    |byteCodeSlotOffset byteCodePtr byteCodeRef byteCode|
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   872
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   873
    self isMethod ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   874
        byteCodeSlotOffset := Method instVarOffsetOf:'byteCode'.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   875
    ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   876
    byteCodeSlotOffset notNil ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   877
        byteCodePtr := self at:byteCodeSlotOffset.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   878
        byteCodeRef := memory fetchObjectAt:byteCodePtr.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   879
        byteCodeRef isNil ifTrue:[^ nil].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   880
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   881
        byteCode := memory fetchByteArrayFor:byteCodeRef.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   882
        ^ byteCode
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   883
    ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   884
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   885
    self halt.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   886
!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   887
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   888
comment
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   889
    |src comment comments parser|
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   890
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   891
    self isMethod ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   892
        src := self source.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   893
        src isNil ifTrue:[^ nil].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   894
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   895
        parser := Parser for:src in:nil.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   896
        parser ignoreErrors; ignoreWarnings; saveComments:true.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   897
        parser parseMethodSpec.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   898
        comments := parser comments.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   899
        comments size ~~ 0 ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   900
            comment := comments first string.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   901
            (comment withoutSpaces endsWith:'}') ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   902
                "if first comment is a pragma, take next comment"
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   903
                comment := comments at:2 ifAbsent:nil.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   904
                comment notNil ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   905
                    comment := comment string.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   906
                ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   907
            ].
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   908
        ].
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   909
        ^ comment.
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   910
    ].
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   911
    self isLazyMethod ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   912
        ^ ''
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   913
    ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   914
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   915
    self halt.
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   916
!
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   917
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   918
containingClass
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   919
    self isMethodOrLazyMethod ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   920
        ^ self mclass
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   921
    ].
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   922
    self halt.!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   923
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   924
hasCode
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   925
    ^ false!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   926
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   927
isBreakpointed
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   928
    ^ false!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   929
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   930
isCounting
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   931
    ^ false!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   932
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   933
isCountingMemoryUsage
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   934
    ^ false!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   935
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   936
isDynamic
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   937
    ^ false!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   938
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   939
isExecutable
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   940
    self isMethod ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   941
        ^ false
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   942
    ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   943
    self halt.!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   944
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   945
isIgnored
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   946
    ^ false!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   947
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   948
isPrivate
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   949
    ^ false!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   950
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   951
isProtected
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   952
    ^ false!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   953
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   954
isPublic
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   955
    ^ true!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   956
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   957
isTimed
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   958
    ^ false!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   959
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   960
isTraced
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   961
    ^ false!
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   962
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   963
isWrapped
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
   964
    ^ false
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   965
!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   966
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   967
mclass
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   968
    |mclassSlotOffset mclassPtr mclass|
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   969
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   970
    self isMethod ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   971
        mclassSlotOffset := Method instVarOffsetOf:'mclass'.
1420
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   972
    ] ifFalse:[
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   973
        self isJavaMethod ifTrue:[
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   974
            mclassSlotOffset := JavaMethod instVarOffsetOf:'javaClass'.
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   975
        ]
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   976
    ].
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   977
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   978
    mclassSlotOffset notNil ifTrue:[
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   979
        mclassPtr := self at:mclassSlotOffset.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   980
        mclassPtr ~~ 0 ifTrue:[
1420
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   981
            mclassPtr isInteger ifTrue:[
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   982
                mclass := memory fetchObjectAt:mclassPtr.
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   983
                self at:mclassSlotOffset put:mclass.    
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   984
            ] ifFalse:[
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   985
                mclass := mclassPtr.
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   986
            ].
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   987
            mclass isImageBehavior ifFalse:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   988
                self halt
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   989
            ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   990
            ^ mclass
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   991
        ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   992
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   993
        "/ search my class ...
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   994
        memory image allClassesDo:[:eachClass |
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   995
            eachClass theNonMetaclass methodDictionary keysAndValuesDo:[:sel :mthdRef |
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   996
                mthdRef == self ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   997
                    self at:mclassSlotOffset put:eachClass theNonMetaclass.    
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   998
                    ^ eachClass theNonMetaclass
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   999
                ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1000
            ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1001
            eachClass theMetaclass methodDictionary keysAndValuesDo:[:sel :mthdRef |
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1002
                mthdRef == self ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1003
                    self at:mclassSlotOffset put:eachClass theMetaclass.    
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1004
                    ^ eachClass theMetaclass
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1005
                ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1006
            ]
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1007
        ].
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1008
        self halt.
1420
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1009
        ^ nil.
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1010
    ].
1420
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1011
    ^ nil.
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1012
    self halt.
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1013
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1014
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1015
numArgs
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1016
    |flagsSlotOffset flagsPtr flags|
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1017
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1018
    self isMethod ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1019
        flagsSlotOffset := Method instVarOffsetOf:'flags'.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1020
    ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1021
    flagsSlotOffset notNil ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1022
        flagsPtr := self at:flagsSlotOffset.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1023
        flags := memory fetchObjectAt:flagsPtr.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1024
        ^ (flags bitAnd:(Method numArgsMaskInFlags)) bitShift:(Method numArgsShiftInFlags negated)   
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1025
    ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1026
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1027
    self halt.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1028
!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1029
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1030
package
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1031
    |packageSlotOffset packagePtr packageRef package|
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1032
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1033
    self isImageBehavior ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1034
        self isMeta ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1035
            ^ self theNonMetaclass package
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1036
        ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1037
        packageSlotOffset := Class instVarOffsetOf:'package'.
1420
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1038
    ] ifFalse:[
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1039
        self isMethod ifTrue:[
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1040
            packageSlotOffset := Method instVarOffsetOf:'package'.
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1041
        ] ifFalse:[
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1042
            self isLazyMethod ifTrue:[
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1043
                packageSlotOffset := Method instVarOffsetOf:'package'.
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1044
            ].
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1045
        ].
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1046
    ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1047
    packageSlotOffset notNil ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1048
        packagePtr := self at:packageSlotOffset.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1049
        packageRef := memory fetchObjectAt:packagePtr.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1050
        packageRef isNil ifTrue:[^ nil].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1051
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1052
        packageRef isImageSymbol ifFalse:[
1420
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1053
            packageRef isImageBytes ifFalse:[
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1054
                self halt.
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1055
            ].
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1056
            "/ mhmh - can be a string sometimes ...
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1057
        ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1058
        package := memory fetchStringFor:packageRef.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1059
        ^ package asSymbol
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1060
    ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1061
    self isMeta ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1062
        self halt
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1063
    ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1064
1420
9a649c1bb8cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1065
    ^ nil
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1066
!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1067
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1068
previousVersion
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1069
    ^ nil!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1070
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1071
printStringForBrowserWithSelector:selector
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1072
    ^ selector
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1073
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1074
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1075
privacy
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1076
    ^ #public!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1077
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1078
resources
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1079
    ^ nil
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1080
!
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1081
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1082
source
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1083
    |sourcePosition sourcePositionPtr sourcePtr sourceRef source aStream junk|
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1084
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1085
    self isMethodOrLazyMethod ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1086
        sourcePositionPtr := self at:(Method instVarOffsetOf:'sourcePosition').
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1087
        sourcePtr := self at:(Method instVarOffsetOf:'source').
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1088
        sourceRef := memory fetchObjectAt:sourcePtr.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1089
        sourceRef isString ifFalse:[
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1090
            self halt.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1091
        ].
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1092
        source := memory printStringOfString:sourceRef.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1093
        sourcePosition := memory fetchObjectAt:sourcePositionPtr.
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1094
        sourcePosition isNil ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1095
            ^ source
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1096
        ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1097
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1098
        aStream := self sourceStream.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1099
        aStream notNil ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1100
            Stream positionErrorSignal handle:[:ex |
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1101
                ^ nil
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1102
            ] do:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1103
                aStream position:sourcePosition abs.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1104
            ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1105
            junk := aStream nextChunk.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1106
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1107
            aStream close.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1108
            ^ junk
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1109
        ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1110
    ].
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1111
    self halt.
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1112
!
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1113
1419
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1114
sourceFilename
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1115
    "return the sourcefilename if source is extern; nil otherwise"
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1116
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1117
    self isMethodOrLazyMethod ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1118
        self sourcePosition notNil ifTrue:[^ self source].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1119
        ^ nil
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1120
    ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1121
    self halt.!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1122
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1123
sourceLineNumber
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1124
    self isMethodOrLazyMethod ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1125
        ^ 1
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1126
    ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1127
    self halt.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1128
!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1129
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1130
sourcePosition
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1131
    |sourcePosition|
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1132
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1133
    self isMethodOrLazyMethod ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1134
        sourcePosition := self sourcePositionValue.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1135
        sourcePosition isNil ifTrue:[^ sourcePosition].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1136
        ^ sourcePosition abs
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1137
    ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1138
    self halt.!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1139
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1140
sourcePositionValue
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1141
    |sourcePosition sourcePositionPtr|
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1142
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1143
    self isMethodOrLazyMethod ifTrue:[
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1144
        sourcePositionPtr := self at:(Method instVarOffsetOf:'sourcePosition').
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1145
        sourcePosition := memory fetchObjectAt:sourcePositionPtr.
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1146
        ^ sourcePosition 
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1147
    ].
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1148
    self halt.!
f808d17ff6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1149
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1150
sourceStream
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1151
    |sourcePosition source aStream fileName junk who 
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1152
     myClass mgr className sep dir mod package|
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1153
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1154
    self isMethod ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1155
        sourcePosition := self at:(Method instVarOffsetOf:'sourcePosition').
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1156
        source := self at:(Method instVarOffsetOf:'source').
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1157
        source := memory fetchObjectAt:source.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1158
        source isString ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1159
            source := memory printStringOfString:source.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1160
        ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1161
        sourcePosition notNil ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1162
            sourcePosition := memory fetchObjectAt:sourcePosition.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1163
        ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1164
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1165
        source isNil ifTrue:[^ nil].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1166
        sourcePosition isNil ifTrue:[^ source readStream].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1167
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1168
        sourcePosition < 0 ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1169
            aStream := source asFilename readStream.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1170
            aStream notNil ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1171
                ^ aStream
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1172
            ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1173
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1174
            fileName := Smalltalk getSourceFileName:source.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1175
            fileName notNil ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1176
                aStream := fileName asFilename readStream.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1177
                aStream notNil ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1178
                    ^ aStream
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1179
                ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1180
            ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1181
        ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1182
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1183
        "/
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1184
        "/ if there is no SourceManager, look in local standard places first
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1185
        "/
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1186
        (mgr := Smalltalk at:#SourceCodeManager) isNil ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1187
            aStream := self localSourceStream.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1188
            aStream notNil ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1189
                ^ aStream
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1190
            ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1191
        ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1192
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1193
        "/
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1194
        "/ nope - ask my class for the source (this also invokes the SCMgr)
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1195
        "/
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1196
        myClass := self mclass.
1416
eec0911414fe initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1197
1417
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1198
        package := self package.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1199
        (package notNil and:[package ~= myClass package]) ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1200
            mgr notNil ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1201
                "/ try to get the source using my package information ...
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1202
                sep := package indexOfAny:'/\:'.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1203
                sep ~~ 0 ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1204
                    mod := package copyTo:sep - 1.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1205
                    dir := package copyFrom:sep + 1.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1206
                    aStream := mgr streamForClass:nil fileName:source revision:nil directory:dir module:mod cache:true.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1207
                    aStream notNil ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1208
                        ^ aStream
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1209
                    ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1210
                ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1211
            ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1212
        ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1213
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1214
        aStream := myClass sourceStreamFor:source.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1215
        aStream notNil ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1216
            ^ aStream
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1217
        ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1218
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1219
        "/
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1220
        "/ nope - look in standard places 
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1221
        "/ (if there is a source-code manager - otherwise, we already did that)
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1222
        "/
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1223
        mgr notNil ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1224
            aStream := self localSourceStream.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1225
            aStream notNil ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1226
                ^ aStream
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1227
            ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1228
        ].
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1229
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1230
        "/
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1231
        "/ final chance: try current directory
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1232
        "/
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1233
        aStream isNil ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1234
            aStream := source asFilename readStream.
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  1235
            aStream notNil ifTrue:[
28d6026fe30c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1416
diff change