we got burned because CompiledMethod>>timeStamp returns a '' when the compiled
method has not timeStamp instead of a TimeStamp.
What we did
we systematically created a timeStamp for a MethodReference
and suddenly
changeStamp size > 0 broke in the following method because it was not
expected a time stamp
We are puzzled because this code should not work when a MethodReference has a
timeStamp. So probably it was only use
without timeStamp.... :(
Stef
printCategoryChunk: category on: aFileStream withStamp: changeStamp
priorMethod: priorMethod
"Print a method category preamble. This must have a category name.
It may have an author/date stamp, and it may have a prior source link.
If it has a prior source link, it MUST have a stamp, even if it is
empty."
"The current design is that changeStamps and prior source links are preserved
in the changes file. All fileOuts include changeStamps. Condensing sources,
however, eliminates all stamps (and links, natch)."
aFileStream cr; nextPut: $!.
aFileStream nextChunkPut: (String streamContents:
[:strm |
strm nextPutAll: self name; nextPutAll: ' methodsFor: '; print:
category asString.
(changeStamp ~~ nil and:
[changeStamp size > 0 or: [priorMethod ~~ nil]]) ifTrue:
[strm nextPutAll: ' stamp: '; print: changeStamp].
priorMethod ~~ nil ifTrue:
[strm nextPutAll: ' prior: '; print: priorMethod
sourcePointer]]).
CompiledMethod>>timeStamp
"Answer the authoring time-stamp for the given method, retrieved from
the sources or changes file. Answer the empty string if no time stamp is
available."
"(CompiledMethod compiledMethodAt: #timeStamp) timeStamp"
| file preamble stamp tokens tokenCount |
self fileIndex == 0 ifTrue: [^ String new]. "no source pointer for
this method"
file := SourceFiles at: self fileIndex.
file ifNil: [^ String new]. "sources file not available"
"file does not exist happens in secure mode"
file := [file readOnlyCopy]
on: FileDoesNotExistException
do:[:ex| ^ String new].
preamble := self getPreambleFrom: file at: (0 max: self filePosition -
3).
stamp := String new.
tokens := (preamble findString: 'methodsFor:' startingAt: 1) > 0
ifTrue: [Scanner new scanTokens: preamble]
ifFalse: [Array new "ie cant be back ref"].
(((tokenCount := tokens size) between: 7 and: 8) and: [(tokens
at: tokenCount - 5) = #methodsFor:])
ifTrue:
[(tokens at: tokenCount - 3) = #stamp:
ifTrue: ["New format gives change stamp
and unified prior pointer"
stamp := tokens at:
tokenCount - 2]].
((tokenCount between: 5 and: 6) and: [(tokens at: tokenCount -
3) = #methodsFor:])
ifTrue:
[(tokens at: tokenCount - 1) = #stamp:
ifTrue: ["New format gives change stamp
and unified prior pointer"
stamp := tokens at:
tokenCount]].
file close.
^ stamp
_______________________________________________
Pharo-users mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users