Levente Uzonyi uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-ul.480.mcz
==================== Summary ====================
Name: Tests-ul.480
Author: ul
Time: 31 March 2022, 5:10:21.743078 pm
UUID: 18dce5e3-6390-4fc5-a1a3-f7419181d048
Ancestors: Tests-mt.479
- updated DecompilerTests >> #decompilerFailures to match the actual methods
=============== Diff against Tests-mt.479 ===============
Item was changed:
----- Method: DecompilerTests>>decompilerFailures (in category 'utilities') -----
decompilerFailures
"Here is the list of failures: either a syntax error, a hard error or some failure to decompile correctly.
Collected initially via
DecompilerTestFailuresCollector new computeFailures.
But can be maintained manually."
"class name, selector, error class name or nil"
^#(
#(BrowserCommentTextMorph showPane SyntaxErrorNotification)
- #(CodeHolder getSelectorAndSendQuery:to:with: SyntaxErrorNotification)
#(DecompilerTests testDecompileUnreachableParameter Error)
#(MVCToolBuilder setLayout:in: SyntaxErrorNotification) "same-name block-local temps in optimized blocks"
#(PNGReadWriter copyPixelsGray: SyntaxErrorNotification)
#(SHMCClassDefinition withAllSuperclassesDo: SyntaxErrorNotification) "same-name block-local temps in optimized blocks"
#(DoItFirst parse: SyntaxErrorNotification) "same-name block-local temps in optimized blocks"
+ #(TheWorldMainDockingBar listMethodChanges:andClassChanges:on: SyntaxErrorNotification) "same-name block-local temps in optimized blocks"
+ #(TTFontReader readCharacterMappingTable SyntaxErrorNotification) "same-name block-local temps in optimized blocks"
- #(TheWorldMainDockingBar listChangesOn: SyntaxErrorNotification) "same-name block-local temps in optimized blocks"
)!
Levente Uzonyi uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-ul.1332.mcz
==================== Summary ====================
Name: System-ul.1332
Author: ul
Time: 31 March 2022, 5:09:06.559954 pm
UUID: 681b55d7-1b75-4a3e-b571-f29ceaccaad2
Ancestors: System-mt.1331
- use Symbol class >> #lookup: instead of #hasInterned:ifTrue:
=============== Diff against System-mt.1331 ===============
Item was changed:
----- Method: DiskProxy>>comeFullyUpOnReload: (in category 'i/o') -----
comeFullyUpOnReload: smartRefStream
"Internalize myself into a fully alive object after raw loading from a DataStream. (See my class comment.) DataStream will substitute the object from this eval for the DiskProxy."
| globalObj symbol pr nn arrayIndex env |
symbol := globalObjectName.
"See if class is mapped to another name"
(smartRefStream respondsTo: #renamed) ifTrue:
[| maybeReadDataFromContext maybeReadArrayContext |
"Ugh; so ugly and brittle. If there were pragmas in the relevant methods we could search, etc. eem 7/3/2017 15:54"
maybeReadArrayContext := thisContext sender sender sender sender.
maybeReadDataFromContext := maybeReadArrayContext sender sender sender sender.
"If in outPointers in an ImageSegment, remember original class name.
See mapClass:installIn:. Would be lost otherwise." "Anyone know where mapClass:installIn: is/was? eem 7/3/2017 15:55"
(maybeReadDataFromContext method selector == #readDataFrom:size:
and: [maybeReadDataFromContext receiver class == NativeImageSegment
and: [maybeReadArrayContext method == (DataStream compiledMethodAt: #readArray)]]) ifTrue:
[arrayIndex := maybeReadArrayContext tempAt: 4.
"index var in readArray. Later safer to find i on stack of context."
smartRefStream renamedConv at: arrayIndex put: symbol]. "save original name"
symbol := smartRefStream renamed at: symbol ifAbsent: [symbol]]. "map"
env := Environment current.
globalObj := env valueOf: symbol ifAbsent: [
preSelector == nil & (constructorSelector = #yourself) ifTrue: [
Transcript cr; show: symbol, ' is undeclared.'.
env undeclare: symbol.
^ nil].
^ self error: 'Global "', symbol, '" not found'].
((symbol == #World) and: [Smalltalk isMorphic not]) ifTrue: [
self inform: 'These objects will work better if opened in a Morphic World.
Dismiss and reopen all menus.'].
preSelector ifNotNil: [
+ (Symbol lookup: preSelector) ifNotNil: [:selector |
- Symbol hasInterned: preSelector ifTrue: [:selector |
[globalObj := globalObj perform: selector] on: Error do: [:ex |
ex messageText = 'key not found' ifTrue: [^ nil].
^ ex signal]]
].
symbol == #Project ifTrue: [
(constructorSelector = #fromUrl:) ifTrue: [
nn := (constructorArgs first findTokens: '/') last.
nn := (nn findTokens: '.|') first.
pr := Project named: nn.
^ pr ifNil: [self] ifNotNil: [pr]].
pr := globalObj perform: constructorSelector withArguments: constructorArgs.
^ pr ifNil: [self] ifNotNil: [pr]]. "keep the Proxy if Project does not exist"
constructorSelector ifNil: [^ globalObj].
+ (Symbol lookup: constructorSelector) ifNotNil: [:selector |
- Symbol hasInterned: constructorSelector ifTrue: [:selector |
[^ globalObj perform: selector withArguments: constructorArgs] on: Error do: [:ex |
ex messageText = 'key not found' ifTrue: [^ nil].
^ ex signal]
].
"args not checked against Renamed"
^ nil "was not in proper form"!
Item was changed:
----- Method: ImageSegment>>comeFullyUpOnReload: (in category 'fileIn') -----
comeFullyUpOnReload: smartRefStream
"fix up the objects in the segment that changed size. An object in the segment is the wrong size for the modern version of the class. Construct a fake class that is the old size. Replace the modern class with the old one in outPointers. Load the segment. Traverse the instances, making new instances by copying fields, and running conversion messages. Keep the new instances. Bulk forward become the old to the new. Let go of the fake objects and classes.
After the install (below), arrayOfRoots is filled in. Globalize new classes. Caller may want to do some special install on certain objects in arrayOfRoots.
May want to write the segment out to disk in its new form."
| mapFakeClassesToReal receiverClasses existing forgetDoItsClass endianness |
forgetDoItsClass := Set new.
RecentlyRenamedClasses := nil. "in case old data hanging around"
mapFakeClassesToReal := smartRefStream reshapedClassesIn: outPointers.
"Dictionary of just the ones that change shape. Substitute them in outPointers."
self fixCapitalizationOfSymbols.
endianness := self endianness.
segment := self loadSegmentFrom: segment outPointers: outPointers.
arrayOfRoots := segment first.
mapFakeClassesToReal isEmpty ifFalse: [
self reshapeClasses: mapFakeClassesToReal refStream: smartRefStream
].
"When a Project is stored, arrayOfRoots has all objects in the project, except those in outPointers"
arrayOfRoots do: [:importedObject |
((importedObject isMemberOf: WideString) or: [importedObject isMemberOf: WideSymbol]) ifTrue: [
importedObject mutateJISX0208StringToUnicode.
importedObject class = WideSymbol ifTrue: [
"self halt."
+ (Symbol lookup: importedObject) ifNotNil: [:multiSymbol |
- Symbol hasInterned: importedObject asString ifTrue: [:multiSymbol |
multiSymbol == importedObject ifFalse: [
importedObject becomeForward: multiSymbol.
].
].
].
].
(importedObject isMemberOf: TTCFontSet) ifTrue: [
existing := TTCFontSet familyName: importedObject familyName
pointSize: importedObject pointSize. "supplies default"
existing == importedObject ifFalse: [importedObject becomeForward: existing].
].
].
receiverClasses := self restoreEndianness: endianness ~~ Smalltalk endianness. "rehash sets"
smartRefStream checkFatalReshape: receiverClasses.
"Classes in this segment."
arrayOfRoots do: [:importedObject |
importedObject class class == Metaclass ifTrue: [forgetDoItsClass add: importedObject. self declare: importedObject]].
"Let all extensions work with the current arrayOfRoots."
self processRoots.
mapFakeClassesToReal isEmpty ifFalse: [
mapFakeClassesToReal keysAndValuesDo: [:aFake :aReal |
aFake removeFromSystemUnlogged.
aFake becomeForward: aReal].
SystemOrganization removeEmptyCategories].
forgetDoItsClass do: [:c | self forgetDoItsInClass: c].
"^ self"
!
Item was changed:
----- Method: SmartRefStream>>mapClass: (in category 'read write') -----
mapClass: incoming
"See if the old class named nm exists. If so, return it. If not, map it to a new class, and save the mapping in renamed. "
<hasLiteralTest: #isConversionSelector:>
"To find this method as sender of all conversion methods"
| cls oldVer sel nm |
self flag: #bobconv.
nm := renamed at: incoming ifAbsent: [incoming]. "allow pre-mapping around collisions"
(nm endsWith: ' class')
ifFalse: [cls := Smalltalk at: nm ifAbsent: [nil].
cls ifNotNil: [^ cls]] "Known class. It will know how to translate the instance."
ifTrue: [cls := Smalltalk at: nm substrings first asSymbol ifAbsent: [nil].
cls ifNotNil: [^ cls class]]. "Known class. It will know how to translate the instance."
oldVer := self versionSymbol: (structures at: nm).
sel := nm asString.
sel at: 1 put: (sel at: 1) asLowercase.
sel := sel, oldVer. "i.e. #rectangleoc4"
+ (Symbol lookup: sel) ifNotNil: [:symb |
- Symbol hasInterned: sel ifTrue: [:symb |
(self class canUnderstand: sel asSymbol) ifTrue: [
reshaped ifNil: [reshaped := Dictionary new].
cls := self perform: sel asSymbol]]. "This class will take responsibility"
cls ifNil: [cls := self writeClassRenameMethod: sel was: nm
fromInstVars: (structures at: nm).
cls isString ifTrue: [cls := nil]].
cls ifNotNil: [renamed at: nm put: cls name].
^ cls
!
Item was changed:
----- Method: SystemDictionary>>hasClassNamed: (in category 'classes and traits') -----
hasClassNamed: aString
"Answer whether there is a class of the given name, but don't intern aString if it's not alrady interned. 4/29/96 sw"
+ ^(Symbol lookup: aString)
+ ifNil: [ false ]
+ ifNotNil: [ :aSymbol | (self at: aSymbol ifAbsent: [nil]) isKindOf: Class ]!
- Symbol hasInterned: aString ifTrue:
- [:aSymbol | ^ (self at: aSymbol ifAbsent: [nil]) isKindOf: Class].
- ^ false!
Levente Uzonyi uploaded a new version of Chronology-Core to project The Trunk:
http://source.squeak.org/trunk/Chronology-Core-ul.76.mcz
==================== Summary ====================
Name: Chronology-Core-ul.76
Author: ul
Time: 31 March 2022, 10:29:59.505362 am
UUID: b883c0a9-ae6e-4c05-bea8-2ca5b9c3d464
Ancestors: Chronology-Core-ct.75
- avoid the creation of a Duration in Time class >> #localMicrosecondClock by using #localOffsetSeconds instead of #localOffset and #asSeconds.
- fixed the comment of Time class >> #updateTimeZoneCacheAt:
=============== Diff against Chronology-Core-ct.75 ===============
Item was changed:
----- Method: Time class>>localMicrosecondClock (in category 'clock') -----
localMicrosecondClock
"Answer the local microseconds since the Smalltalk epoch (January 1st 1901, the start of the 20th century).
The value is derived from the current UTC wallclock time and the image's current notion of time zone."
+ ^self utcMicrosecondClock + (DateAndTime localOffsetSeconds * 1000000)!
- ^self utcMicrosecondClock + (DateAndTime localOffset asSeconds * 1000000)!
Item was changed:
----- Method: Time class>>updateTimeZoneCacheAt: (in category 'clock') -----
updateTimeZoneCacheAt: posixUtcMicrosecondClock
+ "Tell the VM to update its cached time zone value if the POSIX UTC time has reached the value stored in UpdateVMTimeZoneCacheAt. Assume that posixUtcMicrosecondClock is an integer with the current POSIX UTC microsecond clock value. Return true if the cache was updated to indicate that the time zone may have changed."
- "Tell the VM to update its cached time zone value if the POSIX UTC time reached the valute stored in UpdateVMTimeZoneCacheAt has been reached. Assume that posixUtcMicrosecondClock is an integer with the current POSIX UTC microsecond clock value. Return true when the cache was updated to indicate that the time zone may have changed."
| updateInterval |
UpdateVMTimeZoneCacheAt ifNil: [
"Automatic update is disabled."
^false ].
posixUtcMicrosecondClock < UpdateVMTimeZoneCacheAt ifTrue: [ ^false ].
self primitiveUpdateTimeZone ifNil: [
"The primitive failed."
^false ].
+ updateInterval := 1800000000. "This could be a preference but 30 minutes works for all upcoming DST change times."
- updateInterval := 1800000000. "This could be a preference but 30 minutes matches all upcoming DST change times."
UpdateVMTimeZoneCacheAt := posixUtcMicrosecondClock // updateInterval + 1 * updateInterval "Round up posixUtcMicrosecondClock to the next multiple of updateInterval.".
^true!
Levente Uzonyi uploaded a new version of Environments to project The Trunk:
http://source.squeak.org/trunk/Environments-ul.84.mcz
==================== Summary ====================
Name: Environments-ul.84
Author: ul
Time: 31 March 2022, 9:44:33.789829 am
UUID: 8bddd87e-953c-485a-b76a-991fd4548c87
Ancestors: Environments-ct.83
- use Symboll class >> #lookup: instead of #hasInterned:ifTrue:
- just check whether baseName is an existing symbol in Environment >> #classOrTraitNamed: instead of interning it, because if it is not a symbol, it cannot be present as a key in declarations
=============== Diff against Environments-ct.83 ===============
Item was changed:
----- Method: Environment>>classOrTraitNamed: (in category 'classes and traits') -----
classOrTraitNamed: aString
"aString is either a class or trait name or a class or trait name followed by ' class' or 'classTrait' respectively.
Answer the class or metaclass it names."
| meta baseName |
(aString endsWith: ' class')
+ ifTrue: [
+ meta := true.
+ baseName := aString copyFrom: 1 to: aString size - 6 ]
- ifTrue: [meta := true.
- baseName := aString copyFrom: 1 to: aString size - 6]
ifFalse: [
(aString endsWith: ' classTrait')
ifTrue: [
meta := true.
+ baseName := aString copyFrom: 1 to: aString size - 11 ]
- baseName := aString copyFrom: 1 to: aString size - 11]
ifFalse: [
meta := false.
+ baseName := aString ] ].
+ ^(Symbol lookup: baseName) ifNotNil: [ :baseNameSymbol |
+ declarations at: baseNameSymbol ifPresent: [ :global |
+ global isBehavior ifTrue: [
+ meta
+ ifFalse: [ global ]
+ ifTrue: [ global classSide ] ] ] ]!
- baseName := aString]].
-
- ^declarations at: baseName asSymbol ifPresent:
- [ :global |
- global isBehavior ifTrue:
- [ meta
- ifFalse: [ global ]
- ifTrue: [ global classSide ]]]!
Item was changed:
----- Method: Environment>>hasClassNamed: (in category 'classes and traits') -----
hasClassNamed: aString
+
+ ^(Symbol lookup: aString)
+ ifNil: [ false ]
+ ifNotNil: [:symbol |
+ (declarations at: symbol ifAbsent: [nil])
+ isKindOf: Class]!
- Symbol hasInterned: aString ifTrue:
- [:symbol |
- ^ (declarations at: symbol ifAbsent: [nil])
- isKindOf: Class].
- ^ false.!
Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.1454.mcz
==================== Summary ====================
Name: Kernel-ul.1454
Author: ul
Time: 31 March 2022, 9:40:35.561194 am
UUID: 77c53e53-4088-4309-9dcf-a2ea77469e41
Ancestors: Kernel-ct.1453
- do not try to compact immutable MethodDictionaries in #compactAllInstances
- update the tally first when modifying a MethodDictionary, so that immutable MethodDictionaries raise an error before their non-immutable array variable is updated
- do not send #rounded to #sign in Float >> #rounded. #sign is already rounded
- use Symboll class >> #lookup: instead of #hasInterned:ifTrue:
- use #anySatisfy: instead of reinventing it in Object >> #inheritsFromAnyIn:. Also, use #classNamed: to look up a class in the same method.
=============== Diff against Kernel-ct.1453 ===============
Item was changed:
----- Method: Behavior>>whichClassDefinesClassVar: (in category 'queries') -----
whichClassDefinesClassVar: aString
+
+ ^(Symbol lookup: aString) ifNotNil: [ :aSymbol |
- Symbol hasInterned: aString ifTrue: [ :aSymbol |
^self whichSuperclassSatisfies:
[:aClass |
+ aClass classVarNames anySatisfy: [:each | each = aSymbol]]]!
- aClass classVarNames anySatisfy: [:each | each = aSymbol]]].
- ^nil!
Item was changed:
----- Method: Float>>rounded (in category 'truncation and round off') -----
rounded
"Answer the integer nearest the receiver.
Implementation note: super would not handle tricky inexact arithmetic"
"self assert: 5000000000000001.0 rounded = 5000000000000001"
self fractionPart abs < 0.5
ifTrue: [^self truncated]
+ ifFalse: [^self truncated + self sign]!
- ifFalse: [^self truncated + self sign rounded]!
Item was changed:
----- Method: MethodDictionary class>>compactAllInstances (in category 'initialize-release') -----
compactAllInstances
| instancesToExchange newInstances |
instancesToExchange := Array streamContents: [ :oldStream |
newInstances := Array streamContents: [ :newStream |
self allInstances do: [ :each |
+ each isReadOnlyObject ifFalse: [
+ | newInstance |
+ newInstance := each compactWithoutBecome.
+ newInstance capacity = each capacity
+ ifTrue: [ each copyFrom: newInstance ]
+ ifFalse: [
+ oldStream nextPut: each.
+ newStream nextPut: newInstance ] ] ] ] ].
- | newInstance |
- newInstance := each compactWithoutBecome.
- newInstance capacity = each capacity
- ifTrue: [ each copyFrom: newInstance ]
- ifFalse: [
- oldStream nextPut: each.
- newStream nextPut: newInstance ] ] ] ].
instancesToExchange elementsForwardIdentityTo: newInstances!
Item was changed:
----- Method: MethodDictionary>>removeDangerouslyKey:ifAbsent: (in category 'private') -----
removeDangerouslyKey: key ifAbsent: aBlock
"This is not really dangerous. But if normal removal
were done WHILE a MethodDict were being used, the
system might crash. So instead we make a copy, then do
this operation (which is NOT dangerous in a copy that is
not being used), and then use the copy after the removal."
| index element |
index := self scanFor: key.
(element := array at: index) ifNil: [ ^aBlock value ].
+ tally := tally - 1. "Update tally first, so that read-only hashed collections raise an error before modifying array."
array at: index put: nil.
self basicAt: index put: nil.
- tally := tally - 1.
self fixCollisionsFrom: index.
^element!
Item was changed:
----- Method: Object>>inheritsFromAnyIn: (in category 'class membership') -----
inheritsFromAnyIn: aList
"Answer whether the receiver inherits from any class represented by any element in the list. The elements of the list can be classes, class name symbols, or strings representing possible class names. This allows speculative membership tests to be made even when some of the classes may not be known to the current image, and even when their names are not interned symbols."
+ ^aList anySatisfy: [ :element |
+ (Smalltalk classNamed: element asString)
+ ifNil: [ false ]
+ ifNotNil: [ :class |
+ (class isKindOf: Class)
+ and: [ self isKindOf: class ] ] ]
- aList do:
- [:elem | Symbol hasInterned: elem asString ifTrue:
- [:elemSymbol |
- | aClass |
- (((aClass := Smalltalk at: elemSymbol ifAbsent: [nil]) isKindOf: Class)
- and: [self isKindOf: aClass])
- ifTrue:
- [^ true]]].
- ^ false
-
"
{3. true. 'olive'} do:
[:token |
{{#Number. #Boolean}. {Number. Boolean }. {'Number'. 'Boolean'}} do:
[:list |
Transcript cr; show: token asString, ' list element provided as a ', list first class name, ' - ', (token inheritsFromAnyIn: list) asString]]
"!