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